02/02/2024 - 17h

master
cherif 2024-02-02 17:06:56 +01:00
parent 2bcf801cf4
commit 78036bee47
9 changed files with 4458 additions and 77 deletions

View File

@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="31/01/2024 - 16h"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="31/01/2024 - 20h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/module_editique.py" beforeDir="false" afterPath="$PROJECT_DIR$/module_editique.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -77,13 +80,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1680804787304</updated> <updated>1680804787304</updated>
</task> </task>
<task id="LOCAL-00159" summary="30/11/2023 - 21h">
<created>1701375202172</created>
<option name="number" value="00159" />
<option name="presentableId" value="LOCAL-00159" />
<option name="project" value="LOCAL" />
<updated>1701375202174</updated>
</task>
<task id="LOCAL-00160" summary="01/12/2023 - 23h"> <task id="LOCAL-00160" summary="01/12/2023 - 23h">
<created>1701470779882</created> <created>1701470779882</created>
<option name="number" value="00160" /> <option name="number" value="00160" />
@ -420,7 +416,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1706713340254</updated> <updated>1706713340254</updated>
</task> </task>
<option name="localTasksCounter" value="208" /> <task id="LOCAL-00208" summary="31/01/2024 - 20h">
<created>1706727057687</created>
<option name="number" value="00208" />
<option name="presentableId" value="LOCAL-00208" />
<option name="project" value="LOCAL" />
<updated>1706727057688</updated>
</task>
<option name="localTasksCounter" value="209" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -435,7 +438,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="28/12/2023- 19h" />
<MESSAGE value="29/12/2023- 12h" /> <MESSAGE value="29/12/2023- 12h" />
<MESSAGE value="31/12/2023- 18h" /> <MESSAGE value="31/12/2023- 18h" />
<MESSAGE value="01/01/2024- 18h" /> <MESSAGE value="01/01/2024- 18h" />
@ -460,6 +462,7 @@
<MESSAGE value="29/01/24 - 21h30" /> <MESSAGE value="29/01/24 - 21h30" />
<MESSAGE value="ss" /> <MESSAGE value="ss" />
<MESSAGE value="31/01/2024 - 16h" /> <MESSAGE value="31/01/2024 - 16h" />
<option name="LAST_COMMIT_MESSAGE" value="31/01/2024 - 16h" /> <MESSAGE value="31/01/2024 - 20h" />
<option name="LAST_COMMIT_MESSAGE" value="31/01/2024 - 20h" />
</component> </component>
</project> </project>

View File

@ -5335,7 +5335,7 @@ def AcceptAttendeeInscription(diction):
""" """
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(my_partner, "CONF_INSCRIPTION", local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(my_partner, "CONF_INSCRIPTION",
str(ret_val2['session_id']), 'inscription', str(diction['inscription_id'])) str(ret_val2['session_id']), 'inscription', str(diction['inscription_id']), "")
@ -7303,7 +7303,7 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
ts = datetime.now().timestamp() ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:] ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convention_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf" orig_file_name = "Convention_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name) outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary) # open output file for writing (truncated binary)
@ -7444,6 +7444,15 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
smtpserver.close() smtpserver.close()
print(" Email envoyé " + str(val)) print(" Email envoyé " + str(val))
"""
25/01/2024 : pour loger une action dans la collection ==> courrier_template_tracking_history
"""
local_status, local_retval = module_editique.Editic_Log_History_Action(my_partner, courrier_template_data,
str(diction['session_id']),
"inscription",
str(diction['inscription_id']))
""" """
# Ajout de l'evenement dans l'historique # Ajout de l'evenement dans l'historique
""" """
@ -7806,7 +7815,7 @@ def Sent_Convention_Individuelle_Stagiaire_By_Email(tab_files, Folder, diction):
ts = datetime.now().timestamp() ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:] ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convention_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf" orig_file_name = "Convention_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name) outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary) # open output file for writing (truncated binary)
@ -8329,7 +8338,7 @@ def Download_Convention_Stagiaire_PDF(diction):
ts = datetime.now().timestamp() ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:] ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convention_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf" orig_file_name = "Convention_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name) outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary) # open output file for writing (truncated binary)
@ -8570,7 +8579,7 @@ def Download_Convention_Individuelle_Stagiaire_PDF(diction):
ts = datetime.now().timestamp() ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:] ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convention_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf" orig_file_name = "Convention_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name) outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary) # open output file for writing (truncated binary)
@ -8774,7 +8783,7 @@ def Download_Convention_Stagiaire_PDF_By_Partner_client(diction):
ts = datetime.now().timestamp() ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:] ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convention_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf" orig_file_name = "Convention_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name) outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary) # open output file for writing (truncated binary)
@ -8815,7 +8824,6 @@ donc on n'envoie pas l'email à l'adresss de prod ou contact du client
def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path, Folder, diction): def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path, Folder, diction):
try: try:
print(" #### Sent_Convention_Stagiaire_By_Email_By_Partner_client diction = ", diction)
field_list_obligatoire = ['token', 'courrier_template_id', 'email_test', 'email_production', 'partner_client_id', 'session_id'] field_list_obligatoire = ['token', 'courrier_template_id', 'email_test', 'email_production', 'partner_client_id', 'session_id']
for val in field_list_obligatoire: for val in field_list_obligatoire:
@ -9075,7 +9083,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
ts = datetime.now().timestamp() ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:] ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convention_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf" orig_file_name = "Convention_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name) outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary) # open output file for writing (truncated binary)
@ -9224,6 +9232,25 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
smtpserver.close() smtpserver.close()
print(" Email envoyé " + str(val)) print(" Email envoyé " + str(val))
"""
25/01/2024 : pour loger une action dans la collection ==> courrier_template_tracking_history
"""
# Recuperation des données du stagiaire
inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'client_rattachement_id': str(
diction['partner_client_id'])})
for inscription in inscription_data:
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(
my_partner, "CONVENTION_STAGIAIRE_ENTREPRISE", str(diction['session_id']), 'inscription',
str(inscription['_id']), str(courrier_template_data['_id']))
#print(" local_status = ", local_status)
""" """
# Ajout de l'evenement dans l'historique # Ajout de l'evenement dans l'historique
""" """

File diff suppressed because one or more lines are too long

View File

@ -4239,8 +4239,8 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
new_diction_client['email_production'] = str(list_local_email_production) new_diction_client['email_production'] = str(list_local_email_production)
new_diction_client['session_id'] = diction['session_id'] new_diction_client['session_id'] = diction['session_id']
print(" ##### new_diction_client = ", new_diction_client) print(" ##### new_diction_client 0102 = ", new_diction_client)
print(" ##### tab_files = ", tab_files)
local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_saved_file_full_path, Folder, new_diction_client) local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_saved_file_full_path, Folder, new_diction_client)
if( local_status is False): if( local_status is False):
@ -4291,45 +4291,6 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
"""
25/01/2024 : pour loger une action dans la collection ==> courrier_template_tracking_history
"""
local_status, local_retval = module_editique.Editic_Log_History_Action(my_partner, courrier_template_data,
str(diction['session_id']), "inscription", str(single_inscrit_no_client['_id']))
"""
courrier_template_type_document_ref_interne = ""
if( "courrier_template_type_document_ref_interne" in courrier_template_data.keys() ):
courrier_template_type_document_ref_interne = courrier_template_data['courrier_template_type_document_ref_interne']
courrier_template_tracking_id = ""
courrier_template_tracking_data = MYSY_GV.dbname['courrier_template_tracking'].find_one({'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0',
'courrier_template_type_document_ref_interne':str(courrier_template_type_document_ref_interne)})
if(courrier_template_tracking_data is None ):
mycommon.myprint(
" WARNING impossible de recuperer le 'courrier_template_tracking' pour courrier_template_id : " +str(diction['courrier_template_id']) )
return True, " WARNING impossible de récuperer le 'courrier_template_tracking' pour courrier_template_id : " +str(diction['courrier_template_id'])
courrier_template_tracking_id = str(courrier_template_tracking_data['_id'])
history_data_to_log = {}
history_data_to_log ['partner_owner_recid'] = str(my_partner['recid'])
history_data_to_log['related_collection_recid'] = str(diction['session_id'])
history_data_to_log['courrier_template_tracking_id'] = courrier_template_tracking_id
history_data_to_log['date_update'] = str(datetime.now())
history_data_to_log['update_by'] = str(my_partner['_id'])
history_data_to_log['valide'] = "1"
history_data_to_log['locked'] = "0"
print( "#### history_data_to_log = ", history_data_to_log)
MYSY_GV.dbname['courrier_template_tracking_history'].insert_one(history_data_to_log)
"""
return True, " Les conventions ont été correctement envoyées par emails" return True, " Les conventions ont été correctement envoyées par emails"
except Exception as e: except Exception as e:
@ -4681,6 +4642,14 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
str(inspect.stack()[0][ str(inspect.stack()[0][
3]) + " La valeur '" + val + "' n'est pas presente dans liste ") 3]) + " La valeur '" + val + "' n'est pas presente dans liste ")
return False, " La valeur '" + val + "' n'est pas presente dans liste" return False, " La valeur '" + val + "' n'est pas presente dans liste"
elif str(diction[val]).strip() == "":
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le champ obligatoire '" + val + "' est vide ")
return False, " Le champ obligatoire '" + val + "' est vide "
my_token = "" my_token = ""
if ("token" in diction.keys()): if ("token" in diction.keys()):
@ -4707,6 +4676,8 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
list_file_name_to_zip = [] list_file_name_to_zip = []
# Verifier qu'il ya bien des inscriptions valides dans la session pour le client # Verifier qu'il ya bien des inscriptions valides dans la session pour le client
liste_client_rattachement_id = MYSY_GV.dbname['inscription'].distinct("client_rattachement_id", liste_client_rattachement_id = MYSY_GV.dbname['inscription'].distinct("client_rattachement_id",
{'session_id':str(diction['session_id']), {'session_id':str(diction['session_id']),
'status': '1', 'status': '1',
@ -5248,6 +5219,8 @@ def Create_Convention_By_Client_PDF(diction):
""" """
Creation du ficier PDF Creation du ficier PDF
""" """
contenu_doc_Template = jinja2.Template(str(template_courrier_data['contenu_doc'])) contenu_doc_Template = jinja2.Template(str(template_courrier_data['contenu_doc']))
@ -5271,6 +5244,19 @@ def Create_Convention_By_Client_PDF(diction):
# close output file # close output file
resultFile.close() resultFile.close()
"""
25/01/2024 : pour loger une action dans la collection ==> courrier_template_tracking_history
"""
# Recuperation des données du stagiaire
inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'client_rattachement_id': str(
diction['client_id'])})
for inscription in inscription_data:
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(my_partner, "CONVENTION_STAGIAIRE_ENTREPRISE", str(diction['session_id']), 'inscription', str(inscription['_id']),
str(template_courrier_data['_id']))
return True, outputFilename return True, outputFilename
@ -5575,6 +5561,13 @@ def Create_Convocation_By_Stagiaire_PDF(diction):
if (local_status is not True): if (local_status is not True):
return local_status, my_partner return local_status, my_partner
qry = {'_id':ObjectId(str(diction['courrier_template_id'])),
'valide':'1',
'locked':'0',
'ref_interne': 'CONVOCATION_STAGIAIRE',
'partner_owner_recid':str(my_partner['recid'])}
print(" ##### qry = ", qry)
# 1 - Verifier que le modele de courrier est bien editable par individu # 1 - Verifier que le modele de courrier est bien editable par individu
template_courrier_data = MYSY_GV.dbname['courrier_template'].find_one({'_id':ObjectId(str(diction['courrier_template_id'])), template_courrier_data = MYSY_GV.dbname['courrier_template'].find_one({'_id':ObjectId(str(diction['courrier_template_id'])),
@ -5583,12 +5576,19 @@ def Create_Convocation_By_Stagiaire_PDF(diction):
'ref_interne': 'CONVOCATION_STAGIAIRE', 'ref_interne': 'CONVOCATION_STAGIAIRE',
'partner_owner_recid':str(my_partner['recid'])}) 'partner_owner_recid':str(my_partner['recid'])})
if( template_courrier_data is None or ("edit_by_client" in template_courrier_data.keys() and str(template_courrier_data['edit_by_client']) == "1" ) ): if( template_courrier_data is None ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du modèle de courrier est invalide ")
return False, " L'identifiant du modèle de courrier est invalide "
if ("edit_by_client" in template_courrier_data.keys() and str(template_courrier_data['edit_by_client']) == "1"):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][ str(inspect.stack()[0][
3]) + " Le modèle de courrier n'est pas éditable par stagiaire. ") 3]) + " Le modèle de courrier n'est pas éditable par stagiaire. ")
return False, " Le modèle de courrier n'est pas éditable par stagiaire " return False, " Le modèle de courrier n'est pas éditable par stagiaire "
# Verifier que le statgiaire est valide # Verifier que le statgiaire est valide
local_qry = {'_id':ObjectId(str(diction['inscription_id'])), 'status':'1', local_qry = {'_id':ObjectId(str(diction['inscription_id'])), 'status':'1',
'partner_owner_recid':str(my_partner['recid'])} 'partner_owner_recid':str(my_partner['recid'])}

View File

@ -1921,7 +1921,7 @@ def SendEmargementMail( diction):
d'emargement, on log une action dans la collection ==> courrier_template_tracking_history d'emargement, on log une action dans la collection ==> courrier_template_tracking_history
""" """
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne( local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(
my_partner, "EMARGEMENT_FORMATION", str(val_emarge['session_id']), "emargement", str(val_emarge['_id']) ) my_partner, "EMARGEMENT_FORMATION", str(val_emarge['session_id']), "emargement", str(val_emarge['_id']), "" )
""" """

View File

@ -234,7 +234,8 @@ def Get_Editable_Document_By_Partner_By_Collection(diction):
}, },
{ {
'$unwind': '$collection_courrier_template' '$unwind': '$collection_courrier_template'
} },
{'$sort': {"collection_courrier_template.rang": 1}},
]) ])
#print(" #### Get_Editable_Document_By_Partner_By_Collection pipe_qry_Get_Editable_Document_By_Partner = ", pipe_qry) #print(" #### Get_Editable_Document_By_Partner_By_Collection pipe_qry_Get_Editable_Document_By_Partner = ", pipe_qry)
@ -324,8 +325,9 @@ def Get_Editable_Document_By_Partner_By_Collection(diction):
if( val and "courrier_template_id" in val.keys() and "related_collection_recid" in val.keys() ): if( val and "courrier_template_id" in val.keys() and "related_collection_recid" in val.keys() ):
local_courrier_template_id = val['courrier_template_id'] local_courrier_template_id = val['courrier_template_id']
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one({'_id':ObjectId(str(local_courrier_template_id))}, if( ObjectId.is_valid(local_courrier_template_id)):
{'contenu_doc':'0'}) courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one({'_id':ObjectId(str(local_courrier_template_id))},
{'contenu_doc':'0'})
related_collection_data = MYSY_GV.dbname[related_collection].find_one({'_id':ObjectId(str(diction['related_collection_recid']))}) related_collection_data = MYSY_GV.dbname[related_collection].find_one({'_id':ObjectId(str(diction['related_collection_recid']))})
#print(" #### SESSSION DATA = ", related_collection_data) #print(" #### SESSSION DATA = ", related_collection_data)
@ -711,8 +713,11 @@ def Init_And_Update_courrier_template_tracking(diction):
""" """
Cette fonction log un historique d'envoie email ou de telechargement Cette fonction log un historique d'envoie email ou de telechargement
d'un document d'un document
/!\ : Dans certains cas on n'utilise pas de modele de courrier, comme l'accetation d'un inscription ou ,
l'envoi des demande demande d'emargement (boff a reanalyser tout meme),
on laisse la valeur "courrier_template_id" a vide
""" """
def Editic_Log_History_Action(my_partner, courrier_template_data, related_collection_recid, target_collection = None, target_collection_recid = None): def Editic_Log_History_Action(my_partner, courrier_template_data, related_collection_recid, target_collection = None, target_collection_recid = None, courrier_template_id=""):
try: try:
courrier_template_type_document_ref_interne = "" courrier_template_type_document_ref_interne = ""
@ -738,7 +743,7 @@ def Editic_Log_History_Action(my_partner, courrier_template_data, related_collec
history_data_to_log ['partner_owner_recid'] = str(my_partner['recid']) history_data_to_log ['partner_owner_recid'] = str(my_partner['recid'])
history_data_to_log['related_collection_recid'] = related_collection_recid history_data_to_log['related_collection_recid'] = related_collection_recid
history_data_to_log['courrier_template_tracking_id'] = courrier_template_tracking_id history_data_to_log['courrier_template_tracking_id'] = courrier_template_tracking_id
history_data_to_log['courrier_template_id'] = str(courrier_template_data['_id']) history_data_to_log['courrier_template_id'] = str(courrier_template_id)
history_data_to_log['date_update'] = str(datetime.now()) history_data_to_log['date_update'] = str(datetime.now())
history_data_to_log['update_by'] = str(my_partner['_id']) history_data_to_log['update_by'] = str(my_partner['_id'])
history_data_to_log['valide'] = "1" history_data_to_log['valide'] = "1"
@ -770,13 +775,25 @@ def Editic_Log_History_Action(my_partner, courrier_template_data, related_collec
""" """
Cette fonction log un historique tout evenement lié à un element Cette fonction log un historique tout evenement lié à un element
de la collection courrier_template_tracking (CONF_INSCRIPTION, EMARGEMENT_FORMATION, etc) de la collection courrier_template_tracking (CONF_INSCRIPTION, EMARGEMENT_FORMATION, etc)
/!\ : Dans certains cas on n'utilise pas de modele de courrier, comme l'accetation d'un inscription ou ,
l'envoi des demande demande d'emargement (boff a reanalyser tout meme),
on laisse la valeur "courrier_template_id" a vide
""" """
def Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(my_partner, courrier_template_type_document_ref_interne, def Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(my_partner, courrier_template_type_document_ref_interne,
related_collection_recid, target_collection = None, target_collection_recid = None): related_collection_recid, target_collection = None, target_collection_recid = None, courrier_template_id=""):
try: try:
courrier_template_tracking_data = {} courrier_template_tracking_data = {}
if( courrier_template_type_document_ref_interne ): if( courrier_template_type_document_ref_interne ):
qry ={'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0',
'courrier_template_type_document_ref_interne':str(courrier_template_type_document_ref_interne)}
print(" #### qry = ,", qry)
courrier_template_tracking_data = MYSY_GV.dbname['courrier_template_tracking'].find_one({'partner_owner_recid':str(my_partner['recid']), courrier_template_tracking_data = MYSY_GV.dbname['courrier_template_tracking'].find_one({'partner_owner_recid':str(my_partner['recid']),
'valide':'1', 'valide':'1',
'locked':'0', 'locked':'0',
@ -791,8 +808,10 @@ def Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(m
" WARNING impossible de recuperer le 'courrier_template_tracking'(2) ") " WARNING impossible de recuperer le 'courrier_template_tracking'(2) ")
return True, " WARNING impossible de récuperer le 'courrier_template_tracking' (2)" return True, " WARNING impossible de récuperer le 'courrier_template_tracking' (2)"
print(" #### courrier_template_tracking_data = ", courrier_template_tracking_data)
courrier_template_tracking_id = str(courrier_template_tracking_data['_id']) courrier_template_tracking_id = str(courrier_template_tracking_data['_id'])
courrier_template_id = str(courrier_template_tracking_data['courrier_template_id']) courrier_template_id = str(courrier_template_id)
#print(" ### courrier_template_data = ", courrier_template_data) #print(" ### courrier_template_data = ", courrier_template_data)

View File

@ -39,7 +39,7 @@ def Add_Partner_Document(diction):
Verification des input acceptés Verification des input acceptés
""" """
field_list = ['token', "nom", "ref_interne", "type_doc", "cible", "sujet",'contenu_doc', 'duplicate', field_list = ['token', "nom", "ref_interne", "type_doc", "cible", "sujet",'contenu_doc', 'duplicate',
'joint_pdf', 'default_version', 'corps_mail', 'edit_by_client'] 'joint_pdf', 'default_version', 'corps_mail', 'edit_by_client', 'courrier_template_type_document_ref_interne']
incom_keys = diction.keys() incom_keys = diction.keys()
for val in incom_keys: for val in incom_keys:
@ -126,6 +126,18 @@ def Add_Partner_Document(diction):
return False, " - Le champ 'cible' fait plus de 255 caractères " return False, " - Le champ 'cible' fait plus de 255 caractères "
data['cible'] = cible data['cible'] = cible
courrier_template_type_document_ref_interne = ""
if ("courrier_template_type_document_ref_interne" in diction.keys()):
if diction['courrier_template_type_document_ref_interne']:
courrier_template_type_document_ref_interne = diction['courrier_template_type_document_ref_interne']
if (len(str(courrier_template_type_document_ref_interne)) > 255):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Le champ 'courrier_template_type_document_ref_interne' fait plus de 255 caractères ")
return False, " - Le champ 'courrier_template_type_document_ref_interne' fait plus de 255 caractères "
data['courrier_template_type_document_ref_interne'] = courrier_template_type_document_ref_interne
type_doc = "" type_doc = ""
if ("type_doc" in diction.keys()): if ("type_doc" in diction.keys()):

View File

@ -1159,21 +1159,30 @@ def getRecodedParnterImage_from_front(diction=None):
RetObject = [] RetObject = []
partner_images = {} partner_images = {}
cpt = 0
# Recuperation des image 'logo' et 'cachet' si le partenaire en a # Recuperation des image 'logo' et 'cachet' si le partenaire en a
for retVal in MYSY_GV.dbname['mysy_images'].find(qery_images): for retVal in MYSY_GV.dbname['mysy_images'].find(qery_images):
if ('type_img' in retVal.keys()): if ('type_img' in retVal.keys()):
if (retVal['type_img'] == "logo"): if (retVal['type_img'] == "logo"):
partner_images['logo_img'] = retVal['img'].decode() partner_images['logo_img'] = retVal['img'].decode()
partner_images['logo_img_recid'] = retVal['recid'] partner_images['logo_img_recid'] = retVal['recid']
cpt = cpt + 1
if (retVal['type_img'] == "cachet"): if (retVal['type_img'] == "cachet"):
partner_images['cachet_img'] = retVal['img'].decode() partner_images['cachet_img'] = retVal['img'].decode()
partner_images['cachet_img_recid'] = retVal['recid'] partner_images['cachet_img_recid'] = retVal['recid']
cpt = cpt + 1
RetObject.append(JSONEncoder().encode(partner_images)) if( cpt > 0):
RetObject.append(JSONEncoder().encode(partner_images))
#print(" ### getRecodedParnterImage_from_front RetObject = ", RetObject)
return True, RetObject
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " Aucune image (Logo ou Cachet trouvé) ")
return False, "Aucune image (Logo ou Cachet trouvé) "
#print(" ### getRecodedParnterImage_from_front RetObject = ", RetObject)
return True, RetObject
except Exception as e: except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info() exc_type, exc_obj, exc_tb = sys.exc_info()

View File

@ -4397,6 +4397,7 @@ def Get_Dictionnary_data_For_Template(diction):
local_JSON = ast.literal_eval(local_part_imgs[0]) local_JSON = ast.literal_eval(local_part_imgs[0])
new_field_logo = {'societe_logo': "data:image/png;base64,"+local_JSON['logo_img']} new_field_logo = {'societe_logo': "data:image/png;base64,"+local_JSON['logo_img']}
new_field_cachet = {'societe_cachet': "data:image/png;base64,"+local_JSON['cachet_img']} new_field_cachet = {'societe_cachet': "data:image/png;base64,"+local_JSON['cachet_img']}
company_data.update(new_field_logo) company_data.update(new_field_logo)
@ -4485,7 +4486,7 @@ def Get_Dictionnary_data_For_Template(diction):
Recuperartion des champs des apprenants Recuperartion des champs des apprenants
""" """
list_apprenant_data = [] list_apprenant_data = []
print(" ### diction['list_apprenant_id'] = ", diction['list_apprenant_id'])
if( "list_apprenant_id" in diction.keys()): if( "list_apprenant_id" in diction.keys()):
tab_apprenant_id = diction['list_apprenant_id'] tab_apprenant_id = diction['list_apprenant_id']
apprenant_liste_champ = ['prenom', 'nom', 'email', 'civilite', 'telephone', 'employeur', 'adresse', 'code_postal', 'ville', 'pays', 'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', apprenant_liste_champ = ['prenom', 'nom', 'email', 'civilite', 'telephone', 'employeur', 'adresse', 'code_postal', 'ville', 'pays', 'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone',
@ -4698,7 +4699,11 @@ def Get_Dictionnary_data_For_Template(diction):
""" """
sequence_session_liste_champ = [ 'sequence_title', 'sequence_start', 'sequence_end', 'agenda', 'objectif', 'commentaire' ] sequence_session_liste_champ = [ 'sequence_title', 'sequence_start', 'sequence_end', 'agenda', 'objectif', 'commentaire' ]
list_sequence_session_data = [] list_sequence_session_data = []
tab_sequence_session = diction['list_sequence_session_id'] tab_sequence_session = []
if( "list_sequence_session_id" in diction.keys() ):
tab_sequence_session = diction['list_sequence_session_id']
for sequence_session_data in MYSY_GV.dbname['session_formation_sequence'].find({'_id': {'$in': tab_sequence_session, }, for sequence_session_data in MYSY_GV.dbname['session_formation_sequence'].find({'_id': {'$in': tab_sequence_session, },
'valide': '1', 'valide': '1',