20/03/2024 - 22h30d

master
cherif 2024-03-22 18:54:55 +01:00
parent 383a17117e
commit 969bc26918
6 changed files with 5693 additions and 6 deletions

View File

@ -6,6 +6,7 @@
<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$/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>
<option name="SHOW_DIALOG" value="false" />

View File

@ -268,6 +268,9 @@ def Get_Given_E_Document_Not_Signed_No_Token(diction):
if( "signature_digitale" in New_retVal.keys() ):
del New_retVal['signature_digitale']
if ("document_data_signed" in New_retVal.keys()):
del New_retVal['document_data_signed']
val_tmp = val_tmp + 1
decode_data = user['document_data'].decode()
user['document_data'] = decode_data
@ -620,12 +623,13 @@ def Create_E_Signature_For_E_Document(diction):
qrcode.save(
qr_code_img_file,
scale=5,
border=10,
dark="darkblue",
)
qr_code_converted_string = ""
with open(qr_code_img_file, "rb") as image2string:
qr_code_converted_string = base64.b64encode(image2string.read())
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)
@ -635,7 +639,8 @@ def Create_E_Signature_For_E_Document(diction):
body = {
"params": {"mysy_signature_digitale":str(local_signature_digitale),
'mysy_url_securite':local_url_securite,
'mysy_qrcode_securite':img_qr_code},
'mysy_qrcode_securite': "data:image/png;base64," + qr_code_converted_string,
}
}
contenu_doc_Template = jinja2.Template(str(e_document_data['source_document']))

View File

@ -9719,9 +9719,8 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
sourceHtml = contenu_doc_Template.render(params=body["params"])
new_model_courrier_with_code_tag = str(sourceHtml) + " <br/> <div> Code Sécurité = {{ params.mysy_signature_digitale }} </div> \
<br/> <div> url Sécurité = {{ params.mysy_url_securite }} </div> " \
" <br/> qr code : <p> <img class='profil_img' src='{{ params.mysy_url_securite }}'>QR_CODE <br> yyyyy</p> "
new_model_courrier_with_code_tag = str(sourceHtml) + "<br/> <div> Lien sécurisé = {{ params.mysy_url_securite }} </div> <br/> " \
" <p style='width: 300px; text-align: center;'> <img style='height:200px; width:200px;' src='{{ params.mysy_qrcode_securite }}'>&nbsp;</p> "

File diff suppressed because one or more lines are too long

View File

@ -8983,3 +8983,140 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible d'envoyer la convention par email ", False
"""
Audite action session :
Cette fonction permet de lister les inscrits pour qui
les actions ci-dessous n'ont pas été faite :
- convocation
- convention
- etc
"""
def Audit_Session_Action_Inscrit(diction):
try:
field_list = ['token', 'session_id', ]
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
mycommon.myprint(str(inspect.stack()[0][
3]) + " - Le champ '" + val + "' n'est pas autorisé, Creation partenaire annulée")
return False, "Toutes les informations fournies ne sont pas valables"
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['token', 'session_id', ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
return False, "Toutes les informations necessaires n'ont pas été fournies"
# Recuperation du recid du partner
mydata = {}
mytoken = ""
if ("token" in diction.keys()):
if diction['token']:
mytoken = diction['token']
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({'token':str(diction['token'])})
if (local_status is not True):
return local_status, my_partner
# Verifier la validité de la session
is_valide_session_count = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_session_count != 1 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de la session est invalide ")
return False, " L'identifiant de la session est invalide "
session_data = MYSY_GV.dbname['session_formation'].find_one(
{'_id': ObjectId(str(diction['session_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
"""
Recuperer la listes des inscrit validé à cette session
"""
tab_email_inscrti_valide = []
tab_inscrit = MYSY_GV.dbname['inscription'].find({'session_id':str(diction['session_id']),
'status':'1',
'partner_owner_recid':str(my_partner['recid'])})
for email in tab_inscrit:
if( "email" in email):
tab_email_inscrti_valide.append(email['email'])
print(" Liste des email inscrit en tout = ", tab_email_inscrti_valide)
"""
Recuperer la liste des documents tracké pour cette session
"""
diction_list_tracked_doc = {}
diction_list_tracked_doc['token'] = str(diction['token'])
diction_list_tracked_doc['related_collection'] = "session_formation"
diction_list_tracked_doc['related_collection_recid'] = str(diction['session_id'])
local_status, local_retval = module_editique.Get_Editable_Document_By_Partner_By_Collection(diction_list_tracked_doc)
if( local_status is False ):
return local_status, local_retval
tab_statut_action = []
local_id = 0
for tmp_val in local_retval :
#print( tmp_val)
document_type = ast.literal_eval(tmp_val)
tab_inscrit_ok = []
node = {}
node['id'] = local_id
node['courrier_template_nom'] = document_type['courrier_template_nom']
node['courrier_template_ref_interne'] = document_type['courrier_template_nom']
node['tab_user_statut'] = []
local_id = local_id + 1
for local_email in tab_email_inscrti_valide:
email_exist = 0
sub_node = {}
for val in document_type['list_document_history_event'] :
if( val['local_target_collection_name'] == local_email ):
email_exist = 1
sub_node['_id'] = val['_id']
sub_node['email_inscrit'] = val['local_target_collection_name']
sub_node['date_update'] = val['date_update']
sub_node['local_update_by_email'] = val['local_update_by_email']
sub_node['statut'] = "1"
if( email_exist == 0 ):
sub_node['email_inscrit'] = local_email
sub_node['date_update'] = ""
sub_node['local_update_by_email'] = ""
sub_node['statut'] = "0"
node['tab_user_statut'].append(sub_node)
tab_statut_action.append(node)
RetObject = []
RetObject.append(mycommon.JSONEncoder().encode(tab_statut_action))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de réaliser l'audit de la session"

11
main.py
View File

@ -8033,6 +8033,17 @@ def Create_E_Signature_For_E_Document():
return jsonify(status=status, message=retval)
"""
API Pour auditer une session
"""
@app.route('/myclass/api/Audit_Session_Action_Inscrit/', methods=['POST','GET'])
@crossdomain(origin='*')
def Audit_Session_Action_Inscrit():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Audit_Session_Action_Inscrit : payload = ",str(payload))
localStatus, message= SF.Audit_Session_Action_Inscrit(payload)
return jsonify(status=localStatus, message=message )
if __name__ == '__main__':