20/03/2024 - 22h30dss
parent
969bc26918
commit
c264ad0ac2
|
@ -1,13 +1,10 @@
|
||||||
<?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="20/03/2024 - 22h30">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/03/2024 - 22h30d">
|
||||||
<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$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" 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$/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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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" />
|
||||||
|
@ -77,13 +74,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680804787304</updated>
|
<updated>1680804787304</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00197" summary="16/01/2024 - 19h">
|
|
||||||
<created>1705426888964</created>
|
|
||||||
<option name="number" value="00197" />
|
|
||||||
<option name="presentableId" value="LOCAL-00197" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1705426888964</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00198" summary="19/01/2024 - 16h">
|
<task id="LOCAL-00198" summary="19/01/2024 - 16h">
|
||||||
<created>1705677688291</created>
|
<created>1705677688291</created>
|
||||||
<option name="number" value="00198" />
|
<option name="number" value="00198" />
|
||||||
|
@ -420,7 +410,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1710970329203</updated>
|
<updated>1710970329203</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="246" />
|
<task id="LOCAL-00246" summary="20/03/2024 - 22h30d">
|
||||||
|
<created>1711130098363</created>
|
||||||
|
<option name="number" value="00246" />
|
||||||
|
<option name="presentableId" value="LOCAL-00246" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1711130098364</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="247" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -435,7 +432,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="17/02/2024 - 11h" />
|
|
||||||
<MESSAGE value="18/02/2024 - 14h" />
|
<MESSAGE value="18/02/2024 - 14h" />
|
||||||
<MESSAGE value="dd" />
|
<MESSAGE value="dd" />
|
||||||
<MESSAGE value="ddr" />
|
<MESSAGE value="ddr" />
|
||||||
|
@ -460,6 +456,7 @@
|
||||||
<MESSAGE value="12/03/2024 - 20h30" />
|
<MESSAGE value="12/03/2024 - 20h30" />
|
||||||
<MESSAGE value="19/03/2024 - 17h30" />
|
<MESSAGE value="19/03/2024 - 17h30" />
|
||||||
<MESSAGE value="20/03/2024 - 22h30" />
|
<MESSAGE value="20/03/2024 - 22h30" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="20/03/2024 - 22h30" />
|
<MESSAGE value="20/03/2024 - 22h30d" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="20/03/2024 - 22h30d" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -41,7 +41,6 @@ Chaque signataire reçoit par mail une notification pour signer ainsi qu’un co
|
||||||
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
import bson
|
import bson
|
||||||
import pymongo
|
import pymongo
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
|
@ -364,37 +363,94 @@ def Get_Given_E_Document_Not_Signed_No_Token(diction):
|
||||||
# Creation de l'email à enoyer
|
# Creation de l'email à enoyer
|
||||||
msg = MIMEMultipart("alternative")
|
msg = MIMEMultipart("alternative")
|
||||||
|
|
||||||
html = """\
|
"""
|
||||||
<html>
|
Recupération du modele de courrier.
|
||||||
<body>
|
le principe est de prendre le module du partenaire. si pas de modele du partenaire on
|
||||||
<br />
|
prend le modele par default
|
||||||
<div style="text-align: center;">
|
|
||||||
<nav style="text-align: center; font-weight: bold;">LOGO</nav>
|
|
||||||
<br />
|
|
||||||
<div style="text-align: center;">
|
|
||||||
<nav style="text-align: center; font-weight: bold;">SIGNATURE ELECTRONIQUE</nav>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
Bonjour
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div >
|
|
||||||
Vous venez de lancer une procedure de signature digitale. Voici le code de validation : <br/>
|
|
||||||
|
|
||||||
""" + secret_key_for_sign + """<br>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
Cordialement.
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
"""
|
||||||
|
courrier_template_model = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_CODE",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': str(local_partner_owner_recid)}
|
||||||
|
)
|
||||||
|
if (courrier_template_model == 1):
|
||||||
|
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_CODE",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': str(local_partner_owner_recid)}
|
||||||
|
)
|
||||||
|
|
||||||
# contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
else:
|
||||||
# sourceHtml = contenu_doc_Template.render(params=body["params"])
|
courrier_template_model = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_CODE",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': "default"}
|
||||||
|
)
|
||||||
|
if (courrier_template_model == 1):
|
||||||
|
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_CODE",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': "default"}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
mycommon.myprint(str(
|
||||||
|
inspect.stack()[0][3]) + " Aucun modèle de document configuré pour envoyer les e-documents signés ")
|
||||||
|
return False, " Aucun modèle de document configuré pour envoyer les e-documents signés "
|
||||||
|
|
||||||
|
if ("contenu_doc" not in courrier_template_data.keys() or str(
|
||||||
|
courrier_template_data['contenu_doc']).strip() == ""):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Le modèle de document ne contient pas de valeur 'contenu_doc' ")
|
||||||
|
return False, " Le modèle de document ne contient pas de valeur 'contenu_doc' "
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
On est sur une fonction sans token, mais pour recuperer des infos en mode connecté comme le dictionnaire
|
||||||
|
je vais aller prendre le token du compte admin
|
||||||
|
"""
|
||||||
|
temp_admin_account = MYSY_GV.dbname['partnair_account'].find_one({'recid':str(local_partner_owner_recid),
|
||||||
|
'active':'1',
|
||||||
|
'is_partner_admin_account':'1',
|
||||||
|
'locked':'0'})
|
||||||
|
|
||||||
|
if( temp_admin_account is None ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Impossible de recupérer les données du partenaire ")
|
||||||
|
return False, " Impossible de recupérer les données du partenaire "
|
||||||
|
|
||||||
|
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||||
|
# Creation du dictionnaire d'information à utiliser pour la creation du doc
|
||||||
|
convention_dictionnary_data = {}
|
||||||
|
new_diction = {}
|
||||||
|
new_diction['token'] = temp_admin_account['token']
|
||||||
|
new_diction['list_stagiaire_id'] = []
|
||||||
|
new_diction['list_session_id'] = []
|
||||||
|
new_diction['list_class_id'] = []
|
||||||
|
new_diction['list_client_id'] = []
|
||||||
|
new_diction['list_apprenant_id'] = []
|
||||||
|
|
||||||
|
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||||
|
|
||||||
|
if (local_status is False):
|
||||||
|
return local_status, local_retval
|
||||||
|
|
||||||
|
convention_dictionnary_data = local_retval
|
||||||
|
|
||||||
|
convention_dictionnary_data["secret_key_signature"] = str(secret_key_for_sign)
|
||||||
|
|
||||||
|
body = {
|
||||||
|
"params": convention_dictionnary_data
|
||||||
|
}
|
||||||
|
|
||||||
|
html = contenu_doc_Template.render(params=body["params"])
|
||||||
|
|
||||||
html_mime = MIMEText(html, 'html')
|
html_mime = MIMEText(html, 'html')
|
||||||
|
|
||||||
|
@ -594,7 +650,7 @@ def Create_E_Signature_For_E_Document(diction):
|
||||||
str(inspect.stack()[0][3]) + " L'idientifiant du E-Document est invalide ")
|
str(inspect.stack()[0][3]) + " L'idientifiant du E-Document est invalide ")
|
||||||
return False, " L'idientifiant du E-Document est invalide "
|
return False, " L'idientifiant du E-Document est invalide "
|
||||||
|
|
||||||
|
local_partner_owner_recid = e_document_data['partner_owner_recid']
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -631,17 +687,50 @@ def Create_E_Signature_For_E_Document(diction):
|
||||||
with open(qr_code_img_file, "rb") as image2string:
|
with open(qr_code_img_file, "rb") as image2string:
|
||||||
qr_code_converted_string = base64.b64encode(image2string.read()).decode()
|
qr_code_converted_string = base64.b64encode(image2string.read()).decode()
|
||||||
|
|
||||||
print(" ### qr_code_converted_string = ", qr_code_converted_string)
|
|
||||||
img_qr_code = "data:image/png;base64," + str(qr_code_converted_string)
|
|
||||||
|
|
||||||
print(" ### img_qr_code = ", img_qr_code)
|
|
||||||
|
"""
|
||||||
|
On est sur une fonction sans token, mais pour recuperer des infos en mode connecté comme le dictionnaire
|
||||||
|
je vais aller prendre le token du compte admin
|
||||||
|
"""
|
||||||
|
temp_admin_account = MYSY_GV.dbname['partnair_account'].find_one({'recid': str(local_partner_owner_recid),
|
||||||
|
'active': '1',
|
||||||
|
'is_partner_admin_account': '1',
|
||||||
|
'locked': '0'})
|
||||||
|
|
||||||
|
if (temp_admin_account is None):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Impossible de recupérer les données du partenaire ")
|
||||||
|
return False, " Impossible de recupérer les données du partenaire "
|
||||||
|
|
||||||
|
Create_E_Signature_For_E_Document
|
||||||
|
# Creation du dictionnaire d'information à utiliser pour la creation du doc
|
||||||
|
convention_dictionnary_data = {}
|
||||||
|
new_diction = {}
|
||||||
|
new_diction['token'] = temp_admin_account['token']
|
||||||
|
new_diction['list_stagiaire_id'] = []
|
||||||
|
new_diction['list_session_id'] = []
|
||||||
|
new_diction['list_class_id'] = []
|
||||||
|
new_diction['list_client_id'] = []
|
||||||
|
new_diction['list_apprenant_id'] = []
|
||||||
|
|
||||||
|
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||||
|
|
||||||
|
if (local_status is False):
|
||||||
|
return local_status, local_retval
|
||||||
|
|
||||||
|
convention_dictionnary_data = local_retval
|
||||||
|
|
||||||
|
convention_dictionnary_data["mysy_signature_digitale"] = str(local_signature_digitale)
|
||||||
|
convention_dictionnary_data["mysy_url_securite"] = local_url_securite
|
||||||
|
convention_dictionnary_data["mysy_qrcode_securite"] = "data:image/png;base64," + qr_code_converted_string,
|
||||||
|
|
||||||
body = {
|
body = {
|
||||||
"params": {"mysy_signature_digitale":str(local_signature_digitale),
|
"params": convention_dictionnary_data
|
||||||
'mysy_url_securite':local_url_securite,
|
|
||||||
'mysy_qrcode_securite': "data:image/png;base64," + qr_code_converted_string,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source_data = str(e_document_data['source_document']) + "<div> cherifffffffff </div> <br/> <div> {{ mysy_url_securite }} </div> <br/> <div> </div>"
|
||||||
|
|
||||||
contenu_doc_Template = jinja2.Template(str(e_document_data['source_document']))
|
contenu_doc_Template = jinja2.Template(str(e_document_data['source_document']))
|
||||||
|
|
||||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||||
|
@ -672,6 +761,7 @@ def Create_E_Signature_For_E_Document(diction):
|
||||||
'secret_key_signature': str(diction['secret_key_signature']),
|
'secret_key_signature': str(diction['secret_key_signature']),
|
||||||
'email_destinataire': str(diction['email_destinataire'])}
|
'email_destinataire': str(diction['email_destinataire'])}
|
||||||
|
|
||||||
|
|
||||||
new_data = {}
|
new_data = {}
|
||||||
new_data['document_data_signed'] = final_encoded_pdf_to_string
|
new_data['document_data_signed'] = final_encoded_pdf_to_string
|
||||||
result = MYSY_GV.dbname['e_document_signe'].find_one_and_update(
|
result = MYSY_GV.dbname['e_document_signe'].find_one_and_update(
|
||||||
|
@ -703,34 +793,95 @@ def Create_E_Signature_For_E_Document(diction):
|
||||||
new_node = {"attached_file": file_to_attache_to_mail}
|
new_node = {"attached_file": file_to_attache_to_mail}
|
||||||
tab_files_to_attache_to_mail.append(new_node)
|
tab_files_to_attache_to_mail.append(new_node)
|
||||||
|
|
||||||
html = """\
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<br />
|
|
||||||
<div style="text-align: center;">
|
|
||||||
<nav style="text-align: center; font-weight: bold;">LOGO</nav>
|
|
||||||
<br />
|
|
||||||
<div style="text-align: center;">
|
|
||||||
<nav style="text-align: center; font-weight: bold;">SIGNATURE ELECTRONIQUE</nav>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
Bonjour
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div >
|
|
||||||
Merci de trouver en pièce jointe le document signé electroniquement
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
Cordialement.
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
"""
|
||||||
|
Recupération du modele de courrier.
|
||||||
|
le principe est de prendre le module du partenaire. si pas de modele du partenaire on
|
||||||
|
prend le modele par default
|
||||||
|
"""
|
||||||
|
courrier_template_model = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNED",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': str(local_partner_owner_recid)}
|
||||||
|
)
|
||||||
|
if( courrier_template_model == 1 ):
|
||||||
|
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNED",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': str(local_partner_owner_recid)}
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
courrier_template_model = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNED",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': "default"}
|
||||||
|
)
|
||||||
|
if (courrier_template_model == 1):
|
||||||
|
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNED",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': "default"}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " Aucun modèle de document configuré pour envoyer les e-documents signés ")
|
||||||
|
return False, " Aucun modèle de document configuré pour envoyer les e-documents signés "
|
||||||
|
|
||||||
|
if( "contenu_doc" not in courrier_template_data.keys() or str(courrier_template_data['contenu_doc']).strip() == ""):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Le modèle de document ne contient pas de valeur 'contenu_doc' ")
|
||||||
|
return False, " Le modèle de document ne contient pas de valeur 'contenu_doc' "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||||
|
|
||||||
|
"""
|
||||||
|
On est sur une fonction sans token, mais pour recuperer des infos en mode connecté comme le dictionnaire
|
||||||
|
je vais aller prendre le token du compte admin
|
||||||
|
"""
|
||||||
|
temp_admin_account = MYSY_GV.dbname['partnair_account'].find_one({'recid': str(local_partner_owner_recid),
|
||||||
|
'active': '1',
|
||||||
|
'is_partner_admin_account': '1',
|
||||||
|
'locked': '0'})
|
||||||
|
|
||||||
|
if (temp_admin_account is None):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Impossible de recupérer les données du partenaire ")
|
||||||
|
return False, " Impossible de recupérer les données du partenaire "
|
||||||
|
|
||||||
|
# Creation du dictionnaire d'information à utiliser pour la creation du doc
|
||||||
|
convention_dictionnary_data = {}
|
||||||
|
new_diction = {}
|
||||||
|
new_diction['token'] = temp_admin_account['token']
|
||||||
|
new_diction['list_stagiaire_id'] = []
|
||||||
|
new_diction['list_session_id'] = []
|
||||||
|
new_diction['list_class_id'] = []
|
||||||
|
new_diction['list_client_id'] = []
|
||||||
|
new_diction['list_apprenant_id'] = []
|
||||||
|
|
||||||
|
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||||
|
|
||||||
|
if (local_status is False):
|
||||||
|
return local_status, local_retval
|
||||||
|
|
||||||
|
convention_dictionnary_data = local_retval
|
||||||
|
|
||||||
|
|
||||||
|
body = {
|
||||||
|
"params": convention_dictionnary_data
|
||||||
|
}
|
||||||
|
|
||||||
|
html = contenu_doc_Template.render(params=body["params"])
|
||||||
|
|
||||||
|
html_mime = MIMEText(html, 'html')
|
||||||
|
|
||||||
# Creation de l'email à enoyer
|
# Creation de l'email à enoyer
|
||||||
msg = MIMEMultipart("alternative")
|
msg = MIMEMultipart("alternative")
|
||||||
|
@ -912,7 +1063,7 @@ def Sent_E_Document_Signature_Request(diction):
|
||||||
"""
|
"""
|
||||||
url_signature = MYSY_GV.CLIENT_URL_BASE+"E_Signature/"+str(e_document_data['_id'])
|
url_signature = MYSY_GV.CLIENT_URL_BASE+"E_Signature/"+str(e_document_data['_id'])
|
||||||
|
|
||||||
|
local_partner_owner_recid = e_document_data['partner_owner_recid']
|
||||||
|
|
||||||
"""
|
"""
|
||||||
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
|
||||||
|
@ -966,40 +1117,84 @@ def Sent_E_Document_Signature_Request(diction):
|
||||||
# Creation de l'email à enoyer
|
# Creation de l'email à enoyer
|
||||||
msg = MIMEMultipart("alternative")
|
msg = MIMEMultipart("alternative")
|
||||||
|
|
||||||
html = """\
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<br />
|
|
||||||
<div style="text-align: center;">
|
|
||||||
<nav style="text-align: center; font-weight: bold;">LOGO</nav>
|
|
||||||
<br />
|
|
||||||
<div style="text-align: center;">
|
|
||||||
<nav style="text-align: center; font-weight: bold;">SIGNATURE ELECTRONIQUE</nav>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
Bonjour
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div >
|
|
||||||
Cliquez sur le lien ci-dessous pour signer electroniquement le document : <br/>
|
|
||||||
|
|
||||||
""" + url_signature + """<br>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Le code d'ouverture du document est : """+ str(e_document_open_code) +"""
|
|
||||||
</p>
|
|
||||||
Cordialement.
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
"""
|
||||||
|
Recupération du modele de courrier.
|
||||||
|
le principe est de prendre le module du partenaire. si pas de modele du partenaire on
|
||||||
|
prend le modele par default
|
||||||
|
"""
|
||||||
|
courrier_template_model = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_REQUEST",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': str(local_partner_owner_recid)}
|
||||||
|
)
|
||||||
|
if (courrier_template_model == 1):
|
||||||
|
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_REQUEST",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': str(local_partner_owner_recid)}
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
courrier_template_model = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_REQUEST",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': "default"}
|
||||||
|
)
|
||||||
|
if (courrier_template_model == 1):
|
||||||
|
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||||
|
{'ref_interne': "E_DOCUMENT_SIGNATURE_REQUEST",
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'type_doc': 'email',
|
||||||
|
'partner_owner_recid': "default"}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
mycommon.myprint(str(
|
||||||
|
inspect.stack()[0][3]) + " Aucun modèle de document configuré pour envoyer les e-documents signés ")
|
||||||
|
return False, " Aucun modèle de document configuré pour envoyer les e-documents signés "
|
||||||
|
|
||||||
|
if ("contenu_doc" not in courrier_template_data.keys() or str(
|
||||||
|
courrier_template_data['contenu_doc']).strip() == ""):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Le modèle de document ne contient pas de valeur 'contenu_doc' ")
|
||||||
|
return False, " Le modèle de document ne contient pas de valeur 'contenu_doc' "
|
||||||
|
|
||||||
|
|
||||||
|
contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||||
|
|
||||||
|
# Creation du dictionnaire d'information à utiliser pour la creation du doc
|
||||||
|
convention_dictionnary_data = {}
|
||||||
|
new_diction = {}
|
||||||
|
new_diction['token'] = diction['token']
|
||||||
|
new_diction['list_stagiaire_id'] = []
|
||||||
|
new_diction['list_session_id'] = []
|
||||||
|
new_diction['list_class_id'] = []
|
||||||
|
new_diction['list_client_id'] = []
|
||||||
|
new_diction['list_apprenant_id'] = []
|
||||||
|
|
||||||
|
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||||
|
|
||||||
|
if (local_status is False):
|
||||||
|
return local_status, local_retval
|
||||||
|
|
||||||
|
convention_dictionnary_data = local_retval
|
||||||
|
|
||||||
|
convention_dictionnary_data["e_document_open_code"] = str(e_document_data['secret_key_open'])
|
||||||
|
convention_dictionnary_data["url_signature"] = str(url_signature)
|
||||||
|
|
||||||
|
body = {
|
||||||
|
"params": convention_dictionnary_data
|
||||||
|
}
|
||||||
|
|
||||||
|
html = contenu_doc_Template.render(params=body["params"])
|
||||||
|
|
||||||
|
html_mime = MIMEText(html, 'html')
|
||||||
|
|
||||||
#contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
#contenu_doc_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||||
#sourceHtml = contenu_doc_Template.render(params=body["params"])
|
#sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||||
|
|
1296
Log/log_file.log
1296
Log/log_file.log
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue