qsdsq
parent
bd827f217d
commit
3b4a771d8b
|
@ -1,10 +1,10 @@
|
|||
<?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="01/06/2024 - 14h30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="qsdsq">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
@ -75,13 +75,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00272" summary="20/04/2024 - 13h">
|
||||
<created>1713610715820</created>
|
||||
<option name="number" value="00272" />
|
||||
<option name="presentableId" value="LOCAL-00272" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1713610715822</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00273" summary="20/04/2024 - 20h44">
|
||||
<created>1713638681958</created>
|
||||
<option name="number" value="00273" />
|
||||
|
@ -418,7 +411,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1717245781085</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="321" />
|
||||
<task id="LOCAL-00321" summary="qsdsq">
|
||||
<created>1717533847419</created>
|
||||
<option name="number" value="00321" />
|
||||
<option name="presentableId" value="LOCAL-00321" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1717533847419</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="322" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -480,11 +480,11 @@
|
|||
<MESSAGE value="ss" />
|
||||
<MESSAGE value="gdfgdf" />
|
||||
<MESSAGE value="26/05/2024 - 20h30" />
|
||||
<MESSAGE value="qsdsq" />
|
||||
<MESSAGE value="qsdsqqsdsq" />
|
||||
<MESSAGE value="sd" />
|
||||
<MESSAGE value="sss" />
|
||||
<MESSAGE value="01/06/2024 - 14h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="01/06/2024 - 14h30" />
|
||||
<MESSAGE value="qsdsq" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="qsdsq" />
|
||||
</component>
|
||||
</project>
|
3353
Log/log_file.log
3353
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -8501,7 +8501,7 @@ def Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path,
|
|||
return False, " Aucune adresse email n'a été fourni. "
|
||||
|
||||
|
||||
print(" ## laaa : tab_emails_destinataire lalala = ", tab_emails_destinataire)
|
||||
#print(" ## laaa : tab_emails_destinataire lalala = ", tab_emails_destinataire)
|
||||
|
||||
# Verifier que le 'courrier_template_id' est valide
|
||||
# Ici le template doit etre un email
|
||||
|
@ -8621,7 +8621,7 @@ def Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path,
|
|||
|
||||
convention_dictionnary_data = local_retval
|
||||
|
||||
print(" ")
|
||||
|
||||
## Creation du PDF
|
||||
|
||||
body = {
|
||||
|
|
136
partner_order.py
136
partner_order.py
|
@ -5156,6 +5156,7 @@ def Send_Partner_Order_By_Email(diction):
|
|||
return False, " Le parametrage du document est invalide "
|
||||
|
||||
|
||||
|
||||
# Recuperation des données du client
|
||||
if( "order_header_client_id" in Order_header_data.keys() ):
|
||||
Order_header_client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(Order_header_data['order_header_client_id'])),
|
||||
|
@ -5363,45 +5364,107 @@ def Send_Partner_Order_By_Email(diction):
|
|||
"params": convention_dictionnary_data,
|
||||
}
|
||||
|
||||
# print(" #### BODY = ", body) zzzz
|
||||
# Traitement de l'eventuel fichier joint
|
||||
tab_files_to_attache_to_mail = []
|
||||
|
||||
#print(" ### Order_header_lines_data = ", Order_header_lines_data)
|
||||
# Verifier s'il s'agit d'un document à envoyer avec une version de pièce jointe.
|
||||
if ("joint_pdf" in partner_document_CONF_ORDER_data.keys() and str(partner_document_CONF_ORDER_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(partner_document_CONF_ORDER_data['contenu_doc']))
|
||||
|
||||
contenu_doc_Template = jinja2.Template(str(partner_document_CONF_ORDER_data['contenu_doc']))
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
contenu_doc_Template_subject = jinja2.Template(str(partner_document_CONF_ORDER_data['sujet']))
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
ts = datetime.now().timestamp()
|
||||
ts = str(ts).replace(".", "").replace(",", "")[-5:]
|
||||
|
||||
#print(" #### Order_header_data = ", Order_header_data)
|
||||
Order_header_data['order_header_type'] = str(Order_header_data['order_header_type']).capitalize()
|
||||
#sourceHtml = contenu_doc_Template.render(params=Order_header_data, param_order_lines=Order_header_lines_data)
|
||||
sourceHtml = contenu_doc_Template.render(params=body['params'], )
|
||||
orig_file_name = str(Order_header_data['order_header_type']) +"_"+ str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
|
||||
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
|
||||
|
||||
#sujetHtml = str(Order_header_data['order_header_type']) + " : "+ str(Order_header_data['order_header_ref_interne'])
|
||||
# open output file for writing (truncated binary)
|
||||
resultFile = open(outputFilename, "w+b")
|
||||
|
||||
sujetHtml = contenu_doc_Template_subject.render(params=body['params'], )
|
||||
# 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)
|
||||
|
||||
contenu_pdf_doc_Template = jinja2.Template(str(partner_document_CONF_ORDER_data['contenu_doc']))
|
||||
corps_mail_doc_Template = jinja2.Template(str(partner_document_CONF_ORDER_data['corps_mail']))
|
||||
sujet_doc_Template_subject = jinja2.Template(str(partner_document_CONF_ORDER_data['sujet']))
|
||||
|
||||
#print(" #### Order_header_data = ", Order_header_data)
|
||||
Order_header_data['order_header_type'] = str(Order_header_data['order_header_type']).capitalize()
|
||||
|
||||
sourceHtml = corps_mail_doc_Template.render(params=body['params'], )
|
||||
sujetHtml = sujet_doc_Template_subject.render(params=body['params'], )
|
||||
contenu_pdf_html = contenu_pdf_doc_Template.render(params=body['params'], )
|
||||
|
||||
|
||||
new_model_courrier_with_code_tag = str(
|
||||
sourceHtml) + " <p style='width: 300px; text-align: right;'> Signature Client <br/> <img style='height:150px; width:150px' src='{{ params.mysy_manual_signature_img }}'> </p> <br/> " \
|
||||
" <p style='width: 300px; text-align: center;'> <img style='height:150px; width:150px;' src='{{ params.mysy_qrcode_securite }}'> </p> "
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
||||
todays_date = str(date.today().strftime("%d_%m_%Y"))
|
||||
ts = datetime.now().timestamp()
|
||||
ts = str(ts).replace(".", "").replace(",", "")[-2:]
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
orig_file_name = "Devis_" + str(my_partner['recid'])[0:5] + "_" + str(todays_date)+"_"+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
|
||||
new_model_courrier_with_code_tag = " <div style='width: 100%'> <div style = 'width: 100%; text-align: center;' >" \
|
||||
" <img style = 'height:60px; width:60px;' src = '{{ params.mysy_qrcode_securite }}' > <br/>" \
|
||||
" <nav style = 'font-size: 10px; font-style: italic;' > Sécurisé par MySy Training Technology </nav>" \
|
||||
" <br/> </div> </div>" +\
|
||||
str( contenu_pdf_html) + " <div style='width: 100%'> <div style = 'width: 100%; text-align: center;' >" \
|
||||
" Signature Client <br/> <img style = 'height:100px; width:100px' " \
|
||||
" src = '{{ params.mysy_manual_signature_img }}' > <br/> " \
|
||||
" </div> </div>"
|
||||
|
||||
todays_date = str(date.today().strftime("%d_%m_%Y"))
|
||||
ts = datetime.now().timestamp()
|
||||
ts = str(ts).replace(".", "").replace(",", "")[-2:]
|
||||
|
||||
orig_file_name = "Devis_" + str(my_partner['recid'])[0:5] + "_" + str(todays_date)+"_"+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=contenu_pdf_html, # the HTML to convert
|
||||
dest=resultFile) # file handle to receive result
|
||||
|
||||
# close output file
|
||||
resultFile.close()
|
||||
|
||||
else:
|
||||
# Il s'agit d'une simple email
|
||||
|
||||
## Creation du mail au format email
|
||||
contenu_doc_Template = jinja2.Template(str(partner_document_CONF_ORDER_data['contenu_doc']))
|
||||
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
# close output file
|
||||
resultFile.close()
|
||||
|
||||
"""
|
||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||
|
@ -5449,8 +5512,10 @@ def Send_Partner_Order_By_Email(diction):
|
|||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
print("debut envoi mail de test ")
|
||||
msg = EmailMessage()
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
msg.attach(html_mime)
|
||||
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
|
||||
"""
|
||||
|
@ -5481,6 +5546,10 @@ def Send_Partner_Order_By_Email(diction):
|
|||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
|
||||
# Attacher l'eventuelle pièces jointes
|
||||
for myfile in tab_files_to_attache_to_mail:
|
||||
msg.attach(myfile['attached_file'])
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(partner_SMTP_COUNT_user, partner_SMTP_COUNT_password)
|
||||
|
@ -5489,12 +5558,13 @@ def Send_Partner_Order_By_Email(diction):
|
|||
print(" Email envoyé " + str(val))
|
||||
|
||||
|
||||
|
||||
else:
|
||||
|
||||
print("debut envoi mail de test ")
|
||||
msg = EmailMessage()
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
msg.attach(html_mime)
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
||||
"""
|
||||
|
@ -5527,6 +5597,9 @@ def Send_Partner_Order_By_Email(diction):
|
|||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
|
||||
# Attacher l'eventuelle pièces jointes
|
||||
for myfile in tab_files_to_attache_to_mail:
|
||||
msg.attach(myfile['attached_file'])
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
|
@ -5535,6 +5608,7 @@ def Send_Partner_Order_By_Email(diction):
|
|||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
|
||||
"""
|
||||
Gestion de la E-Signature
|
||||
|
||||
|
|
Loading…
Reference in New Issue