22/06/24 - 17h30
parent
92200a89f7
commit
3f020e68c5
|
@ -1,8 +1,14 @@
|
|||
<?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="ss">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/06/24 - 22h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -72,13 +78,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00287" summary="06/05/2024 - 22h30">
|
||||
<created>1715027674052</created>
|
||||
<option name="number" value="00287" />
|
||||
<option name="presentableId" value="LOCAL-00287" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1715027674052</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00288" summary="07/05/2024 - 17h30">
|
||||
<created>1715096332563</created>
|
||||
<option name="number" value="00288" />
|
||||
|
@ -415,7 +414,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1718903703380</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="336" />
|
||||
<task id="LOCAL-00336" summary="21/06/24 - 22h30">
|
||||
<created>1719001828472</created>
|
||||
<option name="number" value="00336" />
|
||||
<option name="presentableId" value="LOCAL-00336" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1719001828472</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="337" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -457,7 +463,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="19/05/2024 - 22h15" />
|
||||
<MESSAGE value="20/05/2024 - 14h00" />
|
||||
<MESSAGE value="20/05/2024 - 22h00" />
|
||||
<MESSAGE value="21/05/2024 - 21h" />
|
||||
|
@ -482,6 +487,7 @@
|
|||
<MESSAGE value="17/06/2024 - 21h30" />
|
||||
<MESSAGE value="18/06/2024 - 21h30" />
|
||||
<MESSAGE value="ss" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ss" />
|
||||
<MESSAGE value="21/06/24 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="21/06/24 - 22h30" />
|
||||
</component>
|
||||
</project>
|
|
@ -12221,6 +12221,291 @@ def Get_List_Inscrit_OF_UE_And_Type_Evaluation_with_filter(diction):
|
|||
return False, "Impossible de récupérer la liste des inscrits"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
22/06/2024 - nouvelle methode pour envoyer les demandes
|
||||
d'emargement de manière securisée, à l'image de la gestion des QR code
|
||||
"""
|
||||
"""
|
||||
Cette fonction prends une liste d'inscription et une session
|
||||
pui créer un QR pour l'emargement
|
||||
"""
|
||||
|
||||
def Create_Emargement_Send_Email_From_Inscription(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'tab_emargement_ids']
|
||||
|
||||
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é")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'session_id', 'tab_emargement_ids']
|
||||
|
||||
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, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# Verifier que la session est valide
|
||||
is_session_id_valide = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'_id': ObjectId(str(diction['session_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_session_id_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
|
||||
"""
|
||||
Recuperation du modèle de courrier pour la demande d'emargement
|
||||
"""
|
||||
local_diction = {}
|
||||
local_diction['ref_interne'] = "EMARGEMENT_REQUEST_EMAIL"
|
||||
local_diction['type_doc'] = "email"
|
||||
local_diction['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(local_diction)
|
||||
if (courrier_data_status is False):
|
||||
return courrier_data_status, courrier_data_retval
|
||||
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port = mycommon.Get_Partner_SMTP_Param(
|
||||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
|
||||
|
||||
# Verifier que les inscriptions sont valides
|
||||
my_emargement_ids = ""
|
||||
if ("tab_emargement_ids" in diction.keys()):
|
||||
if diction['tab_emargement_ids']:
|
||||
my_emargement_ids = diction['tab_emargement_ids']
|
||||
|
||||
|
||||
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
if(len(tab_my_emargement_ids) <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Aucune Séquence ")
|
||||
return False, " Aucun Séquence "
|
||||
|
||||
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
|
||||
# Verifier qui la formation n'a pas deja été evaluée
|
||||
tmp_count = MYSY_GV.dbname['emargement'].count_documents({'session_id': str(diction['session_id']),
|
||||
'_id': ObjectId(str(my_emargement_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
})
|
||||
|
||||
|
||||
|
||||
if (tmp_count != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de l'émargement "+str(my_emargement_id)+" est invalide ")
|
||||
return False, " L'identifiant de l'émargement "+str(my_emargement_id)+" est invalide "
|
||||
|
||||
# Creation d'une clé securisé
|
||||
my_safe_token = mycommon.create_user_recid()
|
||||
|
||||
"""
|
||||
Mettre à jour l'inscription avec la clé
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
|
||||
ret_val2 = MYSY_GV.dbname['emargement'].find_one_and_update(
|
||||
{'session_id': str(diction['session_id']),
|
||||
'_id': ObjectId(str(my_emargement_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'
|
||||
},
|
||||
{"$set": {'emargement_qr_safe_token':str(my_safe_token), 'statut':'1',
|
||||
'date_envoi':str(now), 'update_by':str(my_partner['_id'])}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
url_for_qr_code = str(MYSY_GV.CLIENT_URL_BASE)+"qr_emargement/"+str(diction['session_id'])+"/"+str(my_partner['recid'])+"/"+str(my_safe_token)+"/"
|
||||
ts = datetime.now().timestamp()
|
||||
ts = str(ts).replace(".", "").replace(",", "")[-3:]
|
||||
qr_code_img_file = str(MYSY_GV.TEMPORARY_DIRECTORY_V2) + "qr_code_" + str(ts) + ".png"
|
||||
|
||||
qrcode = segno.make_qr(str(url_for_qr_code))
|
||||
qrcode.save(
|
||||
qr_code_img_file,
|
||||
scale=5,
|
||||
dark="darkblue",
|
||||
)
|
||||
|
||||
"""
|
||||
25/01/2024 : Apres l'envoi de la demande
|
||||
d'emargement, on log une action dans la collection ==> courrier_template_tracking_history
|
||||
"""
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
|
||||
|
||||
val_emarge = MYSY_GV.dbname['emargement'].find_one({'_id':ObjectId(str(my_emargement_id)), 'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
|
||||
|
||||
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(
|
||||
my_partner, "EMARGEMENT_FORMATION", str(val_emarge['session_id']), "inscription", str(val_emarge['inscription_id']),
|
||||
"")
|
||||
|
||||
"""
|
||||
Debut de la procedure d'envoie de l'email
|
||||
"""
|
||||
convention_dictionnary_data = {}
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
new_diction['list_stagiaire_id'] = []
|
||||
new_diction['list_session_id'] = [ObjectId(str(diction['session_id']))]
|
||||
new_diction['list_class_id'] = []
|
||||
new_diction['list_client_id'] = []
|
||||
|
||||
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||
|
||||
if (local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
emargement_dictionnary_data = local_retval
|
||||
emargement_dictionnary_data['mysyurl'] = url_for_qr_code
|
||||
|
||||
smtpserver = None
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
else:
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
|
||||
|
||||
"""
|
||||
on envoi qu'un seul mail d'emargement par personnes.
|
||||
1 - On va aller recuperer la liste des personnes concernée (inscription_id)
|
||||
2 - Apres avoir envoyer les email, on va venir mettre à jour la table emargement id)
|
||||
"""
|
||||
|
||||
cpt_email_envoye = 0
|
||||
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
|
||||
"""
|
||||
Des qu'on envoie un emailn on met l'inscription_id dans la collection 'tab_inscription_id_emargement_send'
|
||||
Avant d'envoyer un email à un inscrit on verifie qu'il n'est pa dans la table : tab_inscription_id_emargement_send
|
||||
|
||||
"""
|
||||
tab_inscription_id_emargement_send = []
|
||||
|
||||
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
|
||||
my_emargement_data = MYSY_GV.dbname['emargement'].find_one({'_id':ObjectId(str(my_emargement_id)),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
|
||||
if( str(my_emargement_data['inscription_id']) not in tab_inscription_id_emargement_send ):
|
||||
|
||||
tab_inscription_id_emargement_send.append(str(my_emargement_data['inscription_id']))
|
||||
cpt_email_envoye = cpt_email_envoye + 1
|
||||
|
||||
# Recuperation des données de l'inscrit
|
||||
local_inscrit_data = mycommon.Get_Inscrit_And_Apprenant_Data({'token':str(diction['token']), 'inscrit_id':str(my_emargement_data['inscription_id'])})
|
||||
emargement_dictionnary_data['emargement_inscrit_data'] = local_inscrit_data
|
||||
|
||||
# Recuperation des données de la formation
|
||||
myclass_data = MYSY_GV.dbname['myclass'].find_one( {'internal_url':str(my_emargement_data['class_internal_url']), 'partner_owner_recid':my_partner['recid']}, {'title':1})
|
||||
emargement_dictionnary_data['emargement_class_data'] = myclass_data
|
||||
|
||||
emargement_dictionnary_data['emargement_data'] = my_emargement_data
|
||||
|
||||
body = {
|
||||
"params": emargement_dictionnary_data,
|
||||
}
|
||||
|
||||
#print( " ### emargement_dictionnary_data ===== ", emargement_dictionnary_data)
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(courrier_data_retval['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
# Traitement du corps du mail
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
msg['to'] = str(str(my_emargement_data['email']))
|
||||
val = smtpserver.send_message(msg)
|
||||
print(" Email demande emargement envoyé " + str(val))
|
||||
|
||||
else:
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
msg['to'] = str(str(my_emargement_data['email']))
|
||||
val = smtpserver.send_message(msg)
|
||||
print(" Email demande emargement envoyé " + str(val))
|
||||
|
||||
smtpserver.close()
|
||||
|
||||
print(" NB_email envoyé = ", cpt_email_envoye)
|
||||
return True, "Les demandes d'émargement ont été correctement envoyées "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer les demandes d'émargement "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction prends une liste d'inscription et une session
|
||||
pui créer un QR pour l'emargement
|
||||
|
@ -12299,7 +12584,8 @@ def Create_Emargement_QR_Code_From_Inscription(diction):
|
|||
tmp_count = MYSY_GV.dbname['emargement'].count_documents({'session_id': str(diction['session_id']),
|
||||
'_id': ObjectId(str(my_emargement_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'statut':'0' })
|
||||
'valide':'1',
|
||||
'locked':'0' })
|
||||
|
||||
if (tmp_count != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de l'émargement "+str(my_emargement_id)+" est invalide ")
|
||||
|
@ -12309,8 +12595,10 @@ def Create_Emargement_QR_Code_From_Inscription(diction):
|
|||
my_safe_token = mycommon.create_user_recid()
|
||||
|
||||
"""
|
||||
Mettre à jour l'inscription avec la clé
|
||||
Mettre à jour l'inscription avec la , et on met le statut à "1" pour dire qu'on a demarré le process
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
|
||||
|
@ -12318,8 +12606,9 @@ def Create_Emargement_QR_Code_From_Inscription(diction):
|
|||
{'session_id': str(diction['session_id']),
|
||||
'_id': ObjectId(str(my_emargement_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'statut': '0'},
|
||||
{"$set": {'emargement_qr_safe_token':str(my_safe_token)}},
|
||||
'valide':'1','locked':'0'},
|
||||
{"$set": {'emargement_qr_safe_token':str(my_safe_token), 'statut':'1',
|
||||
'date_envoi':str(now), 'update_by':str(my_partner['_id'])}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
@ -12338,6 +12627,19 @@ def Create_Emargement_QR_Code_From_Inscription(diction):
|
|||
|
||||
print(" ### Create_Emargement_QR_Code_From_Inscription url_for_qr_code = ", url_for_qr_code)
|
||||
|
||||
"""
|
||||
25/01/2024 : Apres l'envoi de la demande
|
||||
d'emargement, on log une action dans la collection ==> courrier_template_tracking_history
|
||||
"""
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
val_emarge = MYSY_GV.dbname['emargement'].find_one({'_id':ObjectId(str(my_emargement_id)), 'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
|
||||
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(
|
||||
my_partner, "EMARGEMENT_FORMATION", str(val_emarge['session_id']), "inscription", str(val_emarge['inscription_id']),
|
||||
"")
|
||||
|
||||
if os.path.exists(qr_code_img_file):
|
||||
return True, send_file(qr_code_img_file, as_attachment=True)
|
||||
|
||||
|
@ -12396,7 +12698,7 @@ def Check_Emargement_QR_Code_From_Inscription_No_Token(diction):
|
|||
'emargement_qr_safe_token': str(diction['my_safe_token']),
|
||||
'email': str( diction['user_email']),
|
||||
'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'statut': '0'})
|
||||
'statut': '1'})
|
||||
|
||||
if( is_emargement_valide_count <= 0 ):
|
||||
mycommon.myprint(
|
||||
|
@ -12411,7 +12713,7 @@ def Check_Emargement_QR_Code_From_Inscription_No_Token(diction):
|
|||
'emargement_qr_safe_token': str(diction['my_safe_token']),
|
||||
'email': str(diction['user_email']),
|
||||
'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'statut': '0'}):
|
||||
'statut': '1'}):
|
||||
|
||||
|
||||
user = {}
|
||||
|
@ -12463,7 +12765,7 @@ def Update_Emargement_QR_Code_From_Inscription_No_Token(file_img=None, Folder=No
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_owner_recid', 'my_safe_token', 'tab_emargement_ids', 'is_present']
|
||||
field_list = ['partner_owner_recid', 'my_safe_token', 'tab_emargement_ids', 'is_present', 'signature_img_selected']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -12475,7 +12777,7 @@ def Update_Emargement_QR_Code_From_Inscription_No_Token(file_img=None, Folder=No
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['partner_owner_recid', 'my_safe_token', 'tab_emargement_ids', 'is_present']
|
||||
field_list_obligatoire = ['partner_owner_recid', 'my_safe_token', 'tab_emargement_ids', 'is_present', 'signature_img_selected']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -12488,6 +12790,8 @@ def Update_Emargement_QR_Code_From_Inscription_No_Token(file_img=None, Folder=No
|
|||
appelle cette API
|
||||
"""
|
||||
|
||||
|
||||
|
||||
local_status, my_partner = mycommon.Get_Connected_User_Partner_Data_From_RecID(
|
||||
str(diction['partner_owner_recid']))
|
||||
if (local_status is not True):
|
||||
|
@ -12505,7 +12809,7 @@ def Update_Emargement_QR_Code_From_Inscription_No_Token(file_img=None, Folder=No
|
|||
is_emargement_valide_count = MYSY_GV.dbname['emargement'].count_documents({'emargement_qr_safe_token': str(diction['my_safe_token']),
|
||||
'_id': ObjectId(str( my_emargement_id) ),
|
||||
'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'statut': '0'})
|
||||
'statut': '1'})
|
||||
|
||||
if( is_emargement_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
|
@ -12523,17 +12827,20 @@ def Update_Emargement_QR_Code_From_Inscription_No_Token(file_img=None, Folder=No
|
|||
with open(saved_file, "rb") as imageFile:
|
||||
image_signature_manuelle_string = base64.b64encode(imageFile.read()).decode()
|
||||
|
||||
"""
|
||||
22/06/204 - On abandone l'approche qui consiste a envoyer le fichier de signature.
|
||||
on va plutot envoyer directement la signature sous forme d'image.
|
||||
"""
|
||||
|
||||
|
||||
image_signature_manuelle_string_v2 = diction['signature_img_selected']
|
||||
|
||||
tab_my_emargement_ids = str(my_emargement_ids).split(",")
|
||||
for my_emargement_id in tab_my_emargement_ids:
|
||||
data_cle = {'emargement_qr_safe_token': str(diction['my_safe_token']),
|
||||
'_id': ObjectId(str(my_emargement_id)),
|
||||
'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'statut': '0'}
|
||||
|
||||
|
||||
print(" ### data_cle = ", data_cle)
|
||||
|
||||
'statut': '1'}
|
||||
|
||||
is_present = ""
|
||||
if ("is_present" in diction.keys()):
|
||||
|
@ -12549,7 +12856,10 @@ def Update_Emargement_QR_Code_From_Inscription_No_Token(file_img=None, Folder=No
|
|||
data_update['statut'] = "2"
|
||||
data_update['date_emargement'] = now
|
||||
data_update['update_by'] = str(my_partner['_id'])
|
||||
data_update["mysy_manual_signature_img"] = "data:image/png;base64," + image_signature_manuelle_string
|
||||
|
||||
#data_update["mysy_manual_signature_img"] = "data:image/png;base64," + image_signature_manuelle_string
|
||||
|
||||
data_update["mysy_manual_signature_img"] = image_signature_manuelle_string_v2
|
||||
|
||||
if (is_present == "1"):
|
||||
data_update['is_present'] = True
|
||||
|
|
11111
Log/log_file.log
11111
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -5579,7 +5579,6 @@ def Create_Convention_By_Client_PDF(diction):
|
|||
|
||||
contenu_doc_Template = jinja2.Template(str(template_courrier_data['contenu_doc']))
|
||||
|
||||
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
|
|
|
@ -384,6 +384,11 @@ def CreateTableauEmargement_From_Sequence(diction):
|
|||
new_my_local_data['statut'] = "0"
|
||||
new_my_local_data['date_envoi'] = ""
|
||||
|
||||
new_my_local_data['date_update'] = str(datetime.now())
|
||||
new_my_local_data['update_by'] = str(my_partner['recid'])
|
||||
new_my_local_data['valide'] = "1"
|
||||
new_my_local_data['locked'] = "0"
|
||||
|
||||
new_my_local_data['partner_owner_recid'] = str(str(partner_recid))
|
||||
|
||||
#print("### emargement insertion de : "+str(new_my_local_data))
|
||||
|
@ -477,6 +482,9 @@ def GetTableauEmargement(diction):
|
|||
if ("date_emargement" not in retval.keys()):
|
||||
user['date_emargement'] = ""
|
||||
|
||||
if ("mysy_manual_signature_img" not in retval.keys()):
|
||||
user['mysy_manual_signature_img'] = ""
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
|
18
main.py
18
main.py
|
@ -10026,6 +10026,24 @@ def Create_Emargement_QR_Code_From_Inscription(token, session_id, tab_emargement
|
|||
return False
|
||||
|
||||
|
||||
"""
|
||||
API :
|
||||
22/06/2024 - Nouvelle version d'envoi des demandes d'emargement par email
|
||||
"""
|
||||
|
||||
"""
|
||||
API pour créer un fichier QR code pour
|
||||
les émargements
|
||||
"""
|
||||
@app.route('/myclass/api/Create_Emargement_Send_Email_From_Inscription/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Create_Emargement_Send_Email_From_Inscription():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Create_Emargement_Send_Email_From_Inscription : payload = ",str(payload))
|
||||
status, retval = inscription.Create_Emargement_Send_Email_From_Inscription(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
"""
|
||||
API qui permet de verifier la validité d'un QR Code d'emargement
|
||||
"""
|
||||
|
|
135
prj_common.py
135
prj_common.py
|
@ -4987,8 +4987,8 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
|
||||
json_formatted_str = json.dumps(dictionnary_data, indent=2)
|
||||
|
||||
#print(" ### AFFICHAGE dU data dictionnary ")
|
||||
#print(json_formatted_str)
|
||||
print(" ### AFFICHAGE dU data dictionnary ")
|
||||
print(json_formatted_str)
|
||||
|
||||
|
||||
return True, dictionnary_data
|
||||
|
@ -6143,3 +6143,134 @@ def Check_Partner_Session_Alert(diction):
|
|||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de verifier si la session est ok ", False
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de recuper les données du modele de courrier en prenant
|
||||
en compte le modèle standard
|
||||
c'est a dire, si on ne trouve pas de courrier pour le client, on va cherche le courrier modele de base du système
|
||||
"""
|
||||
def Get_Courrier_Template_Include_Default_Data(diction):
|
||||
try:
|
||||
diction = strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_owner_recid', 'ref_interne', 'type_doc']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['partner_owner_recid', 'ref_interne', 'type_doc']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
courrier_template_data_count = MYSY_GV.dbname['courrier_template'].count_documents({'partner_owner_recid':diction['partner_owner_recid'],
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'type_doc':str(diction['type_doc']),
|
||||
'ref_interne':str(diction['ref_interne'])})
|
||||
if( courrier_template_data_count > 0 ):
|
||||
courrier_template_data_data = MYSY_GV.dbname['courrier_template'].find_one({'partner_owner_recid':diction['partner_owner_recid'],
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'type_doc':str(diction['type_doc']),
|
||||
'ref_interne':str(diction['ref_interne'])})
|
||||
|
||||
return True, courrier_template_data_data
|
||||
else:
|
||||
courrier_template_data_count = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||
{'partner_owner_recid': 'default',
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'type_doc': str(diction['type_doc']),
|
||||
'ref_interne': str(diction['ref_interne'])})
|
||||
|
||||
if (courrier_template_data_count > 0):
|
||||
courrier_template_data_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'partner_owner_recid': 'default',
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'type_doc': str(diction['type_doc']),
|
||||
'ref_interne': str(diction['ref_interne'])})
|
||||
|
||||
return True, courrier_template_data_data
|
||||
else:
|
||||
myprint(
|
||||
str(inspect.stack()[0][3]) + " Il n'y a aucun modèle de document avec la reférence : "+str(diction['ref_interne'])+" de Type : "+str(diction['type_doc']))
|
||||
return False, " Il n'y a aucun modèle de document avec la reférence : "+str(diction['ref_interne'])+" de Type : "+str(diction['type_doc'])
|
||||
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récuperer les données du modèle de courrier "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de recuper les données du modele de courrier SANS PRENDRE EN COMPTE le modèle standard (default)
|
||||
c'est a dire, si on ne trouve pas de courrier pour le client, ON NE VA PAS chercher le courrier modele de base du système
|
||||
"""
|
||||
def Get_Courrier_Template_Exclude_Default_Data(diction):
|
||||
try:
|
||||
diction = strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_owner_recid', 'ref_interne', 'type_doc']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['partner_owner_recid', 'ref_interne', 'type_doc']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
courrier_template_data_count = MYSY_GV.dbname['courrier_template'].count_documents({'partner_owner_recid':diction['partner_owner_recid'],
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'type_doc':str(diction['type_doc']),
|
||||
'ref_interne':str(diction['ref_interne'])})
|
||||
if( courrier_template_data_count > 0 ):
|
||||
courrier_template_data_data = MYSY_GV.dbname['courrier_template'].find_one({'partner_owner_recid':diction['partner_owner_recid'],
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'type_doc':str(diction['type_doc']),
|
||||
'ref_interne':str(diction['ref_interne'])})
|
||||
|
||||
return True, courrier_template_data_data
|
||||
else:
|
||||
myprint(
|
||||
str(inspect.stack()[0][3]) + " Il n'y a aucun modèle de document avec la reférence : " + str(
|
||||
diction['ref_interne']) + " de Type : " + str(diction['type_doc']))
|
||||
return False, " Il n'y a aucun modèle de document avec la reférence : " + str(
|
||||
diction['ref_interne']) + " de Type : " + str(diction['type_doc'])
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récuperer les données du modèle de courrier "
|
||||
|
|
Loading…
Reference in New Issue