11/06/2024 - 23h30
parent
404b2a6bab
commit
adb336147f
|
@ -1,10 +1,13 @@
|
|||
<?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="ssq">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="qqsd">
|
||||
<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$/suivi_pedagogique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/suivi_pedagogique_mgt.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_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -74,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00280" summary="28/04/2024 - 22h">
|
||||
<created>1714332210979</created>
|
||||
<option name="number" value="00280" />
|
||||
<option name="presentableId" value="LOCAL-00280" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1714332210979</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00281" summary="02/05/2024 - 22h">
|
||||
<created>1714678394239</created>
|
||||
<option name="number" value="00281" />
|
||||
|
@ -417,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1717867948695</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="329" />
|
||||
<task id="LOCAL-00329" summary="qqsd">
|
||||
<created>1718034595563</created>
|
||||
<option name="number" value="00329" />
|
||||
<option name="presentableId" value="LOCAL-00329" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1718034595564</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="330" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -459,7 +462,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="sds" />
|
||||
<MESSAGE value="sdsdd" />
|
||||
<MESSAGE value="ddd" />
|
||||
<MESSAGE value="17/05/2024 - 21h30" />
|
||||
|
@ -484,6 +486,7 @@
|
|||
<MESSAGE value="06/06/2024 - 20h" />
|
||||
<MESSAGE value="07/06/2024 - 22h30" />
|
||||
<MESSAGE value="ssq" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ssq" />
|
||||
<MESSAGE value="qqsd" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="qqsd" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,7 +1,10 @@
|
|||
"""
|
||||
Ce fichier permets de créer les inscription des stagiaires à une formation
|
||||
"""
|
||||
import base64
|
||||
import smtplib
|
||||
|
||||
import segno
|
||||
import xlsxwriter
|
||||
from email import encoders
|
||||
from email.mime.base import MIMEBase
|
||||
|
@ -12209,3 +12212,197 @@ def Get_List_Inscrit_OF_UE_And_Type_Evaluation_with_filter(diction):
|
|||
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écupérer la liste des inscrits"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction prends une liste d'inscription et une session
|
||||
pui créer un QR pour l'emargement
|
||||
"""
|
||||
def Create_Emargement_QR_Code_From_Inscription(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'tab_inscription_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_inscription_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 "
|
||||
|
||||
|
||||
# Verifier que les inscriptions sont valides
|
||||
my_inscription_ids = ""
|
||||
if ("tab_inscription_ids" in diction.keys()):
|
||||
if diction['tab_inscription_ids']:
|
||||
my_inscription_ids = diction['tab_inscription_ids']
|
||||
|
||||
|
||||
|
||||
tab_my_inscription_ids = str(my_inscription_ids).split(",")
|
||||
if(len(tab_my_inscription_ids) <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Aucun inscrit ")
|
||||
return False, " Aucun inscrit "
|
||||
|
||||
|
||||
for my_inscription_id in tab_my_inscription_ids:
|
||||
|
||||
# Verifier qui la formation n'a pas deja été evaluée
|
||||
tmp_count = MYSY_GV.dbname['inscription'].count_documents({'session_id': str(diction['session_id']),
|
||||
'_id': ObjectId(str(my_inscription_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'status':'1' })
|
||||
|
||||
if (tmp_count != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit "+str(my_inscription_id)+" est invalide ")
|
||||
return False, " L'identifiant de l'inscrit "+str(my_inscription_id)+" est invalide "
|
||||
|
||||
# Creation d'une clé securisé
|
||||
my_safe_token = mycommon.create_user_recid()
|
||||
|
||||
"""
|
||||
Mettre à jour l'inscription avec la clé
|
||||
"""
|
||||
tab_my_inscription_ids = str(my_inscription_ids).split(",")
|
||||
for my_inscription_id in tab_my_inscription_ids:
|
||||
|
||||
ret_val2 = MYSY_GV.dbname['inscription'].find_one_and_update(
|
||||
{'session_id': str(diction['session_id']),
|
||||
'_id': ObjectId(str(my_inscription_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'status': '1'},
|
||||
{"$set": {'emargement_qr_safe_token':str(my_safe_token)}},
|
||||
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",
|
||||
)
|
||||
|
||||
print(" ### Create_Emargement_QR_Code_From_Inscription url_for_qr_code = ", url_for_qr_code)
|
||||
|
||||
if os.path.exists(qr_code_img_file):
|
||||
return True, send_file(qr_code_img_file, as_attachment=True)
|
||||
|
||||
return False, " Impossible de générer les QR Code (1) "
|
||||
|
||||
|
||||
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 de créer le QR code "
|
||||
|
||||
"""
|
||||
Verifier qu'un QR code est valide avec le mail de la personne.
|
||||
C'est le controle qui est fait avant acces à l'emargemnt
|
||||
"""
|
||||
|
||||
def Check_Emargement_QR_Code_From_Inscription_No_Token(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_owner_recid', 'my_safe_token', 'session_id', 'user_email']
|
||||
|
||||
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 = ['partner_owner_recid', 'my_safe_token', 'session_id', 'user_email']
|
||||
|
||||
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
|
||||
"""
|
||||
|
||||
local_status, my_partner = mycommon.Get_Connected_User_Partner_Data_From_RecID(
|
||||
str(diction['partner_owner_recid']))
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# Verifier que les info sont valide
|
||||
is_inscription_valide_count = MYSY_GV.dbname['inscription'].count_documents({'session_id': str(diction['session_id']),
|
||||
'emargement_qr_safe_token': str(diction['my_safe_token']),
|
||||
'email': str( diction['user_email']),
|
||||
'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'status': '1'})
|
||||
|
||||
if( is_inscription_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Les identifiants sont invalides ")
|
||||
return False, " Les identifiants sont invalides "
|
||||
|
||||
|
||||
|
||||
return True, " Les identifiants sont OK "
|
||||
|
||||
|
||||
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 de vérifier la validité des information "
|
||||
|
||||
|
|
3013
Log/log_file.log
3013
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -8441,7 +8441,7 @@ def Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path,
|
|||
|
||||
# Verifier que ce client a bien des inscriptions valide pour cette session
|
||||
is_valide_inscription_pr_client = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'client_rattachement_id': str(diction['partner_client_id']),
|
||||
{'facture_client_rattachement_id': str(diction['partner_client_id']),
|
||||
'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'status': '1'})
|
||||
|
@ -8583,7 +8583,7 @@ def Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path,
|
|||
inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'client_rattachement_id':str(diction['partner_client_id'])})
|
||||
'facture_client_rattachement_id':str(diction['partner_client_id'])})
|
||||
tab_apprenant = []
|
||||
tab_participant = []
|
||||
for val in inscription_data:
|
||||
|
@ -8824,7 +8824,7 @@ def Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path,
|
|||
inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'client_rattachement_id': str(
|
||||
'facture_client_rattachement_id': str(
|
||||
diction['partner_client_id'])})
|
||||
|
||||
for inscription in inscription_data:
|
||||
|
@ -9756,7 +9756,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
|
||||
# Verifier que ce client a bien des inscriptions valide pour cette session
|
||||
nb_valide_inscription_pr_client = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'client_rattachement_id': str(diction['partner_client_id']),
|
||||
{'facture_client_rattachement_id': str(diction['partner_client_id']),
|
||||
'session_id': str(diction['session_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'status': '1',
|
||||
|
@ -9780,7 +9780,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
qry = {'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'client_rattachement_id':str(diction['partner_client_id']),
|
||||
'facture_client_rattachement_id':str(diction['partner_client_id']),
|
||||
'_id':{'$in':diction['tab_inscription_ids']}}
|
||||
|
||||
|
||||
|
@ -9788,7 +9788,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'client_rattachement_id':str(diction['partner_client_id']),
|
||||
'facture_client_rattachement_id':str(diction['partner_client_id']),
|
||||
'_id':{'$in':diction['tab_inscription_ids']}})
|
||||
tab_apprenant = []
|
||||
tab_participant = []
|
||||
|
@ -9871,6 +9871,8 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
ction_paiement_nb_jour = ction_paiement_data['nb_jour']
|
||||
ction_paiement_depart = ction_paiement_data['depart']
|
||||
|
||||
|
||||
|
||||
nb_jour_int = mycommon.tryInt(str(ction_paiement_nb_jour))
|
||||
today = datetime.today()
|
||||
date_echance = datetime.today()
|
||||
|
|
36
main.py
36
main.py
|
@ -9983,6 +9983,42 @@ def Delete_Suivi_Pedagogique():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour créer un fichier QR code pour
|
||||
les émargements
|
||||
"""
|
||||
@app.route('/myclass/api/Create_Emargement_QR_Code_From_Inscription/<token>/<session_id>/<tab_inscription_ids>', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Create_Emargement_QR_Code_From_Inscription(token, session_id, tab_inscription_ids):
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
payload = {}
|
||||
payload['token'] = str(token)
|
||||
payload['session_id'] = str(session_id)
|
||||
payload['tab_inscription_ids'] = str(tab_inscription_ids)
|
||||
|
||||
print(" ### Create_Emargement_QR_Code_From_Inscription : payload = ",str(payload))
|
||||
|
||||
localStatus, response= inscription.Create_Emargement_QR_Code_From_Inscription(payload)
|
||||
if(localStatus ):
|
||||
return response
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
"""
|
||||
API qui permet de verifier la validité d'un QR Code d'emargement
|
||||
"""
|
||||
@app.route('/myclass/api/Check_Emargement_QR_Code_From_Inscription_No_Token/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Check_Emargement_QR_Code_From_Inscription_No_Token():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Check_Emargement_QR_Code_From_Inscription_No_Token payload = ",payload)
|
||||
status, retval = inscription.Check_Emargement_QR_Code_From_Inscription_No_Token(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
|
|
@ -1512,6 +1512,8 @@ def GerneratePDF_Partner_Invoice(diction):
|
|||
my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
|
||||
if( "e_document_signe_id" in Order_header_data.keys() and Order_header_data['e_document_signe_id'] ):
|
||||
# On retourne la e_Invoice securisée
|
||||
|
||||
|
@ -1535,8 +1537,7 @@ def GerneratePDF_Partner_Invoice(diction):
|
|||
|
||||
if(e_Invoice_Secure_Data is None ):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " Le document sécurisé associé à la facture est invalide 'e_document_signe_id' = ",
|
||||
str(Order_header_data['e_document_signe_id']))
|
||||
3]) + " Le document sécurisé associé à la facture est invalide 'e_document_signe_id' = "+str(Order_header_data['e_document_signe_id']))
|
||||
|
||||
return False, " Le document sécurisé associé à la facture est invalide "
|
||||
|
||||
|
@ -2666,17 +2667,20 @@ def Create_Invoice_Avoir_Total(diction):
|
|||
|
||||
|
||||
"""
|
||||
Verifier que la factre est valide
|
||||
Verifier que la facture est valide et s'assurer qu'il n'y pas un avoir (on est en mode avoir TOTAL).
|
||||
Colonne : 'credit_note_ref'
|
||||
"""
|
||||
is_valide_invoice_cout = MYSY_GV.dbname['partner_invoice_header'].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
'locked':'0',
|
||||
'credit_note_ref': {'$exists': False},
|
||||
})
|
||||
|
||||
if( is_valide_invoice_cout <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la facture est invalide ")
|
||||
return False, " L'identifiant de la facture est invalide ", False
|
||||
return False, " L'identifiant de la facture est invalide Ou le document a déjà une avoir ", False
|
||||
|
||||
|
||||
|
||||
|
@ -2741,6 +2745,10 @@ def Create_Invoice_Avoir_Total(diction):
|
|||
|
||||
if( "_id" in local_credit_note.keys() ):
|
||||
del local_credit_note['_id']
|
||||
|
||||
if( "e_document_signe_id" in local_credit_note.keys()):
|
||||
del local_credit_note['e_document_signe_id']
|
||||
|
||||
"""
|
||||
Insertion de l'avoir
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue