24/03/23 - 23h
parent
2be60d1fdd
commit
1ff8c40637
|
@ -5,8 +5,7 @@
|
|||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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" />
|
||||
|
|
|
@ -2532,6 +2532,7 @@ def CancelAttendeeInscription(diction):
|
|||
# 1 - Recuperation des données de la formation
|
||||
local_class = MYSY_GV.dbname['myclass'].find({'internal_url': str(diction['class_internal_url'])})
|
||||
data_mail['title'] = local_class[0]['title']
|
||||
class_title = local_class[0]['title']
|
||||
|
||||
# 2 - Recuperation des données de l'inscription
|
||||
local_inscription = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
|
@ -2546,6 +2547,31 @@ def CancelAttendeeInscription(diction):
|
|||
if local_inscription[0]['lms_user_id']:
|
||||
lms_user_id = local_inscription[0]['lms_user_id']
|
||||
|
||||
nom = ""
|
||||
if ("nom" in local_inscription[0].keys()):
|
||||
if local_inscription[0]['nom']:
|
||||
nom = local_inscription[0]['nom']
|
||||
|
||||
prenom = ""
|
||||
if ("prenom" in local_inscription[0].keys()):
|
||||
if local_inscription[0]['prenom']:
|
||||
prenom = local_inscription[0]['prenom']
|
||||
|
||||
email = ""
|
||||
if ("email" in local_inscription[0].keys()):
|
||||
if local_inscription[0]['email']:
|
||||
email = local_inscription[0]['email']
|
||||
|
||||
date_du = ""
|
||||
if ("date_du" in local_inscription[0].keys()):
|
||||
if local_inscription[0]['date_du']:
|
||||
date_du = str(local_inscription[0]['date_du'])[0:10]
|
||||
|
||||
date_au = ""
|
||||
if ("date_au" in local_inscription[0].keys()):
|
||||
if local_inscription[0]['date_au']:
|
||||
date_au = str(local_inscription[0]['date_au'])[0:10]
|
||||
|
||||
|
||||
# Recuperation des données de la session
|
||||
local_session = MYSY_GV.dbname['session_formation'].find_one(
|
||||
|
@ -2588,7 +2614,20 @@ def CancelAttendeeInscription(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - WARNING : Impossible de supprimer l'inscription dans le LMS pour "+str( diction['email']) )
|
||||
return_message = "Impossible de supprimer l'inscription dans le LMS pour : "+str( diction['email'])
|
||||
|
||||
email_data = {}
|
||||
email_data['nom'] = nom
|
||||
email_data['prenom'] = prenom
|
||||
email_data['email'] = email
|
||||
email_data['date_du'] = date_du
|
||||
email_data['date_au'] = date_au
|
||||
email_data['title'] = class_title
|
||||
|
||||
local_status, local_message = email_session.incription_training_cancelled_mail(email_data)
|
||||
if( local_status is False ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - WARNING : Impossible d'envoyer le mail de notification pour " + str(
|
||||
diction['email']))
|
||||
return_message = return_message + str(" Impossible d'envoyer le mail de notification pour : " + str(diction['email']))
|
||||
|
||||
if( return_message.strip() != ""):
|
||||
return True, return_message
|
||||
|
|
1066
Log/log_file.log
1066
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -289,6 +289,120 @@ def incription_training_refused_mail(diction):
|
|||
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 "
|
||||
|
||||
"""
|
||||
Envoie de l'email d'information sur l'annulation de l'inscription
|
||||
"""
|
||||
def incription_training_cancelled_mail(diction):
|
||||
try:
|
||||
|
||||
print(" ### incription_training_cancelled_mail = "+str(diction))
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['nom', 'prenom', 'email', 'date_du', 'date_au', 'title', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, "Impossible d'envoyer l'email d'annulation de l'inscritpion"
|
||||
|
||||
|
||||
|
||||
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
|
||||
tomorrow_day = tomorrow.strftime("%A")
|
||||
|
||||
print("debut envoi mail de test ")
|
||||
|
||||
"""
|
||||
Verification si c'est une formation en ligne.
|
||||
auquel cas, l'adresse est du type : enligne"""
|
||||
|
||||
my_adress = ""
|
||||
if ("adresse" in diction.keys()):
|
||||
if diction['adresse']:
|
||||
my_adress = diction['adresse']
|
||||
|
||||
presentiel = ""
|
||||
if ("presentiel" in diction.keys()):
|
||||
if diction['presentiel']:
|
||||
presentiel = diction['presentiel']
|
||||
|
||||
distantiel = ""
|
||||
if ("distantiel" in diction.keys()):
|
||||
if diction['distantiel']:
|
||||
distantiel = diction['distantiel']
|
||||
|
||||
|
||||
adresse_session = my_adress
|
||||
|
||||
|
||||
# on rentre les renseignements pris sur le site du fournisseur
|
||||
|
||||
# msg = MIMEMultipart("alternative")
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
msg = EmailMessage()
|
||||
|
||||
# JINJA2
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/MySy_annule_inscription_formation_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
body = {}
|
||||
if ("comment" in diction.keys()):
|
||||
if diction['comment']:
|
||||
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']),
|
||||
"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'])},
|
||||
}
|
||||
|
||||
sourceHtml = template.render(params=body["params"])
|
||||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation annulé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 confirlation envoyé " + str(val))
|
||||
|
||||
|
||||
return True, " Email d'annulation de l'inscritpion 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 "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue