parent
f2692f1da6
commit
1f5a3e4ba7
|
|
@ -4,12 +4,19 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="10/03/26 - 20h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="14/03/2026 - 22h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/session_admission_fi.py" beforeDir="false" afterPath="$PROJECT_DIR$/session_admission_fi.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_access_right.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_access_right.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -453,7 +460,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="548" />
|
||||
<option name="localTasksCounter" value="549" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -495,7 +502,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="02/01/26 - 21h" />
|
||||
<MESSAGE value="04/01/26 - 21h30" />
|
||||
<MESSAGE value="09/01/26 - 20h30" />
|
||||
<MESSAGE value="30/01/2026 - 18h" />
|
||||
|
|
@ -520,6 +526,7 @@
|
|||
<MESSAGE value="07/03/26 - 16h" />
|
||||
<MESSAGE value="08/03/26 - 20h" />
|
||||
<MESSAGE value="10/03/26 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="10/03/26 - 20h" />
|
||||
<MESSAGE value="14/03/2026 - 22h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="14/03/2026 - 22h" />
|
||||
</component>
|
||||
</project>
|
||||
14934
Log/log_file.log
14934
Log/log_file.log
File diff suppressed because one or more lines are too long
48
agenda.py
48
agenda.py
|
|
@ -258,7 +258,7 @@ def Add_Update_Agenda_Event_Stagiaire(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'related_collection', 'event_title', 'event_start', 'event_end', 'comment',
|
||||
'event_type', 'justified', 'related_collection_email', 'inscription_id']
|
||||
'event_type', 'justified', 'related_collection_email', 'inscription_id', 'session_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -352,6 +352,20 @@ def Add_Update_Agenda_Event_Stagiaire(diction):
|
|||
comment = str(diction['comment'])
|
||||
mydata['comment'] = comment
|
||||
|
||||
session_id = ""
|
||||
if ("session_id" in diction.keys()):
|
||||
is_valide_session_id = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(diction['session_id']),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_session_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La session de formation est invalide ")
|
||||
return False, " La formation est invalide "
|
||||
|
||||
session_id = str(diction['session_id'])
|
||||
mydata['session_id'] = session_id
|
||||
|
||||
|
||||
event_type = ""
|
||||
if ("event_type" in diction.keys()):
|
||||
event_type = str(diction['event_type'])
|
||||
|
|
@ -636,13 +650,39 @@ def get_Agenda_Event_List_Stagiaire(diction):
|
|||
|
||||
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
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
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
|
||||
user['heure_absence'] = str(total.total_seconds()/3600)
|
||||
|
||||
code_session = ""
|
||||
if("session_id" in New_retVal.keys() and New_retVal['session_id']):
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(New_retVal['session_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1, 'code_session':1})
|
||||
|
||||
if( local_session_data and "code_session" in local_session_data.keys()):
|
||||
code_session = local_session_data['code_session']
|
||||
|
||||
user['code_session'] = code_session
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
else:
|
||||
user['session_id'] = ""
|
||||
user['code_session'] = ""
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
|
|
|||
|
|
@ -1555,9 +1555,14 @@ def Get_Apprenant_List_Inscription(diction):
|
|||
|
||||
local_status, local_retval_str = sf.GetSessionFormation(local_diction)
|
||||
if( local_status is False ):
|
||||
return local_status, local_retval
|
||||
return local_status, local_retval_str
|
||||
|
||||
local_retval = ast.literal_eval(local_retval_str[0])
|
||||
print(" local_retval_str = ", local_retval_str)
|
||||
|
||||
local_retval = []
|
||||
|
||||
if( len(local_retval_str) > 0):
|
||||
local_retval = ast.literal_eval(local_retval_str[0])
|
||||
|
||||
if( local_retval and "title" in local_retval.keys()):
|
||||
user['class_title'] = local_retval['title']
|
||||
|
|
|
|||
30
class_mgt.py
30
class_mgt.py
|
|
@ -3901,7 +3901,7 @@ def get_partner_class(diction):
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive']
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive', 'is_ftion_initiale']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
|
@ -3969,6 +3969,8 @@ def get_partner_class(diction):
|
|||
title_crit['title'] = diction['title']
|
||||
|
||||
|
||||
|
||||
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
# verifier que le token et l'email sont ok
|
||||
|
|
@ -4025,6 +4027,13 @@ def get_partner_class(diction):
|
|||
filt_archive = {'archive':'1'}
|
||||
|
||||
|
||||
filt_is_ftion_initiale = {}
|
||||
if ("is_ftion_initiale" in diction.keys() and diction['is_ftion_initiale'] == "1"):
|
||||
filt_is_ftion_initiale = {'is_ftion_initiale':"1"}
|
||||
else:
|
||||
filt_is_ftion_initiale = {'is_ftion_initiale': {'$ne':'1'}}
|
||||
|
||||
|
||||
|
||||
"""
|
||||
print(" ATTTTENNTION : GESTION DU CAS OU LA PERSONNE QUI CHERCHE LE COURS EST UN UTILISATEUR : PB avec : partner_owner_recid ")
|
||||
|
|
@ -4056,9 +4065,11 @@ def get_partner_class(diction):
|
|||
filt_scope_class_id['_id'] = {'$in':tab_class_id_ObjectId}
|
||||
|
||||
|
||||
|
||||
|
||||
for retVal in coll_name.find( {"$and":[ {'valide':'1'},{'locked':'0'},
|
||||
{'partner_owner_recid':user_recid} ,
|
||||
filt_external_code, filt_title, filt_internal_url, filt_scope_class_id, filt_archive]},
|
||||
filt_external_code, filt_title, filt_internal_url, filt_scope_class_id, filt_archive, filt_is_ftion_initiale]},
|
||||
{ 'indexed':0, 'indexed_desc':0,
|
||||
'indexed_obj':0, 'indexed_title':0, }
|
||||
).sort([("_id", pymongo.DESCENDING), ]):
|
||||
|
|
@ -4205,7 +4216,7 @@ def get_partner_class(diction):
|
|||
else:
|
||||
user['duration_in_hour'] = ""
|
||||
|
||||
user['currecny'] = currency
|
||||
user['currency'] = currency
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
|
@ -4516,7 +4527,7 @@ def get_partner_class_Without_Scope_Action(diction):
|
|||
else:
|
||||
user['duration_in_hour'] = ""
|
||||
|
||||
user['currecny'] = currency
|
||||
user['currency'] = currency
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
|
@ -4541,7 +4552,7 @@ def find_partner_class_like(diction):
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive']
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive', 'is_ftion_initiale']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
|
@ -4657,6 +4668,11 @@ def find_partner_class_like(diction):
|
|||
elif( "archive" not in diction.keys()):
|
||||
filt_archive = {'archive': {'$ne': '1'}}
|
||||
|
||||
filt_is_ftion_initiale = {}
|
||||
if ("is_ftion_initiale" in diction.keys() and diction['is_ftion_initiale'] == "1"):
|
||||
filt_is_ftion_initiale = {'is_ftion_initiale': "1"}
|
||||
else:
|
||||
filt_is_ftion_initiale = {'is_ftion_initiale': {'$ne': '1'}}
|
||||
|
||||
filt_internal_url = {}
|
||||
if ("internal_url" in diction.keys()):
|
||||
|
|
@ -4698,7 +4714,7 @@ def find_partner_class_like(diction):
|
|||
val_tmp = 1
|
||||
for retVal in coll_name.find({"$and": [{'valide': '1'}, {'locked': '0'},
|
||||
{'partner_owner_recid': user_recid},
|
||||
filt_external_code, filt_title, filt_internal_url, filt_scope_class_id, filt_archive]},
|
||||
filt_external_code, filt_title, filt_internal_url, filt_scope_class_id, filt_archive, filt_is_ftion_initiale]},
|
||||
{'programme':0, 'objectif': 0, 'indexed': 0, 'indexed_desc': 0,
|
||||
'indexed_obj': 0, 'indexed_title': 0, }
|
||||
).sort([("_id", pymongo.DESCENDING), ]):
|
||||
|
|
@ -4824,7 +4840,7 @@ def find_partner_class_like(diction):
|
|||
else:
|
||||
user['duration_in_hour'] = ""
|
||||
|
||||
user['currecny'] = currency
|
||||
user['currency'] = currency
|
||||
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
|
|
|||
10
email_mgt.py
10
email_mgt.py
|
|
@ -2512,7 +2512,7 @@ def ManualSendInvoiceEmailRIB_CIC_JMJFormation(diction):
|
|||
body = {
|
||||
"params": {"order_id": "MTT/2025_N°0012/JMJ FORMATION",
|
||||
"date_order": ": 14/07/2025",
|
||||
"periode":"13/02/2026 au 14/03/2026",
|
||||
"periode":"14/03/2026 au 13/04/2026",
|
||||
"total_ht": "130",
|
||||
"tva": "11.05",
|
||||
"total_ttc": "141,05 ",
|
||||
|
|
@ -2528,9 +2528,9 @@ def ManualSendInvoiceEmailRIB_CIC_JMJFormation(diction):
|
|||
"montant": "130 €",
|
||||
|
||||
|
||||
"invoice_id": "FACT_20260217",
|
||||
"invoice_date": "15/02/2026",
|
||||
"due_date": "15/02/2026",
|
||||
"invoice_id": "FACT_20260318",
|
||||
"invoice_date": "17/03/2026",
|
||||
"due_date": "17/03/2026",
|
||||
"orign_order": "Contrat MTT/2025_N°0012/JMJ FORMATION",
|
||||
}
|
||||
}
|
||||
|
|
@ -2564,7 +2564,7 @@ def ManualSendInvoiceEmailRIB_CIC_JMJFormation(diction):
|
|||
#print(" ### body 22 = ", body)
|
||||
|
||||
sourceHtml = template.render(json_data=body["params"])
|
||||
orig_file_name = "invoice_FACT_20260116.pdf"
|
||||
orig_file_name = "invoice_FACT_20260318.pdf"
|
||||
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
|
||||
|
||||
# open output file for writing (truncated binary)
|
||||
|
|
|
|||
|
|
@ -2440,3 +2440,208 @@ def Get_ENT_Data_From_Subdomain_Light_Data_For_Footer(diction):
|
|||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recuprer les absence d'un apprenant
|
||||
avec un filtre sur les inscription
|
||||
"""
|
||||
|
||||
def Get_Ent_Student_Absence(diction):
|
||||
try:
|
||||
full_file_path = ""
|
||||
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
|
||||
|
||||
field_list = ['token', 'apprenant_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é")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'apprenant_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, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité de l'apprenant
|
||||
"""
|
||||
is_apprenant_valide_count = MYSY_GV.dbname['apprenant'].count_documents(
|
||||
{'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_apprenant_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'apprenant est invalide ")
|
||||
return False, " L'identifiant de l'apprenant est invalide ",
|
||||
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one(
|
||||
{'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
total_heure_absence = 0
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['agenda'].find({'related_collection': "apprenant",
|
||||
'related_collection_email': str(apprenant_data['email']),
|
||||
'event_type':'absence',
|
||||
'partner_owner_recid': str(my_partner['partner_owner_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)
|
||||
print(" total = ", total.total_seconds() / 3600)
|
||||
total_heure_absence = total_heure_absence + total.total_seconds() / 3600
|
||||
user['heure_absence'] = str(total.total_seconds() / 3600)
|
||||
|
||||
|
||||
|
||||
code_session = ""
|
||||
if ("session_id" in New_retVal.keys() and New_retVal['session_id']):
|
||||
local_session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['session_id'])),
|
||||
'partner_owner_recid': str(my_partner['partner_owner_recid'])}, {'_id': 1, 'code_session': 1})
|
||||
|
||||
if (local_session_data and "code_session" in local_session_data.keys()):
|
||||
code_session = local_session_data['code_session']
|
||||
user['code_session'] = code_session
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
else:
|
||||
user['session_id'] = ""
|
||||
user['code_session'] = ""
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
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 les absences "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recuprer le total des heures d'absence d'un apprenant
|
||||
"""
|
||||
def Get_Ent_Student_total_Heure_Absence(diction):
|
||||
try:
|
||||
full_file_path = ""
|
||||
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
|
||||
field_list = ['token', 'apprenant_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é")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'apprenant_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, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier la validité de l'apprenant
|
||||
"""
|
||||
is_apprenant_valide_count = MYSY_GV.dbname['apprenant'].count_documents(
|
||||
{'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_apprenant_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'apprenant est invalide ")
|
||||
return False, " L'identifiant de l'apprenant est invalide ",
|
||||
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one(
|
||||
{'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
total_heure_absence = 0
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['agenda'].find({'related_collection': "apprenant",
|
||||
'related_collection_email': str(apprenant_data['email']),
|
||||
'event_type': 'absence',
|
||||
'partner_owner_recid': str(my_partner['partner_owner_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_absence':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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer le total des heures d'absences "
|
||||
|
|
|
|||
42
main.py
42
main.py
|
|
@ -15034,6 +15034,34 @@ def Get_ENT_Data_From_Subdomain_Light_Data_For_Footer():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour recuprer les absences d'un apprenant
|
||||
avec un filtre sur les inscription
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Ent_Student_Absence/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Ent_Student_Absence():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Ent_Student_Absence : payload = ",str(payload))
|
||||
status, retval = ent_student_common.Get_Ent_Student_Absence( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour recuprer le total des heures d'absence d'un apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Ent_Student_total_Heure_Absence/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Ent_Student_total_Heure_Absence():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Ent_Student_total_Heure_Absence : payload = ",str(payload))
|
||||
status, retval = ent_student_common.Get_Ent_Student_total_Heure_Absence( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API - Gestion ENT Apprenant : pour publier des document dans l'espace ENT des apprenants
|
||||
"""
|
||||
|
|
@ -16034,6 +16062,20 @@ def Update_Stagiaire_To_Admission_Session():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour Mettre à jour une personne à une session d'admission en mode bulk
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Stagiaire_To_Admission_Session_Bulk/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Stagiaire_To_Admission_Session_Bulk():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Stagiaire_To_Admission_Session_Bulk : payload = ",payload)
|
||||
localStatus, message = session_admission_fi.Update_Stagiaire_To_Admission_Session_Bulk(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour Mettre à jour une personne à une session d'admission JUSTE l'ETAPE DE LA SESSION d'ADMISSION
|
||||
"""
|
||||
|
|
|
|||
16
partners.py
16
partners.py
|
|
@ -190,6 +190,9 @@ def add_partner_account(diction):
|
|||
# 20/12/2025 - Par defaut, on le met en formation initiale pour voir toutes les fonctionalité
|
||||
mydata['formation_initiale'] = '1'
|
||||
|
||||
#16/03/26 - on lui associe le menu full (FC+FI)
|
||||
mydata['user_menu'] = '2'
|
||||
|
||||
#print(str(datetime.now()) + " webservice : diction = "+str(mydata))
|
||||
coll_name = MYSY_GV.dbname['partnair_account']
|
||||
coll_name_user_account = MYSY_GV.dbname['user_account']
|
||||
|
|
@ -1472,7 +1475,7 @@ def get_partner_account(diction):
|
|||
|
||||
|
||||
RetObject = []
|
||||
for retVal in coll_name.find({'_id': ObjectId(str(parnter_account_id)), 'active':'1', 'locked':'0'}):
|
||||
for retVal in MYSY_GV.dbname['partnair_account'].find({'_id': ObjectId(str(parnter_account_id)), 'active':'1', 'locked':'0'}):
|
||||
|
||||
user = retVal
|
||||
|
||||
|
|
@ -1521,6 +1524,11 @@ def get_partner_account(diction):
|
|||
abonnement_periodicite = retVal['abonnement_periodicite']
|
||||
user['abonnement_periodicite'] = abonnement_periodicite
|
||||
|
||||
user_menu = ""
|
||||
if ( "user_menu" in retVal.keys()):
|
||||
user_menu = str(retVal['user_menu'])
|
||||
user['user_menu'] = user_menu
|
||||
|
||||
|
||||
"""
|
||||
05/09/2024 : Recuperer le nombre d'activité en retard pour la personne connectée
|
||||
|
|
@ -1563,13 +1571,12 @@ def get_partner_account(diction):
|
|||
formation_initiale = "0"
|
||||
if(admin_partnair_account and "formation_initiale" in admin_partnair_account.keys() ):
|
||||
formation_initiale = str(admin_partnair_account['formation_initiale'])
|
||||
|
||||
user['formation_initiale'] = formation_initiale
|
||||
|
||||
|
||||
document_super_admin = "0"
|
||||
if (admin_partnair_account and "document_super_admin" in admin_partnair_account.keys()):
|
||||
document_super_admin = str(admin_partnair_account['document_super_admin'])
|
||||
|
||||
user['document_super_admin'] = document_super_admin
|
||||
|
||||
plateforme_super_admin = "0"
|
||||
|
|
@ -2697,6 +2704,9 @@ def get_partner_account_from_id(diction):
|
|||
user['formation_initiale'] = formation_initiale
|
||||
user['formation_initiale_code'] = formation_initiale_code
|
||||
|
||||
if( "user_menu" not in user.keys()):
|
||||
user['user_menu'] = ""
|
||||
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
|
|
|
|||
|
|
@ -2209,7 +2209,7 @@ def Get_Given_Ressource_Humaine(diction):
|
|||
account_data = MYSY_GV.dbname['partnair_account'].find_one({'_id':ObjectId(str(retval['account_partner_id'])),
|
||||
'recid':str(my_partner['recid'])
|
||||
}, {'lms_virtualhost_url':1, 'mysy_lms_user_id':1,
|
||||
'lms_username':1, 'lms_account_disable':1, 'locked':1})
|
||||
'lms_username':1, 'lms_account_disable':1, 'locked':1, 'user_menu':1})
|
||||
|
||||
lms_virtualhost_url = ""
|
||||
if(account_data and "lms_virtualhost_url" in account_data.keys() ):
|
||||
|
|
@ -2236,6 +2236,11 @@ def Get_Given_Ressource_Humaine(diction):
|
|||
locked = account_data['locked']
|
||||
user['locked'] = locked
|
||||
|
||||
user_menu = "0"
|
||||
if (account_data and "user_menu" in account_data.keys()):
|
||||
user_menu = account_data['user_menu']
|
||||
user['user_menu'] = user_menu
|
||||
|
||||
|
||||
"""
|
||||
Si on a des compétences associés, alors on va aller cherche la note dans la collection 'base_competence_type'.
|
||||
|
|
|
|||
|
|
@ -1281,7 +1281,7 @@ def Update_Stagiaire_To_Admission_Session(diction):
|
|||
'type_apprenant', 'civilite', 'date_naissance', 'memo', 'comment',
|
||||
"num_secu", "is_rgpd", "situation_famille", "piece_identite_type", "piece_identite_num",
|
||||
"type_mobilite", "telephone_bis", "nationalite", "is_handicap", "is_droit_image",
|
||||
'naissance_lieu', 'naissance_departement', 'naissance_pays', 'session_etape'
|
||||
'naissance_lieu', 'naissance_departement', 'naissance_pays', 'session_etape', 'rang'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
|
@ -1294,8 +1294,7 @@ def Update_Stagiaire_To_Admission_Session(diction):
|
|||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['nom', 'prenom', 'email', 'telephone',
|
||||
'session_id', 'token', '_id']
|
||||
field_list_obligatoire = ['session_id', 'token', '_id']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
|
@ -1338,6 +1337,15 @@ def Update_Stagiaire_To_Admission_Session(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide"
|
||||
|
||||
|
||||
if ("rang" in diction.keys()):
|
||||
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" Le rang est " + str(diction['rang']) + " est invalide ")
|
||||
return False, " Le rang est " + str(diction['rang']) + " est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité de l'etape
|
||||
"""
|
||||
|
|
@ -1387,6 +1395,8 @@ def Update_Stagiaire_To_Admission_Session(diction):
|
|||
return False, " Le type d'apprenant est invalide. Valeurs autorisées" + str(
|
||||
MYSY_GV.INSCRIPTION_TYPE_APPRENANT)
|
||||
|
||||
|
||||
|
||||
local_id = str(diction['_id'])
|
||||
|
||||
del diction['token']
|
||||
|
|
@ -1447,6 +1457,145 @@ def Update_Stagiaire_To_Admission_Session(diction):
|
|||
return False, "Impossible de mettre à jour le candidat "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour en mode bulk avec un stringigy
|
||||
"""
|
||||
def Update_Stagiaire_To_Admission_Session_Bulk(diction):
|
||||
try:
|
||||
# Dictionnaire des champs utilisables
|
||||
'''
|
||||
# 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 = ['session_id', 'token', 'tab_rang_candidat']
|
||||
|
||||
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 = ['session_id', 'token', 'tab_rang_candidat']
|
||||
|
||||
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, "Impossible de créer le stagiaire. La valeur '" + val + "' n'est pas presente dans la liste des arguments"
|
||||
|
||||
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
|
||||
|
||||
"""
|
||||
Verififier l'existance et la valididé de la session
|
||||
"""
|
||||
my_session_data_qry = {"_id": ObjectId(str(diction['session_id'])), 'valide': '1'}
|
||||
# print(" AddStagiairetoClass my_session_data_qry = ", my_session_data_qry)
|
||||
|
||||
my_session_data = MYSY_GV.dbname['admission_session'].find_one(my_session_data_qry)
|
||||
if (my_session_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide"
|
||||
|
||||
tab_rang_candidat = diction['tab_rang_candidat']
|
||||
tab_rang_candidat_JSON = ast.literal_eval(tab_rang_candidat)
|
||||
|
||||
|
||||
for local_data in tab_rang_candidat_JSON:
|
||||
|
||||
"""
|
||||
Verifier la validé de l'inscrit
|
||||
"""
|
||||
is_existe_inscrit = MYSY_GV.dbname['admission_session_inscrit'].count_documents(
|
||||
{'_id': ObjectId(str(local_data['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_existe_inscrit != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du candidat est invalide ")
|
||||
return False, " L'identifiant du candidat est invalide "
|
||||
|
||||
|
||||
if ("rang" in local_data.keys()):
|
||||
local_status, local_rang = mycommon.IsInt(str(local_data['rang']).strip())
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" Le rang est " + str(local_data['rang']) + " est invalide ")
|
||||
return False, " Le rang est " + str(local_data['rang']) + " est invalide "
|
||||
|
||||
|
||||
for local_data in tab_rang_candidat_JSON:
|
||||
|
||||
local_id = str(local_data['_id'])
|
||||
new_data = {}
|
||||
new_data['rang'] = str(local_data['rang'])
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
if( "date_naissance" in new_data.keys() and new_data['date_naissance'] == ""):
|
||||
new_data['date_naissance'] = "01/01/1900"
|
||||
|
||||
if( "date_naissance" not in new_data.keys() ):
|
||||
new_data['date_naissance'] = "01/01/1900"
|
||||
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = ObjectId(local_id)
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
result = MYSY_GV.dbname['admission_session_inscrit'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
if (not result or "_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour le candidat (2) ")
|
||||
return False, " Impossible de mettre à jour le candidat (2) "
|
||||
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "admission_session_inscrit"
|
||||
history_event_dict['related_collection_recid'] = str(local_id)
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = "Inscription du candidat " + str(result['nom']) + " " + str(
|
||||
result['prenom']) + " " + str(result['_id'])
|
||||
|
||||
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 de mettre à jour le candidat "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Suppression de l'inscription d'une personne à une session d'admission
|
||||
|
|
@ -2448,6 +2597,9 @@ def Get_Synthese_Candidat_Process_Admission(diction):
|
|||
if ("civilite" not in retval.keys() or retval['civilite'] == ""):
|
||||
retval['civilite'] = "neutre"
|
||||
|
||||
if ("rang" not in retval.keys() or retval['rang'] == ""):
|
||||
retval['rang'] = "999"
|
||||
|
||||
|
||||
age = relativedelta( date.today(), datetime.strptime(str(retval['date_naissance']), '%d/%m/%Y') )
|
||||
retval['age'] = str(age.years)
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ def Add_Update_User_Access_Scope(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'user_id', 'tab_scope_class', 'tab_scope_session']
|
||||
field_list = ['token', 'user_id', 'tab_scope_class', 'tab_scope_session', 'user_menu']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -519,6 +519,8 @@ def Add_Update_User_Access_Scope(diction):
|
|||
return local_status, my_partner
|
||||
|
||||
# Verification de la validide du partnair_account
|
||||
|
||||
|
||||
is_partnair_account_existe_count = MYSY_GV.dbname['partnair_account'].count_documents({'ressource_humaine_id':str(diction['user_id']),
|
||||
'recid':str(my_partner['recid']),
|
||||
'active':'1',
|
||||
|
|
@ -568,6 +570,9 @@ def Add_Update_User_Access_Scope(diction):
|
|||
new_data['scope']['class_id'] = tab_scope_class
|
||||
new_data['scope']['session_id'] =tab_scope_session
|
||||
|
||||
if( "user_menu" in diction.keys() and diction['user_menu'] in ['', '0', '1', '2']):
|
||||
new_data['user_menu'] = str(diction['user_menu'])
|
||||
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue