17/12/2023 - 21h12

master
cherif 2023-12-17 21:06:41 +01:00
parent 42c7e2b590
commit b22ed5af94
7 changed files with 6333 additions and 65 deletions

View File

@ -1,14 +1,14 @@
<?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="15/12/2023 - 18h"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="16/12/2023 - 23h12">
<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$/Dashbord_queries/session_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.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$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.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" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -78,13 +78,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1680804787304</updated> <updated>1680804787304</updated>
</task> </task>
<task id="LOCAL-00126" summary="07/10/2023 - 16h40">
<created>1696690295543</created>
<option name="number" value="00126" />
<option name="presentableId" value="LOCAL-00126" />
<option name="project" value="LOCAL" />
<updated>1696690295544</updated>
</task>
<task id="LOCAL-00127" summary="07/10/2023 - 22h40"> <task id="LOCAL-00127" summary="07/10/2023 - 22h40">
<created>1696711273624</created> <created>1696711273624</created>
<option name="number" value="00127" /> <option name="number" value="00127" />
@ -421,7 +414,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1702658652895</updated> <updated>1702658652895</updated>
</task> </task>
<option name="localTasksCounter" value="175" /> <task id="LOCAL-00175" summary="16/12/2023 - 23h12">
<created>1702764810012</created>
<option name="number" value="00175" />
<option name="presentableId" value="LOCAL-00175" />
<option name="project" value="LOCAL" />
<updated>1702764810013</updated>
</task>
<option name="localTasksCounter" value="176" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -436,7 +436,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="15/11/2023 - 17h" />
<MESSAGE value="15/11/2023 - 21h" /> <MESSAGE value="15/11/2023 - 21h" />
<MESSAGE value="17/11/2023 - 16h" /> <MESSAGE value="17/11/2023 - 16h" />
<MESSAGE value="18/11/2023 - 17h00" /> <MESSAGE value="18/11/2023 - 17h00" />
@ -461,6 +460,7 @@
<MESSAGE value="14/12/2023 - 21h" /> <MESSAGE value="14/12/2023 - 21h" />
<MESSAGE value="14/12/2023 - 22h" /> <MESSAGE value="14/12/2023 - 22h" />
<MESSAGE value="15/12/2023 - 18h" /> <MESSAGE value="15/12/2023 - 18h" />
<option name="LAST_COMMIT_MESSAGE" value="15/12/2023 - 18h" /> <MESSAGE value="16/12/2023 - 23h12" />
<option name="LAST_COMMIT_MESSAGE" value="16/12/2023 - 23h12" />
</component> </component>
</project> </project>

View File

@ -6159,6 +6159,7 @@ On va chercher les adresse de communication par defaut de l'apprenant
""" """
def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction): def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
try: try:
field_list_obligatoire = [ 'token', 'inscription_id', 'courrier_template_id', 'email_test', 'email_production' ] field_list_obligatoire = [ 'token', 'inscription_id', 'courrier_template_id', 'email_test', 'email_production' ]
for val in field_list_obligatoire: for val in field_list_obligatoire:
@ -6194,12 +6195,14 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
# Traitement de l'eventuel fichier joint # Traitement de l'eventuel fichier joint
tab_files_to_attache_to_mail = [] tab_files_to_attache_to_mail = []
for file in tab_files : for saved_file in tab_files :
"""
status, saved_file = mycommon.Upload_Save_PDF_IMG_File(file, Folder) status, saved_file = mycommon.Upload_Save_PDF_IMG_File(file, Folder)
if (status is False): if (status is False):
mycommon.myprint("Impossible de récupérer correctement le fichier à importer") mycommon.myprint("Impossible de récupérer correctement le fichier à importer")
return False, "Impossible de récupérer correctement le fichier à importer" return False, "Impossible de récupérer correctement le fichier à importer"
"""
@ -6232,6 +6235,7 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
if( "email_test" in diction.keys() and diction['email_test']): if( "email_test" in diction.keys() and diction['email_test']):
send_in_production = 0
tab_email_test = str(diction['email_test']).replace(";",",").split(",") tab_email_test = str(diction['email_test']).replace(";",",").split(",")
for email in tab_email_test: for email in tab_email_test:
email = email.strip() email = email.strip()
@ -7077,9 +7081,15 @@ def Download_Convention_Stagiaire_PDF_By_Partner_client(diction):
""" """
Envoie par email pour les stagiaires rattachés à un client Envoie par email pour les stagiaires rattachés à un client
important :
si le champ 'email_test' est rempli, alors il s'agit d'un email de test.
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:
@ -7196,6 +7206,9 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
3]) + " Aucune adresse email n'a été fourni. ") 3]) + " Aucune adresse email n'a été fourni. ")
return False, " Aucune adresse email n'a été fourni. " return False, " Aucune adresse email n'a été fourni. "
print(" ## laaa : tab_emails_destinataire lalala = ", tab_emails_destinataire)
# Verifier que le 'courrier_template_id' est valide # Verifier que le 'courrier_template_id' est valide
# Ici le template doit etre un email # Ici le template doit etre un email
is_courrier_template_id_valide = MYSY_GV.dbname['courrier_template'].count_documents( is_courrier_template_id_valide = MYSY_GV.dbname['courrier_template'].count_documents(
@ -7265,8 +7278,6 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
tab_session = [] tab_session = []
tab_session.append(session_data['_id']) tab_session.append(session_data['_id'])
print(" ### tab_session = ", tab_session)
# Recuperation du titre de la formation # Recuperation du titre de la formation
class_data = MYSY_GV.dbname['myclass'].find({'internal_url': str(session_data['class_internal_url']), class_data = MYSY_GV.dbname['myclass'].find({'internal_url': str(session_data['class_internal_url']),
@ -7305,6 +7316,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
convention_dictionnary_data = local_retval convention_dictionnary_data = local_retval
print(" ")
## Creation du PDF ## Creation du PDF
body = { body = {

File diff suppressed because one or more lines are too long

View File

@ -4038,7 +4038,7 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
new_diction_no_client['email_production'] = diction['email_production'] new_diction_no_client['email_production'] = diction['email_production']
print(" ##### new_diction_no_client = ", new_diction_no_client) print(" ##### new_diction_no_client = ", new_diction_no_client)
local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email(tab_files, Folder, new_diction_no_client) local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email(tab_saved_file_full_path, Folder, new_diction_no_client)
if (local_status is False): if (local_status is False):
mycommon.myprint(" WARNING impossible d'envoyer la convention a l'apprenant : " + str(single_inscrit_no_client['_id']) ) mycommon.myprint(" WARNING impossible d'envoyer la convention a l'apprenant : " + str(single_inscrit_no_client['_id']) )
@ -4061,7 +4061,11 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
""" """
Cette fonction envoie les convention cochées par 'default'. Cette fonction envoie les convention cochées par 'default'.
La fonction va envoyer les convention par defaut pour les inscrit rattachés à une societé et ceux rattaché à une societe La fonction va envoyer les convention par defaut pour les inscrit rattachés à une societé et ceux rattaché à une societe.
Regle de gestion des adresse email :
Si le champ 'email_test' est rempli, alors il prend le pas sur la recherche des emails par defaut. Cela signifie que le
client veux faire un test.
""" """
def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder, diction): def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder, diction):
@ -4085,6 +4089,20 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
if (local_status is not True): if (local_status is not True):
return local_status, my_partner return local_status, my_partner
is_test_mode = "0"
email_test = ""
if( "email_test" in diction.keys() and diction['email_test']):
email_test = diction['email_test']
if( mycommon.isEmailValide(email_test) is False ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'adresse email du test est invalide ")
return False, " L'adresse email du test est invalide "
is_test_mode = "1"
# Verifier que la session est valide # Verifier que la session est valide
is_session_valide = MYSY_GV.dbname['session_formation'].count_documents( is_session_valide = MYSY_GV.dbname['session_formation'].count_documents(
{'_id': ObjectId(str(diction['session_id'])), {'_id': ObjectId(str(diction['session_id'])),
@ -4109,9 +4127,6 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
) )
print(" ### la liste des liste_client_rattachement_id = ", liste_client_rattachement_id)
# Sauvegarde des fichiers joints depuis le front # Sauvegarde des fichiers joints depuis le front
tab_saved_file_full_path = [] tab_saved_file_full_path = []
for file in tab_files: for file in tab_files:
@ -4187,26 +4202,8 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
- edit_by_client = "0" - edit_by_client = "0"
- type_doc = "email" - type_doc = "email"
""" """
qry_indi = {"$or": [{'valide': '1',
'locked': '0',
'ref_interne': 'CONVENTION_STAGIAIRE',
'default_version': '1',
'edit_by_client': '0',
'type_doc':'email',
'partner_owner_recid': str(my_partner['recid'])}
,
{'valide': '1',
'locked': '0',
'ref_interne': 'CONVENTION_STAGIAIRE',
'default_version': '1',
'edit_by_client': {'$exists': False},
'type_doc':'email',
'partner_owner_recid': str(my_partner['recid'])}
]
}
print(" ### qry_indi = ", qry_indi)
default_courrier_template_individuel_count = MYSY_GV.dbname['courrier_template'].count_documents( default_courrier_template_individuel_count = MYSY_GV.dbname['courrier_template'].count_documents(
{"$or": [{'valide': '1', {"$or": [{'valide': '1',
@ -4239,8 +4236,8 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
if (default_courrier_template_individuel_count > 1): if (default_courrier_template_individuel_count > 1):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][ str(inspect.stack()[0][
3]) + " Il y a "+str(default_courrier_template_individuel_count)+" conventions individuelles configurées. Il ne doit y avoir qu'une seule ") 3]) + " Il y a "+str(default_courrier_template_individuel_count)+" conventions individuelles par défaut configurées. Il ne doit y avoir qu'une seule ")
return False, " Il y a "+str(default_courrier_template_individuel_count)+" conventions individuelles configurées. Il ne doit y avoir qu'une seule " return False, " Il y a "+str(default_courrier_template_individuel_count)+" conventions individuelles par défaut configurées. Il ne doit y avoir qu'une seule "
@ -4260,14 +4257,13 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
) )
for single_client in liste_client_rattachement_id : for single_client in liste_client_rattachement_id :
print(" Traintement du client_id = ", single_client)
# Recuperation des contacts de communication du client # Recuperation des contacts de communication du client
local_diction = {} local_diction = {}
local_diction['token'] = diction['token'] local_diction['token'] = diction['token']
local_diction['_id'] = str(single_client) local_diction['_id'] = str(single_client)
print(" ##### local_diction = ", local_diction) print(" ## Traitement du client id: ", str(single_client))
local_status, partner_client_contact_communication = partner_client.Get_Partner_Client_Communication_Contact(local_diction) local_status, partner_client_contact_communication = partner_client.Get_Partner_Client_Communication_Contact(local_diction)
@ -4275,7 +4271,7 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
mycommon.myprint(" Impossible de récupérer les contacts de communication du client ") mycommon.myprint(" Impossible de récupérer les contacts de communication du client ")
return False, " Impossible de récupérer les contacts de communication du client " return False, " Impossible de récupérer les contacts de communication du client "
print(" ### partner_client_contact_communication = ", partner_client_contact_communication)
tab_local_email_production = [] tab_local_email_production = []
for tmp in partner_client_contact_communication: for tmp in partner_client_contact_communication:
tmp_JSON = ast.literal_eval(tmp) tmp_JSON = ast.literal_eval(tmp)
@ -4288,12 +4284,17 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
new_diction_client['partner_client_id'] = single_client new_diction_client['partner_client_id'] = single_client
new_diction_client['token'] = diction['token'] new_diction_client['token'] = diction['token']
new_diction_client['courrier_template_id'] = default_courrier_template_client_data['_id'] new_diction_client['courrier_template_id'] = default_courrier_template_client_data['_id']
new_diction_client['email_test'] = diction['email_test']
new_diction_client['email_production'] = str(list_local_email_production) if( is_test_mode == "1"):
new_diction_client['email_test'] = email_test
new_diction_client['email_production'] = ""
else:
new_diction_client['email_test'] = ""
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(" ##### 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):
@ -4352,11 +4353,15 @@ def Prepare_and_Send_Default_Convention_From_Session_By_Email(tab_files, Folder,
new_diction_no_client['courrier_template_id'] = default_courrier_template_individuel_data['_id'] new_diction_no_client['courrier_template_id'] = default_courrier_template_individuel_data['_id']
new_diction_no_client['session_id'] = diction['session_id'] new_diction_no_client['session_id'] = diction['session_id']
new_diction_no_client['email_test'] = "" if (is_test_mode == "1"):
new_diction_no_client['email_production'] = "" new_diction_no_client['email_test'] = email_test
new_diction_no_client['email_production'] = ""
else:
new_diction_no_client['email_test'] = ""
new_diction_no_client['email_production'] = ""
print(" ##### new_diction_no_client = ", new_diction_no_client) print(" ##### new_diction_no_client = ", new_diction_no_client)
local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email(tab_files, Folder, new_diction_no_client) local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email(tab_saved_file_full_path, Folder, new_diction_no_client)
if (local_status is False): if (local_status is False):
mycommon.myprint(" WARNING impossible d'envoyer la convention a l'apprenant : " + str(single_inscrit_no_client['_id']) ) mycommon.myprint(" WARNING impossible d'envoyer la convention a l'apprenant : " + str(single_inscrit_no_client['_id']) )
@ -4434,16 +4439,25 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
print(" ### la liste des liste_client_rattachement_id = ", liste_client_rattachement_id) print(" ### la liste des liste_client_rattachement_id = ", liste_client_rattachement_id)
# Recuperer inscriptions indépenantes, donc pas liée à un client # Recuperer inscriptions indépenantes, donc pas liée à un client
liste_inscription_no_client = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
'status': '1',
'partner_owner_recid': str( liste_inscription_no_client = MYSY_GV.dbname['inscription'].find({"$or": [{'session_id': str(diction['session_id']),
my_partner['recid']), 'status': '1',
"client_rattachement_id": '' 'partner_owner_recid': str(my_partner['recid']),
}, {'_id': 1} "client_rattachement_id": ''
},
{'session_id': str(diction['session_id']),
'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'client_rattachement_id': {'$exists': False}
}]
}
) )
"""
for val in liste_inscription_no_client: for val in liste_inscription_no_client:
print(" ### la liste des liste_inscription_no_client = ", str(val)) print(" ### la liste des liste_inscription_no_client = ", str(val))
"""
@ -4482,6 +4496,19 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
elif (str(is_convention_by_client) == "0"): elif (str(is_convention_by_client) == "0"):
liste_inscription_no_client = MYSY_GV.dbname['inscription'].find(
{"$or": [{'session_id': str(diction['session_id']),
'status': '1',
'partner_owner_recid': str(my_partner['recid']),
"client_rattachement_id": ''
},
{'session_id': str(diction['session_id']),
'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'client_rattachement_id': {'$exists': False}
}]
}
)
for val in liste_inscription_no_client: for val in liste_inscription_no_client:
local_diction = {} local_diction = {}
# field_list_obligatoire = ['token', 'session_id', 'courrier_template_id', 'client_id'] # field_list_obligatoire = ['token', 'session_id', 'courrier_template_id', 'client_id']
@ -4490,7 +4517,7 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
local_diction['courrier_template_id'] = diction['courrier_template_id'] local_diction['courrier_template_id'] = diction['courrier_template_id']
local_diction['inscription_id'] = str(val['_id']) local_diction['inscription_id'] = str(val['_id'])
print(" #### Traitemnt de local_diction bb = ", local_diction) #print(" #### Traitemnt de local_diction bb = ", local_diction)
local_status, local_full_file_name = Create_Convention_By_Stagiaire_PDF(local_diction) local_status, local_full_file_name = Create_Convention_By_Stagiaire_PDF(local_diction)
if( local_status is False): if( local_status is False):
return local_status, local_full_file_name return local_status, local_full_file_name
@ -4608,9 +4635,9 @@ def Prepare_and_Send_Default_Convention_From_Session_By_PDF(diction):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][ str(inspect.stack()[0][
3]) + " Il y a " + str( 3]) + " Il y a " + str(
default_courrier_template_client_count) + " conventions d'entreprise configurées. Il ne doit y avoir qu'une seule ") default_courrier_template_client_count) + " conventions d'entreprise par défaut configurées. Il ne doit y avoir qu'une seule ")
return False, " Il y a " + str( return False, " Il y a " + str(
default_courrier_template_client_count) + " conventions d'entreprise configurées. Il ne doit y avoir qu'une seule " default_courrier_template_client_count) + " conventions d'entreprise par défaut configurées. Il ne doit y avoir qu'une seule "
nb_liste_inscription_no_client = MYSY_GV.dbname['inscription'].count_documents( nb_liste_inscription_no_client = MYSY_GV.dbname['inscription'].count_documents(
{"$or": [{'session_id': str(diction['session_id']), {"$or": [{'session_id': str(diction['session_id']),
@ -4726,7 +4753,7 @@ def Prepare_and_Send_Default_Convention_From_Session_By_PDF(diction):
'ref_interne': 'CONVENTION_STAGIAIRE', 'ref_interne': 'CONVENTION_STAGIAIRE',
'default_version': '1', 'default_version': '1',
'edit_by_client': '1', 'edit_by_client': '1',
'type_doc': 'email', 'type_doc': 'pdf',
'partner_owner_recid': str(my_partner['recid'])} 'partner_owner_recid': str(my_partner['recid'])}
) )

View File

@ -1659,7 +1659,7 @@ def Get_Partner_Client_Communication_Contact(diction):
new_diction['locked'] = "0" new_diction['locked'] = "0"
new_diction['include_com'] = "1" new_diction['include_com'] = "1"
print(" ### new_diction = ", new_diction)
RetObject = [] RetObject = []
val_tmp = 1 val_tmp = 1

View File

@ -1318,9 +1318,9 @@ def Duplicate_Given_Partner_Document(diction):
if( "joint_pdf" in is_document_data.keys()): if( "joint_pdf" in is_document_data.keys()):
new_document['is_document_data'] = str(is_document_data['is_document_data']) new_document['joint_pdf'] = str(is_document_data['joint_pdf'])
else: else:
new_document['is_document_data'] = "0" new_document['joint_pdf'] = "0"
if ("corps_mail" in is_document_data.keys()): if ("corps_mail" in is_document_data.keys()):
new_document['corps_mail'] = str(is_document_data['corps_mail']) new_document['corps_mail'] = str(is_document_data['corps_mail'])

View File

@ -1,3 +1,4 @@
import ast
import hashlib import hashlib
import _pickle as cPickle import _pickle as cPickle
import pickle import pickle
@ -43,6 +44,8 @@ import html
import mariadb import mariadb
from datetime import timedelta from datetime import timedelta
import Collection_Historique as Collection_Historique import Collection_Historique as Collection_Historique
import partner_client
class JSONEncoder(json.JSONEncoder): class JSONEncoder(json.JSONEncoder):
def default(self, o): def default(self, o):
@ -3944,6 +3947,7 @@ convention_dictionnary_data =
{'class_data':{....}} {'class_data':{....}}
{'list_session_data':{....}} {'list_session_data':{....}}
{'list_stagiaire_data':[{...}]} {'list_stagiaire_data':[{...}]}
{'client_data':{'raison_sociale':'xxx', 'nom':'yyy', list_contact_communication[{'civilite':'aa', 'nom':'bbb', ....'telephone_mobile':'01222'}, {'civilite':'aa', 'nom':'bbb', ....'telephone_mobile':'01222'} .... ]}
{'systeme':{'date_jour':'11/02/2023'}} {'systeme':{'date_jour':'11/02/2023'}}
} }
@ -4153,7 +4157,7 @@ def Get_Dictionnary_data_For_Template(diction):
list_client_data = [] list_client_data = []
tab_client_id = diction['list_client_id'] tab_client_id = diction['list_client_id']
client_liste_champ = ['raison_sociale', 'nom', 'email', 'adr_adresse', 'adr_code_postal', 'adr_code_postal', 'adr_pays'] client_liste_champ = ['raison_sociale', 'nom', 'email', 'adr_adresse', 'adr_code_postal', 'adr_ville', 'adr_code_postal', 'adr_pays']
for client_data in MYSY_GV.dbname['partner_client'].find({'_id': {'$in': tab_client_id, }, for client_data in MYSY_GV.dbname['partner_client'].find({'_id': {'$in': tab_client_id, },
'valide': '1', 'valide': '1',
@ -4171,8 +4175,45 @@ def Get_Dictionnary_data_For_Template(diction):
new_field = {new_champ_name: ""} new_field = {new_champ_name: ""}
new_client_data.update(new_field) new_client_data.update(new_field)
# Recuperation des contacts de communucation du client
local_diction = {}
local_diction['token'] = diction['token']
local_diction['_id'] = str(client_data['_id'])
local_status, partner_client_contact_communication = partner_client.Get_Partner_Client_Communication_Contact(
local_diction)
list_contact_communication = []
if(local_status is True):
print(" partner_client_contact_communication = ", partner_client_contact_communication)
for contact_communication_str in partner_client_contact_communication :
print(" contact_communication_str = ", contact_communication_str)
contact_communication = ast.literal_eval(contact_communication_str)
print(" my_json = ", contact_communication)
contact_communication_node = {}
contact_communication_node['civilite'] = contact_communication['civilite']
contact_communication_node['nom'] = contact_communication['nom']
contact_communication_node['prenom'] = contact_communication['prenom']
contact_communication_node['fonction'] = contact_communication['fonction']
contact_communication_node['adr_adresse'] = contact_communication['adr_adresse']
contact_communication_node['adr_code_postal'] = contact_communication['adr_code_postal']
contact_communication_node['adr_ville'] = contact_communication['adr_ville']
contact_communication_node['adr_pays'] = contact_communication['adr_pays']
contact_communication_node['email'] = contact_communication['email']
contact_communication_node['telephone'] = contact_communication['telephone']
contact_communication_node['telephone_mobile'] = contact_communication['telephone_mobile']
list_contact_communication.append(contact_communication_node)
new_client_data["list_contact_communication"] = list_contact_communication
list_client_data.append(new_client_data) list_client_data.append(new_client_data)
dictionnary_data['list_client_data'] = list_client_data dictionnary_data['list_client_data'] = list_client_data
@ -4187,6 +4228,11 @@ def Get_Dictionnary_data_For_Template(diction):
systeme_data.update(new_field) systeme_data.update(new_field)
dictionnary_data['systeme_data'] = systeme_data dictionnary_data['systeme_data'] = systeme_data
json_formatted_str = json.dumps(dictionnary_data, indent=2)
#print(" ### AFFICHAGE dU data dictionnary ")
#print(json_formatted_str)
return True, dictionnary_data return True, dictionnary_data