15/12/2023 - 22h30
parent
2ebf5312f4
commit
18c251e2a2
|
@ -1,14 +1,12 @@
|
||||||
<?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="14/12/2023 - 22h">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/12/2023 - 18h">
|
||||||
<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$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.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_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.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 +76,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680804787304</updated>
|
<updated>1680804787304</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00125" summary="06/10/2023 - 21h40">
|
|
||||||
<created>1696628469996</created>
|
|
||||||
<option name="number" value="00125" />
|
|
||||||
<option name="presentableId" value="LOCAL-00125" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1696628469998</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00126" summary="07/10/2023 - 16h40">
|
<task id="LOCAL-00126" summary="07/10/2023 - 16h40">
|
||||||
<created>1696690295543</created>
|
<created>1696690295543</created>
|
||||||
<option name="number" value="00126" />
|
<option name="number" value="00126" />
|
||||||
|
@ -421,7 +412,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1702588091723</updated>
|
<updated>1702588091723</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="174" />
|
<task id="LOCAL-00174" summary="15/12/2023 - 18h">
|
||||||
|
<created>1702658652894</created>
|
||||||
|
<option name="number" value="00174" />
|
||||||
|
<option name="presentableId" value="LOCAL-00174" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1702658652895</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="175" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -436,7 +434,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="15/11/2023 - 12h" />
|
|
||||||
<MESSAGE value="15/11/2023 - 17h" />
|
<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" />
|
||||||
|
@ -461,6 +458,7 @@
|
||||||
<MESSAGE value="14/12/2023 - 16h16" />
|
<MESSAGE value="14/12/2023 - 16h16" />
|
||||||
<MESSAGE value="14/12/2023 - 21h" />
|
<MESSAGE value="14/12/2023 - 21h" />
|
||||||
<MESSAGE value="14/12/2023 - 22h" />
|
<MESSAGE value="14/12/2023 - 22h" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="14/12/2023 - 22h" />
|
<MESSAGE value="15/12/2023 - 18h" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="15/12/2023 - 18h" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -113,9 +113,17 @@ def Add_Historique_Event(diction):
|
||||||
})
|
})
|
||||||
|
|
||||||
if( is_existe_valide_related_collection_recid <= 0):
|
if( is_existe_valide_related_collection_recid <= 0):
|
||||||
mycommon.myprint(
|
# On verifie si on a pas plutot un 'partner_recid' au lieu d'un 'partner_owner_recid'
|
||||||
str(inspect.stack()[0][3]) + " - L'identifiant du 'related_collection_recid' n'est pas valide ")
|
is_existe_valide_related_collection_recid2 = MYSY_GV.dbname[
|
||||||
return False, " L'identifiant du 'related_collection_recid' n'est pas valide "
|
str(diction['related_collection'])].count_documents(
|
||||||
|
{'_id': ObjectId(str(diction['related_collection_recid'])),
|
||||||
|
'partner_recid': str(my_partner['recid']),
|
||||||
|
})
|
||||||
|
|
||||||
|
if( is_existe_valide_related_collection_recid2 is None ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - L'identifiant du 'related_collection_recid' n'est pas valide ")
|
||||||
|
return False, " L'identifiant du 'related_collection_recid' n'est pas valide "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import lms_chamilo.mysy_lms as mys_lms
|
||||||
from email.message import EmailMessage
|
from email.message import EmailMessage
|
||||||
import attached_file_mgt as attached_file_mgt
|
import attached_file_mgt as attached_file_mgt
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
import partner_client as partner_client
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Enregistrement d'un stagiaire
|
Enregistrement d'un stagiaire
|
||||||
|
@ -7103,11 +7104,11 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files, Folder, dict
|
||||||
'locked': '0',
|
'locked': '0',
|
||||||
'partner_recid': str(my_partner['recid'])})
|
'partner_recid': str(my_partner['recid'])})
|
||||||
|
|
||||||
|
|
||||||
# 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 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")
|
||||||
|
@ -7284,6 +7285,73 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files, Folder, dict
|
||||||
"params": convention_dictionnary_data,
|
"params": convention_dictionnary_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# Verifier s'il s'agit d'un document à envoyer avec une version de pièce jointe.
|
||||||
|
if ("joint_pdf" in courrier_template_data.keys() and str(courrier_template_data['joint_pdf']) == "1"):
|
||||||
|
# Il s'agit bien d'un envoie avec 'contenu_doc' en pièce jointe PDF
|
||||||
|
"""
|
||||||
|
1 - Creation du PDF
|
||||||
|
"""
|
||||||
|
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||||
|
|
||||||
|
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||||
|
|
||||||
|
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||||
|
ts = datetime.now().timestamp()
|
||||||
|
ts = str(ts).replace(".", "").replace(",", "")[-5:]
|
||||||
|
|
||||||
|
orig_file_name = "Convention_" + str(my_partner['recid']) + "_" + str(ts) + ".pdf"
|
||||||
|
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
|
||||||
|
|
||||||
|
# open output file for writing (truncated binary)
|
||||||
|
resultFile = open(outputFilename, "w+b")
|
||||||
|
|
||||||
|
# convert HTML to PDF
|
||||||
|
pisaStatus = pisa.CreatePDF(
|
||||||
|
src=sourceHtml, # the HTML to convert
|
||||||
|
dest=resultFile) # file handle to receive result
|
||||||
|
|
||||||
|
# close output file
|
||||||
|
resultFile.close()
|
||||||
|
|
||||||
|
# Attachement du fichier joint
|
||||||
|
file_to_attache_to_mail = MIMEBase('application', "octet-stream")
|
||||||
|
file_to_attache_to_mail.set_payload(open(outputFilename, "rb").read())
|
||||||
|
|
||||||
|
encoders.encode_base64(file_to_attache_to_mail)
|
||||||
|
file_to_attache_to_mail.add_header('Content-Disposition',
|
||||||
|
'attachment; filename="{0}"'.format(os.path.basename(outputFilename)))
|
||||||
|
|
||||||
|
new_node = {"attached_file": file_to_attache_to_mail}
|
||||||
|
tab_files_to_attache_to_mail.append(new_node)
|
||||||
|
|
||||||
|
## Creation du mail au format email
|
||||||
|
|
||||||
|
corps_mail_Template = jinja2.Template(str(courrier_template_data['corps_mail']))
|
||||||
|
|
||||||
|
sourceHtml = corps_mail_Template.render(params=body["params"])
|
||||||
|
|
||||||
|
html_mime = MIMEText(sourceHtml, 'html')
|
||||||
|
|
||||||
|
# Creation de l'email à enoyer
|
||||||
|
msg = MIMEMultipart("alternative")
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Il s'agit d'une simple email
|
||||||
|
|
||||||
|
## Creation du mail au format email
|
||||||
|
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||||
|
|
||||||
|
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||||
|
|
||||||
|
html_mime = MIMEText(sourceHtml, 'html')
|
||||||
|
|
||||||
|
# Creation de l'email à enoyer
|
||||||
|
msg = MIMEMultipart("alternative")
|
||||||
|
|
||||||
|
# ---
|
||||||
|
|
||||||
|
"""
|
||||||
## Creation du PDF
|
## Creation du PDF
|
||||||
|
|
||||||
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||||
|
@ -7294,7 +7362,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files, Folder, dict
|
||||||
|
|
||||||
# Creation de l'email à enoyer
|
# Creation de l'email à enoyer
|
||||||
msg = MIMEMultipart("alternative")
|
msg = MIMEMultipart("alternative")
|
||||||
|
"""
|
||||||
"""
|
"""
|
||||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||||
"""
|
"""
|
||||||
|
@ -7390,8 +7458,8 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files, Folder, dict
|
||||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||||
history_event_dict = {}
|
history_event_dict = {}
|
||||||
history_event_dict['token'] = diction['token']
|
history_event_dict['token'] = diction['token']
|
||||||
history_event_dict['related_collection'] = "inscription"
|
history_event_dict['related_collection'] = "partner_client"
|
||||||
history_event_dict['related_collection_recid'] = str(diction['inscription_id'])
|
history_event_dict['related_collection_recid'] = str(diction['partner_client_id'])
|
||||||
history_event_dict['action_date'] = str(now)
|
history_event_dict['action_date'] = str(now)
|
||||||
history_event_dict['action_description'] = "Convention envoyée par email à la liste : " + str(
|
history_event_dict['action_description'] = "Convention envoyée par email à la liste : " + str(
|
||||||
tab_emails_destinataire)
|
tab_emails_destinataire)
|
||||||
|
|
1679
Log/log_file.log
1679
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Ce fichier gere les sessions de formation
|
Ce fichier gere les sessions de formation
|
||||||
"""
|
"""
|
||||||
|
import ast
|
||||||
from email import encoders
|
from email import encoders
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.base import MIMEBase
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ from datetime import datetime, date
|
||||||
|
|
||||||
from xhtml2pdf import pisa
|
from xhtml2pdf import pisa
|
||||||
|
|
||||||
|
import partner_client
|
||||||
import prj_common as mycommon
|
import prj_common as mycommon
|
||||||
import secrets
|
import secrets
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -3892,6 +3894,9 @@ pour les autres, on envoi des conventions individuelle
|
||||||
"""
|
"""
|
||||||
def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction):
|
def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
print(" #### INITIAL tab_files = ", tab_files)
|
||||||
|
ORIG_tab_files = tab_files
|
||||||
field_list_obligatoire = ['token', 'session_id', 'courrier_template_id', 'email_test', 'email_production']
|
field_list_obligatoire = ['token', 'session_id', 'courrier_template_id', 'email_test', 'email_production']
|
||||||
|
|
||||||
for val in field_list_obligatoire:
|
for val in field_list_obligatoire:
|
||||||
|
@ -3943,22 +3948,47 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
|
||||||
"client_rattachement_id":''
|
"client_rattachement_id":''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
for tmp in liste_inscription_no_client:
|
||||||
print(" ### la liste des liste_inscription_no_client = ", str(liste_inscription_no_client))
|
print(" ### la liste des liste_inscription_no_client = ", str(tmp))
|
||||||
|
|
||||||
|
|
||||||
for single_client in liste_client_rattachement_id :
|
for single_client in liste_client_rattachement_id :
|
||||||
print(" Traintement du client_id = ", single_client)
|
print(" Traintement du client_id = ", single_client)
|
||||||
#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']
|
||||||
|
|
||||||
|
# Recuperation des contacts de communication du client
|
||||||
|
local_diction = {}
|
||||||
|
local_diction['token'] = diction['token']
|
||||||
|
local_diction['_id'] = str(single_client)
|
||||||
|
|
||||||
|
print(" ##### local_diction = ", local_diction)
|
||||||
|
local_status, partner_client_contact_communication = partner_client.Get_Partner_Client_Communication_Contact(local_diction)
|
||||||
|
|
||||||
|
|
||||||
|
if (local_status is False):
|
||||||
|
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 "
|
||||||
|
|
||||||
|
print(" ### partner_client_contact_communication = ", partner_client_contact_communication)
|
||||||
|
tab_local_email_production = []
|
||||||
|
for tmp in partner_client_contact_communication:
|
||||||
|
tmp_JSON = ast.literal_eval(tmp)
|
||||||
|
if ("email" in tmp_JSON.keys()):
|
||||||
|
tab_local_email_production.append(str(tmp_JSON["email"]))
|
||||||
|
|
||||||
|
list_local_email_production = ",".join(tab_local_email_production)
|
||||||
|
|
||||||
new_diction_client = {}
|
new_diction_client = {}
|
||||||
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'] = diction['courrier_template_id']
|
new_diction_client['courrier_template_id'] = diction['courrier_template_id']
|
||||||
new_diction_client['email_test'] = diction['email_test']
|
new_diction_client['email_test'] = diction['email_test']
|
||||||
new_diction_client['email_production'] = diction['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 = ", new_diction_client)
|
||||||
|
print(" ##### tab_files = ", tab_files)
|
||||||
|
print(" ##### ORIG_tab_files = ", ORIG_tab_files)
|
||||||
local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files, Folder, new_diction_client)
|
local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files, Folder, new_diction_client)
|
||||||
|
|
||||||
if( local_status is False):
|
if( local_status is False):
|
||||||
|
@ -4059,11 +4089,12 @@ 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['client_id'] = str(val)
|
local_diction['client_id'] = str(val)
|
||||||
|
|
||||||
print(" #### Traitemnt de local_diction = ", local_diction)
|
print(" #### Traitemnt de local_diction aaa = ", local_diction)
|
||||||
local_status, local_full_file_name = Create_Convention_By_Client_PDF(local_diction)
|
local_status, local_full_file_name = Create_Convention_By_Client_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
|
||||||
else:
|
else:
|
||||||
|
print(" ### pdf_file_name = ", local_full_file_name)
|
||||||
list_file_name_to_zip.append(str(local_full_file_name))
|
list_file_name_to_zip.append(str(local_full_file_name))
|
||||||
|
|
||||||
|
|
||||||
|
@ -4076,17 +4107,19 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
|
||||||
}, {'_id':1}
|
}, {'_id':1}
|
||||||
)
|
)
|
||||||
|
|
||||||
print(" ### la liste des liste_inscription_no_client = ", str(liste_inscription_no_client))
|
for val in liste_inscription_no_client:
|
||||||
|
print(" ### la liste des liste_inscription_no_client = ", str(val))
|
||||||
|
|
||||||
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']
|
||||||
local_diction['token'] = diction['token']
|
local_diction['token'] = diction['token']
|
||||||
local_diction['session_id'] = diction['session_id']
|
local_diction['session_id'] = diction['session_id']
|
||||||
local_diction['courrier_template_id'] = diction['courrier_template_id']
|
local_diction['courrier_template_id'] = diction['courrier_template_id']
|
||||||
local_diction['inscription_id'] = str(val)
|
local_diction['inscription_id'] = str(val['_id'])
|
||||||
|
|
||||||
print(" #### Traitemnt de local_diction = ", local_diction)
|
print(" #### Traitemnt de local_diction bb = ", local_diction)
|
||||||
local_status, local_full_file_name = Create_Convention_By_Client_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
|
||||||
else:
|
else:
|
||||||
|
@ -4097,14 +4130,15 @@ def Prepare_and_Send_Convention_From_Session_By_PDF(diction):
|
||||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||||
ts = datetime.now().timestamp()
|
ts = datetime.now().timestamp()
|
||||||
ts = str(ts).replace(".", "").replace(",", "")[-3:]
|
ts = str(ts).replace(".", "").replace(",", "")[-3:]
|
||||||
zip_file_name = "List_Convention_session_"+str(diction['session_id'])+"_"+str(str)+".pdf"
|
zip_file_name = "List_Convention_session_"+str(diction['session_id'])+"_"+str(ts)+".zip"
|
||||||
|
|
||||||
with ZipFile('zip_file_name', 'w') as zip_object:
|
with ZipFile(zip_file_name, 'w') as zip_object:
|
||||||
for pdf_files in list_file_name_to_zip :
|
for pdf_files in list_file_name_to_zip :
|
||||||
|
print(" ### fichier a zipper = ", pdf_files)
|
||||||
zip_object.write(str(pdf_files))
|
zip_object.write(str(pdf_files))
|
||||||
|
|
||||||
|
|
||||||
if os.path.exists("./temp_direct/mysy.zip"):
|
if os.path.exists(zip_file_name):
|
||||||
# print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
|
# print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
|
||||||
return True, send_file(zip_file_name, as_attachment=True)
|
return True, send_file(zip_file_name, as_attachment=True)
|
||||||
|
|
||||||
|
@ -4160,12 +4194,12 @@ def Create_Convention_By_Client_PDF(diction):
|
||||||
# Verifier que le client est valide
|
# Verifier que le client est valide
|
||||||
client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['client_id'])), 'valide':'1',
|
client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['client_id'])), 'valide':'1',
|
||||||
'locked':'0',
|
'locked':'0',
|
||||||
'partner_owner_recid':str(my_partner['recid'])})
|
'partner_recid':str(my_partner['recid'])})
|
||||||
|
|
||||||
if (client_data is None ):
|
if (client_data is None ):
|
||||||
mycommon.myprint(
|
mycommon.myprint(
|
||||||
str(inspect.stack()[0][
|
str(inspect.stack()[0][
|
||||||
3]) + " L'identifiant du client est invalide ")
|
3]) + " L'identifiant du client est invalide ")
|
||||||
return False, " L'identifiant du client est invalide "
|
return False, " L'identifiant du client est invalide "
|
||||||
|
|
||||||
tab_client = []
|
tab_client = []
|
||||||
|
@ -4241,7 +4275,7 @@ def Create_Convention_By_Client_PDF(diction):
|
||||||
resultFile.close()
|
resultFile.close()
|
||||||
|
|
||||||
|
|
||||||
return True, template_courrier_data
|
return True, outputFilename
|
||||||
|
|
||||||
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()
|
||||||
|
|
Loading…
Reference in New Issue