parent
7977b01017
commit
8258b97469
|
|
@ -4,11 +4,19 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="26/03/2026 - 12h">
|
||||
<change afterPath="$PROJECT_DIR$/help_articles.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="23/03/26 - 20h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -452,7 +460,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="556" />
|
||||
<option name="localTasksCounter" value="557" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -494,7 +502,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="12/02/26 - 10h" />
|
||||
<MESSAGE value="12/02/26 - 10h30" />
|
||||
<MESSAGE value="15/02/26 - 18h30" />
|
||||
<MESSAGE value="16/02/26 - 18h30" />
|
||||
|
|
@ -519,6 +526,7 @@
|
|||
<MESSAGE value="23/03/2026 - 20h" />
|
||||
<MESSAGE value="25/03/2026 - 20h" />
|
||||
<MESSAGE value="26/03/2026 - 12h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="26/03/2026 - 12h" />
|
||||
<MESSAGE value="23/03/26 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="23/03/26 - 20h" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1191,27 +1191,57 @@ def Format_employee_contrat_agenda_events(tab_diction):
|
|||
new_node['rh_event_planning_event_unit_cost'] = str(local_event_cost_by_type)
|
||||
new_node['rh_event_planning_event_unit_cost_periodicite'] = str(local_event_periodicite_by_type)
|
||||
|
||||
"""
|
||||
Si aucun tarif spécifique n'est saisi par l'utilisateur, alors on va aller prendre le tarif par defaut
|
||||
val['collection_ressource_humaine_contrat']['cout']) avec sa périodicité
|
||||
"""
|
||||
if( str(local_event_cost_by_type) == ""):
|
||||
new_node['rh_event_planning_event_unit_cost'] = str(val['collection_ressource_humaine_contrat']['cout'])
|
||||
new_node['rh_event_planning_event_unit_cost_periodicite'] = str(val['collection_ressource_humaine_contrat']['periodicite'])
|
||||
|
||||
if (str(local_event_periodicite_by_type) == "heure"):
|
||||
new_node['rh_event_planning_event_cost'] = str(
|
||||
mycommon.tryFloat(local_event_cost_by_type) * mycommon.tryFloat(
|
||||
new_node['rh_event_planning_event_duration_hour']))
|
||||
total_cost = total_cost + mycommon.tryFloat((str(new_node['rh_event_planning_event_cost'])))
|
||||
local_event_cost_by_type = str(val['collection_ressource_humaine_contrat']['cout'])
|
||||
local_event_periodicite_by_type = str(val['collection_ressource_humaine_contrat']['periodicite'])
|
||||
|
||||
elif (str(local_event_periodicite_by_type) == "fixe"):
|
||||
new_node['rh_event_planning_event_cost'] = str(local_event_cost_by_type)
|
||||
total_cost = total_cost + mycommon.tryFloat((str(new_node['rh_event_planning_event_cost'])))
|
||||
"""
|
||||
Verifier qu'infiné on a bien un tarif et une périodicité
|
||||
"""
|
||||
local_isfloat_status, local_isfloat_retval = mycommon.IsFloat(str(new_node['rh_event_planning_event_unit_cost']))
|
||||
|
||||
"""
|
||||
if( local_isfloat_status is False or new_node['rh_event_planning_event_unit_cost_periodicite'] not in ['heure', 'fixe']):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " WARNING : Format_employee_contrat_agenda_events - le cout ou la période ne sont pas valident ")
|
||||
new_node['rh_event_planning_event_cost'] = "??"
|
||||
|
||||
|
||||
else:
|
||||
if (str(local_event_periodicite_by_type) == "heure"):
|
||||
new_node['rh_event_planning_event_cost'] = str(
|
||||
mycommon.tryFloat(local_event_cost_by_type) * mycommon.tryFloat(
|
||||
new_node['rh_event_planning_event_duration_hour']))
|
||||
total_cost = total_cost + mycommon.tryFloat((str(new_node['rh_event_planning_event_cost'])))
|
||||
|
||||
elif (str(local_event_periodicite_by_type) == "fixe"):
|
||||
new_node['rh_event_planning_event_cost'] = str(local_event_cost_by_type)
|
||||
total_cost = total_cost + mycommon.tryFloat((str(new_node['rh_event_planning_event_cost'])))
|
||||
|
||||
|
||||
|
||||
"""
|
||||
print(" ============== ")
|
||||
print(" ### event_data['event_type'] = ", str(event_data['event_type']))
|
||||
print(" ### local_event_cost_by_type = ", local_event_cost_by_type)
|
||||
print(" ### local_event_periodicite_by_type = ", local_event_periodicite_by_type)
|
||||
print(" ### total cokst = ", new_node['rh_event_planning_event_cost'])
|
||||
|
||||
print(" ### la cout basique = ", str(val['collection_ressource_humaine_contrat']['cout']))
|
||||
print(" ### la peridicité basique = ", str(val['collection_ressource_humaine_contrat']['periodicite']))
|
||||
|
||||
print(" ### total_cost = ", total_cost)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
else:
|
||||
new_node['rh_event_planning_event_cost'] = "Impossible a calculer"
|
||||
|
||||
|
|
|
|||
|
|
@ -1047,7 +1047,8 @@ Gestion du context de connexion d'un partenaire
|
|||
"""
|
||||
PARTNER_ACCOUNT_CONNEXION_CONTEXT_VALUES = ['mysy_session_display_view',
|
||||
'mysy_menu_gauche_reduit',
|
||||
'mysy_catalog_data_row_grouped_by']
|
||||
'mysy_catalog_data_row_grouped_by',
|
||||
'mysy_last_menu_visited']
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1452,6 +1452,13 @@ def AddStagiairetoClass_from_marketplace(diction):
|
|||
diction['status']) + " est invalide ")
|
||||
return False, " Le statut d'inscription : " + str(diction['status']) + " est invalide "
|
||||
|
||||
"""
|
||||
03/04/2026 : s'il s'agit d'une formation avec inscription directe,
|
||||
"""
|
||||
if( "inscription_direct" in is_myclass_valide_data.keys() and is_myclass_valide_data['inscription_direct'] == "1"):
|
||||
new_status = "1"
|
||||
|
||||
|
||||
mydata['status'] = str(new_status)
|
||||
mydata['type_apprenant'] = str(type_apprenant)
|
||||
|
||||
|
|
@ -1710,6 +1717,88 @@ def AddStagiairetoClass_from_marketplace(diction):
|
|||
du dossier apprenant en meme tps
|
||||
"""
|
||||
if (new_status == "1"):
|
||||
"""
|
||||
28/03/26
|
||||
Pour les formation en inscription directe : myclass.inscription_direct == '1'
|
||||
Il faudra envoyer l'email de notification d'inscription d'une personne
|
||||
courrier_template.ref_interne = 'PARTNER_PRE_INSCRIPTION_NOTIF'
|
||||
au gestionnaire de la formation
|
||||
"""
|
||||
|
||||
local_inscription_direct = ""
|
||||
if( "inscription_direct" in is_myclass_valide_data.keys()):
|
||||
local_inscription_direct = is_myclass_valide_data['inscription_direct']
|
||||
|
||||
if( local_inscription_direct == "1"):
|
||||
"""
|
||||
field_list_obligatoire = ['nom', 'prenom', 'email', 'date_du', 'date_au', 'title',
|
||||
'partner_mail', 'telephone', 'token', 'partner_owner_recid',
|
||||
'session_id', 'formateur_email', ]
|
||||
"""
|
||||
|
||||
notif_mail_dic = {}
|
||||
|
||||
notif_mail_dic['session_id'] = diction['session_id']
|
||||
notif_mail_dic['token'] = my_partner['token']
|
||||
notif_mail_dic['partner_owner_recid'] = my_partner['recid']
|
||||
notif_mail_dic['nom'] = diction['nom']
|
||||
notif_mail_dic['prenom'] = diction['prenom']
|
||||
notif_mail_dic['email'] = diction['email']
|
||||
notif_mail_dic['telephone'] = diction['telephone']
|
||||
notif_mail_dic['partner_mail'] = my_partner['email']
|
||||
|
||||
local_distanciel = "0"
|
||||
local_presentiel = "0"
|
||||
if( "mode_animation" in my_session_data.keys()):
|
||||
if( my_session_data['mode_animation'] == "0"):
|
||||
local_presentiel = "1"
|
||||
local_distanciel = "0"
|
||||
elif ( my_session_data['mode_animation'] == "1"):
|
||||
local_distanciel = "1"
|
||||
local_presentiel = "0"
|
||||
|
||||
notif_mail_dic['presentiel'] = local_presentiel
|
||||
notif_mail_dic['distantiel'] = local_distanciel
|
||||
|
||||
|
||||
if( my_session_data and 'date_debut' in my_session_data.keys()):
|
||||
notif_mail_dic['date_du'] = my_session_data['date_debut']
|
||||
else:
|
||||
notif_mail_dic['date_du'] = ''
|
||||
|
||||
if (my_session_data and 'date_fin' in my_session_data.keys()):
|
||||
notif_mail_dic['date_au'] = my_session_data['date_fin']
|
||||
else:
|
||||
notif_mail_dic['date_au'] = ''
|
||||
|
||||
if (is_myclass_valide_data and 'title' in is_myclass_valide_data.keys()):
|
||||
notif_mail_dic['title'] = is_myclass_valide_data['title']
|
||||
else:
|
||||
notif_mail_dic['title'] = ''
|
||||
|
||||
formateur = ""
|
||||
formateur_email = ""
|
||||
if ("formateur_id" in my_session_data.keys()):
|
||||
if my_session_data['formateur_id']:
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(my_session_data['formateur_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': my_partner['recid']})
|
||||
|
||||
if (formateur_data and "nom" in formateur_data.keys() and "prenom" in formateur_data.keys()):
|
||||
formateur = str(formateur_data['nom']) + " " + str(formateur_data['prenom'])
|
||||
|
||||
if (formateur_data and "email" in formateur_data.keys()):
|
||||
formateur_email = str(formateur_data['email'])
|
||||
|
||||
notif_mail_dic['formateur_email'] = formateur_email
|
||||
|
||||
# Envoi de l'email de notification au formateur
|
||||
local_status, local_message = email_session.Notification_partner_Pre_incription_mail(notif_mail_dic)
|
||||
|
||||
|
||||
|
||||
local_apprenant_id = ""
|
||||
is_apprenant_existe_count = MYSY_GV.dbname['apprenant'].count_documents(
|
||||
{'email': str(diction['email']),
|
||||
|
|
@ -1799,7 +1888,7 @@ def AddStagiairetoClass_from_marketplace(diction):
|
|||
local_diction['email'] = str(diction['email'])
|
||||
local_diction['inscription_id'] = str(inserted_id)
|
||||
|
||||
# print(" ### -- local_diction = ", local_diction)
|
||||
#print(" ### -- eeeeeeeeeeeeeeeeeeeee local_diction = ", local_diction)
|
||||
|
||||
local_status, local_retval = AcceptAttendeeInscription(local_diction)
|
||||
if (local_status is False):
|
||||
|
|
@ -1899,7 +1988,7 @@ def UpdateStagiairetoClass(diction):
|
|||
'is_handicap', 'is_droit_image', 'is_rgpd', 'nationalite', 'situation_famille', 'naissance_lieu',
|
||||
'naissance_departement',
|
||||
'naissance_pays', 'num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite',
|
||||
'telephone_bis', 'frequence_facturation'
|
||||
'telephone_bis', 'frequence_facturation', 'update_dossier_apprenant'
|
||||
|
||||
]
|
||||
|
||||
|
|
@ -2599,6 +2688,36 @@ def UpdateStagiairetoClass(diction):
|
|||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
"""
|
||||
31/03/2026 : Mise à jour du dossier apprenant si update_dossier_apprenant == "1"
|
||||
"""
|
||||
|
||||
#print(" ### mise à jour de l'apprenant 000 : ", ret_val2['apprenant_id'])
|
||||
if ("update_dossier_apprenant" in diction.keys() and diction['update_dossier_apprenant'] == "1"
|
||||
and "apprenant_id" in ret_val2.keys() and ret_val2['apprenant_id']):
|
||||
|
||||
#print(" ### mise à jour de l'apprenant : ", ret_val2['apprenant_id'])
|
||||
local_apprenant_id = ret_val2['apprenant_id']
|
||||
new_apprenant_data = {}
|
||||
tab_champ = ['civilite', 'nom', 'prenom', 'employeur', 'email', 'adresse', 'code_postal', 'ville', 'pays']
|
||||
for field in tab_champ:
|
||||
if( str(field) in ret_val2.keys()):
|
||||
new_apprenant_data[str(field)] = ret_val2[str(field)]
|
||||
|
||||
|
||||
new_apprenant_data['update_date'] = str(datetime.now())
|
||||
new_apprenant_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
ret_val = MYSY_GV.dbname['apprenant'].find_one_and_update(
|
||||
{'_id': ObjectId(str(ret_val2['apprenant_id'])), },
|
||||
{"$set": new_apprenant_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return True, "Les données du stagiaire ont été correctement mise à jour"
|
||||
|
||||
|
||||
|
|
@ -2607,6 +2726,8 @@ def UpdateStagiairetoClass(diction):
|
|||
return False, "Impossible de mettre à jour les données du stagiaire "
|
||||
|
||||
|
||||
|
||||
|
||||
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))
|
||||
|
|
@ -7249,7 +7370,7 @@ def Init_AcceptAttendeeInscription_For_Initial_Formation(diction):
|
|||
if( formation_initiale != "1"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Il ne s'agit pas d'un formation initiale ")
|
||||
return True, " Il ne s'agit pas d'un formation initiale "
|
||||
return True, []
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -7478,7 +7599,7 @@ def Update_AcceptAttendeeInscription_For_Initial_Formation(diction):
|
|||
if (formation_initiale != "1"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Il ne s'agit pas d'un formation initiale ")
|
||||
return True, " Il ne s'agit pas d'un formation initiale "
|
||||
return True, []
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -7768,6 +7889,10 @@ def AcceptAttendeeInscription(diction):
|
|||
data_mail['title'] = local_class[0]['title']
|
||||
class_title = local_class[0]['title']
|
||||
|
||||
class_inscription_directe = ""
|
||||
if( "inscription_direct" in local_class[0].keys()):
|
||||
class_inscription_directe = local_class[0]['inscription_direct']
|
||||
|
||||
|
||||
# Recuperation des données de la session
|
||||
local_session = MYSY_GV.dbname['session_formation'].find_one(
|
||||
|
|
@ -7952,6 +8077,7 @@ def AcceptAttendeeInscription(diction):
|
|||
email_data['title'] = class_title
|
||||
email_data['partner_owner_recid'] = str(partner_recid)
|
||||
email_data['token'] = str(diction['token'])
|
||||
email_data['class_inscription_directe'] = class_inscription_directe
|
||||
|
||||
|
||||
if( "code_session" in local_session.keys()):
|
||||
|
|
@ -8009,6 +8135,11 @@ def AcceptAttendeeInscription(diction):
|
|||
else:
|
||||
email_data['ville'] = ""
|
||||
|
||||
if ("mode_animation_detail_organisation" in local_session.keys()):
|
||||
email_data['mode_animation_detail_organisation'] = local_session['mode_animation_detail_organisation']
|
||||
else:
|
||||
email_data['mode_animation_detail_organisation'] = ""
|
||||
|
||||
print(" ### 2izmmm er envoie emailll email_data = ", email_data)
|
||||
local_status, local_message = email_session.incription_training_confirmation_mail(email_data)
|
||||
if( local_status is False ):
|
||||
|
|
@ -9861,6 +9992,19 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
if ("nom" in diction.keys()):
|
||||
filt_nom = {'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom'])), "$options": "i"}}
|
||||
|
||||
"""
|
||||
Filtre général
|
||||
"""
|
||||
if ("nom" in diction.keys()):
|
||||
qry_gle = {"$or": [
|
||||
{'prenom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
]}
|
||||
else:
|
||||
qry_gle = {}
|
||||
|
||||
filt_class_partner_recid = {'partner_owner_recid': str(partner_recid)}
|
||||
|
||||
filt_client_rattachement_id = {}
|
||||
|
|
@ -9897,7 +10041,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
# ----
|
||||
|
||||
query = [{'$match': {
|
||||
'$and': [filt_archive, filt_class_internal_url, filt_session_code, filt_email, filt_nom, filt_client_nom,
|
||||
'$and': [filt_archive, filt_class_internal_url, filt_session_code, qry_gle,
|
||||
filt_client_rattachement_id,
|
||||
filt_session_id, filt_invoiced, {'partner_owner_recid': str(partner_recid), 'valide': '1'}]}},
|
||||
{'$sort': {'_id': -1}},
|
||||
|
|
@ -16325,7 +16469,7 @@ def Get_Inscrit_List_EU(diction):
|
|||
if (formation_initiale != "1"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Il ne s'agit pas d'un formation initiale ")
|
||||
return True, " Il ne s'agit pas d'un formation initiale "
|
||||
return True, []
|
||||
|
||||
"""
|
||||
Verifier que l'inscription est valide
|
||||
|
|
@ -16439,7 +16583,7 @@ def Get_Inscrit_List_EU_Type_Evaluation(diction):
|
|||
if (formation_initiale != "1"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Il ne s'agit pas d'un formation initiale ")
|
||||
return True, " Il ne s'agit pas d'un formation initiale "
|
||||
return True, []
|
||||
|
||||
"""
|
||||
Verifier que l'inscription est valide
|
||||
|
|
@ -16528,7 +16672,7 @@ def Get_Inscrit_List_EU_Type_Evaluation(diction):
|
|||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
#print(" ### Get_Inscrit_List_EU_Type_Evaluation RetObject = ", RetObject)
|
||||
print(" ### Get_Inscrit_List_EU_Type_Evaluation RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
14966
Log/log_file.log
14966
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -905,14 +905,142 @@ def Update_SessionFormation_Only_Step(diction):
|
|||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, " La promotion de formation à bien été mise à jour"
|
||||
return True, " La mise à jour a été correctement faite."
|
||||
|
||||
|
||||
|
||||
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 mettre à jour La promotion de formation"
|
||||
return False, "Impossible mettre à jour la formation "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour de quelque données de la session
|
||||
"""
|
||||
|
||||
def Update_SessionFormation_From_Id(diction):
|
||||
try:
|
||||
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['token', '_id', 'session_etape', 'mode_animation_detail_organisation']
|
||||
|
||||
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, " Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id', ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
mydata = {}
|
||||
query_key = {}
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
|
||||
|
||||
data_for_check_connexion = {'token': my_token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
"""
|
||||
Verifier la valididé de La promotion de formation
|
||||
"""
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'valide':'1', 'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_session != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - L'identifiant de la session / promotion de formation est invalide ")
|
||||
return False, "L'identifiant de la session/promotion de formation est invalide"
|
||||
|
||||
|
||||
is_valide_session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
new_data = {}
|
||||
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['valide'] = "1"
|
||||
if( 'session_etape' in diction.keys()):
|
||||
new_data['session_etape'] = str(diction['session_etape'])
|
||||
|
||||
if ('mode_animation_detail_organisation' in diction.keys()):
|
||||
new_data['mode_animation_detail_organisation'] = str(diction['mode_animation_detail_organisation'])
|
||||
|
||||
|
||||
|
||||
# print(" ###laaa mydata = ", mydata)
|
||||
coll_name = MYSY_GV.dbname['session_formation']
|
||||
ret_val = coll_name.find_one_and_update(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1', 'partner_owner_recid': str(my_partner['recid'])},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
if (ret_val is None or '_id' not in ret_val.keys()):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Impossible d'ajouter/mettre à jour La promotion '" + str(
|
||||
diction['code_session']) + "' ")
|
||||
return False, "Impossible d'ajouter/mettre à jour La promotion '" + str(diction['code_session']) + "' "
|
||||
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
|
||||
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = diction['token']
|
||||
history_event_dict['related_collection'] = "session_formation"
|
||||
history_event_dict['related_collection_recid'] = str(ret_val['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = "Mise à jour "
|
||||
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, " La mise à jour a été correctement faite."
|
||||
|
||||
|
||||
|
||||
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 mettre à jour la formation "
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -17773,7 +17901,7 @@ def Add_Update_UE_To_Session(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'ue_id', ]
|
||||
field_list = ['token', 'session_id', 'ue_id', 'formateur_id' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -17836,6 +17964,22 @@ def Add_Update_UE_To_Session(diction):
|
|||
})
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du formateur
|
||||
"""
|
||||
local_formateur_id = ""
|
||||
if( "formateur_id" in diction.keys() ):
|
||||
local_formateur_id = diction['formateur_id']
|
||||
is_valide_formateur = MYSY_GV.dbname['ressource_humaine'].count_documents({'_id':ObjectId(diction['formateur_id']),
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_formateur != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du formateur est invalide ")
|
||||
return False, " L'identifiant du formateur est invalide "
|
||||
|
||||
|
||||
|
||||
|
||||
# Verifier que la session est valide
|
||||
is_session_exist_count = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
|
|
@ -17902,7 +18046,7 @@ def Add_Update_UE_To_Session(diction):
|
|||
diction['ue_id'])},
|
||||
{'$set':
|
||||
{
|
||||
|
||||
'list_unite_enseignement.$[xxx].formateur_id': local_formateur_id,
|
||||
'list_unite_enseignement.$[xxx].date_update': str(now),
|
||||
'list_unite_enseignement.$[xxx].update_by': str(
|
||||
my_partner['_id']),
|
||||
|
|
@ -17938,7 +18082,7 @@ def Add_Update_UE_To_Session(diction):
|
|||
new_data['valide'] = "1"
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['formateur_id'] = local_formateur_id
|
||||
new_data['_id'] = str(diction['ue_id'])
|
||||
|
||||
insert = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
|
||||
|
|
@ -18175,6 +18319,30 @@ def Get_List_UE_Given_SessionFormation(diction):
|
|||
user['code'] = str(ue_data['code'])
|
||||
user['titre'] = str(ue_data['titre'])
|
||||
|
||||
local_formateur_id = ""
|
||||
local_formateur_nom = ""
|
||||
local_formateur_prenom = ""
|
||||
local_formateur_prenom_nom = ""
|
||||
|
||||
if( "formateur_id" in local_ue.keys()):
|
||||
|
||||
local_formateur_id = local_ue['formateur_id']
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(local_ue['formateur_id']),
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
|
||||
if( formateur_data and "nom" in formateur_data.keys()):
|
||||
local_formateur_nom = formateur_data['nom']
|
||||
|
||||
if (formateur_data and "prenom" in formateur_data.keys()):
|
||||
local_formateur_prenom = formateur_data['prenom']
|
||||
|
||||
local_formateur_prenom_nom = local_formateur_prenom+" "+local_formateur_nom
|
||||
|
||||
user['formateur_id'] = str(local_formateur_id)
|
||||
user['formateur_prenom_nom'] = str(local_formateur_prenom_nom)
|
||||
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
|
|
|||
71
agenda.py
71
agenda.py
|
|
@ -692,6 +692,77 @@ def get_Agenda_Event_List_Stagiaire(diction):
|
|||
return False, " Impossible de récupérer la liste des évènements "
|
||||
|
||||
|
||||
"""
|
||||
Recuperation du nombre d'heure total
|
||||
"""
|
||||
def get_Agenda_Event_List_Stagiaire_Total_Nb_Heure(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'related_collection', 'related_collection_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 = ['token', 'related_collection', 'related_collection_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 la liste des arguments ")
|
||||
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
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
total_heure_absence = 0
|
||||
for New_retVal in MYSY_GV.dbname['agenda'].find({'related_collection':str(diction['related_collection']), 'related_collection_email':str(diction['related_collection_email']),
|
||||
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}):
|
||||
|
||||
user = New_retVal
|
||||
|
||||
a = datetime.fromisoformat(New_retVal['event_start'])
|
||||
b = datetime.fromisoformat(New_retVal['event_end'])
|
||||
total = (b - a)
|
||||
|
||||
total_heure_absence = total_heure_absence + total.total_seconds()/3600
|
||||
|
||||
node_total_absence = {'total_heure':str(total_heure_absence)}
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(node_total_absence))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer le nombre total d'heures "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction retourne la liste de eventment d'un user/materiel avec
|
||||
des filtre (exemple : event_type = absence, from start_date to end_date
|
||||
|
|
|
|||
|
|
@ -994,6 +994,20 @@ def Get_Apprenant_List_Partner_with_filter(diction):
|
|||
if ("prenom" in diction.keys()):
|
||||
filt_prenom = {'prenom': {'$regex': mycommon.regex_replace_cartere(str(diction['prenom'])), "$options": "i"}}
|
||||
|
||||
"""
|
||||
Filtre général
|
||||
"""
|
||||
if ("nom" in diction.keys()):
|
||||
qry_gle = {"$or": [
|
||||
{'prenom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'matricule': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
]}
|
||||
else:
|
||||
qry_gle = {}
|
||||
|
||||
filt_matricule = {}
|
||||
if ("matricule" in diction.keys()):
|
||||
filt_matricule = {
|
||||
|
|
@ -1011,10 +1025,10 @@ def Get_Apprenant_List_Partner_with_filter(diction):
|
|||
|
||||
filt_class_partner_recid = {'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
query = [{'$match': {'$and': [filt_archive, filt_email, filt_nom, filt_prenom, filt_matricule, {'partner_owner_recid': str(my_partner['recid'])}]}},
|
||||
query = [{'$match': {'$and': [filt_archive, qry_gle, {'partner_owner_recid': str(my_partner['recid'])}]}},
|
||||
{'$sort': {'_id': -1}},
|
||||
]
|
||||
#print("#### Get_Apprenant_List_Partner_with_filter laa 01 : query = ", query)
|
||||
print("#### Get_Apprenant_List_Partner_with_filter laa 01 : query = ", query)
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
for retVal in MYSY_GV.dbname['apprenant'].aggregate(query):
|
||||
|
|
|
|||
|
|
@ -142,6 +142,43 @@ def incription_training_confirmation_mail(diction):
|
|||
if diction['date_au']:
|
||||
date_fin = diction['date_au']
|
||||
|
||||
mode_animation_detail_organisation = ""
|
||||
if ("mode_animation_detail_organisation" in diction.keys()):
|
||||
if diction['mode_animation_detail_organisation']:
|
||||
mode_animation_detail_organisation = diction['mode_animation_detail_organisation']
|
||||
|
||||
class_inscription_directe = ""
|
||||
if ("class_inscription_directe" in diction.keys()):
|
||||
if diction['class_inscription_directe']:
|
||||
class_inscription_directe = diction['class_inscription_directe']
|
||||
|
||||
|
||||
local_company_data = MYSY_GV.dbname['partnair_account'].find_one(
|
||||
{'recid': str(diction['partner_owner_recid']), 'is_partner_admin_account': '1', 'active': '1',
|
||||
'locked': '0'})
|
||||
|
||||
company_data = {}
|
||||
if( "nom" in local_company_data.keys() ):
|
||||
company_data['societe_nom'] = local_company_data['nom']
|
||||
else:
|
||||
company_data['societe_nom'] = ""
|
||||
|
||||
if ("telephone" in local_company_data.keys()):
|
||||
company_data['societe_telephone'] = local_company_data['telephone']
|
||||
else:
|
||||
company_data['societe_telephone'] = ""
|
||||
|
||||
if ("email" in local_company_data.keys()):
|
||||
company_data['societe_email'] = local_company_data['email']
|
||||
else:
|
||||
company_data['societe_email'] = ""
|
||||
|
||||
if ("website" in local_company_data.keys()):
|
||||
company_data['societe_website'] = local_company_data['website']
|
||||
else:
|
||||
company_data['societe_website'] = ""
|
||||
|
||||
|
||||
|
||||
# JINJA2 zzzzz
|
||||
|
||||
|
|
@ -165,7 +202,12 @@ def incription_training_confirmation_mail(diction):
|
|||
"presentiel": str(local_presentiel),
|
||||
"formateur": str(local_formateur),
|
||||
"session_ondemande": str(session_ondemande),
|
||||
"email": str(diction['email'])},
|
||||
"mode_animation_detail_organisation": str(mode_animation_detail_organisation),
|
||||
"class_inscription_directe": str(class_inscription_directe),
|
||||
"company_data": company_data,
|
||||
"email": str(diction['email']),
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
#print(" ### BODY DATA = ", body)
|
||||
|
|
|
|||
34
main.py
34
main.py
|
|
@ -510,6 +510,7 @@ def get_partner_class():
|
|||
status, retval = cm.get_partner_class(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
Cette API fait une recherche au sens large avec des like
|
||||
"""
|
||||
|
|
@ -2408,6 +2409,22 @@ def Update_SessionFormation_Only_Step():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de Mise à jour de quelque données de la session
|
||||
"""
|
||||
@app.route('/myclass/api/Update_SessionFormation_From_Id/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_SessionFormation_From_Id():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_SessionFormation_From_Id : payload = ",str(payload))
|
||||
localStatus, message= SF.Update_SessionFormation_From_Id(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de mise à jour du paramétrage d'automatisation d'envoi des documents
|
||||
WARNING : Une session est modifiable tanque la facturation n'a pas demarré. Apres tous est bloqué
|
||||
|
|
@ -8062,6 +8079,23 @@ def get_Agenda_Event_List_Stagiaire():
|
|||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de la recuperation le nombre total d'heures
|
||||
"""
|
||||
@app.route('/myclass/api/get_Agenda_Event_List_Stagiaire_Total_Nb_Heure/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def get_Agenda_Event_List_Stagiaire_Total_Nb_Heure():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### get_Agenda_Event_List_Stagiaire_Total_Nb_Heure : payload = ",payload)
|
||||
status, retval = agenda.get_Agenda_Event_List_Stagiaire_Total_Nb_Heure(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de la recuperation de la liste des evenements dans l'agenda avec des filtre
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1705,6 +1705,21 @@ def Get_Partner_List_Partner_Client_with_filter_Like(diction):
|
|||
if ("email" in diction.keys()):
|
||||
filt_email = {'email': {'$regex': str(diction['email']), "$options": "i"}}
|
||||
|
||||
"""
|
||||
Filtre général
|
||||
"""
|
||||
if ("nom" in diction.keys()):
|
||||
qry_gle = {"$or": [
|
||||
{'raison_sociale': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
|
||||
]}
|
||||
else:
|
||||
qry_gle = {}
|
||||
|
||||
|
||||
|
||||
filt_client_is_client = {}
|
||||
if ("is_client" in diction.keys()):
|
||||
filt_client_is_client = {'is_client': str(diction['is_client'])}
|
||||
|
|
@ -1720,13 +1735,13 @@ def Get_Partner_List_Partner_Client_with_filter_Like(diction):
|
|||
|
||||
filt_class_partner_recid = {'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
qry = {'$and': [filt_archive, filt_raison_sociale, filt_email, filt_nom, filt_client_is_client,
|
||||
qry = {'$and': [filt_archive, qry_gle, filt_client_is_client,
|
||||
filt_client_is_financeur,filt_client_is_fournisseur, {'partner_owner_recid': str(my_partner['recid'])}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
#print("#### Get_Partner_List_Partner_Client_with_filter_Like laa 01 : query = ", qry)
|
||||
print("#### Get_Partner_List_Partner_Client_with_filter_Like laa 01 : query = ", qry)
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
|
|
|
|||
12
partners.py
12
partners.py
|
|
@ -2296,13 +2296,17 @@ def Update_Context_Partner_Account(diction):
|
|||
Verifier si j'ai une telle variable de stocké deja
|
||||
"""
|
||||
is_context_exist = "0"
|
||||
for tmp in MYSY_GV.dbname['partnair_account'].find({'list_connexion_context.code':str(key)}):
|
||||
|
||||
#print(" ## QRY = ", {'_id': ObjectId(str(diction['partner_id'])), 'list_connexion_context.code':str(key)})
|
||||
|
||||
|
||||
for tmp in MYSY_GV.dbname['partnair_account'].find({'_id': ObjectId(str(diction['partner_id'])), 'list_connexion_context.code':str(key)}):
|
||||
is_context_exist = "1"
|
||||
|
||||
|
||||
if( is_context_exist == "0"):
|
||||
# L'utilisateur n'a pas cette veleur de context, il faut la créer
|
||||
#print(" ### L'utilisateur n'a pas cette veleur de context, il faut la créer")
|
||||
print(" ### L'utilisateur n'a pas cette veleur de context, il faut la créer")
|
||||
new_data = {}
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
|
@ -2310,7 +2314,7 @@ def Update_Context_Partner_Account(diction):
|
|||
new_data['code'] = str(key)
|
||||
new_data['code_value'] = str(value)
|
||||
|
||||
|
||||
#print(" ### new_data = ", new_data)
|
||||
|
||||
create = MYSY_GV.dbname['partnair_account'].update_one({
|
||||
'_id': ObjectId(str(diction['partner_id'])),
|
||||
|
|
@ -2351,7 +2355,7 @@ def Update_Context_Partner_Account(diction):
|
|||
]
|
||||
)
|
||||
|
||||
print(" ### update = ", update)
|
||||
#print(" ### update = ", update)
|
||||
|
||||
return True, "Le contexte de connexion a été correctement mis à jour"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue