28/12/2023- 19h
parent
88aab10540
commit
153c981df1
|
@ -1,10 +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="27/12/2023 - 13h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="27/12/2023 - 23h">
|
||||
<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$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.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" />
|
||||
|
@ -74,13 +78,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00132" summary="zzz">
|
||||
<created>1697820815600</created>
|
||||
<option name="number" value="00132" />
|
||||
<option name="presentableId" value="LOCAL-00132" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697820815600</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00133" summary="22/10/2023 - 12h">
|
||||
<created>1697981083215</created>
|
||||
<option name="number" value="00133" />
|
||||
|
@ -417,7 +414,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1703714268338</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="181" />
|
||||
<task id="LOCAL-00181" summary="27/12/2023 - 23h">
|
||||
<created>1703715749036</created>
|
||||
<option name="number" value="00181" />
|
||||
<option name="presentableId" value="LOCAL-00181" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1703715749036</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="182" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -432,7 +436,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="22/11/2023 - 23h00" />
|
||||
<MESSAGE value="23/11/23 - 13:30" />
|
||||
<MESSAGE value="23/11/2023 - 21h30" />
|
||||
<MESSAGE value="24/11/2023 - 18h30" />
|
||||
|
@ -457,6 +460,7 @@
|
|||
<MESSAGE value="18/12/2023 - 22:00" />
|
||||
<MESSAGE value="20/12/2023 - 18h" />
|
||||
<MESSAGE value="27/12/2023 - 13h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="27/12/2023 - 13h" />
|
||||
<MESSAGE value="27/12/2023 - 23h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="27/12/2023 - 23h" />
|
||||
</component>
|
||||
</project>
|
|
@ -67,7 +67,12 @@ def AddStagiairetoClass(diction):
|
|||
field_list = ['nom', 'prenom', 'email', 'telephone', 'modefinancement', 'opco',
|
||||
'class_internal_url', 'session_id', 'employeur', 'status', 'price',
|
||||
'inscription_validation_date', 'token', 'client_rattachement_id',
|
||||
'adresse', 'code_postal', 'ville', 'pays', 'type_apprenant', 'apprenant_id' ]
|
||||
'adresse', 'code_postal', 'ville', 'pays', 'type_apprenant', 'apprenant_id', 'civilite',
|
||||
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
|
||||
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
|
||||
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
|
||||
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com',
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -88,6 +93,17 @@ def AddStagiairetoClass(diction):
|
|||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, "Impossible de créer le stagiaire. La valeur '" + val + "' n'est pas presente dans liste"
|
||||
|
||||
my_partner = None
|
||||
connected_user_id = "None"
|
||||
if( "token" in diction.keys() and 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
|
||||
|
||||
connected_user_id = my_partner['recid']
|
||||
|
||||
|
||||
|
||||
mydata = {}
|
||||
|
||||
session_id = ""
|
||||
|
@ -118,7 +134,7 @@ def AddStagiairetoClass(diction):
|
|||
apprenant_id = ""
|
||||
if ("apprenant_id" in diction.keys()):
|
||||
if diction['apprenant_id']:
|
||||
apprenant_id = str(diction['session_id']).strip()
|
||||
apprenant_id = str(diction['apprenant_id']).strip()
|
||||
mydata['apprenant_id'] = str(apprenant_id)
|
||||
|
||||
|
||||
|
@ -167,23 +183,36 @@ def AddStagiairetoClass(diction):
|
|||
if ("class_internal_url" in tmp_val.keys()):
|
||||
mydata['class_internal_url'] = str(tmp_val['class_internal_url']).strip()
|
||||
|
||||
civilite = ""
|
||||
if ("civilite" in diction.keys()):
|
||||
if diction['civilite']:
|
||||
civilite = str(diction['civilite']).strip()
|
||||
mydata['civilite'] = civilite
|
||||
|
||||
|
||||
nom = ""
|
||||
if ("nom" in diction.keys()):
|
||||
if diction['nom']:
|
||||
mydata['nom'] = str(diction['nom']).strip()
|
||||
nom = str(diction['nom']).strip()
|
||||
mydata['nom'] = nom
|
||||
|
||||
prenom = ""
|
||||
if ("prenom" in diction.keys()):
|
||||
if diction['prenom']:
|
||||
mydata['prenom'] = str(diction['prenom']).strip()
|
||||
prenom = str(diction['prenom']).strip()
|
||||
mydata['prenom'] = prenom
|
||||
|
||||
employeur = ""
|
||||
if ("employeur" in diction.keys()):
|
||||
if diction['employeur']:
|
||||
mydata['employeur'] = str(diction['employeur']).strip()
|
||||
employeur = str(diction['employeur']).strip()
|
||||
mydata['employeur'] = employeur
|
||||
|
||||
telephone = ""
|
||||
if ("telephone" in diction.keys()):
|
||||
if diction['telephone']:
|
||||
mydata['telephone'] = str(diction['telephone']).strip()
|
||||
telephone = str(diction['telephone']).strip()
|
||||
mydata['telephone'] = telephone
|
||||
|
||||
if ("client_rattachement_id" in diction.keys()):
|
||||
if diction['client_rattachement_id']:
|
||||
|
@ -198,29 +227,41 @@ def AddStagiairetoClass(diction):
|
|||
str(inspect.stack()[0][3]) + " - Le client de rattachement est invalide : local_client_retval_count = "+ str(local_client_retval_count))
|
||||
return False, " Le client de rattachement est invalide "
|
||||
|
||||
else:
|
||||
mydata['client_rattachement_id'] = ""
|
||||
|
||||
|
||||
if ("ville" in diction.keys()):
|
||||
if diction['ville']:
|
||||
mydata['ville'] = diction['ville']
|
||||
else:
|
||||
mydata['ville'] = ""
|
||||
|
||||
if ("code_postal" in diction.keys()):
|
||||
if diction['code_postal']:
|
||||
mydata['code_postal'] = diction['code_postal']
|
||||
else:
|
||||
mydata['code_postal'] = ""
|
||||
|
||||
if ("adresse" in diction.keys()):
|
||||
if diction['adresse']:
|
||||
mydata['adresse'] = diction['adresse']
|
||||
else:
|
||||
mydata['adresse'] = ""
|
||||
|
||||
|
||||
if ("pays" in diction.keys()):
|
||||
if diction['pays']:
|
||||
mydata['pays'] = diction['pays']
|
||||
else:
|
||||
mydata['pays'] = ""
|
||||
|
||||
|
||||
if ("inscription_validation_date" in diction.keys()):
|
||||
if diction['inscription_validation_date']:
|
||||
mydata['inscription_validation_date'] = str(diction['inscription_validation_date']).strip()
|
||||
else:
|
||||
mydata['inscription_validation_date'] = ""
|
||||
|
||||
if ("email" in diction.keys()):
|
||||
if diction['email']:
|
||||
|
@ -235,14 +276,24 @@ def AddStagiairetoClass(diction):
|
|||
if ("modefinancement" in diction.keys()):
|
||||
if diction['modefinancement']:
|
||||
mydata['modefinancement'] = str(diction['modefinancement']).strip()
|
||||
else:
|
||||
mydata['modefinancement'] = ""
|
||||
|
||||
if ("opco" in diction.keys()):
|
||||
if diction['opco']:
|
||||
mydata['opco'] = str(diction['opco']).strip()
|
||||
else:
|
||||
mydata['opco'] = ""
|
||||
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y, %H:%M:%S")
|
||||
mydata['update_by'] = str(connected_user_id)
|
||||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
||||
new_status = "2" # 0 ==> par defaut Encours (Inscription en cours de creation, ici, on ne declenche aucun email)
|
||||
if ("status" in diction.keys()):
|
||||
|
@ -431,7 +482,7 @@ def UpdateStagiairetoClass(diction):
|
|||
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
|
||||
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
|
||||
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
|
||||
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'type_apprenant'
|
||||
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'type_apprenant', 'civilite'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
@ -458,6 +509,8 @@ def UpdateStagiairetoClass(diction):
|
|||
mytoken = str(diction['token']).strip()
|
||||
#query_key['token'] = diction['token']
|
||||
|
||||
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", mytoken)
|
||||
if retval is False:
|
||||
|
@ -470,7 +523,7 @@ def UpdateStagiairetoClass(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
partner_recid = my_partner['recid']
|
||||
|
||||
myemail = ""
|
||||
if ("email" in diction.keys()):
|
||||
|
@ -485,7 +538,7 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
object_id = ""
|
||||
if ("_id" in diction.keys()):
|
||||
if diction['email']:
|
||||
if diction['_id']:
|
||||
object_id = str(diction['_id']).strip()
|
||||
query_key['_id'] = ObjectId (str(diction['_id']).strip())
|
||||
|
||||
|
@ -503,11 +556,6 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour le stagiaire ")
|
||||
return False, "Impossible de mettre à jour le stagiaire "
|
||||
|
||||
|
||||
|
||||
""""
|
||||
|
@ -524,6 +572,9 @@ def UpdateStagiairetoClass(diction):
|
|||
mydata['nom'] = str(diction['nom']).strip()
|
||||
user_nom = str(diction['nom']).strip()
|
||||
|
||||
if ("civilite" in diction.keys()):
|
||||
mydata['civilite'] = str(diction['civilite']).strip()
|
||||
|
||||
if ("price" in diction.keys()):
|
||||
mydata['price'] = str(diction['price']).strip()
|
||||
|
||||
|
@ -701,7 +752,7 @@ def UpdateStagiairetoClass(diction):
|
|||
mydata[str(val)] = diction[str(val)]
|
||||
|
||||
"""
|
||||
Pour gerer la date de validation, differemment d'une simple mise à jour,
|
||||
Pour gerer la date de validation, différemment d'une simple mise à jour,
|
||||
on récupérer le status actuellement en base, on verifie si le nouveau status != de status en base.
|
||||
|
||||
Si il y a changement de status alors c'est une date de changement de status.
|
||||
|
@ -832,11 +883,27 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
|
||||
if (new_status != old_status and diction['status'] == "1" ):
|
||||
|
||||
# Il s'agit d'envoyer le message de confirmation d'une inscription
|
||||
email_data['partner_owner_recid'] = str(partner_recid)
|
||||
local_status, local_message = email_session.incription_training_confirmation_mail(email_data)
|
||||
message_for_historic = message_for_historic + " : Email Inscription "
|
||||
|
||||
"""
|
||||
Update du 28/12/2023
|
||||
"""
|
||||
local_diction = {}
|
||||
local_diction['token'] = str(diction['token'])
|
||||
local_diction['email'] = str(diction['email'])
|
||||
local_diction['inscription_id'] = str(diction['_id'])
|
||||
|
||||
print(" ### -- local_diction = ", local_diction)
|
||||
|
||||
|
||||
local_status, local_retval = AcceptAttendeeInscription(local_diction)
|
||||
if( local_status is False ):
|
||||
return local_status, local_retval
|
||||
|
||||
""""
|
||||
Inscription sur le LMS :
|
||||
Si la session de formation possede un code de formation lms 'lms_class_code'
|
||||
|
@ -846,6 +913,8 @@ def UpdateStagiairetoClass(diction):
|
|||
1 - La creation du compte LMS participant
|
||||
2 - L'inscription de l'utilisateur à la formation.
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
if( lms_class_code.strip() != ""):
|
||||
print(" ### Debut creation lms_class_code.strip() pour le code class ", lms_class_code)
|
||||
|
@ -884,9 +953,7 @@ def UpdateStagiairetoClass(diction):
|
|||
)
|
||||
if (local_ret_val and local_ret_val['_id']):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le compte LMS du participant a été correctement mis à jour : local_ret_val['_id'] = "+str( local_ret_val['_id']))
|
||||
""""
|
||||
A present, on va proceder à l'inscription à la formation
|
||||
"""
|
||||
|
||||
print(" ### Debut de l'inscription au à la formation dans le LMS ")
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
|
@ -896,8 +963,8 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
local_status2, local_message2 = mys_lms.Add_User_To_LMS_Class(new_diction)
|
||||
if (local_status2 is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " WARNING : Impossbile de finaliser l'incription dans le LMS")
|
||||
return_message = return_message + " Impossbile de finaliser l'incription dans le LMS. "
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " WARNING : Impossbile de finaliser l'inscription dans le LMS")
|
||||
return_message = return_message + " Impossbile de finaliser l'inscription dans le LMS. "
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " TOP, l'inscription dans le LMS a ete correctement faite")
|
||||
|
||||
|
@ -905,7 +972,7 @@ def UpdateStagiairetoClass(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - WARNING : Impossible de mettre à jour le compte LMS ")
|
||||
return_message = return_message + " Impossible de mettre à jour le compte LMS."
|
||||
|
||||
|
||||
"""
|
||||
|
||||
elif ( new_status != old_status and diction['status'] == "-1" ):
|
||||
# Il s'agit d'envoyer le message de refus d'une inscription
|
||||
|
@ -4367,15 +4434,13 @@ def CancelAttendeeInscription(diction):
|
|||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", mytoken)
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer le recid du partenaire")
|
||||
return False, "Impossible de récupérer le recid du partenaire"
|
||||
|
||||
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
|
||||
|
||||
partner_recid = str(my_partner['recid'])
|
||||
|
||||
data_mail = {}
|
||||
# 1 - Recuperation des données de la formation
|
||||
|
@ -4471,6 +4536,8 @@ def CancelAttendeeInscription(diction):
|
|||
email_data['date_du'] = date_du
|
||||
email_data['date_au'] = date_au
|
||||
email_data['title'] = class_title
|
||||
email_data['partner_owner_recid'] = str(partner_recid)
|
||||
|
||||
|
||||
local_status, local_message = email_session.incription_training_cancelled_mail(email_data)
|
||||
if( local_status is False ):
|
||||
|
@ -4512,15 +4579,12 @@ def RefuseAttendeeInscription_with_motif(diction):
|
|||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", mytoken)
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer le recid du partenaire")
|
||||
return False, "Impossible de récupérer le recid du partenaire"
|
||||
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
|
||||
|
||||
partner_recid = str(my_partner['recid'])
|
||||
|
||||
# 0 - Verifier de l'existance et de la validité de l'inscription (preinscription à refuser)
|
||||
my_inscription_count = MYSY_GV.dbname['inscription'].count_documents({'_id':ObjectId(str(diction['inscription_id'])),
|
||||
|
@ -4629,6 +4693,8 @@ def RefuseAttendeeInscription_with_motif(diction):
|
|||
email_data['date_au'] = date_au
|
||||
email_data['title'] = class_title
|
||||
email_data['comment'] = str(diction['motif'])
|
||||
email_data['partner_owner_recid'] = str(partner_recid)
|
||||
|
||||
|
||||
local_status, local_message = email_session.incription_training_cancelled_mail(email_data)
|
||||
if( local_status is False ):
|
||||
|
@ -4668,7 +4734,8 @@ def AcceptAttendeeInscription(diction):
|
|||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({diction})
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
@ -4800,8 +4867,8 @@ def AcceptAttendeeInscription(diction):
|
|||
local_status2, local_message2 = mys_lms.Add_User_To_LMS_Class(new_diction)
|
||||
if (local_status2 is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " WARNING : Impossbile de finaliser l'incription dans le LMS")
|
||||
return_message = return_message + " Impossbile de finaliser l'incription dans le LMS. "
|
||||
str(inspect.stack()[0][3]) + " WARNING : Impossbile de finaliser l'inscription dans le LMS")
|
||||
return_message = return_message + " Impossbile de finaliser l'inscription dans le LMS. "
|
||||
else:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " TOP, l'inscription dans le LMS a ete correctement faite")
|
||||
|
@ -4905,8 +4972,7 @@ def AcceptAttendeeInscription(diction):
|
|||
diction['email']))
|
||||
return_message = return_message + str(" Impossible d'envoyer le mail de notification pour : " + str(diction['email']))
|
||||
|
||||
if( return_message.strip() != ""):
|
||||
return True, return_message
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
@ -4917,6 +4983,7 @@ def AcceptAttendeeInscription(diction):
|
|||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
new_apprenant_diction = {}
|
||||
new_apprenant_diction['token'] = str(diction['token'])
|
||||
new_apprenant_diction['nom'] = inscription_data['nom']
|
||||
new_apprenant_diction['email'] = inscription_data['email']
|
||||
new_apprenant_diction['prenom'] = inscription_data['prenom']
|
||||
|
@ -4937,7 +5004,6 @@ def AcceptAttendeeInscription(diction):
|
|||
new_apprenant_diction['tuteur2_email'] = inscription_data['tuteur2_email']
|
||||
new_apprenant_diction['tuteur2_telephone'] = inscription_data['tuteur2_telephone']
|
||||
new_apprenant_diction['opco'] = inscription_data['opco']
|
||||
new_apprenant_diction['comment'] = inscription_data['comment']
|
||||
new_apprenant_diction['tuteur1_adresse'] = inscription_data['tuteur1_adresse']
|
||||
new_apprenant_diction['tuteur1_cp'] = inscription_data['tuteur1_cp']
|
||||
new_apprenant_diction['tuteur1_ville'] = inscription_data['tuteur1_ville']
|
||||
|
@ -4949,37 +5015,71 @@ def AcceptAttendeeInscription(diction):
|
|||
new_apprenant_diction['tuteur2_pays'] = inscription_data['tuteur2_pays']
|
||||
new_apprenant_diction['tuteur2_include_com'] = inscription_data['tuteur2_include_com']
|
||||
|
||||
local_status, local_retval = apprenant_mgt.Add_Apprenant(new_apprenant_diction)
|
||||
if( local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
"""
|
||||
recuperation de l'id du dossier qui vient d'etre créer
|
||||
# Si la personne de cette inscription existe deja dans la collection appenant, alors on fait une mise à jour.
|
||||
En effet si l'apprenant avait deja suivi une formation, alors il a forcement un dossier.
|
||||
a clé est toujours l'adresse email
|
||||
"""
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'email':str(inscription_data['email']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{'_id':1})
|
||||
local_apprenant_id = ""
|
||||
is_apprenant_existe_count = MYSY_GV.dbname['apprenant'].count_documents({'email':str(inscription_data['email']),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
if(apprenant_data is None ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Impossible de récuperer l'identifiant du dossier créé ")
|
||||
return False, " Impossible de récuperer l'identifiant du dossier créé "
|
||||
|
||||
|
||||
if( is_apprenant_existe_count > 0 ):
|
||||
# Il faut mettre à jour un dossier apprenant
|
||||
is_apprenant_existe = MYSY_GV.dbname['apprenant'].find_one(
|
||||
{'email': str(inscription_data['email']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'_id':1})
|
||||
|
||||
new_apprenant_diction['_id'] = str(is_apprenant_existe['_id'])
|
||||
local_apprenant_id = str(is_apprenant_existe['_id'])
|
||||
local_status, local_retval = apprenant_mgt.Update_Apprenant(new_apprenant_diction)
|
||||
if (local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
else:
|
||||
# Il faut créer un dossier apprenant
|
||||
|
||||
local_status, local_retval = apprenant_mgt.Add_Apprenant(new_apprenant_diction)
|
||||
if( local_status is False):
|
||||
return local_status, local_retval
|
||||
"""
|
||||
recuperation de l'id du dossier qui vient d'etre créer
|
||||
"""
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'email': str(inscription_data['email']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])},
|
||||
{'_id': 1})
|
||||
|
||||
if (apprenant_data is None):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Impossible de récuperer l'identifiant du dossier créé ")
|
||||
return False, " Impossible de récuperer l'identifiant du dossier créé "
|
||||
|
||||
local_apprenant_id = str(apprenant_data['_id'])
|
||||
|
||||
|
||||
"""
|
||||
Apres la creation du dossier on met à jour l'inscription en rajoutant l'apprenant_id
|
||||
"""
|
||||
ret_val2 = MYSY_GV.dbname['inscription'].find_one_and_update(
|
||||
{'_id': ObjectId(str(diction['inscription_id'])), 'email': str(diction['email']), 'partner_owner_recid':str(my_partner['recid'])},
|
||||
{"$set": {'apprenant_id': str(apprenant_data['_id']), 'date_update':str(datetime.now()),
|
||||
{"$set": {'apprenant_id': str(local_apprenant_id), 'date_update':str(datetime.now()),
|
||||
'update_by':str(my_partner['_id'])}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
if (return_message.strip() != ""):
|
||||
return True, return_message
|
||||
|
||||
|
||||
return True, "L'inscription a été correctement validée"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -5714,8 +5814,9 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
RetObject = []
|
||||
cpt = 1
|
||||
for retVal in MYSY_GV.dbname['inscription'].aggregate(query):
|
||||
val = {}
|
||||
if ('myclass_collection' in retVal.keys() and len(retVal['myclass_collection']) > 0):
|
||||
val = {}
|
||||
|
||||
val['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
val['_id'] = retVal['_id']
|
||||
|
@ -5727,6 +5828,11 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
|
||||
val['email'] = retVal['email']
|
||||
|
||||
if ("civilite" in retVal.keys()):
|
||||
val['civilite'] = retVal['civilite']
|
||||
else:
|
||||
val['civilite'] = ""
|
||||
|
||||
|
||||
if( "modefinancement" in retVal.keys()):
|
||||
val['modefinancement'] = retVal['modefinancement']
|
||||
|
@ -5834,6 +5940,64 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
else:
|
||||
val['session_ondemande'] = "0"
|
||||
|
||||
"""
|
||||
/!\ : 28/12/2023 - update
|
||||
S'il y a de la data dans la collection 'apprenant_collection' cela veut dire qu'il y a un dossier apprenant,
|
||||
alors on va plutot retourner les info qui sont dans cette collection
|
||||
"""
|
||||
if ('apprenant_collection' in retVal.keys() and len( retVal['apprenant_collection']) > 0):
|
||||
if ("civilite" in retVal['apprenant_collection'][0].keys()):
|
||||
val['civilite'] = str(retVal['apprenant_collection'][0]['ville'])
|
||||
else:
|
||||
val['civilite'] = ""
|
||||
|
||||
local_nom = ""
|
||||
if ("nom" in retVal['apprenant_collection'][0].keys()):
|
||||
local_nom = retVal['apprenant_collection'][0]['nom']
|
||||
val['nom'] = local_nom
|
||||
|
||||
local_prenom = ""
|
||||
if ("prenom" in retVal['apprenant_collection'][0].keys()):
|
||||
local_prenom = retVal['apprenant_collection'][0]['prenom']
|
||||
val['prenom'] = local_prenom
|
||||
|
||||
local_employeur = ""
|
||||
if ("employeur" in retVal['apprenant_collection'][0].keys()):
|
||||
local_employeur = retVal['apprenant_collection'][0]['employeur']
|
||||
val['employeur'] = local_employeur
|
||||
|
||||
local_telephone = ""
|
||||
if ("telephone" in retVal['apprenant_collection'][0].keys()):
|
||||
local_telephone = retVal['apprenant_collection'][0]['telephone']
|
||||
val['telephone'] = local_telephone
|
||||
|
||||
local_email = ""
|
||||
if ("email" in retVal['apprenant_collection'][0].keys()):
|
||||
local_email = retVal['apprenant_collection'][0]['email']
|
||||
val['email'] = local_email
|
||||
|
||||
local_adresse = ""
|
||||
if ("adresse" in retVal['apprenant_collection'][0].keys()):
|
||||
local_adresse = retVal['apprenant_collection'][0]['adresse']
|
||||
val['adresse'] = local_adresse
|
||||
|
||||
if ("ville" in retVal['apprenant_collection'][0].keys()):
|
||||
val['ville'] = retVal['apprenant_collection'][0]['ville']
|
||||
else:
|
||||
val['ville'] = ""
|
||||
|
||||
if ("code_postal" in retVal['apprenant_collection'][0].keys()):
|
||||
val['code_postal'] = retVal['apprenant_collection'][0]['code_postal']
|
||||
else:
|
||||
val['code_postal'] = ""
|
||||
|
||||
if ("pays" in retVal['apprenant_collection'][0].keys()):
|
||||
val['pays'] = retVal['apprenant_collection'][0]['pays']
|
||||
else:
|
||||
val['pays'] = ""
|
||||
|
||||
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
|
@ -5984,6 +6148,12 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
|
|||
local_prenom = local_Insc_retval['prenom']
|
||||
my_retrun_dict['prenom'] = local_prenom
|
||||
|
||||
local_civilite = ""
|
||||
if ("civilite" in local_Insc_retval.keys()):
|
||||
local_civilite = local_Insc_retval['civilite']
|
||||
my_retrun_dict['civilite'] = local_civilite
|
||||
|
||||
|
||||
local_employeur = ""
|
||||
if ("employeur" in local_Insc_retval.keys()):
|
||||
local_employeur = local_Insc_retval['employeur']
|
||||
|
|
4205
Log/log_file.log
4205
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -799,7 +799,7 @@ def Apprenant_Inscrire_Session(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'session_id', 'type_apprenant' , 'modefinancement']
|
||||
field_list = ['token', '_id', 'session_id', 'type_apprenant' , 'modefinancement', 'client_rattachement_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -852,6 +852,22 @@ def Apprenant_Inscrire_Session(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant de l'apprenant n'est pas valide ")
|
||||
return False, " L'identifiant de l'apprenant n'est pas valide ",
|
||||
|
||||
# Verifier la validité du client , s'il ya un client
|
||||
client_rattachement_id = ""
|
||||
if( "client_rattachement_id" in diction.keys() and diction['client_rattachement_id'] ) :
|
||||
is_client_rattachement_id_exist = MYSY_GV.dbname['partner_client'].count_documents({'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'partner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
if (is_client_rattachement_id_exist <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du client n'est pas valide ")
|
||||
return False, " L'identifiant du client n'est pas valide ",
|
||||
|
||||
client_rattachement_id = str(diction['client_rattachement_id'])
|
||||
|
||||
|
||||
# Recuperer les données de l'apprenant
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
|
@ -881,9 +897,11 @@ def Apprenant_Inscrire_Session(diction):
|
|||
new_data['token'] = diction['token']
|
||||
new_data['email'] = apprenant_data['email']
|
||||
new_data['nom'] = apprenant_data['nom']
|
||||
new_data['civilite'] = apprenant_data['civilite']
|
||||
new_data['prenom'] = apprenant_data['prenom']
|
||||
new_data['telephone'] = apprenant_data['telephone']
|
||||
new_data['modefinancement'] = str(diction['modefinancement'])
|
||||
new_data['client_rattachement_id'] = client_rattachement_id
|
||||
|
||||
|
||||
new_data['apprenant_id'] = str(apprenant_data['_id'])
|
||||
|
@ -898,6 +916,8 @@ def Apprenant_Inscrire_Session(diction):
|
|||
#new_data['update_by'] = str(my_partner['_id'])
|
||||
#new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
|
||||
local_status, local_retval = Inscription_mgt.AddStagiairetoClass(new_data)
|
||||
if( local_status is False ):
|
||||
return local_status, local_retval
|
||||
|
@ -934,7 +954,7 @@ def Apprenant_Inscrire_Session_List(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'list_apprenant_id', 'session_id', 'type_apprenant' , 'modefinancement']
|
||||
field_list = ['token', 'list_apprenant_id', 'session_id', 'type_apprenant' , 'modefinancement', 'client_rattachement_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -967,6 +987,9 @@ def Apprenant_Inscrire_Session_List(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
|
||||
# Verifier que le type d'apprenant est bien valide
|
||||
type_apprenant = "0"
|
||||
if( str(diction['type_apprenant']) not in MYSY_GV.INSCRIPTION_TYPE_APPRENANT ):
|
||||
|
@ -976,6 +999,23 @@ def Apprenant_Inscrire_Session_List(diction):
|
|||
else:
|
||||
type_apprenant = str(diction['type_apprenant'])
|
||||
|
||||
# Verifier la validité du client, s'il ya un client
|
||||
client_rattachement_id = ""
|
||||
if ("client_rattachement_id" in diction.keys() and diction['client_rattachement_id']):
|
||||
is_client_rattachement_id_exist = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'partner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
if (is_client_rattachement_id_exist <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du client n'est pas valide ")
|
||||
return False, " L'identifiant du client n'est pas valide ",
|
||||
|
||||
client_rattachement_id = str(diction['client_rattachement_id'])
|
||||
|
||||
|
||||
# Verifier que la session de formation existe et est valide
|
||||
is_session_existe = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'_id': ObjectId(str(diction['session_id'])),
|
||||
|
@ -1044,8 +1084,9 @@ def Apprenant_Inscrire_Session_List(diction):
|
|||
local_diction['session_id'] = diction['session_id']
|
||||
local_diction['type_apprenant'] = diction['type_apprenant']
|
||||
local_diction['modefinancement'] = diction['modefinancement']
|
||||
local_diction['client_rattachement_id'] = client_rattachement_id
|
||||
|
||||
local_status, local_retval =Apprenant_Inscrire_Session(local_diction)
|
||||
local_status, local_retval = Apprenant_Inscrire_Session(local_diction)
|
||||
|
||||
if( local_status is False ):
|
||||
is_warning_message = True
|
||||
|
@ -1127,10 +1168,26 @@ def Get_Apprenant_List_Inscription(diction):
|
|||
for val in MYSY_GV.dbname['inscription'].find({'apprenant_id':str(diction['_id']),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
}, {"_id":1, "class_internal_url":1,"session_id":1, 'status':1,
|
||||
"inscription_validation_date":1, "modefinancement":1, "inscription_refuse_date":1,}):
|
||||
"inscription_validation_date":1, "modefinancement":1, "inscription_refuse_date":1,
|
||||
'client_rattachement_id':1}):
|
||||
user = val
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
client_rattachement_nom = "";
|
||||
if ("client_rattachement_id" in val.keys() and val['client_rattachement_id']):
|
||||
client_rattachement_id_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(val['client_rattachement_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])},
|
||||
{'nom': 1})
|
||||
|
||||
if (client_rattachement_id_data and "nom" in client_rattachement_id_data.keys()):
|
||||
client_rattachement_nom = str(client_rattachement_id_data["nom"])
|
||||
|
||||
user['client_rattachement_nom'] = str(client_rattachement_nom)
|
||||
|
||||
local_diction = {'token':str(diction['token']), 'class_internal_url':str(val['class_internal_url']), 'session_id':str(val['session_id'])}
|
||||
|
||||
local_status, local_retval_str = sf.GetSessionFormation(local_diction)
|
||||
|
|
42
class_mgt.py
42
class_mgt.py
|
@ -2245,8 +2245,11 @@ def get_partner_class(diction):
|
|||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
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
|
||||
|
||||
|
||||
user_recid = str(my_partner['recid'])
|
||||
'''
|
||||
Gestion des filters.
|
||||
'''
|
||||
|
@ -2358,7 +2361,42 @@ def get_partner_class(diction):
|
|||
|
||||
if ("lms_class_code" not in retVal.keys()):
|
||||
retVal['lms_class_code'] = "0"
|
||||
|
||||
|
||||
# Recuperation des données du formateur
|
||||
formateur_nom_prenom = ""
|
||||
# Si il y a un code formateur_id, alors on va recuperer les nom et prenom du formation
|
||||
if ("formateur_id" in retVal.keys() and retVal['formateur_id']):
|
||||
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(retVal['formateur_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])
|
||||
})
|
||||
|
||||
if (formateur_data and "nom" in formateur_data.keys() and "prenom" in formateur_data.keys()):
|
||||
formateur_nom_prenom = str(formateur_data['nom']) + " " + str(formateur_data['prenom'])
|
||||
|
||||
retVal['formateur_nom_prenom'] = formateur_nom_prenom
|
||||
|
||||
# Recuperation des données du niveau de class
|
||||
class_level_description = ""
|
||||
# Si il y a un code class_level, alors on va recuperer la description
|
||||
if ("class_level" in retVal.keys() and retVal['class_level']):
|
||||
|
||||
|
||||
class_level_data = MYSY_GV.dbname['class_niveau_formation'].find_one(
|
||||
{'code': str(retVal['class_level']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': 'default'
|
||||
})
|
||||
|
||||
if (class_level_data and "description" in class_level_data.keys()):
|
||||
class_level_description = str(class_level_data['description'])
|
||||
|
||||
retVal['class_level_description'] = class_level_description
|
||||
|
||||
|
||||
user = retVal
|
||||
user['id'] = str(val_tmp)
|
||||
|
|
|
@ -565,37 +565,34 @@ def incription_training_cancelled_mail(diction):
|
|||
adresse_session = my_adress
|
||||
|
||||
|
||||
# on rentre les renseignements pris sur le site du fournisseur
|
||||
|
||||
|
||||
|
||||
# JINJA2
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/MySy_annule_inscription_formation_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
|
||||
# This data can come from database query
|
||||
body = {}
|
||||
|
||||
|
||||
if ("comment" in diction.keys()):
|
||||
if diction['comment']:
|
||||
body = {
|
||||
if ("comment" in diction.keys() and diction['comment']):
|
||||
body = {
|
||||
|
||||
"params" :{"nom": str(diction['nom']),
|
||||
"prenom": str(diction['prenom']),
|
||||
"date_du": str(diction['date_du']),
|
||||
"date_fin": str(diction['date_au']),
|
||||
"adresse": str(adresse_session),
|
||||
"title": str(diction['title']),
|
||||
"email": str(diction['email']),
|
||||
"distantiel": str(distantiel),
|
||||
"presentiel": str(presentiel),
|
||||
"comment": str(diction['comment'])},
|
||||
}
|
||||
"params" :{"nom": str(diction['nom']),
|
||||
"prenom": str(diction['prenom']),
|
||||
"date_du": str(diction['date_du']),
|
||||
"date_fin": str(diction['date_au']),
|
||||
"adresse": str(adresse_session),
|
||||
"title": str(diction['title']),
|
||||
"email": str(diction['email']),
|
||||
"distantiel": str(distantiel),
|
||||
"presentiel": str(presentiel),
|
||||
"comment": str(diction['comment'])},
|
||||
}
|
||||
|
||||
else:
|
||||
body = {
|
||||
|
||||
"params": {"nom": str(diction['nom']),
|
||||
"prenom": str(diction['prenom']),
|
||||
"date_du": str(diction['date_du']),
|
||||
|
@ -603,10 +600,44 @@ def incription_training_cancelled_mail(diction):
|
|||
"adresse": str(adresse_session),
|
||||
"title": str(diction['title']),
|
||||
"email": str(diction['email'])},
|
||||
}
|
||||
}
|
||||
|
||||
# Recuperation du modele de courrier d'annulation d'une inscription
|
||||
partner_document_ANNULE_INSCRIPTION_data_qry = {'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'valide': '1', 'locked': '0',
|
||||
'ref_interne': 'ANNULE_INSCRIPTION'}
|
||||
|
||||
print(" ### partner_document_PRE_INSCRIPTION_data_qry = ", partner_document_ANNULE_INSCRIPTION_data_qry)
|
||||
partner_document_ANNULE_INSCRIPTION_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'valide': '1', 'locked': '0', 'ref_interne': 'ANNULE_INSCRIPTION'})
|
||||
|
||||
if (partner_document_ANNULE_INSCRIPTION_data is None):
|
||||
# Il n'existe pas de personnalisation de la preinscription pour ce partenaire, on va aller récupérer la presinscription pa defaut
|
||||
partner_document_ANNULE_INSCRIPTION_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'partner_owner_recid': 'default',
|
||||
'valide': '1', 'locked': '0', 'ref_interne': 'ANNULE_INSCRIPTION'})
|
||||
|
||||
if (partner_document_ANNULE_INSCRIPTION_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "-Impossible d'envoyer l'email d'annulation de l'inscription. Aucun document parametré ")
|
||||
return False, " Impossible d'envoyer l'email d'annulation de l'inscription. Aucun document parametré "
|
||||
|
||||
if ("contenu_doc" not in partner_document_ANNULE_INSCRIPTION_data or len(
|
||||
str(partner_document_ANNULE_INSCRIPTION_data['contenu_doc'])) <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " -Impossible d'envoyer l'email d'annulation de l'inscription. Le parametrage du document est invalide")
|
||||
return False, " Impossible d'envoyer l'email d'annulation de l'inscription. Le parametrage du document est invalide "
|
||||
|
||||
ANNULE_INSCRIPTION_contenu_doc_Template = jinja2.Template(
|
||||
str(partner_document_ANNULE_INSCRIPTION_data['contenu_doc']))
|
||||
sourceHtml = ANNULE_INSCRIPTION_contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
|
||||
|
||||
print(" #### body = ", body)
|
||||
sourceHtml = template.render(params=body["params"])
|
||||
|
||||
|
||||
# msg = MIMEMultipart("alternative")
|
||||
|
||||
|
|
227
prj_common.py
227
prj_common.py
|
@ -3063,9 +3063,9 @@ def GetAttendeeDetail_perSession(diction):
|
|||
if( local_Insc_retval is None):
|
||||
myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer le recid du partenaire (2)")
|
||||
return False, " Les informations d'identifier la session (2) "
|
||||
my_retrun_dict = {}
|
||||
|
||||
if ('inscription_collectoin' in local_Insc_retval.keys() and len(local_Insc_retval['inscription_collectoin']) > 0):
|
||||
my_retrun_dict = {}
|
||||
|
||||
if ("session_id" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['session_id'] = local_Insc_retval['session_id']
|
||||
|
@ -3076,6 +3076,12 @@ def GetAttendeeDetail_perSession(diction):
|
|||
my_retrun_dict['apprenant_id'] = ""
|
||||
|
||||
|
||||
if ("civilite" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['civilite'] = local_Insc_retval['civilite']
|
||||
else:
|
||||
my_retrun_dict['civilite'] = ""
|
||||
|
||||
|
||||
if ("code_session" in local_Insc_retval['inscription_collectoin'][0].keys()):
|
||||
my_retrun_dict['code_session'] = str(local_Insc_retval['inscription_collectoin'][0]['code_session'])
|
||||
|
||||
|
@ -3087,71 +3093,114 @@ def GetAttendeeDetail_perSession(diction):
|
|||
|
||||
if ("ville" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['ville'] = local_Insc_retval['ville']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_nom'] = ""
|
||||
|
||||
if ("code_postal" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['code_postal'] = local_Insc_retval['code_postal']
|
||||
else:
|
||||
my_retrun_dict['code_postal'] = ""
|
||||
|
||||
if ("pays" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['pays'] = local_Insc_retval['pays']
|
||||
else:
|
||||
my_retrun_dict['pays'] = ""
|
||||
|
||||
if ("type_apprenant" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['type_apprenant'] = local_Insc_retval['type_apprenant']
|
||||
else:
|
||||
my_retrun_dict['type_apprenant'] = ""
|
||||
|
||||
# Tuteurs
|
||||
if ("tuteur1_nom" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_nom'] = local_Insc_retval['tuteur1_nom']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_nom'] = ""
|
||||
|
||||
if ("tuteur1_prenom" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_prenom'] = local_Insc_retval['tuteur1_prenom']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_prenom'] = ""
|
||||
|
||||
if ("tuteur1_email" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_email'] = local_Insc_retval['tuteur1_email']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_email'] = ""
|
||||
|
||||
if ("tuteur1_telephone" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_telephone'] = local_Insc_retval['tuteur1_telephone']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_telephone'] = ""
|
||||
|
||||
if ("tuteur1_adresse" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_adresse'] = local_Insc_retval['tuteur1_adresse']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_adresse'] = ""
|
||||
|
||||
if ("tuteur1_cp" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_cp'] = local_Insc_retval['tuteur1_cp']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_cp'] = ""
|
||||
|
||||
if ("tuteur1_ville" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_ville'] = local_Insc_retval['tuteur1_ville']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_ville'] = ""
|
||||
|
||||
if ("tuteur1_pays" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_pays'] = local_Insc_retval['tuteur1_pays']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_pays'] = ""
|
||||
|
||||
if ("tuteur1_include_com" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_include_com'] = local_Insc_retval['tuteur1_include_com']
|
||||
|
||||
else:
|
||||
my_retrun_dict['tuteur1_include_com'] = ""
|
||||
|
||||
if ("tuteur2_nom" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_nom'] = local_Insc_retval['tuteur2_nom']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_nom'] = ""
|
||||
|
||||
if ("tuteur2_prenom" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_prenom'] = local_Insc_retval['tuteur2_prenom']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_prenom'] = ""
|
||||
|
||||
if ("tuteur2_email" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_email'] = local_Insc_retval['tuteur2_email']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_email'] = ""
|
||||
|
||||
if ("tuteur2_telephone" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_telephone'] = local_Insc_retval['tuteur2_telephone']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_telephone'] = ""
|
||||
|
||||
if ("tuteur2_adresse" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_adresse'] = local_Insc_retval['tuteur2_adresse']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_adresse'] = ""
|
||||
|
||||
if ("tuteur2_cp" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_cp'] = local_Insc_retval['tuteur2_cp']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_cp'] = ""
|
||||
|
||||
if ("tuteur2_ville" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_ville'] = local_Insc_retval['tuteur2_ville']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_ville'] = ""
|
||||
|
||||
if ("tuteur2_pays" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_pays'] = local_Insc_retval['tuteur2_pays']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_pays'] = ""
|
||||
|
||||
if ("tuteur2_include_com" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_include_com'] = local_Insc_retval['tuteur2_include_com']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_include_com'] = ""
|
||||
|
||||
|
||||
if ("certification_send_date" in local_Insc_retval.keys()):
|
||||
|
@ -3268,9 +3317,167 @@ def GetAttendeeDetail_perSession(diction):
|
|||
|
||||
my_retrun_dict['class_title'] = local_formation['title']
|
||||
|
||||
RetObject.append(JSONEncoder().encode(my_retrun_dict))
|
||||
|
||||
|
||||
"""
|
||||
/!\ : 28/12/2023 - update
|
||||
S'il y a de la data dans la collection 'apprenant_collection' cela veut dire qu'il y a un dossier apprenant,
|
||||
alors on va plutot retourner les info qui sont dans cette collection
|
||||
"""
|
||||
|
||||
if ('apprenant_collection' in local_Insc_retval.keys() and len( local_Insc_retval['apprenant_collection']) > 0):
|
||||
print(" ### apprenant_collection = ", str(local_Insc_retval['apprenant_collection'][0]) )
|
||||
if ("civilite" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['civilite'] = str(local_Insc_retval['apprenant_collection'][0]['ville'])
|
||||
else:
|
||||
my_retrun_dict['civilite'] = ""
|
||||
|
||||
local_nom = ""
|
||||
if ("nom" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
local_nom = local_Insc_retval['apprenant_collection'][0]['nom']
|
||||
my_retrun_dict['nom'] = local_nom
|
||||
|
||||
local_prenom = ""
|
||||
if ("prenom" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
local_prenom = local_Insc_retval['apprenant_collection'][0]['prenom']
|
||||
my_retrun_dict['prenom'] = local_prenom
|
||||
|
||||
local_employeur = ""
|
||||
if ("employeur" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
local_employeur = local_Insc_retval['apprenant_collection'][0]['employeur']
|
||||
my_retrun_dict['employeur'] = local_employeur
|
||||
|
||||
local_telephone = ""
|
||||
if ("telephone" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
local_telephone = local_Insc_retval['apprenant_collection'][0]['telephone']
|
||||
my_retrun_dict['telephone'] = local_telephone
|
||||
|
||||
local_email = ""
|
||||
if ("email" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
local_email = local_Insc_retval['apprenant_collection'][0]['email']
|
||||
my_retrun_dict['email'] = local_email
|
||||
|
||||
local_adresse = ""
|
||||
if ("adresse" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
local_adresse = local_Insc_retval['apprenant_collection'][0]['adresse']
|
||||
my_retrun_dict['adresse'] = local_adresse
|
||||
|
||||
if ("ville" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['ville'] = local_Insc_retval['apprenant_collection'][0]['ville']
|
||||
else:
|
||||
my_retrun_dict['ville'] = ""
|
||||
|
||||
if ("code_postal" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['code_postal'] = local_Insc_retval['apprenant_collection'][0]['code_postal']
|
||||
else:
|
||||
my_retrun_dict['code_postal'] = ""
|
||||
|
||||
if ("pays" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['pays'] = local_Insc_retval['apprenant_collection'][0]['pays']
|
||||
else:
|
||||
my_retrun_dict['pays'] = ""
|
||||
|
||||
|
||||
|
||||
# Tuteurs
|
||||
if ("tuteur1_nom" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_nom'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_nom']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_nom'] = ""
|
||||
|
||||
if ("tuteur1_prenom" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_prenom'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_prenom']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_prenom'] = ""
|
||||
|
||||
if ("tuteur1_email" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_email'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_email']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_email'] = ""
|
||||
|
||||
if ("tuteur1_telephone" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_telephone'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_telephone']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_telephone'] = ""
|
||||
|
||||
if ("tuteur1_adresse" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_adresse'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_adresse']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_adresse'] = ""
|
||||
|
||||
if ("tuteur1_cp" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_cp'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_cp']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_cp'] = ""
|
||||
|
||||
if ("tuteur1_ville" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_ville'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_ville']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_ville'] = ""
|
||||
|
||||
if ("tuteur1_pays" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_pays'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_pays']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_pays'] = ""
|
||||
|
||||
if ("tuteur1_include_com" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur1_include_com'] = local_Insc_retval['apprenant_collection'][0]['tuteur1_include_com']
|
||||
else:
|
||||
my_retrun_dict['tuteur1_include_com'] = ""
|
||||
|
||||
if ("tuteur2_nom" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_nom'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_nom']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_nom'] = ""
|
||||
|
||||
if ("tuteur2_prenom" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_prenom'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_prenom']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_prenom'] = ""
|
||||
|
||||
|
||||
if ("tuteur2_email" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_email'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_email']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_email'] = ""
|
||||
|
||||
|
||||
if ("tuteur2_telephone" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_telephone'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_telephone']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_telephone'] = ""
|
||||
|
||||
|
||||
if ("tuteur2_adresse" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_adresse'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_adresse']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_adresse'] = ""
|
||||
|
||||
|
||||
if ("tuteur2_cp" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_cp'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_cp']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_cp'] = ""
|
||||
|
||||
|
||||
if ("tuteur2_ville" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_ville'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_ville']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_ville'] = ""
|
||||
|
||||
if ("tuteur2_pays" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_pays'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_pays']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_pays'] = ""
|
||||
|
||||
|
||||
if ("tuteur2_include_com" in local_Insc_retval['apprenant_collection'][0].keys()):
|
||||
my_retrun_dict['tuteur2_include_com'] = local_Insc_retval['apprenant_collection'][0]['tuteur2_include_com']
|
||||
else:
|
||||
my_retrun_dict['tuteur2_include_com'] = ""
|
||||
|
||||
RetObject.append(JSONEncoder().encode(my_retrun_dict))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
@ -3293,8 +3500,10 @@ def get_List_domaine_formation():
|
|||
val_tmp = 1
|
||||
|
||||
for retval in coll_liste_domaine_metier.find(myquery).distinct('domaine'):
|
||||
user = retval
|
||||
|
||||
user = {}
|
||||
user['domaine'] = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(user)
|
||||
|
||||
return True, RetObject
|
||||
|
@ -3317,8 +3526,10 @@ def get_List_metier_formation():
|
|||
val_tmp = 1
|
||||
|
||||
for retval in coll_liste_domaine_metier.find(myquery).distinct('metier'):
|
||||
user = retval
|
||||
|
||||
user = {}
|
||||
user['metier'] = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(user)
|
||||
|
||||
return True, RetObject
|
||||
|
@ -3326,7 +3537,7 @@ def get_List_metier_formation():
|
|||
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 de récupérer la liste de domaines de formation"
|
||||
return False, " Impossible de récupérer la liste des métiers de formation"
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue