12/10/2025 - 17:14 - Elyos V1.2
Signed-off-by: Cherif <cbalde@mysy-training.com>master_Elyos_FI
parent
1e5a1207e2
commit
b8f91d9dfb
|
|
@ -4,35 +4,26 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="sss">
|
||||
<change afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="10/10/2025 - 17:30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_document_automatic_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_document_automatic_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_session_step.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_session_step.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/formulaire_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/formulaire_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/jury_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/jury_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_base_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_base_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/temp_direct/qr_code_052.png" beforeDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -475,7 +466,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="497" />
|
||||
<option name="localTasksCounter" value="498" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -517,7 +508,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Init - 29/05/2025 - FI" />
|
||||
<MESSAGE value="31/05/2025 - 20h" />
|
||||
<MESSAGE value="02/06/2025 - 20h" />
|
||||
<MESSAGE value="04/06/2025 - 21h" />
|
||||
|
|
@ -542,6 +532,7 @@
|
|||
<MESSAGE value="30/07/2025 -18h" />
|
||||
<MESSAGE value="10/08/2025 - 10h" />
|
||||
<MESSAGE value="sss" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="sss" />
|
||||
<MESSAGE value="10/10/2025 - 17:30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="10/10/2025 - 17:30" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -49,6 +49,7 @@ from bson import ObjectId
|
|||
import re
|
||||
from datetime import datetime, time
|
||||
|
||||
import email_mgt
|
||||
import partner_order
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
|
|
@ -2197,12 +2198,62 @@ def Sent_E_Document_Signature_Request(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(courrier_template_data['sujet'])
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(local_partner_owner_recid))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]: Convocation session de formation'
|
||||
|
||||
queue_mail_diction['message'] = html
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['email_to'] = str(diction['user_email'])
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer le document électronique "
|
||||
return False, " Impossible d'envoyer la demande de signature électronique "
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1826,6 +1826,8 @@ def SendInscriptionConfirmation(diction):
|
|||
|
||||
data_mail['partner_owner_recid'] = str(partner_recid)
|
||||
|
||||
data_mail['token'] = str(diction['token'])
|
||||
|
||||
"""
|
||||
26/02/2025 :
|
||||
Si le paramettre, 'inscription_notification_email' de la collection 'base_partner_setup' est à 1,
|
||||
|
|
@ -1834,8 +1836,6 @@ def SendInscriptionConfirmation(diction):
|
|||
local_insc_status, local_insc_retval = mycommon.Is_Partnair_Inscription_Notification(
|
||||
{'token': diction['token']})
|
||||
if (local_insc_status and local_insc_retval == "1"):
|
||||
|
||||
|
||||
local_status, local_message = email_session.incription_training_confirmation_mail(data_mail)
|
||||
return local_status, "La confirmation d'inscription a bien ete envoyée"
|
||||
else:
|
||||
|
|
@ -1848,7 +1848,7 @@ def SendInscriptionConfirmation(diction):
|
|||
|
||||
|
||||
"""
|
||||
Cette fonction envoie les pre-inscritpions
|
||||
Cette fonction envoie les pre-inscriptions
|
||||
"""
|
||||
def SendPre_InscriptionEmail(diction):
|
||||
try:
|
||||
|
|
@ -5694,6 +5694,7 @@ def CancelAttendeeInscription(diction):
|
|||
return_message = "Impossible de supprimer l'inscription dans le LMS pour : "+str( diction['email'])
|
||||
|
||||
email_data = {}
|
||||
email_data['token'] = str(diction['token'])
|
||||
email_data['nom'] = nom
|
||||
email_data['prenom'] = prenom
|
||||
email_data['email'] = email
|
||||
|
|
@ -5901,6 +5902,7 @@ def RefuseAttendeeInscription_with_motif(diction):
|
|||
return_message = "Impossible de supprimer l'inscription dans le LMS pour : "+str( diction['email'])
|
||||
|
||||
email_data = {}
|
||||
email_data['token'] = str(diction['token'])
|
||||
email_data['nom'] = nom
|
||||
email_data['prenom'] = prenom
|
||||
email_data['email'] = email
|
||||
|
|
@ -6778,6 +6780,8 @@ def AcceptAttendeeInscription(diction):
|
|||
email_data['date_au'] = date_au
|
||||
email_data['title'] = class_title
|
||||
email_data['partner_owner_recid'] = str(partner_recid)
|
||||
email_data['token'] = str(diction['token'])
|
||||
|
||||
|
||||
if( "code_session" in local_session.keys()):
|
||||
email_data['code_session'] = local_session['code_session']
|
||||
|
|
@ -11464,6 +11468,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
"""
|
||||
20/03/2024 : Creation du E-Document à signer
|
||||
On verifier si le partenaire dispose de l'option "signature_digital" dans la collection base_partner_setup
|
||||
|
|
@ -11517,6 +11522,8 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
# Traitement de l'eventuel fichier joint
|
||||
tab_files_to_attache_to_mail = []
|
||||
|
||||
tab_list_file_for_queu_mail_and_internal_mail = []
|
||||
|
||||
for file_name_full_path in tab_files_name_full_path:
|
||||
"""status, saved_file = mycommon.Upload_Save_PDF_IMG_File(file, Folder)
|
||||
if (status is False):
|
||||
|
|
@ -11533,6 +11540,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(file_name_full_path)
|
||||
|
||||
# Verification de la validité des adresses email_recu
|
||||
"""
|
||||
|
|
@ -11633,6 +11641,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(saved_file)
|
||||
|
||||
# Recuperation des données du stagiaire
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
|
|
@ -11711,6 +11720,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
}
|
||||
|
||||
# ---
|
||||
sujetHtml = ""
|
||||
# Verifier s'il s'agit d'un document à envoyer avec une version de pièce jointe.
|
||||
if ("joint_pdf" in courrier_template_data.keys() and str(courrier_template_data['joint_pdf']) == "1"):
|
||||
# Il s'agit bien d'un envoie avec 'contenu_doc' en pièce jointe PDF
|
||||
|
|
@ -11718,8 +11728,12 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
1 - Creation du PDF
|
||||
"""
|
||||
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(courrier_template_data['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
"""
|
||||
|
|
@ -11763,6 +11777,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(outputFilename)
|
||||
|
||||
## Creation du mail au format email
|
||||
|
||||
|
|
@ -11825,9 +11840,12 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
else:
|
||||
# Il s'agit d'une simple email
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(courrier_template_data['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
## Creation du mail au format email
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
|
@ -12033,8 +12051,51 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]: Convocation session de formation'
|
||||
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
for myfile in tab_list_file_for_queu_mail_and_internal_mail:
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'].append(myfile)
|
||||
|
||||
for destinataire in tab_emails_destinataire:
|
||||
queue_mail_diction['email_to'] = str(destinataire)
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
return True, "L'email a été correctement envoyé "
|
||||
|
||||
|
|
@ -13815,7 +13876,7 @@ def Create_Emargement_Send_Email_From_Inscription(diction):
|
|||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
"""print(" ### local_stpm_status = ", local_stpm_status)
|
||||
print(" ### partner_SMTP_COUNT_smtpsrv = ", partner_SMTP_COUNT_smtpsrv)
|
||||
|
|
@ -13832,7 +13893,6 @@ def Create_Emargement_Send_Email_From_Inscription(diction):
|
|||
my_emargement_ids = diction['tab_emargement_ids']
|
||||
|
||||
|
||||
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
if(len(tab_my_emargement_ids) <= 0 ):
|
||||
mycommon.myprint(
|
||||
|
|
@ -13892,9 +13952,9 @@ def Create_Emargement_Send_Email_From_Inscription(diction):
|
|||
)
|
||||
|
||||
"""
|
||||
25/01/2024 : Apres l'envoi de la demande
|
||||
d'emargement, on log une action dans la collection ==> courrier_template_tracking_history
|
||||
"""
|
||||
25/01/2024 : Apres l'envoi de la demande
|
||||
d'emargement, on log une action dans la collection ==> courrier_template_tracking_history
|
||||
"""
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
|
||||
|
|
@ -13961,6 +14021,13 @@ def Create_Emargement_Send_Email_From_Inscription(diction):
|
|||
"""
|
||||
tab_inscription_id_emargement_send = []
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
|
||||
|
|
@ -14010,7 +14077,7 @@ def Create_Emargement_Send_Email_From_Inscription(diction):
|
|||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
msg['to'] = str(str(my_emargement_data['email']))
|
||||
msg['to'] = str(my_emargement_data['email'])
|
||||
val = smtpserver.send_message(msg)
|
||||
print(" Email demande emargement envoyé " + str(val))
|
||||
|
||||
|
|
@ -14023,10 +14090,46 @@ def Create_Emargement_Send_Email_From_Inscription(diction):
|
|||
msg['From'] = str(MYSY_GV.O365_SMTP_COUNT_From_User)
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
msg['to'] = str(str(my_emargement_data['email']))
|
||||
msg['to'] = str(my_emargement_data['email'])
|
||||
val = smtpserver.send_message(msg)
|
||||
print(" Email demande emargement envoyé " + str(val))
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = "[MySy Training]: Demande d'émargement"
|
||||
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['email_to'] = str(my_emargement_data['email'])
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
smtpserver.close()
|
||||
|
||||
print(" NB_email envoyé = ", cpt_email_envoye)
|
||||
|
|
|
|||
119
Job_Cron.py
119
Job_Cron.py
|
|
@ -2332,32 +2332,51 @@ def Cron_Send_Mail_Queue_Message_With_Filter(diction):
|
|||
smtpserver.login(email_queue_data['smtp_account_user'], email_queue_data['smtp_account_password'])
|
||||
|
||||
|
||||
try:
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
except Exception as error_send_mail:
|
||||
print(" ## error_send_mail = ", error_send_mail)
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['sent'] = str(datetime.now())
|
||||
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
#print(val)
|
||||
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['sent'] = str(datetime.now())
|
||||
|
||||
error_node = {}
|
||||
if( len(val.keys()) > 0 ):
|
||||
new_data['error_message'] = str(val)
|
||||
new_data['error_message'] = str(error_send_mail)
|
||||
new_data['statut'] = "-1"
|
||||
else:
|
||||
new_data['error_message'] = ""
|
||||
new_data['statut'] = "1"
|
||||
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
{'_id':ObjectId(str(email_queue_data['_id']))},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
{'_id': ObjectId(str(email_queue_data['_id']))},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
else:
|
||||
#print(val)
|
||||
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['sent'] = str(datetime.now())
|
||||
|
||||
error_node = {}
|
||||
if( len(val.keys()) > 0 ):
|
||||
new_data['error_message'] = str(val)
|
||||
new_data['statut'] = "-1"
|
||||
else:
|
||||
new_data['error_message'] = ""
|
||||
new_data['statut'] = "1"
|
||||
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
{'_id':ObjectId(str(email_queue_data['_id']))},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
else:
|
||||
for email_queue_data in MYSY_GV.dbname['mail_queue'].find({'statut': '0', 'valide': '1', 'locked': '0', }):
|
||||
|
|
@ -2398,25 +2417,45 @@ def Cron_Send_Mail_Queue_Message_With_Filter(diction):
|
|||
smtpserver.starttls()
|
||||
smtpserver.login(email_queue_data['smtp_account_user'], email_queue_data['smtp_account_password'])
|
||||
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email envoyé" + str(val))
|
||||
try:
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
except Exception as error_send_mail:
|
||||
print(" ## error_send_mail = ", error_send_mail)
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['sent'] = str(datetime.now())
|
||||
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['sent'] = str(datetime.now())
|
||||
new_data['statut'] = "2"
|
||||
new_data['sent_message'] = str(val)
|
||||
new_data['error_message'] = str(error_send_mail)
|
||||
new_data['statut'] = "-1"
|
||||
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
{'_id': ObjectId(str(email_queue_data['_id']))},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
{'_id': ObjectId(str(email_queue_data['_id']))},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
else:
|
||||
print(" Email envoyé" + str(val))
|
||||
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['sent'] = str(datetime.now())
|
||||
new_data['statut'] = "2"
|
||||
new_data['sent_message'] = str(val)
|
||||
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
{'_id': ObjectId(str(email_queue_data['_id']))},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
return True, "L'emails de la file d'attente envoyés "
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import re
|
|||
from datetime import datetime, date, timedelta
|
||||
|
||||
import Session_Formation
|
||||
import email_mgt
|
||||
import module_editique
|
||||
import partner_base_setup
|
||||
import partner_client
|
||||
|
|
@ -1506,12 +1507,19 @@ def Cron_Send_Survey_TabIds(diction):
|
|||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
for my_survey_id in tab_my_survey_ids:
|
||||
# Recuperation des données de l'inscript
|
||||
|
||||
qry = { '_id':ObjectId(str(my_survey_id)), 'partner_owner_recid': str(my_partner['recid']),'valide':'1', 'locked':'0'}
|
||||
print(" ### my_survey_id Qry = ", qry)
|
||||
|
||||
local_survey_retval = MYSY_GV.dbname['survey'].find_one(qry)
|
||||
|
||||
if(local_survey_retval is None ):
|
||||
|
|
@ -1747,6 +1755,38 @@ def Cron_Send_Survey_TabIds(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (subject):
|
||||
queue_mail_diction['email_sujet'] = subject
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = "[MySy Training]: Demande d'évaluation"
|
||||
|
||||
queue_mail_diction['message'] = html
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['email_to'] = str(local_survey_retval['email'])
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
"""
|
||||
Mettre à jour l'enquete pour dire que c'est envoyé
|
||||
"""
|
||||
|
|
@ -3114,7 +3154,7 @@ def Cron_Relance_Emargement_By_Email(diction):
|
|||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
6522
Log/log_file.log
6522
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -21,6 +21,7 @@ import Contact
|
|||
import E_Sign_Document
|
||||
import Session_Formation_Sequence
|
||||
import attached_file_mgt
|
||||
import email_mgt
|
||||
import module_editique
|
||||
import partner_client
|
||||
import prj_common as mycommon
|
||||
|
|
@ -8657,8 +8658,9 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
# Traitement de l'eventuel fichier joint
|
||||
tab_files_to_attache_to_mail = []
|
||||
|
||||
for saved_file in tab_files:
|
||||
tab_list_file_for_queu_mail_and_internal_mail = []
|
||||
|
||||
for saved_file in tab_files:
|
||||
|
||||
file_to_attache_to_mail = MIMEBase('application', "octet-stream")
|
||||
file_to_attache_to_mail.set_payload(open(saved_file, "rb").read())
|
||||
|
|
@ -8669,6 +8671,7 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(saved_file)
|
||||
|
||||
# Verification de la validité des adresses email_recu
|
||||
"""
|
||||
|
|
@ -8781,7 +8784,9 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(saved_file)
|
||||
|
||||
tab_email_cc = []
|
||||
# Recuperation des données du stagaire
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(diction['inscription_id'])),
|
||||
'status': '1',
|
||||
|
|
@ -8806,6 +8811,7 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
tmp_JSON = ast.literal_eval(tmp)
|
||||
if ("email" in tmp_JSON.keys()):
|
||||
tab_local_email_production.append(str(tmp_JSON["email"]))
|
||||
tab_email_cc.append(str(tmp_JSON["email"]))
|
||||
|
||||
tab_apprenant_client_rattachement_contact = ",".join(tab_local_email_production)
|
||||
|
||||
|
|
@ -8913,9 +8919,12 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
file_to_attache_to_mail.add_header('Content-Disposition',
|
||||
'attachment; filename="{0}"'.format(os.path.basename(outputFilename)))
|
||||
|
||||
|
||||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
|
||||
|
||||
## Creation du mail au format email
|
||||
|
||||
corps_mail_Template = jinja2.Template(str(courrier_template_data['corps_mail']))
|
||||
|
|
@ -9025,6 +9034,7 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
for myfile in tab_files_to_attache_to_mail:
|
||||
msg.attach(myfile['attached_file'])
|
||||
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
|
||||
|
|
@ -9033,6 +9043,7 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé 66" + str(val))
|
||||
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
|
|
@ -9073,13 +9084,65 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
new_file['file_name_to_store'] = outputFilename
|
||||
|
||||
# print(" ### new_file new_file = ", new_file)
|
||||
#print(" ### new_file new_file = ", new_file)
|
||||
local_status, local_retval = attached_file_mgt.Internal_Usage_Store_User_Downloaded_File(
|
||||
MYSY_GV.upload_folder, new_file)
|
||||
|
||||
if (local_status is False):
|
||||
print(" ## WARINNGGG Impossible de stocker le fichier de Convocation ")
|
||||
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(local_retval)
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(courrier_template_data['sujet'])
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = tab_email_cc
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]: Convocation session de formation'
|
||||
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
for myfile in tab_list_file_for_queu_mail_and_internal_mail:
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'].append(myfile)
|
||||
|
||||
for destinataire in tab_emails_destinataire:
|
||||
queue_mail_diction['email_to'] = str(destinataire)
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
return True, "L'email a été correctement envoyé "
|
||||
|
|
@ -9267,6 +9330,7 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
# Traitement de l'eventuel fichier joint
|
||||
tab_files_to_attache_to_mail = []
|
||||
tab_list_file_for_queu_mail_and_internal_mail = []
|
||||
|
||||
for saved_file in tab_files:
|
||||
"""
|
||||
|
|
@ -9285,6 +9349,7 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(saved_file)
|
||||
|
||||
# Verification de la validité des adresses email_recu
|
||||
"""
|
||||
|
|
@ -9382,6 +9447,7 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
# print(" ### file stocké = ", local_retval)
|
||||
|
||||
tab_apprenant_client_rattachement_contact_for_email = []
|
||||
# Recuperation des fichiers attachés au modele de courrier, s'il y en a
|
||||
for file in local_retval:
|
||||
local_JSON = ast.literal_eval(file)
|
||||
|
|
@ -9397,6 +9463,7 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(saved_file)
|
||||
|
||||
# Recuperation des données du stagaire
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(diction['inscription_id'])),
|
||||
|
|
@ -9422,6 +9489,7 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
tmp_JSON = ast.literal_eval(tmp)
|
||||
if ("email" in tmp_JSON.keys()):
|
||||
tab_local_email_production.append(str(tmp_JSON["email"]))
|
||||
tab_apprenant_client_rattachement_contact_for_email.append(str(tmp_JSON["email"]))
|
||||
|
||||
tab_apprenant_client_rattachement_contact = ",".join(tab_local_email_production)
|
||||
|
||||
|
|
@ -9498,9 +9566,12 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
1 - Creation du PDF
|
||||
"""
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(courrier_template_data['sujet'])
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
ts = datetime.now().timestamp()
|
||||
ts = str(ts).replace(".", "").replace(",", "")[-5:]
|
||||
|
|
@ -9669,12 +9740,9 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
|
||||
"""
|
||||
Après avoir loggé l'envoie reelle en production, on va aller stocker le document dans la collection : download_files
|
||||
si et seulement si on bien un fichier PDF (voir variables : orig_file_name et outputFilename)
|
||||
"""
|
||||
|
||||
print(" ### orig_file_name = ", orig_file_name)
|
||||
print(" ### outputFilename = ", outputFilename)
|
||||
Après avoir loggé l'envoie reelle en production, on va aller stocker le document dans la collection : download_files
|
||||
si et seulement si on bien un fichier PDF (voir variables : orig_file_name et outputFilename)
|
||||
"""
|
||||
|
||||
|
||||
if (orig_file_name and outputFilename):
|
||||
|
|
@ -9700,6 +9768,59 @@ def Sent_Attestation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
if (local_status is False):
|
||||
print(" ## WARNINGGG Impossible de stocker le fichier d'attestation")
|
||||
|
||||
tab_list_file_for_queu_mail_and_internal_mail.append(local_retval)
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(courrier_template_data['sujet'])
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = tab_apprenant_client_rattachement_contact_for_email
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]: Attestation de formation'
|
||||
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
for myfile in tab_list_file_for_queu_mail_and_internal_mail:
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'].append(myfile)
|
||||
|
||||
for destinataire in tab_emails_destinataire:
|
||||
queue_mail_diction['email_to'] = str(destinataire)
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
return True, "L'email a été correctement envoyé "
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -14970,7 +15091,9 @@ def Send_Email_request_presinscription_data_validation(diction):
|
|||
|
||||
# Recuperation des données des stagiaires
|
||||
tab_stagiaire = []
|
||||
for inscription_id_data in MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']), 'partner_owner_recid': str(diction['partner_recid']), 'status': '1', 'client_rattachement_id': str(diction['client_id'])}):
|
||||
for inscription_id_data in MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(diction['partner_recid']),
|
||||
'status': '1', 'client_rattachement_id': str(diction['client_id'])}):
|
||||
|
||||
if (inscription_id_data is None):
|
||||
mycommon.myprint(
|
||||
|
|
@ -15095,7 +15218,7 @@ def Send_Email_request_presinscription_data_validation(diction):
|
|||
diction['partner_recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
msg.attach(html_mime)
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
|
|
@ -15111,6 +15234,8 @@ def Send_Email_request_presinscription_data_validation(diction):
|
|||
msg['Subject'] = sujetHtml
|
||||
# msg['to'] = "billardman01@hotmail.com"
|
||||
toaddrs = ",".join(tab_email_contact_client_destinataire)
|
||||
|
||||
|
||||
msg['to'] = str(toaddrs)
|
||||
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
|
|
@ -15123,6 +15248,53 @@ def Send_Email_request_presinscription_data_validation(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(diction['partner_recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]:Validation Liste Participants formation '
|
||||
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
for destinataire in tab_email_contact_client_destinataire:
|
||||
queue_mail_diction['email_to'] = str(destinataire)
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
return True, "Les demandes de mise à jour ont été envoyées"
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -2898,7 +2898,7 @@ def ENT_Create_Apprenant_Account(diction):
|
|||
partner_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
smtpserver = None
|
||||
|
||||
|
|
|
|||
|
|
@ -707,8 +707,6 @@ def Get_List_object_owner_collection_Stored_Files(diction):
|
|||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ def Add_CRM_Opportunite(diction):
|
|||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
convention_dictionnary_data = {}
|
||||
new_diction = {}
|
||||
|
|
|
|||
|
|
@ -207,22 +207,25 @@ def incription_training_confirmation_mail(diction):
|
|||
if (partner_document_CONF_INSCRIPTION_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "-Impossible d'envoyer l'email de la preinscription. Aucun document paramétré ")
|
||||
return False, " Impossible d'envoyer l'email de la preinscription. Aucun document paramétré "
|
||||
3]) + "-Impossible d'envoyer l'email de confirmation d'inscription. Aucun document paramétré ")
|
||||
return False, " Impossible d'envoyer l'email de confirmation d'inscription. Aucun document paramétré "
|
||||
|
||||
if ("contenu_doc" not in partner_document_CONF_INSCRIPTION_data or len(
|
||||
str(partner_document_CONF_INSCRIPTION_data['contenu_doc'])) <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " -Impossible d'envoyer l'email de la preinscription. Le paramétrage du document est invalide")
|
||||
return False, " Impossible d'envoyer l'email de la preinscription. Le paramétrage du document est invalide "
|
||||
3]) + " Impossible d'envoyer l'email de confirmation d'inscription. Le paramétrage du document est invalide")
|
||||
return False, "Impossible d'envoyer l'email de confirmation d'inscription. Le paramétrage du document est invalide "
|
||||
|
||||
|
||||
#print(' #### partner_document_CONF_INSCRIPTION_data[contenu_doc]) === ', partner_document_CONF_INSCRIPTION_data['contenu_doc'])
|
||||
|
||||
CONF_INSCRIPTION_contenu_doc_Template = jinja2.Template(
|
||||
str(partner_document_CONF_INSCRIPTION_data['contenu_doc']))
|
||||
CONF_INSCRIPTION_contenu_doc_Template = jinja2.Template(str(partner_document_CONF_INSCRIPTION_data['contenu_doc']))
|
||||
sourceHtml = CONF_INSCRIPTION_contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(partner_document_CONF_INSCRIPTION_data['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
#print(" ### sourceHtml CONF_INSCRIPTION_contenu_doc_Template = ",str(sourceHtml))
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
|
|
@ -279,7 +282,10 @@ def incription_training_confirmation_mail(diction):
|
|||
if (str(partner_own_smtp_value) == "1"):
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Confirmation inscription formation'
|
||||
if( sujetHtml ):
|
||||
msg['Subject'] = sujetHtml
|
||||
else:
|
||||
msg['Subject'] = '[MySy Training]: Confirmation inscription formation'
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
||||
|
|
@ -304,7 +310,11 @@ def incription_training_confirmation_mail(diction):
|
|||
msg['From'] = str(MYSY_GV.O365_SMTP_COUNT_From_User)
|
||||
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Confirmation inscription formation'
|
||||
if (sujetHtml):
|
||||
msg['Subject'] = sujetHtml
|
||||
else:
|
||||
msg['Subject'] = '[MySy Training]: Confirmation inscription formation'
|
||||
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
||||
|
|
@ -314,16 +324,60 @@ def incription_training_confirmation_mail(diction):
|
|||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(diction['partner_owner_recid']))
|
||||
|
||||
print(" Email confirlation envoyé " + str(val))
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]: Confirmation inscription formation'
|
||||
|
||||
queue_mail_diction['email_to'] = str(diction['email'])
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
if ("tab_saved_file_full_path" in diction.keys()):
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = diction['tab_saved_file_full_path']
|
||||
else:
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
|
||||
return True, " Email confirlation inscritpion bien envoyé"
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
print(" Email confirmation envoyé " + str(val))
|
||||
|
||||
|
||||
return True, " Email confirmation inscription bien envoyé"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification "
|
||||
return False, " Impossible d'envoyer l'email de notification d'inscription "
|
||||
|
||||
|
||||
|
||||
|
|
@ -342,7 +396,7 @@ def incription_training_refused_mail(diction):
|
|||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, "Impossible d'envoyer l'email de refus de l'inscritpion"
|
||||
return False, "Impossible d'envoyer l'email de refus de l'inscription"
|
||||
|
||||
|
||||
|
||||
|
|
@ -585,144 +639,52 @@ def incription_training_refused_mail(diction):
|
|||
smtpserver.close()
|
||||
print(" Email refus inscription envoyé à " + str(diction['email']))
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(diction['partner_recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(courrier_data_retval['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
# Traitement du corps du mail
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sourceHtml = template.render(params=body["params"])
|
||||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
"" "
|
||||
Update du 10/09/2023 :
|
||||
Utiliser les documents personnalisés qui sont stockés en base de données plutot que des format de fichiers plats.
|
||||
|
||||
Regles d'utilisation :
|
||||
1 - récupérer les fichier personnalisé pour le partenaire (partner_owner_recid et ref_interne).
|
||||
2 - Si aucun fichier de personnalisation pour le partenaire, alors utiliser le fichier par defaut (partner_owner_recid = "default" et ref_interne).
|
||||
3 - Pour le cas de pre-inscription, la ref_interne du fichier est 'PRE_INSCRIPTION'
|
||||
|
||||
"" "
|
||||
|
||||
partner_document_REFUS_INSCRIPTION_data_qry = {'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'valide': '1', 'locked': '0', 'ref_interne': 'REFUS_INSCRIPTION'}
|
||||
|
||||
print(" ### partner_document_REFUS_INSCRIPTION_data_qry = ", partner_document_REFUS_INSCRIPTION_data_qry)
|
||||
partner_document_REFUS_INSCRIPTION_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'valide': '1', 'locked': '0', 'ref_interne': 'REFUS_INSCRIPTION'})
|
||||
|
||||
if (partner_document_REFUS_INSCRIPTION_data is None):
|
||||
# Il n'existe pas de personnalisation de la preinscription pour ce partenaire, on va aller récupérer la presinscription pa defaut
|
||||
partner_document_PRE_INSCRIPTION_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'partner_owner_recid': 'default',
|
||||
'valide': '1', 'locked': '0', 'ref_interne': 'REFUS_INSCRIPTION'})
|
||||
|
||||
if (partner_document_REFUS_INSCRIPTION_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "-Impossible d'envoyer l'email de la preinscription. Aucun document paramétré ")
|
||||
return False, " Impossible d'envoyer l'email de la preinscription. Aucun document paramétré "
|
||||
|
||||
if ("contenu_doc" not in partner_document_REFUS_INSCRIPTION_data or len(
|
||||
str(partner_document_REFUS_INSCRIPTION_data['contenu_doc'])) <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " -Impossible d'envoyer l'email de la preinscription. Le paramétrage du document est invalide")
|
||||
return False, " Impossible d'envoyer l'email de la preinscription. Le paramétrage du document est invalide "
|
||||
|
||||
REFUS_INSCRIPTION_contenu_doc_Template = jinja2.Template(
|
||||
str(partner_document_REFUS_INSCRIPTION_data['contenu_doc']))
|
||||
sourceHtml = REFUS_INSCRIPTION_contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
# print(" ### PRE_INSCRIPTION_contenu_doc = ",str(sourceHtml))
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
"" "
|
||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||
"" "
|
||||
partner_own_smtp_value = "0"
|
||||
partner_own_smtp = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'partner_smtp',
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (partner_own_smtp and "config_value" in partner_own_smtp.keys()):
|
||||
partner_own_smtp_value = partner_own_smtp['config_value']
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
partner_SMTP_COUNT_password = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_user_pwd',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_smtpsrv = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_server',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_user = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_user',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_From_User = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_count_from_name',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_port = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_count_port',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation refusée'
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(partner_SMTP_COUNT_user, partner_SMTP_COUNT_password)
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email confirmation envoyé " + str(val))
|
||||
|
||||
else:
|
||||
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation refusée'
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email confirmation envoyé " + str(val))
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]: Confirmation inscription formation'
|
||||
|
||||
queue_mail_diction['email_to'] = str(diction['email'])
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
if ("tab_saved_file_full_path" in diction.keys()):
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = diction['tab_saved_file_full_path']
|
||||
else:
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
|
||||
return True, " Email de refus d'inscription bien envoyé"
|
||||
|
||||
|
|
@ -746,7 +708,7 @@ def incription_training_cancelled_mail(diction):
|
|||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, "Impossible d'envoyer l'email d'annulation de l'inscritpion"
|
||||
return False, "Impossible d'envoyer l'email d'annulation de l'inscription"
|
||||
|
||||
|
||||
|
||||
|
|
@ -844,7 +806,9 @@ def incription_training_cancelled_mail(diction):
|
|||
str(partner_document_ANNULE_INSCRIPTION_data['contenu_doc']))
|
||||
sourceHtml = ANNULE_INSCRIPTION_contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(partner_document_ANNULE_INSCRIPTION_data['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
print(" #### body = ", body)
|
||||
|
||||
|
|
@ -902,7 +866,11 @@ def incription_training_cancelled_mail(diction):
|
|||
msg = EmailMessage()
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation annulée'
|
||||
if( sujetHtml):
|
||||
msg['Subject'] = sujetHtml
|
||||
else:
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation annulée'
|
||||
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
smtpserver.ehlo()
|
||||
|
|
@ -910,7 +878,7 @@ def incription_training_cancelled_mail(diction):
|
|||
smtpserver.login(partner_SMTP_COUNT_user, partner_SMTP_COUNT_password)
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email confirlation envoyé " + str(val))
|
||||
print(" Email confirmation envoyé " + str(val))
|
||||
|
||||
else:
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
|
@ -932,7 +900,11 @@ def incription_training_cancelled_mail(diction):
|
|||
msg['From'] = str(MYSY_GV.O365_SMTP_COUNT_From_User)
|
||||
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation annulée'
|
||||
if (sujetHtml):
|
||||
msg['Subject'] = sujetHtml
|
||||
else:
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation annulée'
|
||||
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
||||
|
|
@ -941,10 +913,55 @@ def incription_training_cancelled_mail(diction):
|
|||
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email confirlation (cancellation) envoyé " + str(val))
|
||||
print(" Email confirmation (cancellation) envoyé " + str(val))
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
"""
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(diction['partner_owner_recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]: Confirmation inscription formation'
|
||||
|
||||
queue_mail_diction['email_to'] = str(diction['email'])
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
if ("tab_saved_file_full_path" in diction.keys()):
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = diction['tab_saved_file_full_path']
|
||||
else:
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
return True, " Email d'annulation de l'inscritpion bien envoyé"
|
||||
return True, " Email d'annulation de l'inscription bien envoyé"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
@ -969,7 +986,7 @@ def Pre_incription_training_confirmation_mail(diction):
|
|||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, "Impossible d'envoyer l'email de confirmation de l'inscritpion"
|
||||
return False, "Impossible d'envoyer l'email de confirmation de l'inscription"
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -1075,6 +1092,7 @@ def Pre_incription_training_confirmation_mail(diction):
|
|||
|
||||
"""
|
||||
|
||||
|
||||
partner_document_PRE_INSCRIPTION_data_qry = {'partner_owner_recid':str(diction['partner_owner_recid']),
|
||||
'valide':'1', 'locked':'0', 'ref_interne': 'CONF_PRE_INSCRIPTION'}
|
||||
|
||||
|
|
@ -1102,12 +1120,17 @@ def Pre_incription_training_confirmation_mail(diction):
|
|||
PRE_INSCRIPTION_contenu_doc_Template = jinja2.Template(str(partner_document_PRE_INSCRIPTION_data['contenu_doc']))
|
||||
sourceHtml = PRE_INSCRIPTION_contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(partner_document_PRE_INSCRIPTION_data['sujet'])
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
|
||||
#print(" ### PRE_INSCRIPTION_contenu_doc = ",str(sourceHtml))
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
"""
|
||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||
"""
|
||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||
"""
|
||||
partner_own_smtp_value = "0"
|
||||
partner_own_smtp = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
|
|
@ -1193,6 +1216,48 @@ def Pre_incription_training_confirmation_mail(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(diction['partner_owner_recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training] : pre-inscription formation'
|
||||
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['email_to'] = str(diction['email'])
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
return True, " Email bien envoyé"
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -1219,7 +1284,7 @@ def Notification_partner_Pre_incription_mail(diction):
|
|||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, "Impossible d'envoyer l'email de confirmation de l'inscritpion"
|
||||
return False, "Impossible d'envoyer l'email de confirmation de l'inscription"
|
||||
|
||||
|
||||
|
||||
|
|
@ -1331,8 +1396,8 @@ def Notification_partner_Pre_incription_mail(diction):
|
|||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
"""
|
||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||
"""
|
||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||
"""
|
||||
partner_own_smtp_value = "0"
|
||||
partner_own_smtp = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
|
|
@ -1414,6 +1479,50 @@ def Notification_partner_Pre_incription_mail(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(diction['partner_owner_recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
|
||||
tab_email_cc = []
|
||||
tab_email_cc.append(str(diction['formateur_email']))
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = tab_email_cc
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (sujetHtml):
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = '[MySy Training]:Notification de pré-inscription à une de vos formations'
|
||||
|
||||
queue_mail_diction['message'] = sourceHtml
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['email_to'] = str(diction['partner_mail'])
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
return True, " Email bien envoyé"
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -2406,30 +2515,6 @@ def LMS_Credential_Sending_mail(diction):
|
|||
msg['Subject'] = sujetHtml
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
"""
|
||||
Gestion mail_queue
|
||||
"""
|
||||
mail_queue_local_diction = {}
|
||||
mail_queue_local_diction['token'] = diction['token']
|
||||
mail_queue_local_diction['partner_own_smtp_value'] = partner_own_smtp_value
|
||||
mail_queue_local_diction['partner_SMTP_COUNT_smtpsrv'] = partner_SMTP_COUNT_smtpsrv
|
||||
mail_queue_local_diction['partner_SMTP_COUNT_port'] = partner_SMTP_COUNT_port
|
||||
mail_queue_local_diction['inscription_id'] = ""
|
||||
mail_queue_local_diction['related_collection'] = ""
|
||||
mail_queue_local_diction['partner_SMTP_COUNT_From_User'] = partner_SMTP_COUNT_From_User
|
||||
mail_queue_local_diction['tab_email_cc'] = tab_email_cc
|
||||
mail_queue_local_diction['tab_email_bcc'] = tab_email_bcc
|
||||
mail_queue_local_diction['tab_files_to_attache_to_mail'] = []
|
||||
mail_queue_local_diction['email_sujet'] = sujetHtml
|
||||
mail_queue_local_diction['html_mime'] = html_mime
|
||||
mail_queue_local_diction['email_to'] = email
|
||||
mail_queue_local_diction['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
# print(" ### mail_queue_local_diction = ", mail_queue_local_diction)
|
||||
local_status, local_retval = email_mgt.send_invidual_email(mail_queue_local_diction)
|
||||
if (local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
|
|
@ -2459,6 +2544,52 @@ def LMS_Credential_Sending_mail(diction):
|
|||
print(" Email d'acces lms envoyé à " + str(diction['email']))
|
||||
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
tab_email_bcc.append(str(diction['course_owner_email']))
|
||||
"""
|
||||
Gestion des emails internes et queu mail
|
||||
"""
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
|
||||
tab_email_bcc.append(str(my_partner['email']))
|
||||
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = ""
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
queue_mail_diction['email_to'] = str(diction['email'])
|
||||
queue_mail_diction['message'] = diction['initial_message']
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
if ("tab_saved_file_full_path" in diction.keys()):
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = diction['tab_saved_file_full_path']
|
||||
else:
|
||||
queue_mail_diction = []
|
||||
|
||||
internal_mail_diction = {}
|
||||
for tmp in queue_mail_diction.keys():
|
||||
internal_mail_diction[str(tmp)] = queue_mail_diction[str(tmp)]
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
|
||||
"""
|
||||
Logguer l'action dans l'historique de l'apprenant
|
||||
"""
|
||||
|
|
|
|||
44
email_mgt.py
44
email_mgt.py
|
|
@ -3575,7 +3575,7 @@ def Prepare_and_Send_Email_From_Front(tab_files, Folder, diction):
|
|||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
smtpserver = None
|
||||
|
||||
|
|
@ -3878,7 +3878,7 @@ def Prepare_and_Send_Email_From_Front_For_Unknown_Contact(tab_files, Folder, dic
|
|||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
smtpserver = None
|
||||
|
||||
|
|
@ -3953,11 +3953,7 @@ def Prepare_and_Send_Email_From_Front_For_Unknown_Contact(tab_files, Folder, dic
|
|||
|
||||
"""
|
||||
Envoi d'un email email individuel.
|
||||
Important :
|
||||
Cette fonction va faire 2 choses :
|
||||
1 - Add_Message_To_Mail_Queue : Mettre l'email la file (queu des email)
|
||||
2 - Add_Message_To_Internal_Mail : Si le destinataire a un compte interne, le système va egalement
|
||||
mettre l'email dans la table des emails internes
|
||||
|
||||
"""
|
||||
def send_invidual_email(diction):
|
||||
try:
|
||||
|
|
@ -4045,25 +4041,23 @@ def send_invidual_email(diction):
|
|||
if ("tuteur2_include_com" in inscription_data and inscription_data['tuteur2_include_com'] == "1"):
|
||||
tab_email_cc.append(inscription_data['tuteur2_email'])
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Envoie proprement-dit des emails
|
||||
"""
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
|
||||
"""
|
||||
Envoie proprement-dit des emails
|
||||
"""
|
||||
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
tab_email_bcc.append(str(my_partner['email']))
|
||||
queue_mail_diction = {}
|
||||
""" IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
|
|
@ -4102,6 +4096,15 @@ def send_invidual_email(diction):
|
|||
return False, " Impossible d'envoyer les emails "
|
||||
|
||||
|
||||
"""
|
||||
Gestion mail internet et queu mail.
|
||||
Important :
|
||||
Cette fonction va faire 2 choses :
|
||||
1 - Add_Message_To_Mail_Queue : Mettre l'email la file (queu des email)
|
||||
2 - Add_Message_To_Internal_Mail : Si le destinataire a un compte interne, le système va egalement
|
||||
mettre l'email dans la table des emails internes
|
||||
|
||||
"""
|
||||
def Individual_Mail_Store_Queu_And_Internal_Mail(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
|
@ -4170,7 +4173,7 @@ def Individual_Mail_Store_Queu_And_Internal_Mail(diction):
|
|||
if ("tab_files_to_attache_to_mail" in diction.keys()):
|
||||
queue_mail_diction['tab_saved_file_full_path'] = diction['tab_files_to_attache_to_mail']
|
||||
else:
|
||||
queue_mail_diction = []
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = diction['smtp_account_password']
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = diction['smtp_account_smtpsrv']
|
||||
|
|
@ -4178,7 +4181,6 @@ def Individual_Mail_Store_Queu_And_Internal_Mail(diction):
|
|||
queue_mail_diction['smtp_account_From_User'] = diction['smtp_account_From_User']
|
||||
queue_mail_diction['smtp_account_port'] = diction['smtp_account_port']
|
||||
|
||||
|
||||
internal_mail_diction = {}
|
||||
for tmp in queue_mail_diction.keys():
|
||||
internal_mail_diction[str(tmp)] = queue_mail_diction[str(tmp)]
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ def Resend_List_Mail_Queue(diction):
|
|||
)
|
||||
|
||||
|
||||
return True, "Email(s) reenvoyés "
|
||||
return True, "Email(s) (r)envoyés "
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ def Add_Update_Question_Formulaire(diction):
|
|||
else:
|
||||
new_data['rang'] = 99
|
||||
|
||||
|
||||
if ("commentaire" in diction.keys()):
|
||||
new_data['commentaire'] = str(diction['commentaire'])
|
||||
else:
|
||||
|
|
@ -369,6 +370,17 @@ def Add_Update_Question_Formulaire(diction):
|
|||
new_question_id = secrets.token_hex(5)
|
||||
new_data['_id'] = new_question_id
|
||||
|
||||
if ("rang" in diction.keys()):
|
||||
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" Le rang doit être un nombre entier ")
|
||||
return False, " Le rang doit être un nombre entier"
|
||||
|
||||
new_data['rang'] = mycommon.tryInt(str(diction['rang']))
|
||||
else:
|
||||
new_data['rang'] = 99
|
||||
|
||||
if("commentaire" in diction.keys() ):
|
||||
new_data['commentaire'] = str(diction['commentaire'])
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -5328,7 +5328,7 @@ def Create_Jury_Soutenance_Convocation_By_Inscrit_Email(tab_files, Folder, dicti
|
|||
str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
|
@ -6139,7 +6139,7 @@ def Create_Jury_Convocation_By_Membre_Email(tab_files, Folder, diction):
|
|||
str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
|
|
|||
|
|
@ -1473,7 +1473,7 @@ def Send_Evaluation_Convocation_Participant_By_Email(tab_files, Folder, diction)
|
|||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
|
|
|
|||
|
|
@ -7795,7 +7795,7 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
|
|||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
smtpserver = None
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ from bson import ObjectId
|
|||
import re
|
||||
from datetime import datetime, date
|
||||
|
||||
import email_mgt
|
||||
import module_editique
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
|
|
@ -760,7 +761,7 @@ def Send_Survey_Alert_Notif(diction):
|
|||
partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(diction['partner_owner_recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
|
|
@ -2359,6 +2360,13 @@ def Send_Survey_TabIds(diction):
|
|||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, local_SMTP_COUNT_smtpsrv
|
||||
|
||||
for my_survey_id in tab_my_survey_ids:
|
||||
# Recuperation des données de l'inscript
|
||||
|
|
@ -2599,6 +2607,37 @@ def Send_Survey_TabIds(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (subject):
|
||||
queue_mail_diction['email_sujet'] = subject
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = "[MySy Training]: Demande d'évaluation"
|
||||
|
||||
queue_mail_diction['message'] = html
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['email_to'] = str(local_survey_retval['email'])
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
"""
|
||||
Mettre à jour l'enquete pour dire que c'est envoyé
|
||||
"""
|
||||
|
|
@ -2732,6 +2771,8 @@ def Automatic_Send_Survey_TabIds(diction):
|
|||
my_survey_ids = diction['tab_ids']
|
||||
|
||||
tab_my_survey_ids = str(my_survey_ids).split(",")
|
||||
|
||||
|
||||
for my_survey_id in tab_my_survey_ids:
|
||||
|
||||
# Verifier que les survey sont valides ainsi que la session et l'inscription concerné
|
||||
|
|
@ -2822,6 +2863,13 @@ def Automatic_Send_Survey_TabIds(diction):
|
|||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
|
||||
for my_survey_id in tab_my_survey_ids:
|
||||
# Recuperation des données de l'inscript
|
||||
|
|
@ -3016,6 +3064,38 @@ def Automatic_Send_Survey_TabIds(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
|
||||
tab_email_bcc = []
|
||||
tab_email_bcc.append("contact@mysy-training.com")
|
||||
"""
|
||||
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
|
||||
"""
|
||||
queue_mail_diction = {}
|
||||
queue_mail_diction['token'] = diction['token']
|
||||
queue_mail_diction['tab_email_cc'] = []
|
||||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
if (subject):
|
||||
queue_mail_diction['email_sujet'] = subject
|
||||
else:
|
||||
queue_mail_diction['email_sujet'] = "[MySy Training]: Demande d'évaluation"
|
||||
|
||||
queue_mail_diction['message'] = html
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
|
||||
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
|
||||
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
|
||||
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
queue_mail_diction['email_to'] = str(local_survey_retval['email'])
|
||||
|
||||
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
|
||||
queue_mail_diction)
|
||||
if (queue_and_internal_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
|
||||
|
||||
"""
|
||||
Mettre à jour l'enquete pour dire que c'est envoyé
|
||||
"""
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 896 B |
Loading…
Reference in New Issue