13/05/26 - 17h

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-13 17:21:56 +02:00
parent 22cfb86fdd
commit 829b8b3e3e
5 changed files with 3019 additions and 25 deletions

View File

@ -4,13 +4,12 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="11/05/2026 -22h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="qsd">
<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$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Relance_client_facture.py" beforeDir="false" afterPath="$PROJECT_DIR$/Relance_client_facture.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -454,7 +453,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="579" />
<option name="localTasksCounter" value="580" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -496,7 +495,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="25/03/2026 - 20h" />
<MESSAGE value="26/03/2026 - 12h" />
<MESSAGE value="23/03/26 - 20h" />
<MESSAGE value="04/04/26 - 20h" />
@ -521,6 +519,7 @@
<MESSAGE value="09/05/2025 - 20h30" />
<MESSAGE value="10/05/2026 - 12h30" />
<MESSAGE value="11/05/2026 -22h" />
<option name="LAST_COMMIT_MESSAGE" value="11/05/2026 -22h" />
<MESSAGE value="qsd" />
<option name="LAST_COMMIT_MESSAGE" value="qsd" />
</component>
</project>

File diff suppressed because one or more lines are too long

View File

@ -91,7 +91,7 @@ def Create_Relance_Client_Facture_Given_Client_PDF(diction):
Recuperer le modèle de document
"""
local_diction = {}
local_diction['ref_interne'] = "RELANCE_FACTURE_CLIENT_LEVEL_1"
local_diction['ref_interne'] = "RELANCE_FACTURE_CLIENT"
local_diction['type_doc'] = "pdf"
local_diction['partner_owner_recid'] = str(my_partner['recid'])
@ -102,8 +102,8 @@ def Create_Relance_Client_Facture_Given_Client_PDF(diction):
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier 'RELANCE_FACTURE_CLIENT_LEVEL_1' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'RELANCE_FACTURE_CLIENT_LEVEL_1' n'est pas correctement configuré "
3]) + " Le modèle de courrier 'RELANCE_FACTURE_CLIENT' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'RELANCE_FACTURE_CLIENT' n'est pas correctement configuré "
"""
Recuperation du dictionnaire des info
@ -397,7 +397,7 @@ def Create_Relance_Client_Facture_Given_Client_PDF(diction):
# print(" ### outputFilename = "+str(outputFilename))
if os.path.exists(outputFilename):
# print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
return True, send_file(outputFilename, as_attachment=True)
# return True on success and False on errors
@ -419,8 +419,7 @@ def Create_Relance_Client_Facture_Given_Client_Email(tab_files, Folder, diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'client_id'
]
field_list = ['token', 'client_id', 'courrier_template_id', 'email_test', 'email_production' ]
incom_keys = diction.keys()
for val in incom_keys:
@ -444,6 +443,19 @@ def Create_Relance_Client_Facture_Given_Client_Email(tab_files, Folder, diction)
if (local_status is not True):
return local_status, my_partner
courrier_template_count = MYSY_GV.dbname['courrier_template'].count_documents(
{'_id': ObjectId(str(diction['courrier_template_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])}
)
if (courrier_template_count != 1):
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 "
"""
Verifier la validité du client
"""
@ -462,20 +474,19 @@ def Create_Relance_Client_Facture_Given_Client_Email(tab_files, Folder, diction)
"""
Recuperer le modèle de document
"""
local_diction = {}
local_diction['ref_interne'] = "RELANCE_FACTURE_CLIENT_LEVEL_1"
local_diction['type_doc'] = "email"
local_diction['partner_owner_recid'] = str(my_partner['recid'])
courrier_data_retval = MYSY_GV.dbname['courrier_template'].find_one(
{'_id': ObjectId(str(diction['courrier_template_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])}
)
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(local_diction)
if (courrier_data_status is False):
return courrier_data_status, courrier_data_retval
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier 'RELANCE_FACTURE_CLIENT_LEVEL_1' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'RELANCE_FACTURE_CLIENT_LEVEL_1' n'est pas correctement configuré "
3]) + " Le modèle de courrier 'RELANCE_FACTURE_CLIENT' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'RELANCE_FACTURE_CLIENT' n'est pas correctement configuré "
#print(" IIIIIIIIIIIIIIIIIII courrier_data_retval[_id] = ", str(courrier_data_retval['_id']))
"""
@ -678,11 +689,22 @@ def Create_Relance_Client_Facture_Given_Client_Email(tab_files, Folder, diction)
###############################
# Traitement de l'eventuel fichier joint
tab_files_to_attache_to_mail = []
# Sauvegarde des fichiers joints depuis le front
tab_saved_file_full_path = []
for file in tab_files:
status, saved_file_full_path = mycommon.Upload_Save_PDF_IMG_File(file, Folder)
if (status is False):
mycommon.myprint("Impossible de récupérer correctement le fichier à importer")
return False, "Impossible de récupérer correctement le fichier à importer"
tab_saved_file_full_path.append(saved_file_full_path)
tab_files_to_attache_to_mail = []
tab_list_file_for_queu_mail_and_internal_mail = []
for saved_file in tab_files:
for saved_file in tab_saved_file_full_path:
file_to_attache_to_mail = MIMEBase('application', "octet-stream")
file_to_attache_to_mail.set_payload(open(saved_file, "rb").read())

15
main.py
View File

@ -10329,6 +10329,21 @@ def Get_Competence_Level():
return jsonify(status=status, message=retval)
"""
API qui permet de recuperer les données d'un modele de courrier depuis le front
"""
@app.route('/myclass/api/Get_Front_Partner_Courrier_Model/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Front_Partner_Courrier_Model():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Front_Partner_Courrier_Model payload = ",payload)
status, retval = mycommon.Get_Front_Partner_Courrier_Model(payload)
return jsonify(status=status, message=retval)
"""
API pour créer une compétence
"""

View File

@ -6660,6 +6660,74 @@ def Get_Partner_Courrier_Model(diction):
return False, " Impossible de récupérer le modèle de courrier "
"""
Cette fonction permet de recuperer les données d'un modele de courrier
"""
def Get_Front_Partner_Courrier_Model(diction):
try:
"""
Verification des champs obligatoires
"""
field_list = [ "token", "courrier_template_id", "courrier_template_ref_interne", "courrier_template_type"]
local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner, False
filt_courrier_template_id = {}
filt_courrier_template_ref_interne = {}
filt_courrier_template_type = {}
is_one_filter = 0
if("courrier_template_id" in diction.keys() and diction['courrier_template_id']):
filt_courrier_template_id = {'_id':ObjectId(str(diction['courrier_template_id']))}
is_one_filter = 1
if ("courrier_template_type" in diction.keys() and diction['courrier_template_type']):
filt_courrier_template_type = {'type_doc': str(diction['courrier_template_type'])}
is_one_filter = 1
if ("courrier_template_ref_interne" in diction.keys() and diction['courrier_template_ref_interne']):
filt_courrier_template_ref_interne = {'ref_interne': str(diction['courrier_template_ref_interne'])}
is_one_filter = 1
if( is_one_filter == 0 ):
myprint(
str(inspect.stack()[0][3]) + " Vous devez fournir au moins un filter pour identifier le modèle de courrier ")
return False, " Vous devez fournir au moins un filter pour identifier le modèle de courrier "
query_filter_partner_owner_recid = {'$and': [
{'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])},
filt_courrier_template_id,
filt_courrier_template_ref_interne,filt_courrier_template_type]
}
print(" query_filter_partner_owner_recid = ", query_filter_partner_owner_recid)
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['courrier_template'].find(query_filter_partner_owner_recid, {'_id':1, 'type_doc':1, 'ref_interne':1, 'nom':1}):
user = retval
val_tmp = val_tmp + 1
RetObject.append(JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer le modèle de courrier "
"""
Cette fonction verifie si une ressource (humaine ou materielle) est disponibe sur une creneau donnée
"""