master
cherif 2024-01-30 21:15:09 +01:00
parent 3f7c82584b
commit 84e8d24220
10 changed files with 3790 additions and 103 deletions

View File

@ -1,14 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="rrrf">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="29/01/24 - 21h30">
<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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.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$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -78,13 +81,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00156" summary="23/11/23 - 13:30">
<created>1700742130513</created>
<option name="number" value="00156" />
<option name="presentableId" value="LOCAL-00156" />
<option name="project" value="LOCAL" />
<updated>1700742130514</updated>
</task>
<task id="LOCAL-00157" summary="23/11/2023 - 21h30">
<created>1700772203290</created>
<option name="number" value="00157" />
@ -421,7 +417,14 @@
<option name="project" value="LOCAL" />
<updated>1706369454943</updated>
</task>
<option name="localTasksCounter" value="205" />
<task id="LOCAL-00205" summary="29/01/24 - 21h30">
<created>1706560519176</created>
<option name="number" value="00205" />
<option name="presentableId" value="LOCAL-00205" />
<option name="project" value="LOCAL" />
<updated>1706560519176</updated>
</task>
<option name="localTasksCounter" value="206" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -436,7 +439,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="20/12/2023 - 18h" />
<MESSAGE value="27/12/2023 - 13h" />
<MESSAGE value="27/12/2023 - 23h" />
<MESSAGE value="28/12/2023- 19h" />
@ -461,6 +463,7 @@
<MESSAGE value="24/01/2024 -12h00" />
<MESSAGE value="rrr" />
<MESSAGE value="rrrf" />
<option name="LAST_COMMIT_MESSAGE" value="rrrf" />
<MESSAGE value="29/01/24 - 21h30" />
<option name="LAST_COMMIT_MESSAGE" value="29/01/24 - 21h30" />
</component>
</project>

View File

@ -16,6 +16,7 @@ import re
from datetime import datetime, date
import apprenant_mgt
import module_editique
import prj_common as mycommon
import secrets
import inspect
@ -107,6 +108,11 @@ def AddStagiairetoClass(diction):
mydata = {}
# Initialisation des champs non envoyés à vide
for val in field_list:
if val not in diction.keys():
mydata[str(val)] = ""
session_id = ""
if ("session_id" in diction.keys()):
if diction['session_id']:
@ -175,7 +181,6 @@ def AddStagiairetoClass(diction):
return False, " Le type d'apprenant est invalide "
new_price = "-1" # 0 ==> par defaut
session_partner_owner_recid = ""
for tmp_val in MYSY_GV.dbname['session_formation'].find({"_id":ObjectId(str(session_id)), 'valide':'1' }):
@ -186,7 +191,8 @@ def AddStagiairetoClass(diction):
if ("prix_session" in tmp_val.keys()):
if tmp_val['prix_session']:
new_price = tmp_val['prix_session']
mydata['price'] = tmp_val['prix_session']
mydata['price'] = str(new_price)
if( "partner_owner_recid" in tmp_val.keys() ):
session_partner_owner_recid = tmp_val['partner_owner_recid']
@ -196,6 +202,7 @@ def AddStagiairetoClass(diction):
if ("class_internal_url" in tmp_val.keys()):
mydata['class_internal_url'] = str(tmp_val['class_internal_url']).strip()
civilite = ""
if ("civilite" in diction.keys()):
if diction['civilite']:
@ -298,10 +305,7 @@ def AddStagiairetoClass(diction):
else:
mydata['opco'] = ""
# Initialisation des champs non envoyés à vide
for val in field_list:
if val not in diction.keys():
mydata[str(val)] = ""
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y, %H:%M:%S")
mydata['update_by'] = str(connected_user_id)
@ -322,14 +326,17 @@ def AddStagiairetoClass(diction):
mydata['type_apprenant'] = str(type_apprenant)
# Si un prix est fourni dans le diction, j'ecrase le prise qui est venu de la session
if ("price" in diction.keys()):
if diction['price']:
new_price = str(diction['price']).strip()
mydata['price'] = str(diction['price']).strip()
print(" aGRRRRRRRRRRRRRRRRRRR ")
# Verification des prix. si new_price = "-1" cela veut dire qu'il n'a pas de prix dans le diction ni sur la session
# Alors on va chercher le prix (prix public sans reduction) sur la formation
if( new_price == "-1"):
print(" aucun prix trouvé sur la session ")
local_class = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(diction['class_internal_url']).strip(),
'valide':'1', 'locked':'0'})
@ -649,9 +656,6 @@ def UpdateStagiairetoClass(diction):
#query_key['session_id'] = str(diction['session_id']).strip()
""""
/!\ : update du 18/08/2023 : On va autoriser le changement le session de formation.
en effet il peut arriver qu'on souhaite deplacer la formation d'une personne à une autre session.
@ -4843,7 +4847,7 @@ def RefuseAttendeeInscription_with_motif(diction):
"""
Fontion de validation / acceptation d'un inscription
Fontion de validation / acceptation d'une inscription
"""
def AcceptAttendeeInscription(diction):
try:
@ -5323,10 +5327,21 @@ def AcceptAttendeeInscription(diction):
upsert=False,
)
"""
update du 30/01/2024 :
Apres la mise à jour de l'inscription avec l'apprenant_id,
loger 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(my_partner, "CONF_INSCRIPTION",
str(ret_val2['session_id']), 'inscription', str(diction['inscription_id']))
if (is_warning_message == 1):
return True, return_message
return True, "L'inscription a été correctement validée"
except Exception as e:
@ -5824,7 +5839,7 @@ def getRecodedStagiaireImage_from_front(diction=None):
qery_images = {'locked': '0', 'valide': '1', 'related_collection': 'inscription',
'related_collection_recid': str(local_retval['_id'])}
print(" ### qery_images = ", qery_images)
#print(" ### qery_images = ", qery_images)
RetObject = []
partner_images = {}
@ -6906,7 +6921,7 @@ def Get_List_Convocations_Stagiaire_With_Filter(diction):
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
print(" ### Get_List_Convocations_Stagiaire_With_Filter RetObject = ", RetObject)
#print(" ### Get_List_Convocations_Stagiaire_With_Filter RetObject = ", RetObject)
return True, RetObject
except Exception as e:
@ -7225,8 +7240,6 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
tab_participant = []
tab_participant.append(inscription_data['_id'])
@ -7236,6 +7249,15 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
tab_session = []
tab_session.append(session_data['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
tab_apprenant = []
if ("apprenant_id" in inscription_data.keys() and inscription_data['apprenant_id']):
tab_apprenant.append(ObjectId(str(inscription_data['apprenant_id'])))
# Recuperation du titre de la formation
@ -7253,6 +7275,7 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -7505,6 +7528,16 @@ def Sent_Convention_Individuelle_Stagiaire_By_Email(tab_files, Folder, diction):
tab_participant = []
tab_participant.append(inscription_data['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
tab_apprenant = []
if ("apprenant_id" in inscription_data.keys() and inscription_data['apprenant_id']):
tab_apprenant.append(ObjectId(str(inscription_data['apprenant_id'])))
# Traitement de l'eventuel fichier joint
tab_files_to_attache_to_mail = []
@ -7746,6 +7779,7 @@ def Sent_Convention_Individuelle_Stagiaire_By_Email(tab_files, Folder, diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -8230,6 +8264,7 @@ def Download_Convention_Stagiaire_PDF(diction):
# Recupérer la liste des participant pour une eventuelle à afficher pour les conventions d'entreprise
tab_participant = []
tab_apprenant = []
list_participants_session = MYSY_GV.dbname['inscription'].find({'session_id':str(session_data['_id']), 'status':'1',
'partner_owner_recid':str(my_partner['recid'])},
{'email':1, 'nom':1, 'prenom':1, '_id':1}).sort([("nom", pymongo.DESCENDING)])
@ -8237,6 +8272,16 @@ def Download_Convention_Stagiaire_PDF(diction):
for val in list_participants_session:
tab_participant.append(val['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
if ("apprenant_id" in val.keys() and val['apprenant_id']):
tab_apprenant.append(ObjectId(str(val['apprenant_id'])))
# Recuperation du titre de la formation
class_data = MYSY_GV.dbname['myclass'].find_one(
@ -8254,6 +8299,7 @@ def Download_Convention_Stagiaire_PDF(diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -8451,6 +8497,16 @@ def Download_Convention_Individuelle_Stagiaire_PDF(diction):
tab_participant = []
tab_participant.append(inscription_data['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
tab_apprenant = []
if ("apprenant_id" in inscription_data.keys() and inscription_data['apprenant_id']):
tab_apprenant.append(ObjectId(str(inscription_data['apprenant_id'])))
# Recuperation des données du partenaire associé à l'utilisateur connecté
local_status, local_retval = mycommon.Get_Connected_User_Partner_Data_From_RecID(my_partner['recid'])
if (local_status is False):
@ -8484,6 +8540,7 @@ def Download_Convention_Individuelle_Stagiaire_PDF(diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -8643,6 +8700,7 @@ def Download_Convention_Stagiaire_PDF_By_Partner_client(diction):
tab_session = [session_data['_id']]
print(" tab_session = ", tab_session)
tab_apprenant = []
tab_participant = []
# Recupérer la liste des participant pour une eventuelle à afficher pour les conventions d'entreprise
for participant in MYSY_GV.dbname['inscription'].find({'session_id':str(session_data['_id']), 'status':'1',
@ -8650,6 +8708,16 @@ def Download_Convention_Stagiaire_PDF_By_Partner_client(diction):
{'_id':1}):
tab_participant.append(participant['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
if ("apprenant_id" in participant.keys() and participant['apprenant_id']):
tab_apprenant.append(ObjectId(str(participant['apprenant_id'])))
print(" tab_participant = ", tab_participant)
@ -8671,6 +8739,7 @@ def Download_Convention_Stagiaire_PDF_By_Partner_client(diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = tab_client
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -8922,11 +8991,22 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'client_rattachement_id':str(diction['partner_client_id'])})
tab_apprenant = []
tab_participant = []
for val in inscription_data:
tab_participant.append(val['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
if ("apprenant_id" in val.keys() and val['apprenant_id']):
tab_apprenant.append(ObjectId(str(val['apprenant_id'])))
print(" ### tab_participant = ", tab_participant)
# Recuperations des info de la session de formation

File diff suppressed because one or more lines are too long

View File

@ -4295,7 +4295,8 @@ 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']))
str(diction['session_id']), "inscription", str(single_inscrit_no_client['_id']))
"""
courrier_template_type_document_ref_interne = ""
@ -4819,49 +4820,6 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
if os.path.exists(zip_file_name):
# print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
"""
25/01/2024 : pour loger une action dans la collection ==> courrier_template_tracking_history
"""
"""
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)
"""
"""
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']))
return True, send_file(zip_file_name, as_attachment=True)
@ -5299,7 +5257,7 @@ def Create_Convention_By_Client_PDF(diction):
ts = datetime.now().timestamp()
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)
# open output file for writing (truncated binary)
@ -5376,6 +5334,16 @@ def Create_Convention_By_Stagiaire_PDF(diction):
tab_stagiaire = []
tab_stagiaire.append(statgiaire_data['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
tab_apprenant = []
if ("apprenant_id" in statgiaire_data.keys() and statgiaire_data['apprenant_id']):
tab_apprenant.append(ObjectId(str(statgiaire_data['apprenant_id'])))
# Verifier que la session est valide
session_data = MYSY_GV.dbname['session_formation'].find_one(
@ -5408,6 +5376,7 @@ def Create_Convention_By_Stagiaire_PDF(diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -5431,7 +5400,7 @@ def Create_Convention_By_Stagiaire_PDF(diction):
ts = datetime.now().timestamp()
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)
# open output file for writing (truncated binary)
@ -5445,7 +5414,12 @@ def Create_Convention_By_Stagiaire_PDF(diction):
# close output file
resultFile.close()
"""
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, template_courrier_data, str(diction['session_id']),
'inscription', statgiaire_data['_id'])
return True, outputFilename
except Exception as e:
@ -5563,14 +5537,6 @@ def Prepare_and_Send_Convocation_From_Session_By_PDF(diction):
if os.path.exists(zip_file_name):
# print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
"""
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']))
return True, send_file(zip_file_name, as_attachment=True)
@ -5639,6 +5605,16 @@ def Create_Convocation_By_Stagiaire_PDF(diction):
tab_stagiaire = []
tab_stagiaire.append(statgiaire_data['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
tab_apprenant = []
if ("apprenant_id" in statgiaire_data.keys() and statgiaire_data['apprenant_id']):
tab_apprenant.append(ObjectId(str(statgiaire_data['apprenant_id'])))
# Verifier que la session est valide
session_data = MYSY_GV.dbname['session_formation'].find_one(
@ -5671,6 +5647,7 @@ def Create_Convocation_By_Stagiaire_PDF(diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -5694,7 +5671,7 @@ def Create_Convocation_By_Stagiaire_PDF(diction):
ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convocation_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf"
orig_file_name = "Convocation_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary)
@ -5708,6 +5685,13 @@ def Create_Convocation_By_Stagiaire_PDF(diction):
# close output file
resultFile.close()
"""
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, template_courrier_data,
str(diction['session_id']), 'inscription', statgiaire_data['_id'])
return True, outputFilename
@ -5823,13 +5807,11 @@ def Prepare_and_Send_Convocation_From_Session_By_Email(tab_files, Folder, dictio
# Traitement de l'eventuel fichier joint
tab_files_to_attache_to_mail = []
"""
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']))
str(diction['session_id']), "inscription", str(single_inscrit['_id']))
return True, " Les convocations ont été correctement envoyées par emails"
@ -6042,6 +6024,18 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
tab_participant = []
tab_participant.append(inscription_data['_id'])
"""
update du 30/01/2024
si le participant à un apprenant_id, alors on recupere la valeur de l'apprenant id. On doit travailler sur cette dernier.
En general, avant d'envoyer une convocation ou convention, l'inscription est validée et donc le dossier apprenant existe.
Du coup si tout se passe bien, dans cette fonction, on travaillera tjrs avec l'apprenant_id
"""
tab_apprenant = []
if( "apprenant_id" in inscription_data.keys() and inscription_data['apprenant_id']) :
tab_apprenant.append(ObjectId(str(inscription_data['apprenant_id'])))
# Recuperations des info de la session de formation
session_data = MYSY_GV.dbname['session_formation'].find_one(
{'_id': ObjectId(str(inscription_data['session_id'])), 'valide': '1',
@ -6066,6 +6060,7 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -6092,7 +6087,7 @@ def Sent_Convocation_Stagiaire_By_Email(tab_files, Folder, diction):
ts = datetime.now().timestamp()
ts = str(ts).replace(".", "").replace(",", "")[-5:]
orig_file_name = "Convocation_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf"
orig_file_name = "Convocation_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
# open output file for writing (truncated binary)

View File

@ -16,6 +16,7 @@ import sys, os
from bson import ObjectId
from xhtml2pdf import pisa
import module_editique
import prj_common as mycommon
import GlobalVariable as MYSY_GV
from dateutil import tz
@ -1813,6 +1814,11 @@ def SendEmargementMail( diction):
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é du token
retval = mycommon.check_partner_token_validity("", my_token)
if retval is False:
@ -1908,6 +1914,15 @@ def SendEmargementMail( diction):
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
val = smtpserver.send_message(msg)
#smtpserver.close()
"""
25/01/2024 : Apres l'envoi de la demande
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(
my_partner, "EMARGEMENT_FORMATION",
str(val_emarge['session_id']))
print(" Email matinée envoyé " + str(my_emarge_id))
"""

View File

@ -680,7 +680,7 @@ def Init_And_Update_courrier_template_tracking(diction):
Cette fonction log un historique d'envoie email ou de telechargement
d'un document
"""
def Editic_Log_History_Action(my_partner, courrier_template_data, related_collection_recid):
def Editic_Log_History_Action(my_partner, courrier_template_data, related_collection_recid, target_collection = None, target_collection_recid = None):
try:
courrier_template_type_document_ref_interne = ""
@ -700,7 +700,7 @@ def Editic_Log_History_Action(my_partner, courrier_template_data, related_collec
courrier_template_tracking_id = str(courrier_template_tracking_data['_id'])
print(" ### courrier_template_data = ", courrier_template_data)
#print(" ### courrier_template_data = ", courrier_template_data)
history_data_to_log = {}
history_data_to_log ['partner_owner_recid'] = str(my_partner['recid'])
@ -723,5 +723,55 @@ def Editic_Log_History_Action(my_partner, courrier_template_data, related_collec
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible d'enregistrer de l'évènement éditique"
"""
Cette fonction log un historique tout evenement lié à un element
de la collection courrier_template_tracking (CONF_INSCRIPTION, EMARGEMENT_FORMATION, etc)
"""
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):
try:
courrier_template_tracking_data = {}
if( courrier_template_type_document_ref_interne ):
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' ")
return True, " WARNING impossible de récuperer le 'courrier_template_tracking' "
else:
mycommon.myprint(
" WARNING impossible de recuperer le 'courrier_template_tracking'(2) ")
return True, " WARNING impossible de récuperer le 'courrier_template_tracking' (2)"
courrier_template_tracking_id = str(courrier_template_tracking_data['_id'])
courrier_template_id = str(courrier_template_tracking_data['courrier_template_id'])
#print(" ### courrier_template_data = ", courrier_template_data)
history_data_to_log = {}
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['courrier_template_tracking_id'] = courrier_template_tracking_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['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, " L'évènement Editique a été correctement enregistré "
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'enregistrer de l'évènement éditique"

View File

@ -1155,7 +1155,7 @@ def getRecodedParnterImage_from_front(diction=None):
qery_images = {'locked': '0', 'valide': '1', 'related_collection': 'partnair_account',
'related_collection_recid': str(my_partner['recid'])}
print(" ### qery_images = ", qery_images)
#print(" ### qery_images = ", qery_images)
RetObject = []
partner_images = {}

View File

@ -4315,6 +4315,7 @@ def Get_Dictionnary_data_For_Template(diction):
try:
diction = strip_dictionary(diction)
"""
Verification des input acceptés
"""
@ -4401,11 +4402,8 @@ def Get_Dictionnary_data_For_Template(diction):
company_data.update(new_field_logo)
company_data.update(new_field_cachet)
else:
print(" ### local_part_imgs = ", local_part_imgs)
print(" ### local_part_imgs[0] = ", local_part_imgs[0])
local_JSON = ast.literal_eval(local_part_imgs[0])
print(" ### local_JSON = ", local_JSON)
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']}
@ -4495,12 +4493,20 @@ def Get_Dictionnary_data_For_Template(diction):
Recuperartion des champs des apprenants
"""
list_apprenant_data = []
print(" ### diction['list_apprenant_id'] = ", diction['list_apprenant_id'])
if( "list_apprenant_id" in diction.keys()):
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',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'opco', 'tuteur1_adresse', 'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'client_rattachement_id', 'photo_profil']
qry_apprenant = {'_id': {'$in': tab_apprenant_id, },
'valide': '1',
'locked':'0',
'partner_owner_recid': str(my_partner['recid'])
}
#print(" #### qry_apprenant = ", qry_apprenant)
for apprenant_data in MYSY_GV.dbname['apprenant'].find({'_id': {'$in': tab_apprenant_id, },
'valide': '1',
@ -4514,7 +4520,7 @@ def Get_Dictionnary_data_For_Template(diction):
'valide':'1',
'locked':'0'}
print(" ### qry_img = ", qry_img)
#print(" ### qry_img = ", qry_img)
apprenant_photo_data = MYSY_GV.dbname['mysy_images'].find_one({'related_collection':'apprenant',
'related_collection_recid':str(apprenant_data['_id']),
'valide':'1',
@ -4525,11 +4531,9 @@ def Get_Dictionnary_data_For_Template(diction):
apprenant_data['photo_profil'] = apprenant_img
new_apprenant_data = {}
for champ in apprenant_liste_champ:
#print(" ## traitement du champ : ", champ)
if (champ in apprenant_data):
# Si on a faire au champ 'client_rattachement_id' avec une valeur, on va aller chercher le nom du clien
if( champ == "client_rattachement_id"):
@ -4559,8 +4563,9 @@ def Get_Dictionnary_data_For_Template(diction):
new_apprenant_data.update(new_field)
list_apprenant_data.append(new_apprenant_data)
print(" ### APPEND new_apprenant_data = ", new_apprenant_data)
dictionnary_data['list_apprenant_data'] = list_apprenant_data
@ -4577,7 +4582,7 @@ def Get_Dictionnary_data_For_Template(diction):
'modefinancement', 'tuteur1_adresse', 'tuteur1_cp', 'tuteur1_email', 'tuteur1_nom',
'tuteur1_pays', 'tuteur1_telephone', 'tuteur1_ville', 'tuteur1_prenom',
'tuteur2_adresse', 'tuteur2_cp', 'tuteur2_email', 'tuteur2_nom', 'tuteur2_pays',
'tuteur2_prenom',
'tuteur2_prenom','civilite',
'tuteur2_telephone', 'tuteur2_ville','adresse', 'code_postal', 'ville', 'pays']
@ -4710,7 +4715,7 @@ def Get_Dictionnary_data_For_Template(diction):
json_formatted_str = json.dumps(dictionnary_data, indent=2)
#print(" ### AFFICHAGE dU data dictionnary ")
print(" ### AFFICHAGE dU data dictionnary ")
#print(json_formatted_str)

View File

@ -2100,7 +2100,7 @@ def getRecoded_Employee_Image_from_front(diction=None):
qery_images = {'locked': '0', 'valide': '1', 'related_collection': 'ressource_humaine',
'related_collection_recid': str(diction['rh_id'])}
print(" ### qery_images = ", qery_images)
#print(" ### qery_images = ", qery_images)
RetObject = []
employee_images = {}

View File

@ -952,7 +952,7 @@ def getRecoded_Materielle_Image_from_front(diction=None):
qery_images = {'locked': '0', 'valide': '1', 'related_collection': 'ressource_materielle',
'related_collection_recid': str(diction['rm_id'])}
print(" ### qery_images = ", qery_images)
#print(" ### qery_images = ", qery_images)
RetObject = []
employee_images = {}