10/03/2025 - 13h
parent
62d8938a06
commit
b9d5010c69
|
@ -3,8 +3,10 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="05/03/2025 - 18h">
|
||||
<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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
|
@ -12186,7 +12186,7 @@ Ici l'inscription n'est pas validée encore
|
|||
|
||||
def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction):
|
||||
try:
|
||||
field_list = ['partner_owner_recid', 'class_internal_url', 'code_session', 'status', 'email', 'nom',
|
||||
field_list = ['partner_owner_recid', 'class_internal_url', 'status', 'email', 'nom',
|
||||
'class_title', 'code_session', 'client_nom', 'client_rattachement_id',
|
||||
'session_id']
|
||||
incom_keys = diction.keys()
|
||||
|
@ -12194,7 +12194,7 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction
|
|||
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"
|
||||
return False, "Toutes les informations fournies ne sont pas valables", ""
|
||||
|
||||
|
||||
# Recuperation du recid du partner
|
||||
|
@ -12206,7 +12206,27 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction
|
|||
|
||||
|
||||
partner_recid = diction['partner_owner_recid']
|
||||
|
||||
"""
|
||||
07/03/2025 :
|
||||
Etape 0 : Verifier si ceci concerne une demande stockée dans la collection 'client_preinsc_update_request'.
|
||||
Si oui, alors cela conerne le cas un client doit créer lui la liste des tous preinscrit en respectant le nombre
|
||||
max.
|
||||
"""
|
||||
max_presinscrit = "0"
|
||||
is_client_preinsc_update_request = ""
|
||||
is_client_preinsc_update_request_data = MYSY_GV.dbname['client_preinsc_update_request'].find_one({'partner_owner_recid': str(partner_recid),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'client_id': str(diction['client_rattachement_id']),
|
||||
'session_id': str(diction['session_id'])})
|
||||
|
||||
if( is_client_preinsc_update_request_data and "max_presinscrit" in is_client_preinsc_update_request_data.keys()):
|
||||
max_presinscrit = str(is_client_preinsc_update_request_data['max_presinscrit'])
|
||||
is_client_preinsc_update_request = "1"
|
||||
|
||||
|
||||
print(" #### is_client_preinsc_update_request_data = ", is_client_preinsc_update_request_data)
|
||||
"""
|
||||
Etape 1 : si on a le champ 'code session' saisie par l'utilisateur,
|
||||
alors on va commencer par aller cherche toutes les session avec un regex de la valeur saisie filter sur le partner_recid
|
||||
|
@ -12226,7 +12246,7 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction
|
|||
|
||||
if (list_session_id_count <= 0):
|
||||
# Aucune session
|
||||
return True, []
|
||||
return True, [], ""
|
||||
|
||||
for val in MYSY_GV.dbname['session_formation'].find(qry_list_session_id):
|
||||
list_session_id.append(str(val['_id']))
|
||||
|
@ -12496,15 +12516,116 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction
|
|||
else:
|
||||
val['session_ondemande'] = "0"
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
"""
|
||||
S'il n'y aucune personne déjà inscrite et que 'is_client_preinsc_update_request' == 1 , j'initialise le table
|
||||
'RetObject' avec une seule ligne vide
|
||||
|
||||
"""
|
||||
if( cpt == 0 and is_client_preinsc_update_request == "1"):
|
||||
|
||||
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': str(partner_recid)})
|
||||
|
||||
class_data = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(session_data['class_internal_url'])})
|
||||
|
||||
val = {}
|
||||
val['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
val['_id'] = str(cpt)
|
||||
val['session_id'] = diction['session_id']
|
||||
val['class_internal_url'] = session_data['class_internal_url']
|
||||
val['nom'] = "Nom"
|
||||
val['partner_owner_recid'] = session_data['partner_owner_recid']
|
||||
val['prenom'] = "Prenom"
|
||||
val['email'] = "email@email.com"
|
||||
val['civilite'] = "neutre"
|
||||
val['modefinancement'] = ""
|
||||
val['opco'] = ""
|
||||
|
||||
val['employeur'] = ""
|
||||
val['telephone'] = ""
|
||||
val['date_naissance'] = ""
|
||||
|
||||
val['adresse'] = ""
|
||||
val['code_postal'] = ""
|
||||
val['ville'] = ""
|
||||
val['pays'] = ""
|
||||
val['status'] = "0"
|
||||
|
||||
val['title'] = class_data['title']
|
||||
if ("domaine" in class_data.keys()):
|
||||
val['domaine'] = class_data['domaine']
|
||||
else:
|
||||
val['domaine'] = ""
|
||||
|
||||
|
||||
if ("code_session" in session_data.keys()):
|
||||
val['code_session'] = str(session_data['code_session'])
|
||||
else:
|
||||
val['code_session'] = ""
|
||||
|
||||
if ("titre" in session_data.keys()):
|
||||
val['session_titre'] = str(session_data['titre'])
|
||||
else:
|
||||
val['session_titre'] = ""
|
||||
|
||||
if ("date_debut" in session_data.keys()):
|
||||
val['date_du'] = str(session_data['date_debut'])[0:10]
|
||||
else:
|
||||
val['date_du'] = ""
|
||||
|
||||
if ("date_fin" in session_data.keys()):
|
||||
val['date_au'] = str(session_data['date_fin'])[0:10]
|
||||
else:
|
||||
val['date_au'] = ""
|
||||
|
||||
if ("code_postal" in session_data.keys()):
|
||||
val['code_postal'] = session_data['code_postal']
|
||||
else:
|
||||
val['code_postal'] = ""
|
||||
|
||||
if ("prix_session" in session_data.keys()):
|
||||
val['price'] = session_data['prix_session']
|
||||
else:
|
||||
val['price'] = ""
|
||||
|
||||
if ("presentiel" in session_data.keys()):
|
||||
val['presentiel'] = session_data['presentiel']
|
||||
else:
|
||||
val['presentiel'] = "0"
|
||||
|
||||
if ("distantiel" in session_data.keys()):
|
||||
val['distantiel'] = session_data['distantiel']
|
||||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("session_ondemande" in session_data.keys()):
|
||||
val['session_ondemande'] = session_data['session_ondemande']
|
||||
else:
|
||||
val['session_ondemande'] = "0"
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
|
||||
|
||||
|
||||
RetObject_global_data = []
|
||||
# Gestion du cas le client peut ajouter lui meme des preinscrits
|
||||
val_global_data = {}
|
||||
val_global_data['max_presinscrit'] = str(max_presinscrit)
|
||||
val_global_data['is_client_preinsc_update_request'] = str(is_client_preinsc_update_request)
|
||||
RetObject_global_data.append(mycommon.JSONEncoder().encode(val_global_data))
|
||||
|
||||
return True, RetObject, RetObject_global_data
|
||||
|
||||
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écupérer la liste des stagiaires"
|
||||
return False, "Impossible de récupérer la liste des stagiaires", ""
|
||||
|
||||
|
||||
|
||||
|
|
2008
Log/log_file.log
2008
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -4886,13 +4886,11 @@ def Duplicate_List_Session_Formation(diction):
|
|||
duplicated_session['code_session'] = str(session_data['code_session'])+"_dup"
|
||||
duplicated_session['date_update'] = now
|
||||
duplicated_session['update_by'] = str(my_partner['_id'])
|
||||
|
||||
duplicated_session['date_debut'] = str(diction['date_debut'])[0:10]
|
||||
duplicated_session['date_fin'] = str(diction['date_fin'])[0:10]
|
||||
duplicated_session['session_etape'] = str(diction['session_etape'])
|
||||
duplicated_session['formateur_id'] = str(formateur_id)
|
||||
|
||||
|
||||
local_retval = MYSY_GV.dbname['session_formation'].insert_one(duplicated_session)
|
||||
|
||||
"""
|
||||
|
@ -13450,6 +13448,117 @@ def Prepare_request_presinscription_data_validation(diction):
|
|||
return False, " Impossible d'envoyer les demandes de mise à jour"
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
07/02/2025 : A l'image de la fonction plus haut, cette fonction
|
||||
permet de demander un client de créer lui meme les preinscriptions pour une nombre limite max de préinscrit
|
||||
|
||||
La fonction plus demande la mise à à jour des données des préinscrits, alors celle ci demande carrement de faire l'inscription
|
||||
|
||||
Alog :
|
||||
|
||||
Apres l'envoi de la demande au client, on va stoker dans une collection "client_preinsc_update_request"
|
||||
le nombre max, le client, la session.
|
||||
Aini à l'ouverture par le front de la route : "/UpadateAttendeeList/:client_id/:session_id/:partner_owner_recid/"
|
||||
le systeme va regarder dans la collection précedente pour recuperer le nombre max.
|
||||
Par la suite cette collection pourra etre utilisé pour d'autre regles.
|
||||
|
||||
"""
|
||||
def Prepare_request_For_Preinsciption_Creation_By_Customer(diction):
|
||||
try:
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'session_id', 'client_id', 'max_presinscrit']
|
||||
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 ne sont pas correctes"
|
||||
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = 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 la validité du client
|
||||
"""
|
||||
is_client_valide_count = MYSY_GV.dbname['partner_client'].count_documents({'partner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'_id':ObjectId(str(diction['client_id']))})
|
||||
|
||||
if( is_client_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du client est invalide ")
|
||||
return False, " L'identifiant du client est invalide "
|
||||
|
||||
|
||||
# A present les controles sont ok sur la liste on peut valide la liste des inscription
|
||||
warning_msg = ""
|
||||
is_warning = ""
|
||||
|
||||
|
||||
new_local_diction = {}
|
||||
new_local_diction['client_id'] = str(diction['client_id'])
|
||||
new_local_diction['session_id'] = str(diction['session_id'] )
|
||||
new_local_diction['partner_recid'] = str(my_partner['recid'])
|
||||
new_local_diction['token'] = str(diction['token'])
|
||||
|
||||
local_send_status, local_retval = Send_Email_request_presinscription_data_validation(new_local_diction)
|
||||
if (local_send_status is False):
|
||||
is_warning = "1"
|
||||
warning_msg = warning_msg + "\n" + str(local_retval)
|
||||
|
||||
|
||||
"""
|
||||
S'il y a un enregistrement dans la collection : 'client_preinsc_update_request', pour la meme session et le meme
|
||||
client alors on fait la mise à jour
|
||||
"""
|
||||
|
||||
update_data = {}
|
||||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = str(my_partner['_id'])
|
||||
update_data['max_presinscrit'] = str(diction['max_presinscrit'])
|
||||
update_data['session_id'] = str(diction['session_id'])
|
||||
update_data['client_id'] = str(diction['client_id'])
|
||||
|
||||
update_data['valide'] = "1"
|
||||
update_data['locked'] = "0"
|
||||
|
||||
result = MYSY_GV.dbname['client_preinsc_update_request'].find_one_and_update(
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'client_id': str(diction['client_id']),
|
||||
'session_id': str(diction['session_id'])},
|
||||
{"$set": update_data},
|
||||
upsert=True,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
|
||||
if (is_warning == "1"):
|
||||
return True, str(warning_msg)
|
||||
|
||||
return True, "Les demandes de mise à jour ont été envoyées"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer les demandes de mise à jour"
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction envoi l'email de demande de validation/maj
|
||||
de la liste des preinscrits à une session de formation
|
||||
|
@ -13584,6 +13693,8 @@ def Send_Email_request_presinscription_data_validation(diction):
|
|||
sourceHtml = corps_mail_Template.render(params=body["params"])
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
||||
#print(" ### sourceHtml === ", sourceHtml)
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(courrier_template_data['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
|
21
main.py
21
main.py
|
@ -3944,6 +3944,23 @@ def Prepare_request_presinscription_data_validation():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet d'envoyer une demande a un client avec la possibilité de créer lui meme
|
||||
la liste des preinscrit, en ajoutant et supprimant des personnes
|
||||
|
||||
"""
|
||||
@app.route('/myclass/api/Prepare_request_For_Preinsciption_Creation_By_Customer/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Prepare_request_For_Preinsciption_Creation_By_Customer():
|
||||
# On CancelAttendeeInscription le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Prepare_request_For_Preinsciption_Creation_By_Customer : payload = ",payload)
|
||||
localStatus, message= SF.Prepare_request_For_Preinsciption_Creation_By_Customer(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet a un client de mettre à jour la liste de ses participants à une session de formation.
|
||||
"""
|
||||
|
@ -4979,8 +4996,8 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN payload = ",payload)
|
||||
status, retval = inscription.Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
status, retval, retval_global_data = inscription.Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(payload)
|
||||
return jsonify(status=status, message=retval, message_global_data = retval_global_data)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue