02/01/26 - 21h

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-01-02 21:44:04 +00:00
parent fcf5e86710
commit 53894b80f1
3 changed files with 1172 additions and 18 deletions

View File

@ -4,22 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/12/25 - 13h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="02/01/26 - 13h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Env_Data.py" beforeDir="false" afterPath="$PROJECT_DIR$/Env_Data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.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$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/user_session.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_session.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -462,7 +450,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="521" />
<option name="localTasksCounter" value="522" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -504,7 +492,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="30/07/2025 -18h" />
<MESSAGE value="10/08/2025 - 10h" />
<MESSAGE value="sss" />
<MESSAGE value="10/10/2025 - 17:30" />
@ -529,6 +516,7 @@
<MESSAGE value="07/12/25 - 14h" />
<MESSAGE value="13/12/25 - 14h" />
<MESSAGE value="15/12/25 - 13h" />
<option name="LAST_COMMIT_MESSAGE" value="15/12/25 - 13h" />
<MESSAGE value="02/01/26 - 13h" />
<option name="LAST_COMMIT_MESSAGE" value="02/01/26 - 13h" />
</component>
</project>

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@ from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import attached_file_mgt as attached_file_mgt
import pymongo
from flask import send_file
from pandas.io.formats.style import jinja2
@ -22,7 +22,7 @@ import json
from bson import ObjectId
import re
from datetime import datetime, date
import email_mgt as email_mgt
from xhtml2pdf import pisa
import E_Sign_Document
@ -6005,6 +6005,8 @@ def Send_Employee_Contract_By_Email(tab_files, Folder, diction):
# Traitement de l'eventuel fichier joint
tab_files_to_attache_to_mail = []
tab_list_file_for_queu_mail_and_internal_mail = []
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())
@ -6016,6 +6018,8 @@ def Send_Employee_Contract_By_Email(tab_files, Folder, diction):
new_node = {"attached_file": file_to_attache_to_mail}
tab_files_to_attache_to_mail.append(new_node)
tab_list_file_for_queu_mail_and_internal_mail.append(saved_file)
print(" ## tab_files_to_attache_to_mail 01 = ", tab_files_to_attache_to_mail)
# Creation du dictionnaire d'information à utiliser pour la creation du doc
@ -6094,6 +6098,11 @@ def Send_Employee_Contract_By_Email(tab_files, Folder, diction):
new_node = {"attached_file": file_to_attache_to_mail}
tab_files_to_attache_to_mail.append(new_node)
tab_list_file_for_queu_mail_and_internal_mail.append(outputFilename)
print(" ajourrrr PDFFF outputFilename = ", outputFilename)
contenu_pdf_doc_Template = jinja2.Template(str(Contrat_Model_Document_data['contenu_doc']))
corps_mail_doc_Template = jinja2.Template(str(Contrat_Model_Document_data['corps_mail']))
sujet_doc_Template_subject = jinja2.Template(str(Contrat_Model_Document_data['sujet']))
@ -6245,6 +6254,60 @@ def Send_Employee_Contract_By_Email(tab_files, Folder, diction):
smtpserver.close()
print(" Email envoyé " + str(val))
"""
Gestion des emails via mail_queu et internal email
"""
# Recuperation des donnes smtp
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
if (local_stpm_status is False):
return local_stpm_status, local_SMTP_COUNT_smtpsrv
tab_email_bcc = []
tab_email_bcc.append("contact@mysy-training.com")
"""
IMPORTANT : Cette section sera utilisée une fois que le module de Queu de message est ok
"""
queue_mail_diction = {}
queue_mail_diction['token'] = diction['token']
queue_mail_diction['tab_email_cc'] = []
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
if (sujetHtml):
queue_mail_diction['email_sujet'] = sujetHtml
else:
nom = ""
if ("nom" in employee_data.keys()):
nom = employee_data['nom']
prenom = ""
if ("prenom" in employee_data.keys()):
prenom = employee_data['prenom']
queue_mail_diction['email_sujet'] = '[MySy Training]: Contrat employé '+str(nom)+' - '+str(prenom)
queue_mail_diction['message'] = sourceHtml
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
queue_mail_diction['smtp_account_user'] = local_SMTP_COUNT_user
queue_mail_diction['smtp_account_From_User'] = local_SMTP_COUNT_From_User
queue_mail_diction['smtp_account_port'] = local_SMTP_COUNT_port
queue_mail_diction['tab_files_to_attache_to_mail'] = []
for myfile in tab_list_file_for_queu_mail_and_internal_mail:
print(" ## les pièces jointes sonntt myfile = ", myfile)
queue_mail_diction['tab_files_to_attache_to_mail'].append(myfile)
queue_mail_diction['email_to'] = str(employee_data['email'])
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
queue_mail_diction)
if (queue_and_internal_mail_status is False):
print(" ## WARNING queue_mail_retval = ", queue_and_internal_mail_status)
"""
Gestion de la E-Signature
@ -6314,6 +6377,43 @@ def Send_Employee_Contract_By_Email(tab_files, Folder, diction):
return local_status_send_e_doc, local_send_retval_e_doc
"""
Après l'envoi du contrat par email, on va stocker le pdf envoyé
"""
new_file = {}
new_file['token'] = diction['token']
type_document = "contrat"
new_file['file_business_object'] = str(orig_file_name)
new_file['file_name'] = str(orig_file_name)
new_file['status'] = "1"
new_file['type_document'] = str(type_document)
new_file['object_owner_collection'] = "ressource_humaine_contrat"
new_file['object_owner_id'] = str(rh_contract_data['_id'])
new_file['file_name_to_store'] = outputFilename
tab_key_word = "contrat," + str(employee_data['email']) + "," + str(employee_data['nom'])+"," + str(employee_data['prenom'])
new_file['tab_key_word'] = tab_key_word
tab_related_collection = []
if (employee_data and '_id' in employee_data.keys()):
node_rh = {}
node_rh['related_collection'] = 'ressource_humaine'
node_rh['related_collection_id'] = str(employee_data['_id'])
tab_related_collection.append(node_rh)
# print(" ### new_file new_file = ", new_file)
local_status, local_retval = attached_file_mgt.Internal_Usage_Store_User_Downloaded_File(
MYSY_GV.upload_folder, new_file, tab_related_collection)
if (local_status is False):
print(" ## WARINNGGG Impossible de stocker le fichier de Convocation ")
# Logguer l'event
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
# print(" ####### laaaa diction = ", diction)
@ -6330,6 +6430,9 @@ def Send_Employee_Contract_By_Email(tab_files, Folder, diction):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
return True, " Le document a été envoyé par email à : '" + str(employee_data['email']) + "' "
except Exception as e: