10/02/23 - 12h
parent
c2644dfde7
commit
406a1c0177
|
@ -5,12 +5,9 @@
|
|||
<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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
|
@ -145,7 +145,9 @@ def AddStagiairetoClass(diction):
|
|||
if diction['class_internal_url']:
|
||||
mydata['class_internal_url'] = diction['class_internal_url']
|
||||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
|
||||
|
||||
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y, %H:%M:%S")
|
||||
|
||||
new_status = "0" # 0 ==> Preinscription, par defaut
|
||||
if ("status" in diction.keys()):
|
||||
|
@ -752,7 +754,7 @@ def DownloadParticipantsList(diction):
|
|||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = field_list = ['token', 'session_id']
|
||||
field_list_obligatoire = field_list = ['token', 'session_id', 'internal_url']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
|
@ -777,9 +779,14 @@ def DownloadParticipantsList(diction):
|
|||
if diction['session_id']:
|
||||
session_id = diction['session_id']
|
||||
|
||||
internal_url = ""
|
||||
if ("internal_url" in diction.keys()):
|
||||
if diction['internal_url']:
|
||||
internal_url = diction['internal_url']
|
||||
|
||||
|
||||
# Recuperation des données de la session
|
||||
local_session = MYSY_GV.dbname['session_formation'].find_one({'formation_session_id':session_id})
|
||||
local_session = MYSY_GV.dbname['session_formation'].find_one({'formation_session_id':session_id, 'class_internal_url':internal_url})
|
||||
|
||||
|
||||
if (local_session is None):
|
||||
|
@ -787,7 +794,7 @@ def DownloadParticipantsList(diction):
|
|||
return False, " Cette session de formation n'a pas d'informations detaillées "
|
||||
|
||||
# Recuperation des données de la formation
|
||||
local_formation = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(local_session['class_internal_url'])})
|
||||
local_formation = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(internal_url)})
|
||||
if (local_formation is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Cette de formation n'a pas d'informations detaillées (2) ")
|
||||
return False, " Cette de formation n'a pas d'informations detaillées (2) "
|
||||
|
@ -796,6 +803,7 @@ def DownloadParticipantsList(diction):
|
|||
coll_session = MYSY_GV.dbname['inscription']
|
||||
myquery = {}
|
||||
myquery['session_id'] = session_id
|
||||
myquery['class_internal_url'] = internal_url
|
||||
|
||||
|
||||
RetObject = []
|
||||
|
@ -896,11 +904,11 @@ def DownloadParticipantsList(diction):
|
|||
|
||||
if ("inscription_validation_date" in retval.keys()):
|
||||
if( retval['inscription_validation_date']):
|
||||
local_data['inscription_validation_date'] = retval['inscription_validation_date']
|
||||
local_data['inscription_validation_date'] = str(retval['inscription_validation_date'])[0:10]
|
||||
|
||||
if ("inscription_refuse_date" in retval.keys()):
|
||||
if (retval['inscription_refuse_date']):
|
||||
local_data['inscription_refuse_date'] = retval['inscription_refuse_date']
|
||||
local_data['inscription_refuse_date'] = str(retval['inscription_refuse_date'])[0:10]
|
||||
|
||||
RetObject.append(local_data)
|
||||
|
||||
|
@ -991,6 +999,237 @@ def DownloadParticipantsList(diction):
|
|||
return False, "Impossible d'envoyer la confirmation d'inscription"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction imprime au formation csv la liste des evaluations d'une formation
|
||||
"""
|
||||
def DownloadEvaluationList(diction):
|
||||
try:
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = field_list = ['token', 'session_id', 'internal_url']
|
||||
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 de generer la liste des participants. les informations sont incompletes"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer la liste des stagiaires, ")
|
||||
return False, " Impossible de generer la liste des participants. les informations sont incompletes"
|
||||
|
||||
|
||||
session_id = ""
|
||||
if ("session_id" in diction.keys()):
|
||||
if diction['session_id']:
|
||||
session_id = diction['session_id']
|
||||
|
||||
internal_url = ""
|
||||
if ("internal_url" in diction.keys()):
|
||||
if diction['internal_url']:
|
||||
internal_url = diction['internal_url']
|
||||
|
||||
|
||||
# Recuperation des données de la session
|
||||
local_session = MYSY_GV.dbname['session_formation'].find_one({'formation_session_id':session_id, 'class_internal_url':internal_url})
|
||||
|
||||
|
||||
if (local_session is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Cette de formation n'a pas d'informations detaillées ")
|
||||
return False, " Cette session de formation n'a pas d'informations detaillées "
|
||||
|
||||
# Recuperation des données de la formation
|
||||
local_formation = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(internal_url)})
|
||||
if (local_formation is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Cette de formation n'a pas d'informations detaillées (2) ")
|
||||
return False, " Cette de formation n'a pas d'informations detaillées (2) "
|
||||
|
||||
## Recuperation de toutes les stagiaire rattaché à cette session
|
||||
coll_session = MYSY_GV.dbname['inscription']
|
||||
myquery = {}
|
||||
myquery['session_id'] = session_id
|
||||
myquery['class_internal_url'] = internal_url
|
||||
myquery['status'] = "1"
|
||||
|
||||
|
||||
RetObject = []
|
||||
|
||||
for retval in coll_session.find(myquery, { 'session_id':0}):
|
||||
|
||||
local_data = {}
|
||||
local_data['titre'] = local_formation['title']
|
||||
local_data['debut_session'] = local_session ['date_debut']
|
||||
local_data['fin_session'] = local_session['date_fin']
|
||||
|
||||
local_formateur = ""
|
||||
if ("formateur" in local_session.keys()):
|
||||
if local_session['formateur']:
|
||||
local_formateur = local_session['formateur']
|
||||
local_data['formateur'] = local_formateur
|
||||
|
||||
presentiel = ""
|
||||
if ("presentiel" in local_session.keys()):
|
||||
if local_session['presentiel']:
|
||||
presentiel = local_session['presentiel']
|
||||
local_data['presentiel'] = presentiel
|
||||
|
||||
distantiel = ""
|
||||
if ("distantiel" in local_session.keys()):
|
||||
if local_session['distantiel']:
|
||||
distantiel = local_session['distantiel']
|
||||
local_data['distantiel'] = distantiel
|
||||
|
||||
adresse = ""
|
||||
if ("adresse" in local_session.keys()):
|
||||
if local_session['adresse']:
|
||||
adresse = local_session['adresse']
|
||||
local_data['adresse'] = adresse
|
||||
|
||||
ville = ""
|
||||
if ("ville" in local_session.keys()):
|
||||
if local_session['ville']:
|
||||
ville = local_session['ville']
|
||||
local_data['ville'] = ville
|
||||
|
||||
code_postal = ""
|
||||
if ("code_postal" in local_session.keys()):
|
||||
if local_session['code_postal']:
|
||||
code_postal = local_session['code_postal']
|
||||
local_data['code_postal'] = code_postal
|
||||
|
||||
|
||||
|
||||
local_data['prenom'] = retval['prenom']
|
||||
local_data['nom'] = retval['nom']
|
||||
local_data['email'] = retval['email']
|
||||
local_data['telephone'] = retval['telephone']
|
||||
local_data['date_inscription'] = str(retval['_id'].generation_time.strftime("%m/%d/%Y, %H:%M"))
|
||||
|
||||
eval_date = ""
|
||||
if ("eval_date" in retval.keys()):
|
||||
eval_date = retval['eval_date']
|
||||
local_data['evaluation_date'] = str(eval_date)[0:10]
|
||||
|
||||
eval_note = ""
|
||||
if ("eval_note" in retval.keys()):
|
||||
eval_note = retval['eval_note']
|
||||
local_data['evaluation_globale'] = eval_note
|
||||
|
||||
eval_pedagogie = ""
|
||||
if ("eval_pedagogie" in retval.keys()):
|
||||
eval_pedagogie = retval['eval_pedagogie']
|
||||
local_data['evaluation_pedagogie'] = eval_pedagogie
|
||||
|
||||
eval_eval = ""
|
||||
if ("eval_eval" in retval.keys()):
|
||||
eval_eval = retval['eval_eval']
|
||||
local_data['evaluation_commentaire'] = mycommon.cleanhtml(str(eval_eval))
|
||||
|
||||
|
||||
if ("inscription_validation_date" in retval.keys()):
|
||||
if( retval['inscription_validation_date']):
|
||||
local_data['inscription_validation_date'] = str(retval['inscription_validation_date'])[0:10]
|
||||
|
||||
|
||||
RetObject.append(local_data)
|
||||
|
||||
|
||||
"""
|
||||
/!\ : Quand il n'y a pas encore de stagaire, alors le grid : RetObject : est vide car la boucle precedent est vide
|
||||
Donc on retourne juste les infos de la session
|
||||
"""
|
||||
|
||||
print(" ### len(RetObject) = ", len(RetObject) , " RetObject = ", RetObject )
|
||||
if(len(RetObject) <= 0 ):
|
||||
local_data = {}
|
||||
local_data['titre_formation'] = local_formation['title']
|
||||
local_data['debut_session'] = local_session['date_debut']
|
||||
local_data['fin_session'] = local_session['date_fin']
|
||||
|
||||
local_formateur = ""
|
||||
if ("formateur" in local_session.keys()):
|
||||
if local_session['formateur']:
|
||||
local_formateur = local_session['formateur']
|
||||
local_data['formateur'] = local_formateur
|
||||
|
||||
presentiel = ""
|
||||
if ("presentiel" in local_session.keys()):
|
||||
if local_session['presentiel']:
|
||||
local_formateur = local_session['presentiel']
|
||||
local_data['presentiel'] = presentiel
|
||||
|
||||
distantiel = ""
|
||||
if ("distantiel" in local_session.keys()):
|
||||
if local_session['distantiel']:
|
||||
distantiel = local_session['distantiel']
|
||||
local_data['distantiel'] = distantiel
|
||||
|
||||
adresse = ""
|
||||
if ("adresse" in local_session.keys()):
|
||||
if local_session['adresse']:
|
||||
adresse = local_session['adresse']
|
||||
local_data['adresse'] = adresse
|
||||
|
||||
ville = ""
|
||||
if ("ville" in local_session.keys()):
|
||||
if local_session['ville']:
|
||||
ville = local_session['ville']
|
||||
local_data['ville'] = ville
|
||||
|
||||
code_postal = ""
|
||||
if ("code_postal" in local_session.keys()):
|
||||
if local_session['code_postal']:
|
||||
code_postal = local_session['code_postal']
|
||||
local_data['code_postal'] = code_postal
|
||||
|
||||
prix_session = ""
|
||||
if ("prix_session" in local_session.keys()):
|
||||
if local_session['prix_session']:
|
||||
prix_session = local_session['prix_session']
|
||||
local_data['prix_session'] = prix_session
|
||||
|
||||
nb_participant = ""
|
||||
if ("nb_participant" in local_session.keys()):
|
||||
if local_session['nb_participant']:
|
||||
nb_participant = local_session['nb_participant']
|
||||
local_data['nb_participants'] = nb_participant
|
||||
|
||||
local_data['nb_inscrit'] = "0"
|
||||
|
||||
RetObject.append(local_data)
|
||||
|
||||
# Expand the cursor and construct the DataFrame
|
||||
df = pd.DataFrame(list(RetObject))
|
||||
|
||||
file_name_tmp = mycommon.create_token_urlsafe()
|
||||
file_name = ''.join(char for char in file_name_tmp if char.isalnum())
|
||||
|
||||
#print("#### filename = "+str(file_name))
|
||||
|
||||
df.to_excel(MYSY_GV.TEMPORARY_DIRECTORY+"/"+str(file_name)+".xlsx", index=False)
|
||||
if os.path.exists(MYSY_GV.TEMPORARY_DIRECTORY+"/"+str(file_name)+".xlsx"):
|
||||
path = MYSY_GV.TEMPORARY_DIRECTORY+"/"+str(file_name)+".xlsx"
|
||||
return True, send_file(path, as_attachment=True)
|
||||
else:
|
||||
return False, False
|
||||
|
||||
|
||||
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 la confirmation d'inscription"
|
||||
|
||||
|
||||
|
||||
""" Import des inscriptions en masse
|
||||
Avec l'import d'un fichier csv
|
||||
"""
|
||||
|
@ -1411,7 +1650,7 @@ eval_pedagogie :
|
|||
def Evaluation_Class(diction):
|
||||
try:
|
||||
|
||||
field_list_obligatoire = ['inscription_id', 'eval_note', 'eval_eval', 'eval_pedagogie']
|
||||
field_list_obligatoire = ['inscription_id', 'eval_note', 'eval_eval', 'eval_pedagogie', 'class_internal_url']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
|
@ -1425,11 +1664,11 @@ def Evaluation_Class(diction):
|
|||
if( mycommon.IsFloat( note ) is False ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La note d'evalution est incorrecte ")
|
||||
return False, " La note d'evalution est incorrecte "
|
||||
3]) + " La note d'evaluation est incorrecte ")
|
||||
return False, " La note d'evaluation est incorrecte "
|
||||
|
||||
mydata = {}
|
||||
mydata['eval_date'] = str(datetime.now())
|
||||
mydata['eval_date'] = str(datetime.now().strftime("%d/%m/%Y, %H:%M:%S"))
|
||||
mydata['eval_note'] = str(diction['eval_note']).strip()
|
||||
mydata['eval_eval'] = str(diction['eval_eval']).strip()
|
||||
mydata['eval_pedagogie'] = str(diction['eval_pedagogie']).strip()
|
||||
|
@ -1446,7 +1685,7 @@ def Evaluation_Class(diction):
|
|||
|
||||
|
||||
# Declencer l'envoi de la notification de l'evaluation
|
||||
email_mgt.EmailNotifEvaluation_Done()
|
||||
email_mgt.EmailNotifEvaluation_Done(diction)
|
||||
return True, " L'evaluation a bien été enregistrée"
|
||||
|
||||
except Exception as e:
|
||||
|
|
1392
Log/log_file.log
1392
Log/log_file.log
File diff suppressed because it is too large
Load Diff
134
email_mgt.py
134
email_mgt.py
|
@ -1997,11 +1997,115 @@ def EmailStopAbonnement( partners_email, partners_pack_service, partners_date_ar
|
|||
"""
|
||||
Cette fonction envoie la notification d'evaluation à un institut de formation
|
||||
"""
|
||||
def EmailNotifEvaluation_Done():
|
||||
def EmailNotifEvaluation_Done(diction):
|
||||
try:
|
||||
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
|
||||
tomorrow_day = tomorrow.strftime("%A")
|
||||
|
||||
field_list_obligatoire = ['inscription_id', 'eval_note', 'eval_eval', 'eval_pedagogie', 'class_internal_url']
|
||||
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, " Les informations fournies sont incorrectes"
|
||||
|
||||
note = str(diction['eval_note']).strip()
|
||||
if (mycommon.IsFloat(note) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La note d'evaluation est incorrecte ")
|
||||
return False, " La note d'evaluation est incorrecte "
|
||||
|
||||
note_peda = str(diction['eval_pedagogie']).strip()
|
||||
if (mycommon.IsFloat(note_peda) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La note pédagogique est incorrecte ")
|
||||
return False, " La note d'pédagogique est incorrecte "
|
||||
|
||||
# Recuperation du titre de la formation
|
||||
local_class = MYSY_GV.dbname['myclass'].find_one({"internal_url":diction['class_internal_url'], 'valide':'1',
|
||||
'locked': '0'})
|
||||
if( local_class is None ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible d'envoyer la notification. La formation est introuvable ")
|
||||
return False, " Impossible d'envoyer la notification. La formation est introuvable "
|
||||
|
||||
|
||||
if ("title" not in local_class.keys()):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible d'envoyer la notification. La formation est introuvable (2) ")
|
||||
return False, " Impossible d'envoyer la notification. La formation est introuvable (2) "
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_partner = MYSY_GV.dbname['partnair_account'].find_one({'recid': str(local_class['partner_owner_recid'])})
|
||||
if (local_partner is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible d'envoyer la notification. Le compte partenaire est introuvable ")
|
||||
return False, " Impossible d'envoyer la notification. Le compte partenaire est introuvable "
|
||||
|
||||
if ("nom" not in local_partner.keys() or "email" not in local_partner.keys()):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible d'envoyer la notification. Le compte partenaire est introuvable (2) ")
|
||||
return False, " Impossible d'envoyer la notification. Le compte partenaire est introuvable (2) "
|
||||
|
||||
|
||||
# Recuperation des donnée d'inscription
|
||||
local_inscription = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(str(diction['inscription_id']).strip())),})
|
||||
if (local_inscription is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible d'envoyer la notification. L'inscription est introuvable ")
|
||||
return False, " Impossible d'envoyer la notification. L'inscription est introuvable "
|
||||
|
||||
insc_nom = ""
|
||||
if ("nom" in local_inscription.keys()):
|
||||
insc_nom = local_inscription['nom']
|
||||
|
||||
insc_prenom = ""
|
||||
if ("prenom" in local_inscription.keys()):
|
||||
insc_prenom = local_inscription['prenom']
|
||||
|
||||
date_du = ""
|
||||
if ("date_du" in local_inscription.keys()):
|
||||
date_du = local_inscription['date_du']
|
||||
|
||||
date_au = ""
|
||||
if ("date_au" in local_inscription.keys()):
|
||||
date_au = local_inscription['nom']
|
||||
|
||||
partenaire_name = ""
|
||||
if ("nom" in local_partner.keys()):
|
||||
partenaire_name = local_partner['nom']
|
||||
|
||||
partenaire_email = ""
|
||||
if ("email" in local_partner.keys()):
|
||||
partenaire_email = local_partner['email']
|
||||
|
||||
eval_note = ""
|
||||
if ("eval_note" in local_inscription.keys()):
|
||||
eval_note = local_inscription['eval_note']
|
||||
|
||||
eval_pedagogie = ""
|
||||
if ("eval_pedagogie" in local_inscription.keys()):
|
||||
eval_pedagogie = local_inscription['eval_pedagogie']
|
||||
|
||||
eval_date = ""
|
||||
if ("eval_date" in local_inscription.keys()):
|
||||
eval_date = str(local_inscription['eval_date'])[0:10]
|
||||
|
||||
eval_eval = ""
|
||||
if ("eval_eval" in local_inscription.keys()):
|
||||
eval_eval = mycommon.cleanhtml(str(local_inscription['eval_eval']))
|
||||
|
||||
title = ""
|
||||
if ("title" in local_class.keys()):
|
||||
title = mycommon.cleanhtml(str(local_class['title']))
|
||||
|
||||
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
@ -2016,21 +2120,21 @@ def EmailNotifEvaluation_Done():
|
|||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
body = {
|
||||
"params":{"partenaire_name": "Mysy",
|
||||
"prenom": "sekou",
|
||||
"nom": "balde",
|
||||
"date_du": "10/01/22",
|
||||
"date_fin": "12/01/22",
|
||||
"eval_note":"5",
|
||||
"eval_pedagogie": "6",
|
||||
"eval_eval": "topppp cool",
|
||||
"eval_date": "09/02/23",
|
||||
"aaa": 3,
|
||||
"aab": "3",
|
||||
|
||||
"params":{"partenaire_name": partenaire_name,
|
||||
"prenom": insc_prenom,
|
||||
"nom": insc_nom,
|
||||
"date_du": date_du,
|
||||
"date_fin": date_au,
|
||||
"eval_note":eval_note,
|
||||
"eval_pedagogie": eval_pedagogie,
|
||||
"eval_eval": eval_eval,
|
||||
"eval_date": eval_date,
|
||||
"title":title
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
#print(" ### body = ", body)
|
||||
sourceHtml = template.render(params=body["params"])
|
||||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
@ -2038,8 +2142,8 @@ def EmailNotifEvaluation_Done():
|
|||
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
msg['Subject'] = "[MySy Training Technology] : Evaluation de votre formation "
|
||||
msg['To'] = "billardman1@gmail.com"
|
||||
msg['Subject'] = "[MySy Training Technology] : Votre formation a été évaluée "
|
||||
msg['To'] = partenaire_email
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
|
|
38
main.py
38
main.py
|
@ -2063,14 +2063,15 @@ def ManualSendInvoiceEmailRIB():
|
|||
API de recuperation au formation CSV de la liste des inscrits à une formation
|
||||
avec les statuts (validé ou pas)
|
||||
"""
|
||||
@app.route('/myclass/api/DownloadParticipantsList/<token>/<sessionid>', methods=['GET','POST'])
|
||||
@app.route('/myclass/api/DownloadParticipantsList/<token>/<sessionid>/<internal_url>', methods=['GET','POST'])
|
||||
@crossdomain(origin='*')
|
||||
def DownloadParticipantsList(sessionid, token):
|
||||
def DownloadParticipantsList(sessionid, token, internal_url):
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
payload = {}
|
||||
payload['token'] = str(token)
|
||||
payload['session_id'] = str(sessionid)
|
||||
payload['internal_url'] = str(internal_url)
|
||||
print(" ### DownloadParticipantsList payload facture = ", str(payload))
|
||||
local_status, local_file = inscription.DownloadParticipantsList(payload)
|
||||
if( local_status is False ):
|
||||
|
@ -2079,6 +2080,29 @@ def DownloadParticipantsList(sessionid, token):
|
|||
return local_file
|
||||
|
||||
|
||||
"""
|
||||
Cette API imprime le detail des evaluations d'une formation au format excel
|
||||
"""
|
||||
@app.route('/myclass/api/DownloadEvaluationList/<token>/<sessionid>/<internal_url>', methods=['GET','POST'])
|
||||
@crossdomain(origin='*')
|
||||
def DownloadEvaluationList(sessionid, token, internal_url):
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
payload = {}
|
||||
payload['token'] = str(token)
|
||||
payload['session_id'] = str(sessionid)
|
||||
payload['internal_url'] = str(internal_url)
|
||||
print(" ### DownloadEvaluationList payload facture = ", str(payload))
|
||||
local_status, local_file = inscription.DownloadEvaluationList(payload)
|
||||
if( local_status is False ):
|
||||
return ""
|
||||
|
||||
return local_file
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API d'import des stagaires en masse avec un fichier csv
|
||||
"""
|
||||
|
@ -2322,6 +2346,16 @@ def email_validation_hopitaux_ehpad():
|
|||
localStatus, message= tools_cherif.email_validation_hopitaux_ehpad()
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
@app.route('/myclass/api/email_validation_list_pos_bio/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def email_validation_list_pos_bio():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### email_validation_list_pos_bio : payload = ",payload)
|
||||
localStatus, message= tools_cherif.email_validation_list_pos_bio()
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API permet de desabonner une personne
|
||||
|
|
|
@ -205,3 +205,64 @@ def email_validation_hopitaux_ehpad():
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
def email_validation_list_pos_bio():
|
||||
try:
|
||||
|
||||
coll_emails = MYSY_GV.dbname['collect_list_pos_bio']
|
||||
|
||||
cpt = 0
|
||||
nb_doc = coll_emails.count_documents({'valide': '1', "email_checked": {"$ne": "1"}})
|
||||
|
||||
print(" ### nb_doc = ", nb_doc)
|
||||
|
||||
for val in coll_emails.find({'valide': '1', "checked": {"$ne": "1"}}):
|
||||
cpt = cpt + 1
|
||||
if ("email" in val.keys()):
|
||||
|
||||
is_valid = validate_email(
|
||||
email_address=str(val['email']).strip(),
|
||||
check_format=True,
|
||||
check_blacklist=True,
|
||||
check_dns=True,
|
||||
dns_timeout=10,
|
||||
check_smtp=True,
|
||||
smtp_timeout=10,
|
||||
smtp_helo_host='smtp.office365.com',
|
||||
smtp_from_address='support@mysy-training.com',
|
||||
smtp_skip_tls=False,
|
||||
smtp_tls_context=None,
|
||||
smtp_debug=False)
|
||||
|
||||
retval = ""
|
||||
checked_status = ""
|
||||
if (is_valid):
|
||||
# print(" ### l'adresse ",val['email_address']," est valide ")
|
||||
retval = True
|
||||
checked_status = "1"
|
||||
else:
|
||||
# print(" ### l'adresse ", val['email_address'], " N'EST PAS valide ")
|
||||
retval = False
|
||||
checked_status = "0"
|
||||
|
||||
mydata = {}
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
mydata['last_check_date'] = str(mytoday)[0:10]
|
||||
|
||||
mydata['email_checked'] = str("1")
|
||||
mydata['email_checked_status'] = str(checked_status)
|
||||
|
||||
ret_val = coll_emails.find_one_and_update(
|
||||
{'email': str(val['email']), 'valide': '1'},
|
||||
{"$set": mydata},
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
print(" ### " + str(cpt) + " / " + str(nb_doc))
|
||||
|
||||
return retval, str(cpt) + " adresse email ont été mise à jour "
|
||||
|
||||
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 recuperer la formation"
|
||||
|
||||
|
|
Loading…
Reference in New Issue