parent
5a3c04aef0
commit
bb2ecc8147
|
|
@ -4,23 +4,22 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="25/11/25 - 21h30dd">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="07/12/25 - 14h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.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_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$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence.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$/ent_alert_messages.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_alert_messages.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/invoice_paiement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/invoice_paiement_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$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -463,7 +462,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="517" />
|
||||
<option name="localTasksCounter" value="518" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -505,7 +504,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="06/07/2025 - 12h" />
|
||||
<MESSAGE value="12/07/2025 - 12h" />
|
||||
<MESSAGE value="qsd" />
|
||||
<MESSAGE value="30/07/2025 -18h" />
|
||||
|
|
@ -530,6 +528,7 @@
|
|||
<MESSAGE value="23/11/25 - 21h30" />
|
||||
<MESSAGE value="23/11/25 - 21h30dd" />
|
||||
<MESSAGE value="25/11/25 - 21h30dd" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="25/11/25 - 21h30dd" />
|
||||
<MESSAGE value="07/12/25 - 14h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="07/12/25 - 14h" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -683,7 +683,8 @@ PARTNER_BASE_CONFIG_NAME = ['tva', 'smtp_server', 'smtp_user', 'smtp_user_pwd',
|
|||
'relance_auto', 'frequence_relance_auto', 'session_warning', 'session_warning_lead_time',
|
||||
'recyclage_warning', 'recyclage_warning_lead_time',
|
||||
'preinscription_notification_email', 'inscription_notification_email','nb_heure_par_jour',
|
||||
'nb_heure_par_mois', 'nb_heure_par_annee', 'nb_heure_par_semaine']
|
||||
'nb_heure_par_mois', 'nb_heure_par_annee', 'nb_heure_par_semaine',
|
||||
'annulation_inscription_notification_email']
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -820,7 +821,7 @@ Les types de formulaire
|
|||
- human_eval = Formulaire pour evaluation d'une ressource humaine
|
||||
- autre_eval = Formulaire pour d'autres evaluation non prevu plus haut
|
||||
"""
|
||||
FORM_TYPE = ['pos', 'hot_eval', 'cold_eval', 'human_eval', 'autre_eval']
|
||||
FORM_TYPE = ['pos', 'hot_eval', 'cold_eval', 'human_eval', 'autre_eval', 'client_eval']
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1437,9 +1437,15 @@ def UpdateStagiairetoClass(diction):
|
|||
email_data['partner_recid'] = str(partner_recid)
|
||||
email_data['token'] = str(diction['token'])
|
||||
|
||||
#print(" ### avant refus : email_data = ", email_data)
|
||||
print(" ### avant refus : email_data = ", email_data)
|
||||
|
||||
local_insc_status, local_insc_retval = mycommon.Is_Partnair_Annulation_Inscription_Notification({'token': diction['token']})
|
||||
if (local_insc_status and local_insc_retval == "1"):
|
||||
print(" ## OKKK ENVOIE MAIL REFUSSS")
|
||||
local_status, local_message = email_session.incription_training_refused_mail(email_data)
|
||||
else:
|
||||
print(" ## NOOOOO ENVOIE MAIL REFUSSS")
|
||||
|
||||
local_status, local_message = email_session.incription_training_refused_mail(email_data)
|
||||
message_for_historic = message_for_historic + " : Email Refus Inscription "
|
||||
|
||||
|
||||
|
|
@ -5714,26 +5720,36 @@ 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['token'] = str(diction['token'])
|
||||
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
|
||||
email_data['partner_owner_recid'] = str(partner_recid)
|
||||
"""
|
||||
13/12/2025 :
|
||||
On n'envoit la notification d'annulation que la paramettre 'annulation_inscription_notification_email' est à 1
|
||||
"""
|
||||
local_insc_status, local_insc_retval = mycommon.Is_Partnair_Annulation_Inscription_Notification( {'token': diction['token']})
|
||||
if (local_insc_status and local_insc_retval == "1"):
|
||||
print(" ###OK on doit envoyer l'email d'annulation à l'apprenant = ")
|
||||
email_data = {}
|
||||
email_data['token'] = str(diction['token'])
|
||||
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
|
||||
email_data['partner_owner_recid'] = str(partner_recid)
|
||||
|
||||
|
||||
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']))
|
||||
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
|
||||
if( return_message.strip() != ""):
|
||||
return True, return_message
|
||||
|
||||
else:
|
||||
print(" ### ON NE DOIT PASSS on doit envoyer l'email d'annulation à l'apprenant = ")
|
||||
|
||||
return True, "L'inscription a été correctement annulée"
|
||||
|
||||
|
|
|
|||
9386
Log/log_file.log
9386
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -8454,6 +8454,7 @@ def Create_Convocation_By_Stagiaire_PDF(diction):
|
|||
"params": convention_dictionnary_data,
|
||||
}
|
||||
|
||||
print(" ## BUUUUUUDYYY = ", body)
|
||||
"""
|
||||
Creation du ficier PDF
|
||||
"""
|
||||
|
|
@ -9361,6 +9362,7 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
"params": convention_dictionnary_data,
|
||||
}
|
||||
|
||||
|
||||
orig_file_name = None
|
||||
outputFilename = None
|
||||
# Verifier s'il s'agit d'un document à envoyer avec une version de pièce jointe.
|
||||
|
|
@ -13986,8 +13988,17 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
partner_invoice_line_data_detail = {}
|
||||
partner_invoice_line_data_detail['order_line_inscription_id'] = str(tmp_inscription_dat['_id'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_type_apprenant'] = str(tmp_inscription_dat['type_apprenant'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_comment'] = str(tmp_inscription_dat['comment'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_memo'] = str(tmp_inscription_dat['memo'])
|
||||
if( "comment" in tmp_inscription_dat.keys()):
|
||||
partner_invoice_line_data_detail['order_line_inscription_comment'] = str(tmp_inscription_dat['comment'])
|
||||
else:
|
||||
partner_invoice_line_data_detail['order_line_inscription_comment'] = ""
|
||||
|
||||
if( "memo" in tmp_inscription_dat.keys()):
|
||||
partner_invoice_line_data_detail['order_line_inscription_memo'] = str(tmp_inscription_dat['memo'])
|
||||
else:
|
||||
partner_invoice_line_data_detail['order_line_inscription_memo'] = ""
|
||||
|
||||
|
||||
partner_invoice_line_data_detail['order_line_inscription_price'] = str(tmp_inscription_dat['price'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_email'] = str(tmp_inscription_dat['email'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_civilite'] = str(tmp_inscription_dat['civilite'])
|
||||
|
|
@ -14586,8 +14597,18 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
|
|||
partner_invoice_line_data_detail = {}
|
||||
partner_invoice_line_data_detail['order_line_inscription_id'] = str(tmp_inscription_dat['_id'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_type_apprenant'] = str(tmp_inscription_dat['type_apprenant'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_comment'] = str(tmp_inscription_dat['comment'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_memo'] = str(tmp_inscription_dat['memo'])
|
||||
|
||||
if("comment" in tmp_inscription_dat.keys()):
|
||||
partner_invoice_line_data_detail['order_line_inscription_comment'] = str(tmp_inscription_dat['comment'])
|
||||
else:
|
||||
partner_invoice_line_data_detail['order_line_inscription_comment'] = ""
|
||||
|
||||
if ("memo" in tmp_inscription_dat.keys()):
|
||||
partner_invoice_line_data_detail['order_line_inscription_memo'] = str(tmp_inscription_dat['memo'])
|
||||
else:
|
||||
partner_invoice_line_data_detail['order_line_inscription_memo'] = ""
|
||||
|
||||
|
||||
partner_invoice_line_data_detail['order_line_inscription_price'] = str(tmp_inscription_dat['price'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_email'] = str(tmp_inscription_dat['email'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_civilite'] = str(
|
||||
|
|
|
|||
|
|
@ -405,6 +405,7 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
|
|||
mydata['valide'] = "1"
|
||||
mydata['status'] = "0"
|
||||
mydata['locked'] = "0"
|
||||
|
||||
mydata['creation_date'] = str(datetime.now())
|
||||
mydata['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
|
|
|
|||
|
|
@ -117,12 +117,14 @@ def Add_Competence(diction):
|
|||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
||||
# Verifier la validité du domaine de compétence
|
||||
print(" ## QRY is_domain_compet_valide = ", {'_id':ObjectId(diction['domaine_competence_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':'default'})
|
||||
if( "domaine_competence_id" in diction.keys() ):
|
||||
|
||||
if( "domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
|
||||
# Verifier la validité du domaine de compétence
|
||||
print(" ## QRY is_domain_compet_valide = ", {'_id': ObjectId(diction['domaine_competence_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': 'default'})
|
||||
|
||||
is_domain_compet_valide = MYSY_GV.dbname['domaine_competence'].count_documents({'_id':ObjectId(diction['domaine_competence_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
|
|
@ -330,6 +332,7 @@ def Get_Competence_no_filter(diction):
|
|||
|
||||
for New_retVal in MYSY_GV.dbname['competence_liste'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_retVal
|
||||
print(" ## useruser = ",user)
|
||||
|
||||
if( "code" not in user.keys() ):
|
||||
user["code"] = "--"
|
||||
|
|
@ -337,7 +340,8 @@ def Get_Competence_no_filter(diction):
|
|||
domaine_competence_nom = ""
|
||||
if ("domaine" not in user.keys() or user['domaine'] == ""):
|
||||
user["domaine"] = ""
|
||||
else:
|
||||
|
||||
elif ( isinstance(user['domaine'], bytes)) :
|
||||
domaine_compet_data = MYSY_GV.dbname['domaine_competence'].find_one({'_id':ObjectId(str(user['domaine'])),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
|
|
|||
|
|
@ -878,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 confirmation envoyé " + str(val))
|
||||
print(" Email annulation inscription envoyé à " + str(diction['email']))
|
||||
|
||||
else:
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
|
@ -908,12 +908,12 @@ def incription_training_cancelled_mail(diction):
|
|||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
||||
"""smtpserver.ehlo()
|
||||
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 (cancellation) envoyé " + str(val))
|
||||
smtpserver.close()
|
||||
print(" Email confirmation (cancellation) envoyé " + str(diction['email']))
|
||||
|
||||
"""
|
||||
Gestion des emails via mail_queu et internal email
|
||||
|
|
|
|||
186
email_mgt.py
186
email_mgt.py
|
|
@ -4186,6 +4186,7 @@ def Individual_Mail_Store_Queu_And_Internal_Mail(diction):
|
|||
internal_mail_diction[str(tmp)] = queue_mail_diction[str(tmp)]
|
||||
|
||||
tab_files = []
|
||||
|
||||
queue_mail_status, queue_mail_retval = email_queu_mgt.Add_Message_To_Mail_Queue(tab_files, queue_mail_diction)
|
||||
if (queue_mail_status is False):
|
||||
print(" ## WARNING queue_mail_retval = ", queue_mail_retval)
|
||||
|
|
@ -4244,3 +4245,188 @@ def Individual_Mail_Store_Queu_And_Internal_Mail(diction):
|
|||
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 d'envoyer les emails "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet d'envoyer une notification d'expédition de mail interne
|
||||
|
||||
c'est a dire, quand un utilisateur envoie un mail depuis Elyos, le système va notifer
|
||||
au destinataire de mail dans sa boite externe qu'il a un mail Elyos, il n'y a qu'a
|
||||
ce connecter pour lire le contenu, un peu comme le font les banques
|
||||
|
||||
"""
|
||||
def Internal_Email_Send_Notification_to_external_email(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
||||
field_list = ['token', 'list_email_dest',]
|
||||
incom_keys = diction.keys()
|
||||
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " - Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, "Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
field_list_obligatoire = ['token', 'list_email_dest', ]
|
||||
|
||||
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 la liste des arguments ")
|
||||
return False, " La valeur '" + val + "' n'est pas presente dans la liste des arguments"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité des emails de destinataire.
|
||||
Si et SEULEMENT SI "related_collection" != "no_contact"
|
||||
"""
|
||||
tab_related_collection_id = []
|
||||
tab_email_dest = ""
|
||||
if ("list_email_dest" in diction.keys()):
|
||||
if diction['list_email_dest']:
|
||||
tab_email_dest = diction['list_email_dest']
|
||||
|
||||
tab_email_dest = str(tab_email_dest).split(",")
|
||||
for email_dest in tab_email_dest:
|
||||
if( email_dest ):
|
||||
if (mycommon.isEmailValide(str(email_dest).strip()) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'adresse email '" + str(email_dest) + "' est invalide ")
|
||||
return False, "L'adresse email '" + str(email_dest) + "' est invalide"
|
||||
|
||||
|
||||
|
||||
#print(" ### la liste _id des destinataire est ", str(tab_related_collection_id))
|
||||
|
||||
if(len(tab_email_dest) > MYSY_GV.EMAIL_MAX_DESTINAIRE ):
|
||||
mycommon.myprint("Vous ne pouvez pas envoyer plus de "+str(MYSY_GV.EMAIL_MAX_DESTINAIRE)+" emails à la fois.")
|
||||
return False, "Vous ne pouvez pas envoyer plus de "+str(MYSY_GV.EMAIL_MAX_DESTINAIRE)+" emails à la fois."
|
||||
|
||||
# Creation du dictionnaire d'information à utiliser pour la creation du doc
|
||||
convention_dictionnary_data = {}
|
||||
new_diction = {}
|
||||
new_diction['token'] = my_partner['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
|
||||
|
||||
company_name = ""
|
||||
if ("company_data" in local_retval.keys() and "societe_nom" in local_retval['company_data'].keys()):
|
||||
company_name = local_retval['company_data']['societe_nom']
|
||||
|
||||
dictionnary_data = local_retval
|
||||
|
||||
"""
|
||||
Recuperer le modèle de document
|
||||
"""
|
||||
local_diction = {}
|
||||
local_diction['ref_interne'] = "NOTIF_EMAIL_ELYOS"
|
||||
local_diction['type_doc'] = "email"
|
||||
local_diction['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(local_diction)
|
||||
if (courrier_data_status is False):
|
||||
return courrier_data_status, courrier_data_retval
|
||||
|
||||
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 'NOTIF_EMAIL_ELYOS' n'est pas correctement configuré ")
|
||||
return False, " Le modèle de courrier 'NOTIF_EMAIL_ELYOS' n'est pas correctement configuré "
|
||||
|
||||
|
||||
|
||||
# Recuperation des donnes SMTP
|
||||
local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port = mycommon.Get_Partner_SMTP_Param(
|
||||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
|
||||
|
||||
smtpserver = None
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
else:
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Envoie proprement-dit des emails
|
||||
"""
|
||||
for local_email_dest in tab_email_dest:
|
||||
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
dictionnary_data['url_connexion'] = str(MYSY_GV.CLIENT_URL_BASE)+"signin/"
|
||||
|
||||
node = {}
|
||||
node['nom'] = ""
|
||||
node['prenom'] = ""
|
||||
body = {
|
||||
"params": dictionnary_data
|
||||
}
|
||||
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
|
||||
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
sujet_doc_Template = jinja2.Template(str(courrier_data_retval['sujet']))
|
||||
sujetHtml = sujet_doc_Template.render(params=body["params"])
|
||||
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
|
||||
sourceHtml = contenu_doc_Template.render(params=body['params'])
|
||||
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
msg.attach(html_mime)
|
||||
|
||||
# msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
if (company_name):
|
||||
msg['From'] = str(company_name) + " <" + str(MYSY_GV.O365_SMTP_COUNT_From_User) + ">"
|
||||
else:
|
||||
msg['From'] = str(MYSY_GV.O365_SMTP_COUNT_From_User)
|
||||
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
|
||||
msg['To'] = str(local_email_dest)
|
||||
|
||||
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 envoyé " + str(val))
|
||||
|
||||
return True, " Les emails ont été correctement 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))
|
||||
return False, " Impossible d'envoyer les emails "
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -126,6 +127,8 @@ def Add_Message_To_Mail_Queue(tab_files, diction):
|
|||
new_data['statut'] = "0"
|
||||
new_data['attached_files_path'] = tab_saved_file_full_path
|
||||
|
||||
new_data['sent'] = str(datetime.now())
|
||||
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
|
|
@ -135,8 +138,6 @@ def Add_Message_To_Mail_Queue(tab_files, diction):
|
|||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
#print(" ### mail to store in queue = ", new_data)
|
||||
|
||||
inserted_id = MYSY_GV.dbname['mail_queue'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
|
|
@ -527,6 +528,12 @@ def Resend_List_Mail_Queue(diction):
|
|||
smtpserver.close()
|
||||
#print(val)
|
||||
|
||||
"""
|
||||
Vu qu'il s'agit de faire un forcing d'envoie d'email, on va directement le delivrer
|
||||
vers l'extérieur sans notification
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -15,6 +15,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
|
||||
|
|
@ -216,6 +217,8 @@ def Add_Message_To_Internal_Mail(tab_files, diction):
|
|||
new_data['is_read'] = "0"
|
||||
new_data['attached_files_path'] = tab_saved_file_full_path
|
||||
|
||||
new_data['sent'] = str(datetime.now())
|
||||
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
|
|
@ -404,6 +407,19 @@ def Update_Message_To_Internal_Mail(tab_files, Folder, diction):
|
|||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
"""
|
||||
Si l'insertion de l'email fonctionne, alors on envoie une notification a la personnes
|
||||
vers sa boite email externe"""
|
||||
if( result and 'to' in result.keys() and result['to']):
|
||||
local_diction = {}
|
||||
local_diction['token'] = str(my_token)
|
||||
local_diction['list_email_dest'] = result['to']
|
||||
|
||||
notif_status, notif_retval = email_mgt.Internal_Email_Send_Notification_to_external_email(local_diction)
|
||||
if( notif_status is False):
|
||||
mycommon.myprint(" WARNING : Impossible d'envoyer l'email de notification -Internal_Email_Send_Notification_to_external_email- ")
|
||||
|
||||
|
||||
"""
|
||||
Une fois l'email mis dans la table interne, on va aller le mettre dans le queu d'envoie
|
||||
pour qu'un DOUBLE DU MAIL soit aussi envoyé directement
|
||||
|
|
@ -847,6 +863,7 @@ def Get_Given_Internal_Mail(diction):
|
|||
{'$set': updata_data})
|
||||
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
|
|
|||
34
main.py
34
main.py
|
|
@ -10104,7 +10104,7 @@ API pour enregistrer les resultat d'une enquete
|
|||
def Record_Survey_Data_No_Token():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Record_Survey_Data_No_Token payload (trop long cherif) = ")
|
||||
print(" ### Record_Survey_Data_No_Token payload (trop long cherif) = ", payload)
|
||||
status, retval = survey_mgt.Record_Survey_Data_No_Token(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
|
@ -10139,6 +10139,21 @@ def Init_Survey_Tab_For_All_Session_Inscrit():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API : Creation et initialisation d'un servey pour un client pour une session
|
||||
"""
|
||||
@app.route('/myclass/api/Init_Specific_Survey_Tab_For_All_Session_Client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Init_Specific_Survey_Tab_For_All_Session_Client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Init_Specific_Survey_Tab_For_All_Session_Client payload = ",payload)
|
||||
status, retval = survey_mgt.Init_Specific_Survey_Tab_For_All_Session_Client(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour initialiset (suppression et creation ) d'une enquete pour tous
|
||||
les inscrits d'un session.
|
||||
|
|
@ -10176,6 +10191,23 @@ def Add_Specific_Survey_Tab_For_All_Session_Inscrit():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter une évaluation spécifique pour un client
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Specific_Survey_Tab_For_All_Session_Client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Specific_Survey_Tab_For_All_Session_Client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Specific_Survey_Tab_For_All_Session_Client payload = ",payload)
|
||||
status, retval, survey_internal_code = survey_mgt.Add_Specific_Survey_Tab_For_All_Session_Client(payload)
|
||||
return jsonify(status=status, message=retval, survey_internal_code=survey_internal_code)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -692,6 +692,18 @@ def Get_Given_Partner_Invoice_Lines(diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if( "order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id':1, 'code_session':1})
|
||||
if( local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -870,6 +882,19 @@ def Get_Given_Partner_Invoice_Lines(diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -1040,6 +1065,19 @@ def Get_Given_Partner_Invoice_Lines_From_Invoice_ref_interne(diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -1213,6 +1251,19 @@ def Get_Given_Partner_Invoice_Lines_From_Invoice_ref_interne(diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -2005,6 +2056,18 @@ def Get_Given_Line_Of_Partner_Invoice_Lines(diction):
|
|||
user['invoice_date'] = retval['invoice_date']
|
||||
user['invoice_header_id'] = retval['invoice_header_id']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
|
|
@ -2152,6 +2215,19 @@ def Get_Given_Line_Of_Partner_Invoice_Lines(diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -2453,6 +2529,19 @@ def GerneratePDF_Partner_Invoice(diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -2648,6 +2737,19 @@ def GerneratePDF_Partner_Invoice(diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -2980,6 +3082,19 @@ def Send_Partner_Invoice_By_Email(tab_files, Folder, diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -2990,6 +3105,24 @@ def Send_Partner_Invoice_By_Email(tab_files, Folder, diction):
|
|||
else:
|
||||
user['order_line_type_article'] = ""
|
||||
|
||||
"""
|
||||
Si on a une session, on va aller chercher les info de la session
|
||||
"""
|
||||
session_date_debut = ""
|
||||
session_date_fin = ""
|
||||
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(retval['partner_owner_recid'])},
|
||||
)
|
||||
if (session_data and "date_debut" in session_data.keys() and "date_fin" in session_data.keys()):
|
||||
session_date_debut = str(session_data['date_debut'])
|
||||
session_date_fin = str(session_data['date_fin'])
|
||||
|
||||
user['session_date_debut'] = str(session_date_debut)
|
||||
user['session_date_fin'] = str(session_date_fin)
|
||||
|
||||
|
||||
if ("order_line_type_apprenant" in retval.keys()):
|
||||
user['order_line_type_apprenant'] = retval['order_line_type_apprenant']
|
||||
|
|
@ -3156,6 +3289,19 @@ def Send_Partner_Invoice_By_Email(tab_files, Folder, diction):
|
|||
user['valide'] = retval['valide']
|
||||
user['locked'] = retval['locked']
|
||||
|
||||
order_line_session_code = ""
|
||||
order_line_session_id = ""
|
||||
if ("order_line_session_id" in retval.keys() and retval['order_line_session_id']):
|
||||
order_line_session_id = retval['order_line_session_id']
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_line_session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1, 'code_session': 1})
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
order_line_session_code = local_session_data['code_session']
|
||||
|
||||
user['order_line_session_code'] = order_line_session_code
|
||||
user['order_line_session_id'] = order_line_session_id
|
||||
|
||||
if ("order_line_montant_reduction" in retval.keys()):
|
||||
user['order_line_montant_reduction'] = retval['order_line_montant_reduction']
|
||||
else:
|
||||
|
|
@ -4296,6 +4442,36 @@ def Create_Invoice_Avoir_Total(diction):
|
|||
upsert=False,
|
||||
)
|
||||
|
||||
#icici : on met à jour la staturation de la session (si elle est partiel ou non facturer)
|
||||
nb_line_inscritpion_invoiced = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'session_id': str(ret_val2['session_id']), 'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'invoiced':'1'
|
||||
|
||||
})
|
||||
|
||||
if( nb_line_inscritpion_invoiced > 0 ):
|
||||
# On au moins un ligne qui est facturé, alors on mets la session à :"facturation" partielle
|
||||
session_update = MYSY_GV.dbname['session_formation'].find_one_and_update(
|
||||
{'_id': ObjectId(str(ret_val2['session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])
|
||||
},
|
||||
{"$set": {'invoiced_statut':'1'}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
else:
|
||||
# Aucune ligne d'inscription n'est facturée, alors on mets la session à :"facturation" NOOO
|
||||
session_update = MYSY_GV.dbname['session_formation'].find_one_and_update(
|
||||
{'_id': ObjectId(str(ret_val2['session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])
|
||||
},
|
||||
{"$set": {'invoiced_statut': '0'}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
|
||||
"""
|
||||
Creation des log historique pour :
|
||||
- la facture et
|
||||
|
|
|
|||
|
|
@ -6035,7 +6035,7 @@ def Is_Partnair_Inscription_Notification(diction):
|
|||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de verifier si le partenaire dispose de la signature digitale "
|
||||
return False, " Impossible de verifier la configuration 'inscription_notification_email' du partenaire "
|
||||
|
||||
|
||||
|
||||
|
|
@ -6112,7 +6112,84 @@ def Is_Partnair_Prenscription_Notification(diction):
|
|||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de verifier si le partenaire dispose de la signature digitale "
|
||||
return False, " Impossible de verifier la configuration 'preinscription_notification_email' du partenaire "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction verifie si le paramettre de notification automatique des inscriptions
|
||||
est actif pour ce partenaire
|
||||
"""
|
||||
def Is_Partnair_Annulation_Inscription_Notification(diction):
|
||||
try:
|
||||
diction = strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['config_name'] = "annulation_inscription_notification_email"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['valide'] = "1"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
retval_value = "0"
|
||||
|
||||
for retval in MYSY_GV.dbname['base_partner_setup'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
if( "config_value" in retval.keys()):
|
||||
retval_value = retval['config_value']
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
return True, str(retval_value)
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de verifier la configuration 'annulation_inscription_notification_email' du partenaire "
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des differents niveaux de compétence
|
||||
|
|
@ -8103,4 +8180,6 @@ def regex_replace_cartere( chaine ):
|
|||
|
||||
return new_chaine
|
||||
except ValueError:
|
||||
return chaine
|
||||
return chaine
|
||||
|
||||
|
||||
|
|
|
|||
648
survey_mgt.py
648
survey_mgt.py
|
|
@ -545,16 +545,25 @@ def Record_Survey_Data_No_Token(diction):
|
|||
local_diction['session_id'] = str(survey_data['session_id'])
|
||||
local_diction['survey_type'] = str(survey_data['_id'])
|
||||
local_diction['formulaire_id'] = str(survey_data['formulaire_id'])
|
||||
local_diction['inscription_id'] = str(survey_data['inscription_id'])
|
||||
if( "inscription_id" in survey_data.keys() and survey_data['survey_data']):
|
||||
local_diction['inscription_id'] = str(survey_data['inscription_id'])
|
||||
|
||||
if ("client_id" in survey_data.keys() and survey_data['client_id']):
|
||||
local_diction['client_id'] = str(survey_data['client_id'])
|
||||
|
||||
if ("employee_id" in survey_data.keys() and survey_data['employee_id']):
|
||||
local_diction['employee_id'] = str(survey_data['employee_id'])
|
||||
|
||||
local_diction['partner_owner_recid'] = str(survey_data['partner_owner_recid'])
|
||||
local_diction['survey_type'] = str(survey_data['survey_type'])
|
||||
|
||||
print(" ### local_diction = ", local_diction)
|
||||
retval_status, retval = Survey_Send_Notification_Sur_Seuil_Alert(local_diction)
|
||||
if( "inscription_id" in local_diction.keys() and local_diction['local_diction']):
|
||||
print(" ### local_diction = ", local_diction)
|
||||
retval_status, retval = Survey_Send_Notification_Sur_Seuil_Alert(local_diction)
|
||||
|
||||
if( retval_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNINGG : Survey_Send_Notification_Sur_Seuil_Alert "+str(retval))
|
||||
if( retval_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNINGG : Survey_Send_Notification_Sur_Seuil_Alert "+str(retval))
|
||||
|
||||
|
||||
return True, " Le formulaire a été correctement mis à jour"
|
||||
|
|
@ -1110,9 +1119,7 @@ def Init_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
1 - suppression des data existate et
|
||||
2 - la creation de l'enquete
|
||||
"""
|
||||
print(" ## DEL QUERY = ", {"$and":[{'partner_owner_recid':str(my_partner['recid']),
|
||||
'session_id':str(diction['session_id']),
|
||||
'survey_type':str(diction['survey_type'])}, filt_inscrit_for_survey_collection]})
|
||||
|
||||
|
||||
MYSY_GV.dbname['survey'].delete_many({"$and":[{'partner_owner_recid':str(my_partner['recid']),
|
||||
'session_id':str(diction['session_id']),
|
||||
|
|
@ -1169,6 +1176,162 @@ def Init_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
return False, " Impossible de créer le formulaire "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de créer l'evaluation d'une formation
|
||||
par un client / financeur
|
||||
"""
|
||||
def Init_Specific_Survey_Tab_For_All_Session_Client(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date', 'related_collection',
|
||||
'related_collection_id', 'tab_client_ids', 'survey_internal_code']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
|
||||
field_list_obligatoire = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date', 'tab_client_ids']
|
||||
|
||||
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 la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier que la session est valide
|
||||
"""
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_session <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
|
||||
tab_client_ids = []
|
||||
tab_client_ids_Object = []
|
||||
if ("tab_client_ids" in diction.keys() and diction['tab_client_ids']):
|
||||
tab_client_ids_work = str(diction['tab_client_ids']).split(",")
|
||||
|
||||
for tmp in tab_client_ids_work:
|
||||
if (tmp):
|
||||
local_Client_retval = MYSY_GV.dbname['partner_client'].find_one({'_id': ObjectId(str(tmp)),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if (local_Client_retval is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant du client est invalide ")
|
||||
return False, " L'identifiant du client est invalide "
|
||||
|
||||
tab_client_ids.append(tmp)
|
||||
tab_client_ids_Object.append(ObjectId(tmp))
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du formulaire
|
||||
"""
|
||||
is_valide_form = MYSY_GV.dbname['formulaire'].count_documents({'_id':ObjectId(str(diction['formulaire_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_form <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du formulaire est invalide ")
|
||||
return False, " L'identifiant du formulaire est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
||||
1 - suppression des data existante pour la session et le client et
|
||||
2 - la creation de l'enquete
|
||||
"""
|
||||
print(" ### QRY DELETE = ", {'survey_internal_code': diction['survey_internal_code'],
|
||||
'session_id':diction['session_id'],
|
||||
'partner_owner_recid': str(my_partner['recid'])
|
||||
})
|
||||
|
||||
delete = MYSY_GV.dbname['survey'].delete_many({'survey_internal_code': diction['survey_internal_code'],
|
||||
'session_id':diction['session_id'],
|
||||
'partner_owner_recid': str(my_partner['recid'])
|
||||
})
|
||||
|
||||
print(" ### deleted = ",delete.deleted_count, " --- ", delete.raw_result )
|
||||
|
||||
|
||||
for my_client_id in tab_client_ids:
|
||||
# Recuperation des données du client
|
||||
|
||||
local_Client_retval = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(my_client_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if(local_Client_retval is None ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant du client est invalide ")
|
||||
return False, " L'identifiant du client est invalide "
|
||||
|
||||
|
||||
server_diction = {}
|
||||
server_diction['token'] = diction['token']
|
||||
server_diction['session_id'] = diction['session_id']
|
||||
server_diction['client_id'] = str(local_Client_retval['_id'])
|
||||
server_diction['formulaire_id'] = diction['formulaire_id']
|
||||
server_diction['survey_type'] = diction['survey_type']
|
||||
server_diction['sending_date'] = diction['sending_date']
|
||||
server_diction['survey_internal_code'] = diction['survey_internal_code']
|
||||
|
||||
if( "related_collection" in diction.keys() and diction['related_collection']
|
||||
and "related_collection_id" in diction.keys() and diction['related_collection_id'] ):
|
||||
server_diction['related_collection'] = diction['related_collection']
|
||||
server_diction['related_collection_id'] = diction['related_collection_id']
|
||||
else:
|
||||
server_diction['related_collection'] = "partner_client"
|
||||
server_diction['related_collection_id'] = str(local_Client_retval['_id'])
|
||||
|
||||
|
||||
|
||||
local_status, local_retval = Create_One_Survey_To_Inscrit(server_diction)
|
||||
if( local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
|
||||
return True, " La demande d'enquete a été créée "
|
||||
|
||||
|
||||
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 créer le formulaire "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction initialiser un Survey de type spécifique.
|
||||
|
|
@ -1266,9 +1429,20 @@ def Init_Specific_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide':'1',}, filt_inscrit_for_inscription_collection]}
|
||||
else:
|
||||
query_incrit = {'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', }
|
||||
|
||||
"""
|
||||
10/12/2025 - s'il s'agit d'un questionnaire de positionnement
|
||||
on a prendre en consideration les preinscriptions,
|
||||
si non, on prend en compte qu'exclusivement les inscriptions validées
|
||||
"""
|
||||
if( "survey_type" in diction.keys() and diction['survey_type'] == "pos"):
|
||||
query_incrit = {'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'status':{'$in':['0', '1']}}
|
||||
else:
|
||||
query_incrit = {'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'status': '1'}
|
||||
|
||||
|
||||
for my_inscription_id in MYSY_GV.dbname['inscription'].find(query_incrit):
|
||||
|
|
@ -1448,9 +1622,14 @@ def Add_Specific_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide':'1',}, filt_inscrit_for_inscription_collection]}
|
||||
else:
|
||||
query_incrit = {'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', }
|
||||
if ("survey_type" in diction.keys() and diction['survey_type'] == "pos"):
|
||||
query_incrit = {'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'status': {'$in': ['0', '1']}}
|
||||
else:
|
||||
query_incrit = {'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'status': '1'}
|
||||
|
||||
|
||||
for my_inscription_id in MYSY_GV.dbname['inscription'].find(query_incrit):
|
||||
|
|
@ -1539,6 +1718,159 @@ def Add_Specific_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Ajout d'une évaluation spécifique mais pour un client
|
||||
"""
|
||||
def Add_Specific_Survey_Tab_For_All_Session_Client(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date', 'related_collection',
|
||||
'related_collection_id', 'tab_client_ids', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
|
||||
field_list_obligatoire = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date']
|
||||
|
||||
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 la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner, False
|
||||
|
||||
local_safe_survey_internal_code = mycommon.create_user_recid()
|
||||
|
||||
"""
|
||||
Verifier que la session est valide
|
||||
"""
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_session <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide ", False
|
||||
|
||||
tab_client_ids = []
|
||||
tab_client_ids_Object = []
|
||||
if ("tab_client_ids" in diction.keys() and diction['tab_client_ids']):
|
||||
tab_client_ids_work = str(diction['tab_client_ids']).split(",")
|
||||
|
||||
for tmp in tab_client_ids_work:
|
||||
if (tmp):
|
||||
local_Client_retval = MYSY_GV.dbname['partner_client'].find_one({
|
||||
'_id': ObjectId(str(tmp)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if (local_Client_retval is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant du client est invalide ")
|
||||
return False, " L'identifiant du client est invalide ", False
|
||||
|
||||
tab_client_ids.append(tmp)
|
||||
tab_client_ids_Object.append(ObjectId(tmp))
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du formulaire
|
||||
"""
|
||||
is_valide_form = MYSY_GV.dbname['formulaire'].count_documents({'_id':ObjectId(str(diction['formulaire_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_form <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du formulaire est invalide ")
|
||||
return False, " L'identifiant du formulaire est invalide ", False
|
||||
|
||||
|
||||
|
||||
"""
|
||||
1 - suppression des data existe et
|
||||
2 - la creation de l'enquete
|
||||
"""
|
||||
|
||||
"""
|
||||
MYSY_GV.dbname['survey'].delete_many({"$and":[{'partner_owner_recid':str(my_partner['recid']),
|
||||
'session_id':str(diction['session_id']),
|
||||
'survey_type':str(diction['survey_type'])}, filt_inscrit_for_survey_collection]})
|
||||
|
||||
|
||||
"""
|
||||
|
||||
for my_client_id in tab_client_ids:
|
||||
# Recuperation des données du client
|
||||
|
||||
local_Client_retval = MYSY_GV.dbname['partner_client'].find_one({
|
||||
'_id':ObjectId(str(my_client_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if(local_Client_retval is None ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant du client est invalide ")
|
||||
return False, " L'identifiant du client est invalide ", False
|
||||
|
||||
server_diction = {}
|
||||
server_diction['token'] = diction['token']
|
||||
server_diction['session_id'] = diction['session_id']
|
||||
server_diction['client_id'] = str(local_Client_retval['_id'])
|
||||
server_diction['formulaire_id'] = diction['formulaire_id']
|
||||
server_diction['survey_type'] = diction['survey_type']
|
||||
server_diction['sending_date'] = diction['sending_date']
|
||||
|
||||
if( "related_collection" in diction.keys() and diction['related_collection']
|
||||
and "related_collection_id" in diction.keys() and diction['related_collection_id'] ):
|
||||
server_diction['related_collection'] = diction['related_collection']
|
||||
server_diction['related_collection_id'] = diction['related_collection_id']
|
||||
else:
|
||||
server_diction['related_collection'] = "partner_client"
|
||||
server_diction['related_collection_id'] = str(local_Client_retval['_id'])
|
||||
|
||||
|
||||
server_diction['survey_internal_code'] = local_safe_survey_internal_code
|
||||
#server_diction['survey_type'] = 'specific_survey'
|
||||
|
||||
local_status, local_retval = Create_One_Survey_To_Inscrit(server_diction)
|
||||
if( local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
|
||||
return True, " La demande d'enquete a été créée ", local_safe_survey_internal_code
|
||||
|
||||
|
||||
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 créer le formulaire ", False
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recupere la liste des evaluations spécifique d'un sessions
|
||||
Juste les internal_code
|
||||
|
|
@ -1592,7 +1924,14 @@ def Get_List_Specific_Survey_Internal_Code(diction):
|
|||
val_tmp = 0
|
||||
|
||||
tab_survey_internal_code = []
|
||||
qry = {"partner_owner_recid": str(my_partner['recid']), 'valide': '1', 'locked': '0'}
|
||||
qry = {'session_id': str(diction['session_id']),
|
||||
'valide': '1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'survey_type':'specific_survey',
|
||||
}
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['survey'].distinct("survey_internal_code",
|
||||
{'session_id': str(diction['session_id']),
|
||||
'valide': '1',
|
||||
|
|
@ -1605,12 +1944,13 @@ def Get_List_Specific_Survey_Internal_Code(diction):
|
|||
tab_survey_internal_code.append(New_retVal)
|
||||
|
||||
tab_survey_all_data = []
|
||||
|
||||
print(" tab_survey_internal_code = ", tab_survey_internal_code)
|
||||
# Recuperation des data par survey_internal_code
|
||||
for survey_internal_code in tab_survey_internal_code:
|
||||
if( survey_internal_code ):
|
||||
qry = {"partner_owner_recid": str(my_partner['recid']), 'valide': '1', 'locked': '0', 'survey_internal_code':str(survey_internal_code)}
|
||||
|
||||
|
||||
pipe_qry = ([
|
||||
{'$match': qry},
|
||||
{'$project': {'valide': 0, 'locked': 0, }},
|
||||
|
|
@ -1648,7 +1988,6 @@ def Get_List_Specific_Survey_Internal_Code(diction):
|
|||
}
|
||||
])
|
||||
|
||||
# print(" ### pipe_qry = ", pipe_qry)
|
||||
|
||||
local_node = {}
|
||||
local_node['survey_internal_code'] = survey_internal_code
|
||||
|
|
@ -1757,7 +2096,6 @@ def Get_List_Specific_Survey_Internal_Code(diction):
|
|||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(local_node))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -1961,7 +2299,7 @@ def Create_One_Survey_To_Inscrit(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['session_id', 'token', 'inscrit_id', 'formulaire_id', 'survey_type', 'sending_date', 'related_collection',
|
||||
'related_collection_id', 'class_id', 'survey_internal_code']
|
||||
'related_collection_id', 'class_id', 'survey_internal_code', 'client_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -1971,7 +2309,7 @@ def Create_One_Survey_To_Inscrit(diction):
|
|||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
|
||||
field_list_obligatoire = ['session_id', 'token', 'inscrit_id', 'formulaire_id', 'survey_type', 'sending_date']
|
||||
field_list_obligatoire = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
|
@ -2037,72 +2375,133 @@ def Create_One_Survey_To_Inscrit(diction):
|
|||
return False, " L'identifiant de la formation est invalide "
|
||||
|
||||
"""
|
||||
Recuperer les données de l'inscrit
|
||||
Recuperer les données de l'inscrit ou du client
|
||||
"""
|
||||
my_inscrit_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
if( "inscrit_id" in diction.keys() and diction['inscrit_id']):
|
||||
my_inscrit_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (my_inscrit_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'inscrit est invalide ")
|
||||
return False, " L'identifiant de l'inscrit est invalide "
|
||||
if (my_inscrit_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'inscrit est invalide ")
|
||||
return False, " L'identifiant de l'inscrit est invalide "
|
||||
|
||||
related_collection = ""
|
||||
related_collection_id = ""
|
||||
if( "related_collection" in diction.keys() and "related_collection_id" in diction.keys()):
|
||||
related_collection = diction['related_collection']
|
||||
related_collection_id = diction['related_collection_id']
|
||||
related_collection = ""
|
||||
related_collection_id = ""
|
||||
if( "related_collection" in diction.keys() and "related_collection_id" in diction.keys()):
|
||||
related_collection = diction['related_collection']
|
||||
related_collection_id = diction['related_collection_id']
|
||||
|
||||
|
||||
new_survey_data = {}
|
||||
new_survey_data['email'] = my_inscrit_data['email']
|
||||
new_survey_data['nom'] = my_inscrit_data['nom']
|
||||
new_survey_data['prenom'] = my_inscrit_data['prenom']
|
||||
new_survey_data['inscription_id'] = str(my_inscrit_data['_id'])
|
||||
new_survey_data['formulaire_id'] = str(diction['formulaire_id'])
|
||||
new_survey_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
new_survey_data['session_id'] = str(diction['session_id'])
|
||||
new_survey_data['class_id'] = str(my_class_data['_id'])
|
||||
new_survey_data['survey_type'] = str(diction['survey_type'])
|
||||
new_survey_data = {}
|
||||
new_survey_data['email'] = my_inscrit_data['email']
|
||||
new_survey_data['nom'] = my_inscrit_data['nom']
|
||||
new_survey_data['prenom'] = my_inscrit_data['prenom']
|
||||
new_survey_data['inscription_id'] = str(my_inscrit_data['_id'])
|
||||
new_survey_data['formulaire_id'] = str(diction['formulaire_id'])
|
||||
new_survey_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
new_survey_data['session_id'] = str(diction['session_id'])
|
||||
new_survey_data['class_id'] = str(my_class_data['_id'])
|
||||
new_survey_data['survey_type'] = str(diction['survey_type'])
|
||||
|
||||
if( "survey_internal_code" in diction.keys()):
|
||||
new_survey_data['survey_internal_code'] = str(diction['survey_internal_code'])
|
||||
else:
|
||||
new_survey_data['survey_internal_code'] = ""
|
||||
if( "survey_internal_code" in diction.keys()):
|
||||
new_survey_data['survey_internal_code'] = str(diction['survey_internal_code'])
|
||||
else:
|
||||
new_survey_data['survey_internal_code'] = ""
|
||||
|
||||
|
||||
new_survey_data['related_collection'] = str(related_collection)
|
||||
new_survey_data['related_collection_id'] = str(related_collection_id)
|
||||
new_survey_data['related_collection'] = str(related_collection)
|
||||
new_survey_data['related_collection_id'] = str(related_collection_id)
|
||||
|
||||
new_survey_data['date_envoi'] = ""
|
||||
new_survey_data['automatique_sending_request_date'] = str(diction['sending_date'])
|
||||
new_survey_data['automatique_traitement'] = "1"
|
||||
new_survey_data['automatique_traitement_done'] = "0"
|
||||
new_survey_data['date_envoi'] = ""
|
||||
new_survey_data['automatique_sending_request_date'] = str(diction['sending_date'])
|
||||
new_survey_data['automatique_traitement'] = "1"
|
||||
new_survey_data['automatique_traitement_done'] = "0"
|
||||
|
||||
new_survey_data['locked'] = "0"
|
||||
new_survey_data['valide'] = "1"
|
||||
new_survey_data['locked'] = "0"
|
||||
new_survey_data['valide'] = "1"
|
||||
|
||||
new_survey_data['mode_envoi'] = ""
|
||||
new_survey_data['mode_envoi'] = ""
|
||||
|
||||
new_survey_data['statut'] = "0"
|
||||
new_survey_data['type'] = "1"
|
||||
new_survey_data['creation_date'] = str(datetime.now())
|
||||
new_survey_data['update_by'] = str(my_partner['_id'])
|
||||
new_survey_data['creation_by'] = str(my_partner['_id'])
|
||||
new_survey_data['statut'] = "0"
|
||||
new_survey_data['type'] = "1"
|
||||
new_survey_data['creation_date'] = str(datetime.now())
|
||||
new_survey_data['update_by'] = str(my_partner['_id'])
|
||||
new_survey_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
new_survey_data['date_dernier_relance_auto'] = str(datetime.now().strftime("%d/%m/%Y"))
|
||||
new_survey_data['date_dernier_relance_auto'] = str(datetime.now().strftime("%d/%m/%Y"))
|
||||
|
||||
|
||||
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
|
||||
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
|
||||
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer l'enquete (2) ")
|
||||
return False, " Impossible de créer l'enquete (2) "
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer l'enquete (2) ")
|
||||
return False, " Impossible de créer l'enquete (2) "
|
||||
|
||||
elif ("client_id" in diction.keys() and diction['client_id']):
|
||||
my_client_data = MYSY_GV.dbname['partner_client'].find_one({'_id': ObjectId(str(diction['client_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (my_client_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du client est invalide ")
|
||||
return False, " L'identifiant du client est invalide "
|
||||
|
||||
related_collection = ""
|
||||
related_collection_id = ""
|
||||
if ("related_collection" in diction.keys() and "related_collection_id" in diction.keys()):
|
||||
related_collection = diction['related_collection']
|
||||
related_collection_id = diction['related_collection_id']
|
||||
|
||||
new_survey_data = {}
|
||||
new_survey_data['email'] = my_client_data['email']
|
||||
new_survey_data['nom'] = my_client_data['nom']
|
||||
new_survey_data['prenom'] = my_client_data['raison_sociale']
|
||||
new_survey_data['client_id'] = str(my_client_data['_id'])
|
||||
new_survey_data['formulaire_id'] = str(diction['formulaire_id'])
|
||||
new_survey_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
new_survey_data['session_id'] = str(diction['session_id'])
|
||||
new_survey_data['class_id'] = str(my_class_data['_id'])
|
||||
new_survey_data['survey_type'] = str(diction['survey_type'])
|
||||
|
||||
if ("survey_internal_code" in diction.keys()):
|
||||
new_survey_data['survey_internal_code'] = str(diction['survey_internal_code'])
|
||||
else:
|
||||
new_survey_data['survey_internal_code'] = ""
|
||||
|
||||
new_survey_data['related_collection'] = str(related_collection)
|
||||
new_survey_data['related_collection_id'] = str(related_collection_id)
|
||||
|
||||
new_survey_data['date_envoi'] = ""
|
||||
new_survey_data['automatique_sending_request_date'] = str(diction['sending_date'])
|
||||
new_survey_data['automatique_traitement'] = "1"
|
||||
new_survey_data['automatique_traitement_done'] = "0"
|
||||
|
||||
new_survey_data['locked'] = "0"
|
||||
new_survey_data['valide'] = "1"
|
||||
|
||||
new_survey_data['mode_envoi'] = ""
|
||||
|
||||
new_survey_data['statut'] = "0"
|
||||
new_survey_data['type'] = "1"
|
||||
new_survey_data['creation_date'] = str(datetime.now())
|
||||
new_survey_data['update_by'] = str(my_partner['_id'])
|
||||
new_survey_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
new_survey_data['date_dernier_relance_auto'] = str(datetime.now().strftime("%d/%m/%Y"))
|
||||
|
||||
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
|
||||
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer l'enquete (2) ")
|
||||
return False, " Impossible de créer l'enquete (2) "
|
||||
|
||||
return True, " L'enquete a été créée"
|
||||
|
||||
|
|
@ -2430,7 +2829,15 @@ def Send_Survey_TabIds(diction):
|
|||
courrier_ref_interne = "EVAL_AUTRE"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "specific_survey"):
|
||||
courrier_ref_interne = "SPECIFIC_SURVEY"
|
||||
if ("client_id" in local_survey_retval.keys() and local_survey_retval['client_id']):
|
||||
courrier_ref_interne = "SPECIFIC_SURVEY_CLIENT"
|
||||
|
||||
elif ("employe_id" in local_survey_retval.keys() and local_survey_retval['employe_id']):
|
||||
courrier_ref_interne = "SPECIFIC_SURVEY_EMPLOYEE"
|
||||
|
||||
else:
|
||||
courrier_ref_interne = "SPECIFIC_SURVEY"
|
||||
|
||||
|
||||
else :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le type d'enquete est invalide ")
|
||||
|
|
@ -2498,6 +2905,11 @@ def Send_Survey_TabIds(diction):
|
|||
new_diction['list_stagiaire_id'].append(ObjectId(str( local_survey_retval['inscription_id'])))
|
||||
|
||||
|
||||
new_diction['list_client_id'] = []
|
||||
if ("client_id" in local_survey_retval.keys() and local_survey_retval['client_id']):
|
||||
new_diction['list_client_id'].append(ObjectId(str(local_survey_retval['client_id'])))
|
||||
|
||||
|
||||
new_diction['list_session_id'] = []
|
||||
if ("session_id" in local_survey_retval.keys() and local_survey_retval['session_id']):
|
||||
new_diction['list_session_id'].append(ObjectId(str(local_survey_retval['session_id'])))
|
||||
|
|
@ -2507,7 +2919,6 @@ def Send_Survey_TabIds(diction):
|
|||
new_diction['list_class_id'].append(ObjectId(str(local_survey_retval['class_id'])))
|
||||
|
||||
|
||||
new_diction['list_client_id'] = []
|
||||
new_diction['list_apprenant_id'] = []
|
||||
|
||||
|
||||
|
|
@ -2554,12 +2965,12 @@ def Send_Survey_TabIds(diction):
|
|||
convention_dictionnary_data["related_rh_data_nom"] = ""
|
||||
|
||||
|
||||
|
||||
body = {
|
||||
"params": convention_dictionnary_data
|
||||
}
|
||||
|
||||
|
||||
|
||||
html = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
subject_doc_Template = jinja2.Template(str(courrier_template_data['sujet']))
|
||||
|
|
@ -3338,7 +3749,7 @@ def Get_List_Survey_with_filter(diction):
|
|||
}
|
||||
])
|
||||
|
||||
print(" ### pipe_qry = ", pipe_qry)
|
||||
#print(" ### pipe_qry ttt= ", pipe_qry)
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['survey'].aggregate(pipe_qry):
|
||||
user = New_retVal
|
||||
|
|
@ -5464,27 +5875,10 @@ def Get_Survey_Url_From_SessionId_Email_No_Token(diction):
|
|||
session
|
||||
"""
|
||||
|
||||
is_inscription_valide = MYSY_GV.dbname['inscription'].count_documents({"session_id": diction['session_id'],
|
||||
'email':diction['email'],
|
||||
'valide':'1',
|
||||
'status':{'$in':['0', '1']}})
|
||||
|
||||
if( is_inscription_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'inscription est invalide ")
|
||||
return False, " L'inscription est invalide"
|
||||
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find_one({"session_id": diction['session_id'],
|
||||
'email': diction['email'],
|
||||
'valide': '1',
|
||||
'status':{'$in':['0', '1']}})
|
||||
|
||||
|
||||
|
||||
|
||||
is_session_valide = MYSY_GV.dbname['session_formation'].count_documents({'partner_owner_recid':str(inscription_data['partner_owner_recid']),
|
||||
'_id':ObjectId(str(diction['session_id'])),
|
||||
is_session_valide = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
|
||||
'valide':'1'})
|
||||
|
||||
if (is_session_valide != 1):
|
||||
|
|
@ -5493,25 +5887,71 @@ def Get_Survey_Url_From_SessionId_Email_No_Token(diction):
|
|||
3]) + " La session de formation est invalide ")
|
||||
return False, " La session de formation est invalide "
|
||||
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(diction['session_id'])),
|
||||
'valide': '1'})
|
||||
|
||||
"""
|
||||
Aller recuperer le survey
|
||||
survey_url = MYSY_GV.CLIENT_URL_BASE + "Survey/" + str(local_survey_retval['_id'])
|
||||
"""
|
||||
|
||||
|
||||
survey_url = ""
|
||||
survey_data = MYSY_GV.dbname['survey'].find_one({'email':str(diction['email']),
|
||||
'session_id':str(diction['session_id']),
|
||||
'inscription_id':str(inscription_data['_id']),
|
||||
'partner_owner_recid':str(inscription_data['partner_owner_recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'qr_code_safe_token': str(diction['qr_code_safe_token']),
|
||||
'statut':'1',})
|
||||
if(diction['survey_type'] == "client_eval"):
|
||||
|
||||
if( survey_data ):
|
||||
survey_url = MYSY_GV.CLIENT_URL_BASE + "Survey/qrcode/" + str(survey_data['_id'])
|
||||
print(" ### CLIENT QRY = ", {'email': str(diction['email']),
|
||||
'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(
|
||||
session_data['partner_owner_recid']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'qr_code_safe_token': str(diction['qr_code_safe_token']),
|
||||
'statut': '1', })
|
||||
|
||||
survey_data = MYSY_GV.dbname['survey'].find_one({'email': str(diction['email']),
|
||||
'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(
|
||||
session_data['partner_owner_recid']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'qr_code_safe_token': str(diction['qr_code_safe_token']),
|
||||
'statut': '1', })
|
||||
|
||||
if (survey_data):
|
||||
survey_url = MYSY_GV.CLIENT_URL_BASE + "Survey/qrcode/" + str(survey_data['_id'])
|
||||
|
||||
else:
|
||||
print(" ## QRYYY OODOD = ", {"session_id": diction['session_id'],
|
||||
'email': diction['email'],
|
||||
'valide': '1',
|
||||
|
||||
'status': {'$in': ['0', '1']}})
|
||||
is_inscription_valide = MYSY_GV.dbname['inscription'].count_documents({"session_id": diction['session_id'],
|
||||
'email': diction['email'],
|
||||
'valide': '1',
|
||||
'status': {'$in': ['0', '1']}})
|
||||
|
||||
if (is_inscription_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'inscription est invalide ")
|
||||
return False, " L'inscription est invalide"
|
||||
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find_one({"session_id": diction['session_id'],
|
||||
'email': diction['email'],
|
||||
'valide': '1',
|
||||
'status': {'$in': ['0', '1']}})
|
||||
|
||||
survey_data = MYSY_GV.dbname['survey'].find_one({'email':str(diction['email']),
|
||||
'session_id':str(diction['session_id']),
|
||||
'inscription_id':str(inscription_data['_id']),
|
||||
'partner_owner_recid':str(inscription_data['partner_owner_recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'qr_code_safe_token': str(diction['qr_code_safe_token']),
|
||||
'statut':'1',})
|
||||
|
||||
if( survey_data ):
|
||||
survey_url = MYSY_GV.CLIENT_URL_BASE + "Survey/qrcode/" + str(survey_data['_id'])
|
||||
|
||||
|
||||
print(" ## survey_url = ", survey_url)
|
||||
|
|
|
|||
Loading…
Reference in New Issue