10/02/205 - 21h
parent
d9cfe96ecc
commit
547ae6fff7
|
@ -1,14 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="06-02-2025 - new_design_2025">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="08/02/205 - 22h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -79,13 +76,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00386" summary="31/08/2024 - 18h50">
|
||||
<created>1725123044361</created>
|
||||
<option name="number" value="00386" />
|
||||
<option name="presentableId" value="LOCAL-00386" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1725123044363</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00387" summary="01/09/2024 - 14:00">
|
||||
<created>1725191980575</created>
|
||||
<option name="number" value="00387" />
|
||||
|
@ -422,7 +412,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1738857403418</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="435" />
|
||||
<task id="LOCAL-00435" summary="08/02/205 - 22h30">
|
||||
<created>1739050182545</created>
|
||||
<option name="number" value="00435" />
|
||||
<option name="presentableId" value="LOCAL-00435" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1739050182546</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="436" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -464,7 +461,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="qsdsq" />
|
||||
<MESSAGE value="qsdsqqs" />
|
||||
<MESSAGE value="29/10/2024 - 18h30" />
|
||||
<MESSAGE value="qsd" />
|
||||
|
@ -489,6 +485,7 @@
|
|||
<MESSAGE value="30/01/2025 - 16h" />
|
||||
<MESSAGE value="01/02/2025 - 20h" />
|
||||
<MESSAGE value="06-02-2025 - new_design_2025" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="06-02-2025 - new_design_2025" />
|
||||
<MESSAGE value="08/02/205 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="08/02/205 - 22h30" />
|
||||
</component>
|
||||
</project>
|
|
@ -1298,11 +1298,21 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
elif ( new_status != old_status and diction['status'] == "-1" ):
|
||||
# Il s'agit d'envoyer le message de refus d'une inscription
|
||||
if( "date_du" not in email_data.keys() ):
|
||||
if( "date_debut" not in email_data.keys() ):
|
||||
email_data['date_du'] = "--"
|
||||
else:
|
||||
email_data['date_du'] = str(email_data['date_debut'])
|
||||
|
||||
if ("date_au" not in email_data.keys()):
|
||||
if ("date_fin" not in email_data.keys()):
|
||||
email_data['date_au'] = "--"
|
||||
else:
|
||||
email_data['date_au'] = str(email_data['date_fin'])
|
||||
|
||||
email_data['partner_recid'] = str(partner_recid)
|
||||
email_data['token'] = str(diction['token'])
|
||||
|
||||
#print(" ### avant refus : email_data = ", email_data)
|
||||
|
||||
local_status, local_message = email_session.incription_training_refused_mail(email_data)
|
||||
message_for_historic = message_for_historic + " : Email Refus Inscription "
|
||||
|
||||
|
|
3858
Log/log_file.log
3858
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -316,7 +316,7 @@ Envoi de l'email de refus d'une d'inscription à une formation
|
|||
def incription_training_refused_mail(diction):
|
||||
try:
|
||||
|
||||
print(" ### incription_training_refused_mail = "+str(diction))
|
||||
#print(" ### incription_training_refused_mail = "+str(diction))
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
|
@ -361,6 +361,26 @@ def incription_training_refused_mail(diction):
|
|||
|
||||
# msg = MIMEMultipart("alternative")
|
||||
|
||||
local_diction = {}
|
||||
local_diction['ref_interne'] = "REFUS_INSCRIPTION"
|
||||
local_diction['type_doc'] = "email"
|
||||
local_diction['partner_owner_recid'] = str(diction['partner_recid'])
|
||||
|
||||
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(local_diction)
|
||||
if (courrier_data_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible de récuperer le modèle de courrier 'REFUS_INSCRIPTION' ")
|
||||
return False, " Impossible de récuperer le modèle de courrier 'REFUS_INSCRIPTION' "
|
||||
|
||||
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le modèle de courrier 'REFUS_INSCRIPTION' n'est pas correctement configuré ")
|
||||
return False, " Le modèle de courrier 'REFUS_INSCRIPTION' n'est pas correctement configuré"
|
||||
|
||||
|
||||
|
||||
msg = EmailMessage()
|
||||
|
||||
# JINJA2
|
||||
|
@ -369,39 +389,195 @@ def incription_training_refused_mail(diction):
|
|||
TEMPLATE_FILE = "Template/MySy_refus_inscription_formation_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
body = {}
|
||||
|
||||
local_nom = ""
|
||||
if ("nom" in diction.keys()):
|
||||
local_nom = diction['nom']
|
||||
|
||||
local_prenom = ""
|
||||
if( "prenom" in diction.keys() ):
|
||||
local_prenom = diction['prenom']
|
||||
|
||||
local_date_du = ""
|
||||
if ("date_du" in diction.keys()):
|
||||
local_date_du = diction['date_du']
|
||||
|
||||
local_date_au = ""
|
||||
if ("date_au" in diction.keys()):
|
||||
local_date_au = diction['date_au']
|
||||
|
||||
local_title = ""
|
||||
if ("title" in diction.keys()):
|
||||
local_title = diction['title']
|
||||
|
||||
local_email = ""
|
||||
if ("email" in diction.keys()):
|
||||
local_email = diction['email']
|
||||
|
||||
local_distantiel = ""
|
||||
if ("distantiel" in diction.keys()):
|
||||
local_distantiel = diction['distantiel']
|
||||
|
||||
local_presentiel = ""
|
||||
if ("presentiel" in diction.keys()):
|
||||
local_presentiel = diction['presentiel']
|
||||
|
||||
local_comment = ""
|
||||
if ("comment" in diction.keys()):
|
||||
local_comment = diction['comment']
|
||||
|
||||
refus_data = {}
|
||||
if ("comment" in diction.keys()):
|
||||
if diction['comment']:
|
||||
body = {
|
||||
refus_data = {
|
||||
"nom": str(local_nom),
|
||||
"prenom": str(local_prenom),
|
||||
"date_du": str(local_date_du),
|
||||
"date_fin": str(local_date_au),
|
||||
"adresse": str(adresse_session),
|
||||
"title": str(local_title),
|
||||
"email": str(local_email),
|
||||
"distantiel": str(local_distantiel),
|
||||
"presentiel": str(local_presentiel),
|
||||
"comment": str(local_comment),
|
||||
|
||||
"params" :{"nom": str(diction['nom']),
|
||||
"prenom": str(diction['prenom']),
|
||||
"date_du": str(diction['date_du']),
|
||||
"date_fin": str(diction['date_au']),
|
||||
"adresse": str(adresse_session),
|
||||
"title": str(diction['title']),
|
||||
"email": str(diction['email']),
|
||||
"distantiel": str(diction['distantiel']),
|
||||
"presentiel": str(diction['presentiel']),
|
||||
"comment": str(diction['comment'])},
|
||||
}
|
||||
}
|
||||
|
||||
else:
|
||||
body = {
|
||||
|
||||
"params": {"nom": str(diction['nom']),
|
||||
"prenom": str(diction['prenom']),
|
||||
"date_du": str(diction['date_du']),
|
||||
"date_fin": str(diction['date_au']),
|
||||
"adresse": str(adresse_session),
|
||||
"title": str(diction['title']),
|
||||
"email": str(diction['email'])},
|
||||
refus_data = {
|
||||
"nom": str(local_nom),
|
||||
"prenom": str(local_prenom),
|
||||
"date_du": str(local_date_du),
|
||||
"date_fin": str(local_date_au),
|
||||
"adresse": str(adresse_session),
|
||||
"title": str(local_title),
|
||||
"email": str(local_email),
|
||||
}
|
||||
|
||||
|
||||
new_diction = {}
|
||||
new_diction['token'] = str(diction['token'])
|
||||
new_diction['list_stagiaire_id'] = []
|
||||
new_diction['list_session_id'] = []
|
||||
new_diction['list_class_id'] = []
|
||||
new_diction['list_client_id'] = []
|
||||
|
||||
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||
|
||||
if (local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
dictionnary_data = local_retval
|
||||
dictionnary_data['refus_data'] = refus_data
|
||||
|
||||
print(" ### refus_data = ", refus_data)
|
||||
|
||||
body = {
|
||||
"params": dictionnary_data,
|
||||
}
|
||||
|
||||
# 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')
|
||||
|
||||
"""
|
||||
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_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_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_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_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_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_recid']),
|
||||
'config_name': 'smtp_count_port',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
msg = MIMEMultipart("alternative")
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com,' + str(diction['email'])
|
||||
msg['Subject'] = sujetHtml
|
||||
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 refus inscription envoyé à " + str(diction['email']))
|
||||
|
||||
else:
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com,' + str(diction['email'])
|
||||
msg['Subject'] = sujetHtml
|
||||
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 refus inscription envoyé à " + str(diction['email']))
|
||||
|
||||
|
||||
|
||||
"""
|
||||
# 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.
|
||||
|
||||
|
@ -410,7 +586,7 @@ def incription_training_refused_mail(diction):
|
|||
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'}
|
||||
|
@ -445,9 +621,9 @@ def incription_training_refused_mail(diction):
|
|||
# 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']),
|
||||
|
@ -519,9 +695,9 @@ def incription_training_refused_mail(diction):
|
|||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email confirmation envoyé " + str(val))
|
||||
"""
|
||||
|
||||
|
||||
return True, " Email confirlation inscritpion bien envoyé"
|
||||
return True, " Email de refus d'inscription bien envoyé"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -2085,7 +2261,7 @@ def LMS_Credential_Sending_mail(diction):
|
|||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
|
||||
history_event_dict['action_description'] = "(R)envoi des accès à la plateforme de E-Learning à pour session de formation " + str(diction['session_code'])
|
||||
history_event_dict['action_description'] = "(R)envoi des accès à la plateforme de E-Learning à "+str(diction['email'])+" - ("+str(diction['inscription_id'])+") pour session de formation " + str(diction['session_code'])
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
|
|
Loading…
Reference in New Issue