20/04/2024 - 20h44
parent
56b3b734bc
commit
0b5db3b6d7
|
@ -1,15 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="19/04/2024 - 22h22">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/04/2024 - 13h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.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" />
|
||||
|
@ -79,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00223" summary="18/02/2024 - 14h">
|
||||
<created>1708260895527</created>
|
||||
<option name="number" value="00223" />
|
||||
<option name="presentableId" value="LOCAL-00223" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1708260895528</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00224" summary="ddr">
|
||||
<created>1708698485603</created>
|
||||
<option name="number" value="00224" />
|
||||
|
@ -422,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1713558162945</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="272" />
|
||||
<task id="LOCAL-00272" summary="20/04/2024 - 13h">
|
||||
<created>1713610715820</created>
|
||||
<option name="number" value="00272" />
|
||||
<option name="presentableId" value="LOCAL-00272" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1713610715822</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="273" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -464,7 +462,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="20/03/2024 - 22h30" />
|
||||
<MESSAGE value="20/03/2024 - 22h30d" />
|
||||
<MESSAGE value="20/03/2024 - 22h30dss" />
|
||||
<MESSAGE value="25/03/2024 - 18h30" />
|
||||
|
@ -489,6 +486,7 @@
|
|||
<MESSAGE value="17/04/2024 - 21h04" />
|
||||
<MESSAGE value="18/04/2024 - 21h50" />
|
||||
<MESSAGE value="19/04/2024 - 22h22" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="19/04/2024 - 22h22" />
|
||||
<MESSAGE value="20/04/2024 - 13h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="20/04/2024 - 13h" />
|
||||
</component>
|
||||
</project>
|
|
@ -6480,7 +6480,9 @@ On y ajoute la formation concernée
|
|||
"""
|
||||
def Get_Statgaire_List_Partner_with_filter(diction):
|
||||
try:
|
||||
field_list = ['token', 'class_internal_url', 'code_session', 'status', 'email', 'nom', 'class_title', 'code_session','client_nom']
|
||||
field_list = ['token', 'class_internal_url', 'code_session', 'status', 'email', 'nom',
|
||||
'class_title', 'code_session','client_nom', 'client_rattachement_id',
|
||||
'session_id']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
@ -6529,7 +6531,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
qry_list_session_id = {"$and": [{'code_session': {'$regex': str(diction['code_session']), "$options": "i"}},
|
||||
{'partner_owner_recid': str(partner_recid)}]}
|
||||
|
||||
print(" ### qry_list_session_id aa = ", qry_list_session_id)
|
||||
#print(" ### qry_list_session_id aa = ", qry_list_session_id)
|
||||
list_session_id_count = MYSY_GV.dbname['session_formation'].count_documents(qry_list_session_id)
|
||||
|
||||
if( list_session_id_count <= 0 ):
|
||||
|
@ -6561,6 +6563,13 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
|
||||
filt_class_partner_recid = {'partner_owner_recid': str(partner_recid)}
|
||||
|
||||
filt_client_rattachement_id = {}
|
||||
if ("client_rattachement_id" in diction.keys()):
|
||||
filt_client_rattachement_id = {'client_rattachement_id': str(diction['client_rattachement_id'])}
|
||||
|
||||
filt_session_id = {}
|
||||
if ("session_id" in diction.keys()):
|
||||
filt_session_id = {'session_id': str(diction['session_id'])}
|
||||
|
||||
# -----
|
||||
|
||||
|
@ -6582,7 +6591,8 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
#----
|
||||
|
||||
|
||||
query = [{'$match':{ '$and' : [ filt_class_internal_url, filt_session_id, filt_email, filt_nom, filt_client_nom, {'partner_owner_recid':str(partner_recid)}] } },
|
||||
query = [{'$match':{ '$and' : [ filt_class_internal_url, filt_session_id, filt_email, filt_nom, filt_client_nom, filt_client_rattachement_id,
|
||||
filt_session_id, {'partner_owner_recid':str(partner_recid)}] } },
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup':
|
||||
{
|
||||
|
@ -6616,7 +6626,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
]
|
||||
print("#### Get_Statgaire_List_Partner_with_filter laa 01 : query = ", query)
|
||||
RetObject = []
|
||||
cpt = 1
|
||||
cpt = 0
|
||||
for retVal in MYSY_GV.dbname['inscription'].aggregate(query):
|
||||
val = {}
|
||||
if ('myclass_collection' in retVal.keys() and len(retVal['myclass_collection']) > 0):
|
||||
|
@ -6626,8 +6636,8 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
val['_id'] = retVal['_id']
|
||||
val['session_id'] = retVal['session_id']
|
||||
val['class_internal_url'] = retVal['class_internal_url']
|
||||
|
||||
val['nom'] = retVal['nom']
|
||||
val['partner_owner_recid'] = retVal['partner_owner_recid']
|
||||
val['prenom'] = retVal['prenom']
|
||||
|
||||
val['email'] = retVal['email']
|
||||
|
@ -6638,7 +6648,6 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
val['civilite'] = ""
|
||||
|
||||
|
||||
|
||||
if( "modefinancement" in retVal.keys()):
|
||||
val['modefinancement'] = retVal['modefinancement']
|
||||
else:
|
||||
|
@ -6907,6 +6916,10 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
return False, "Impossible de récupérer la liste des stagiaires"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction prend '_id' d'une ligne et retour les information de l'inscription associé.
|
||||
|
||||
|
@ -10702,3 +10715,325 @@ def Export_Inscription_To_Excel_From_from_List_Id(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'exporter les inscrits "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Dans le cadre de la modification des inscription
|
||||
cette fonction permet de recuperer les données des inscrit (on ne va pas chercher les données de l'apprenant).
|
||||
|
||||
Ici l'inscription n'est pas validée encore
|
||||
"""
|
||||
|
||||
|
||||
def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction):
|
||||
try:
|
||||
field_list = ['partner_owner_recid', 'class_internal_url', 'code_session', 'status', 'email', 'nom',
|
||||
'class_title', 'code_session', 'client_nom', 'client_rattachement_id',
|
||||
'session_id']
|
||||
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é, Creation partenaire annulée")
|
||||
return False, "Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
|
||||
partner_recid = diction['partner_owner_recid']
|
||||
|
||||
"""
|
||||
Etape 1 : si on a le champ 'code session' saisie par l'utilisateur,
|
||||
alors on va commencer par aller cherche toutes les session avec un regex de la valeur saisie filter sur le partner_recid
|
||||
|
||||
"""
|
||||
filt_session_id = {}
|
||||
list_session_id = []
|
||||
if ("code_session" in diction.keys()):
|
||||
filt_code_session = {'code_session': {'$regex': str(diction['code_session']), "$options": "i"}}
|
||||
|
||||
|
||||
qry_list_session_id = {"$and": [{'code_session': {'$regex': str(diction['code_session']), "$options": "i"}},
|
||||
{'partner_owner_recid': str(partner_recid)}]}
|
||||
|
||||
# print(" ### qry_list_session_id aa = ", qry_list_session_id)
|
||||
list_session_id_count = MYSY_GV.dbname['session_formation'].count_documents(qry_list_session_id)
|
||||
|
||||
if (list_session_id_count <= 0):
|
||||
# Aucune session
|
||||
return True, []
|
||||
|
||||
for val in MYSY_GV.dbname['session_formation'].find(qry_list_session_id):
|
||||
list_session_id.append(str(val['_id']))
|
||||
|
||||
print(" ### liste des Id des sessions eligible list_session_id = ", list_session_id)
|
||||
filt_session_id = {'session_id': {'$in': list_session_id, }}
|
||||
|
||||
filt_class_title = {}
|
||||
if ("class_title" in diction.keys()):
|
||||
filt_class_title = {'title': {'$regex': str(diction['class_title']), "$options": "i"}}
|
||||
|
||||
filt_class_internal_url = {}
|
||||
if ("class_internal_url" in diction.keys()):
|
||||
filt_class_internal_url = {
|
||||
'class_internal_url': {'$regex': str(diction['class_internal_url']), "$options": "i"}}
|
||||
|
||||
filt_email = {}
|
||||
if ("email" in diction.keys()):
|
||||
filt_email = {'email': {'$regex': str(diction['email']), "$options": "i"}}
|
||||
|
||||
filt_nom = {}
|
||||
if ("nom" in diction.keys()):
|
||||
filt_nom = {'nom': {'$regex': str(diction['nom']), "$options": "i"}}
|
||||
|
||||
filt_class_partner_recid = {'partner_owner_recid': str(partner_recid)}
|
||||
|
||||
filt_client_rattachement_id = {}
|
||||
if ("client_rattachement_id" in diction.keys()):
|
||||
filt_client_rattachement_id = {'client_rattachement_id': str(diction['client_rattachement_id'])}
|
||||
|
||||
filt_session_id = {}
|
||||
if ("session_id" in diction.keys()):
|
||||
filt_session_id = {'session_id': str(diction['session_id'])}
|
||||
|
||||
# -----
|
||||
|
||||
filt_client_nom = {}
|
||||
sub_filt_client_nom = {}
|
||||
Lists_partner_client_id = []
|
||||
if ("client_nom" in diction.keys()):
|
||||
sub_filt_client_nom = {'nom': {'$regex': str(diction['client_nom']), "$options": "i"},
|
||||
'partner_recid': str(partner_recid), 'valide': '1', 'locked': '0'}
|
||||
# Recuperation des '_id' des clients dont le nom match en regexp
|
||||
# print(" ### sub_filt_client_nom = ", sub_filt_client_nom)
|
||||
for List_Client_Data in MYSY_GV.dbname['partner_client'].find(sub_filt_client_nom, {'_id': 1}):
|
||||
Lists_partner_client_id.append(str(List_Client_Data['_id']))
|
||||
|
||||
filt_client_nom = {'client_rattachement_id': {'$in': Lists_partner_client_id, }}
|
||||
# print(' ### filt_client_nom = ', filt_client_nom)
|
||||
|
||||
# ----
|
||||
|
||||
query = [{'$match': {'$and': [filt_class_internal_url, filt_session_id, filt_email, filt_nom, filt_client_nom,
|
||||
filt_client_rattachement_id,
|
||||
filt_session_id, {'partner_owner_recid': str(partner_recid)}]}},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': {'$and': [filt_class_title, filt_class_partner_recid]}},
|
||||
{'$project': {'title': 1, 'domaine': 1,
|
||||
'duration': 1,
|
||||
'duration_unit': 1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
print("#### Get_Statgaire_List_Partner_with_filter_ONLY_INSCRIPTION laa 01 : query = ", query)
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
for retVal in MYSY_GV.dbname['inscription'].aggregate(query):
|
||||
val = {}
|
||||
if ('myclass_collection' in retVal.keys() and len(retVal['myclass_collection']) > 0):
|
||||
|
||||
val['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
val['_id'] = retVal['_id']
|
||||
val['session_id'] = retVal['session_id']
|
||||
val['class_internal_url'] = retVal['class_internal_url']
|
||||
val['nom'] = retVal['nom']
|
||||
val['partner_owner_recid'] = retVal['partner_owner_recid']
|
||||
val['prenom'] = retVal['prenom']
|
||||
|
||||
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']
|
||||
else:
|
||||
val['modefinancement'] = ""
|
||||
|
||||
if ("opco" in retVal.keys()):
|
||||
val['opco'] = retVal['opco']
|
||||
else:
|
||||
val['opco'] = ""
|
||||
|
||||
if ("employeur" in retVal.keys()):
|
||||
val['employeur'] = retVal['employeur']
|
||||
else:
|
||||
val['employeur'] = ""
|
||||
|
||||
if ("telephone" in retVal.keys()):
|
||||
val['telephone'] = retVal['telephone']
|
||||
else:
|
||||
val['telephone'] = ""
|
||||
|
||||
if ("date_naissance" in retVal.keys()):
|
||||
val['date_naissance'] = retVal['date_naissance']
|
||||
else:
|
||||
val['date_naissance'] = ""
|
||||
|
||||
if ("adresse" in retVal.keys()):
|
||||
val['adresse'] = retVal['adresse']
|
||||
else:
|
||||
val['adresse'] = ""
|
||||
|
||||
if ("code_postal" in retVal.keys()):
|
||||
val['code_postal'] = retVal['code_postal']
|
||||
else:
|
||||
val['code_postal'] = ""
|
||||
|
||||
if ("ville" in retVal.keys()):
|
||||
val['ville'] = retVal['ville']
|
||||
else:
|
||||
val['ville'] = ""
|
||||
|
||||
if ("pays" in retVal.keys()):
|
||||
val['pays'] = retVal['pays']
|
||||
else:
|
||||
val['pays'] = ""
|
||||
|
||||
val['status'] = retVal['status']
|
||||
|
||||
val['title'] = retVal['myclass_collection'][0]['title']
|
||||
if ("domaine" in retVal['myclass_collection'][0].keys()):
|
||||
val['domaine'] = retVal['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
val['domaine'] = ""
|
||||
|
||||
# Recuperation des informations de la session
|
||||
local_qry = {'_id': ObjectId(retVal['session_id']), 'valide': '1'}
|
||||
|
||||
# print(" #### local_qry zzz = ", local_qry)
|
||||
|
||||
count_session = MYSY_GV.dbname['session_formation'].count_documents(local_qry)
|
||||
|
||||
client_rattachement_id = ""
|
||||
client_rattachement_nom = ""
|
||||
|
||||
# Si il a un client rattacher, recuperation des information du client
|
||||
# print(" ### retVal = ", retVal )
|
||||
if ("client_rattachement_id" in retVal.keys()):
|
||||
if (retVal['client_rattachement_id'] and str(retVal['client_rattachement_id']) != 'undefined'):
|
||||
client_retval = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(retVal['client_rattachement_id']),
|
||||
'valide': '1', 'locked': '0'})
|
||||
|
||||
if (client_retval is not None):
|
||||
client_rattachement_id = client_retval['_id']
|
||||
client_rattachement_nom = client_retval['nom']
|
||||
|
||||
val['client_rattachement_id'] = client_rattachement_id
|
||||
val['client_rattachement_nom'] = client_rattachement_nom
|
||||
|
||||
# ----
|
||||
|
||||
invoiced = ""
|
||||
if ("invoiced" in retVal.keys()):
|
||||
invoiced = retVal['invoiced']
|
||||
val['invoiced'] = invoiced
|
||||
|
||||
invoiced_ref = ""
|
||||
if ("invoiced_ref" in retVal.keys()):
|
||||
invoiced_ref = retVal['invoiced_ref']
|
||||
val['invoiced_ref'] = invoiced_ref
|
||||
|
||||
invoiced_date = ""
|
||||
if ("invoiced_date" in retVal.keys()):
|
||||
invoiced_date = str(retVal['invoiced_date'])[0:10]
|
||||
val['invoiced_date'] = invoiced_date
|
||||
|
||||
financeur_rattachement_id = ""
|
||||
financeur_rattachement_nom = ""
|
||||
|
||||
# Si il a un client rattacher, recuperation des information du client
|
||||
# print(" ### retVal = ", retVal )
|
||||
if ("financeur_rattachement_id" in retVal.keys()):
|
||||
if (retVal['financeur_rattachement_id'] and str(
|
||||
retVal['financeur_rattachement_id']) != 'undefined'):
|
||||
client_retval = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(retVal['financeur_rattachement_id']),
|
||||
'valide': '1', 'locked': '0'})
|
||||
|
||||
if (client_retval is not None):
|
||||
financeur_rattachement_id = client_retval['_id']
|
||||
financeur_rattachement_nom = client_retval['nom']
|
||||
|
||||
val['financeur_rattachement_id'] = financeur_rattachement_id
|
||||
val['financeur_rattachement_nom'] = financeur_rattachement_nom
|
||||
|
||||
if (count_session != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Impossible de récupérer la liste des stagiaires, Il y a une incohérence sur la session : " + str(
|
||||
retVal['session_id']))
|
||||
return False, "Impossible de récupérer la liste des stagiaires, Les informations d'identification sont incorrectes. Il y a une incohérence sur la session : " + str(
|
||||
retVal['session_id'])
|
||||
|
||||
# qry2 = {'class_internal_url':str(retVal['class_internal_url']), 'code_session':str(retVal['session_id']), 'valide':'1'}
|
||||
# print(" ### qry 2 =", qry2)
|
||||
session_retval = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(retVal['session_id'])), 'valide': '1'})
|
||||
|
||||
if ("code_session" in session_retval.keys()):
|
||||
val['code_session'] = str(session_retval['code_session'])
|
||||
else:
|
||||
val['code_session'] = ""
|
||||
|
||||
if ("date_debut" in session_retval.keys()):
|
||||
val['date_du'] = str(session_retval['date_debut'])[0:10]
|
||||
else:
|
||||
val['date_du'] = ""
|
||||
|
||||
if ("date_fin" in session_retval.keys()):
|
||||
val['date_au'] = str(session_retval['date_fin'])[0:10]
|
||||
else:
|
||||
val['date_au'] = ""
|
||||
|
||||
if ("code_postal" in session_retval.keys()):
|
||||
val['code_postal'] = session_retval['code_postal']
|
||||
else:
|
||||
val['code_postal'] = ""
|
||||
|
||||
if ("prix_session" in session_retval.keys()):
|
||||
val['price'] = session_retval['prix_session']
|
||||
else:
|
||||
val['price'] = ""
|
||||
|
||||
if ("presentiel" in session_retval.keys()):
|
||||
val['presentiel'] = session_retval['presentiel']
|
||||
else:
|
||||
val['presentiel'] = "0"
|
||||
|
||||
if ("distantiel" in session_retval.keys()):
|
||||
val['distantiel'] = session_retval['distantiel']
|
||||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("session_ondemande" in session_retval.keys()):
|
||||
val['session_ondemande'] = session_retval['session_ondemande']
|
||||
else:
|
||||
val['session_ondemande'] = "0"
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de récupérer la liste des stagiaires"
|
||||
|
|
1519
Log/log_file.log
1519
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -9432,3 +9432,109 @@ def Send_Email_request_presinscription_data_validation(diction):
|
|||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer les demandes de mise à jour"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet à un client de mettre à jour
|
||||
la liste de ses partipants à une session de formation.
|
||||
|
||||
"""
|
||||
def Client_Update_Liste_Attendee_No_Token(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['client_id', 'session_id', 'list_attendee_data', 'partner_recid']
|
||||
|
||||
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 = ['client_id', 'session_id', 'list_attendee_data', 'partner_recid']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
|
||||
"""
|
||||
Verifier que le client est valide
|
||||
"""
|
||||
is_client_valide_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['client_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(diction['partner_recid'])})
|
||||
if(is_client_valide_data is None ):
|
||||
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 "
|
||||
|
||||
"""
|
||||
Verifier que la session est valide
|
||||
"""
|
||||
is_session_valide_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['session_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
diction['partner_recid'])})
|
||||
if (is_session_valide_data is None):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " L'identifiant de la session n'est pas valide")
|
||||
return False, " L'identifiant de la session n'est pas valide "
|
||||
|
||||
|
||||
JSON_attendee_response = ast.literal_eval(diction['list_attendee_data'])
|
||||
|
||||
|
||||
for val in JSON_attendee_response:
|
||||
# Verifier qu'on mettre à jour tous les participants
|
||||
is_valide_attendee = MYSY_GV.dbname['inscription'].count_documents({'_id':ObjectId(str(val['_id'])),
|
||||
'status':'0',
|
||||
'session_id':str(diction['session_id']),
|
||||
'client_rattachement_id':str(diction['client_id']),
|
||||
'partner_owner_recid':str(diction['partner_recid'])})
|
||||
|
||||
if(is_valide_attendee <= 0 ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le participant "+str(val['_id'])+" n'est pas valide ou n'est pas au statut PREINSCRIT")
|
||||
return False, " Le participant "+str(val['_id'])+" n'est pas valide ou n'est pas au statut PREINSCRIT"
|
||||
|
||||
|
||||
"""
|
||||
A présent toutes les données sont valide, on fait la mise à jour
|
||||
"""
|
||||
for val in JSON_attendee_response:
|
||||
# Verifier qu'on mettre à jour tous les participants
|
||||
update_data = {}
|
||||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = "Client"
|
||||
|
||||
update_data['nom'] = str(val['nom'])
|
||||
update_data['prenom'] = str(val['prenom'])
|
||||
update_data['email'] = str(val['email'])
|
||||
|
||||
update_attendee_data = MYSY_GV.dbname['inscription'].find_one_and_update({'_id':ObjectId(str(val['_id'])),
|
||||
'status':'0',
|
||||
'session_id':str(diction['session_id']),
|
||||
'client_rattachement_id':str(diction['client_id']),
|
||||
'partner_owner_recid':str(diction['partner_recid'])},
|
||||
{"$set": update_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
return True, "Les mise à jour ont été correctement faite"
|
||||
|
||||
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 mettre à jour la liste des participants"
|
|
@ -2620,7 +2620,7 @@ def find_partner_class_like(diction):
|
|||
{'partner_owner_recid': user_recid},
|
||||
filt_external_code, filt_title, filt_internal_url]}
|
||||
|
||||
print(" ##### find_partner_class_like_local_qry = ", find_partner_class_like_local_qry)
|
||||
#print(" ##### find_partner_class_like_local_qry = ", find_partner_class_like_local_qry)
|
||||
|
||||
"""
|
||||
Recuperation du nombre d'heure par jour depuis la confif du partner
|
||||
|
|
30
main.py
30
main.py
|
@ -3590,6 +3590,19 @@ def Prepare_request_presinscription_data_validation():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API permet a un client de mettre à jour la liste de ses participants à une session de formation.
|
||||
"""
|
||||
@app.route('/myclass/api/Client_Update_Liste_Attendee_No_Token/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Client_Update_Liste_Attendee_No_Token():
|
||||
# On CancelAttendeeInscription le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Client_Update_Liste_Attendee_No_Token : payload = ",payload)
|
||||
localStatus, message= SF.Client_Update_Liste_Attendee_No_Token(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de validation d'une inscription d'un stagiaire
|
||||
|
@ -4442,6 +4455,23 @@ def Get_Statgaire_List_Partner_with_filter():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere la liste complete des stagaire d'un partener pour seulement les inscription
|
||||
on ne fait pas de lien avec la collection des apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN payload = ",payload)
|
||||
status, retval = inscription.Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere les informations d'une inscription en partant de '_id' de la ligne
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue