01/03/26 - 13h30

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-03-01 13:46:25 +01:00
parent 5631a62f07
commit bc426a6dfe
6 changed files with 5790 additions and 26 deletions

View File

@ -4,15 +4,13 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="28/02/26 - 22h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="28/02/26 - 23h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.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$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_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$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.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" />
@ -456,7 +454,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="543" />
<option name="localTasksCounter" value="544" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -498,7 +496,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="25/11/25 - 21h30dd" />
<MESSAGE value="07/12/25 - 14h" />
<MESSAGE value="13/12/25 - 14h" />
<MESSAGE value="15/12/25 - 13h" />
@ -523,6 +520,7 @@
<MESSAGE value="26/02/26 - 19h30" />
<MESSAGE value="27/02/26 - 19h30" />
<MESSAGE value="28/02/26 - 22h" />
<option name="LAST_COMMIT_MESSAGE" value="28/02/26 - 22h" />
<MESSAGE value="28/02/26 - 23h" />
<option name="LAST_COMMIT_MESSAGE" value="28/02/26 - 23h" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -267,7 +267,8 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
Verification des input acceptés
"""
field_list = ['token', 'file_business_object', 'file_name', 'status','object_owner_collection', 'object_owner_id',
'file_name_to_store', 'type_document', 'metadata_field', 'tab_key_word']
'file_name_to_store', 'type_document', 'metadata_field', 'tab_key_word', 'related_collection_ue',
'related_collection_session', 'related_collection_class']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
@ -387,6 +388,32 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
tab_related_collection.append(local_node)
if( "related_collection_ue" in diction.keys() and diction['related_collection_ue'] and len(diction['related_collection_ue']) > 0 ):
for local_eu in diction['related_collection_ue']:
local_node = {}
local_node['related_collection'] = "unite_enseignement"
local_node['related_collection_id'] = str(local_eu)
tab_related_collection.append(local_node)
if ("related_collection_session" in diction.keys() and diction['related_collection_session'] and len(
diction['related_collection_session']) > 0):
for local_session_id in diction['related_collection_session']:
local_node = {}
local_node['related_collection'] = "session_formation"
local_node['related_collection_id'] = str(local_session_id)
tab_related_collection.append(local_node)
if ("related_collection_class" in diction.keys() and diction['related_collection_class'] and len(
diction['related_collection_class']) > 0):
for local_class_id in diction['related_collection_class']:
local_node = {}
local_node['related_collection'] = "myclass"
local_node['related_collection_id'] = str(local_class_id)
tab_related_collection.append(local_node)
mydata = {}
mydata['file_business_object'] = file_business_object

View File

@ -61,7 +61,7 @@ def add_class(diction):
'class_level', 'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'class_id',
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite', 'recyclage_alert',
'contenu_attestation', 'note_finale_calculation_rule_id', 'referentiel_padagogique_id',
'published_catalog_prive']
'published_catalog_prive', 'is_ftion_initiale']
incom_keys = diction.keys()
for val in incom_keys:
@ -215,6 +215,11 @@ def add_class(diction):
note = diction['note']
mydata['note'] = note
is_ftion_initiale = "1"
if ("is_ftion_initiale" in diction.keys() and diction['is_ftion_initiale'] in ['', '0', '1']):
note = diction['is_ftion_initiale']
mydata['is_ftion_initiale'] = is_ftion_initiale
cpf = "0"
if ("cpf" in diction.keys()):
@ -841,7 +846,8 @@ def update_class(diction):
'duration_unit', 'source', 'lms_class_code', 'formateur_id', 'class_level','methode_pedagogique',
'condition_handicape', 'suivi_eval', 'class_id', 'version', 'categorie', 'recyclage_delai',
'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation',
'note_finale_calculation_rule_id', 'referentiel_padagogique_id', 'published_catalog_prive']
'note_finale_calculation_rule_id', 'referentiel_padagogique_id', 'published_catalog_prive',
'is_ftion_initiale']
incom_keys = diction.keys()
for val in incom_keys:
@ -1033,6 +1039,12 @@ def update_class(diction):
if ("title" in diction.keys()):
mydata['title'] = diction['title']
if ("is_ftion_initiale" in diction.keys() and diction['is_ftion_initiale'] in ['', '0', '1' ]):
mydata['is_ftion_initiale'] = diction['is_ftion_initiale']
elif ("is_ftion_initiale" in diction.keys() and diction['is_ftion_initiale'] not in ['', '0', '1' ]):
mydata['is_ftion_initiale'] = ""
if ("class_inscription_url" in diction.keys()):
mydata['class_inscription_url'] = diction['class_inscription_url']
@ -4047,6 +4059,10 @@ def get_partner_class(diction):
if ("categorie" not in retVal.keys()):
retVal['categorie'] = ""
if ("is_ftion_initiale" not in retVal.keys()):
retVal['is_ftion_initiale'] = "0"
if ("duration" not in retVal.keys()):
retVal['duration'] = ""

View File

@ -5,6 +5,7 @@ Ce fichier permet de gerer les fonction de ENT ETUDIANT
"""
import bson
import pymongo
from dns.e164 import query
from pymongo import MongoClient
import json
from bson import ObjectId
@ -1472,7 +1473,7 @@ def Get_Ent_Student_List_object_owner_collection_Stored_Files(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'object_owner_collection', 'object_owner_id', 'apprenant_id']
field_list = ['token', 'object_owner_collection', 'object_owner_id', 'apprenant_id', 'class_id']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
@ -1526,28 +1527,57 @@ def Get_Ent_Student_List_object_owner_collection_Stored_Files(diction):
"""
Verification des champs obligatoires
24/12/2024 :
Les 2 valeurs ('object_owner_collection', 'object_owner_id') ne sont plus obligatories, mais au moins une doit
Les 2 valeurs ('object_owner_collection', ) ne sont plus obligatories, mais au moins une doit
etre fourni
"""
if (str(object_owner_collection).strip() == "" and str(object_owner_id).strip() == ""):
if (str(object_owner_collection).strip() == "" ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Il manque des informations obligatoires ")
return False, " Les informations fournies sont incorrectes",
"""
01/03/2026
Si aucun detail détail n'est donnée sur l'inscription_id, on va aller chercher tous les documents de l'apprenant_id
"""
tab_inscription_id = []
if( str(object_owner_id).strip() == "" ):
for tmp in MYSY_GV.dbname['inscription'].find({'apprenant_id':str(diction['apprenant_id']), 'valide':'1',
'partner_owner_recid':my_partner['partner_owner_recid']}):
tab_inscription_id.append(str(tmp['_id']))
else:
tab_inscription_id.append(str(object_owner_id))
my_query = {}
if (object_owner_collection):
my_query['object_owner_collection'] = object_owner_collection
if (object_owner_id):
my_query['object_owner_id'] = object_owner_id
my_query['object_owner_id'] = {'$in':tab_inscription_id}
my_query['valide'] = "1"
my_query['partner_owner_recid'] = str(apprenant_data['partner_owner_recid'])
filt_class_id = {}
if( "class_id" in diction.keys()):
filt_class_id = {'tab_related_collection.related_collection':'myclass',
'tab_related_collection.related_collection_id':diction['class_id']}
query = {'$and': [my_query, filt_class_id] }
else:
query = my_query
RetObject = []
nb_val = 0
for retval in MYSY_GV.dbname['download_files'].find(my_query).sort(
for retval in MYSY_GV.dbname['download_files'].find(query).sort(
[("_id", pymongo.DESCENDING), ("document_display_order", pymongo.DESCENDING)]):
ret_file = {}
ret_file['id'] = str(nb_val)
@ -1596,6 +1626,11 @@ def Get_Ent_Student_List_object_owner_collection_Stored_Files(diction):
else:
ret_file['file_extention'] = "file_extention"
if ("liste_ue_code" in retval.keys()):
ret_file['liste_ue_code'] = retval['liste_ue_code']
else:
ret_file['liste_ue_code'] = ""
"""
Recuperation du nom du client
"""
@ -1615,6 +1650,68 @@ def Get_Ent_Student_List_object_owner_collection_Stored_Files(diction):
ret_file['client_raison_sociale'] = client_raison_sociale
ret_file['client_nom'] = client_nom
liste_ue_code = ""
"""
Recuperation des EU eventuellement ajouté à 'Get_Ent_Student_List_object_owner_collection_Stored_Files'
"""
if( "tab_related_collection" in retval.keys() ):
for single_related_col in retval['tab_related_collection']:
if( "related_collection" in single_related_col.keys() and single_related_col['related_collection'] == "unite_enseignement"):
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(single_related_col['related_collection_id']),
'valide':'1',
'partner_owner_recid':str(apprenant_data['partner_owner_recid'])})
if( ue_data and "code" in ue_data.keys()):
liste_ue_code = liste_ue_code + str(ue_data['code'])+", "
ret_file['liste_ue_code'] = liste_ue_code
"""
Recuperation des session eventuellement ajouté à 'Get_Ent_Student_List_object_owner_collection_Stored_Files'
"""
liste_session_code = ""
if ("tab_related_collection" in retval.keys()):
for single_related_col in retval['tab_related_collection']:
if ("related_collection" in single_related_col.keys() and single_related_col[
'related_collection'] == "session_formation"):
session_data = MYSY_GV.dbname['session_formation'].find_one(
{'_id': ObjectId(single_related_col['related_collection_id']),
'valide': '1',
'partner_owner_recid': str(apprenant_data['partner_owner_recid'])}, {'code_session':1})
if (session_data and "code_session" in session_data.keys()):
liste_session_code = liste_session_code + str(session_data['code_session']) + ", "
ret_file['liste_session_code'] = liste_session_code
"""
Recuperation des session eventuellement ajouté à 'Get_Ent_Student_List_object_owner_collection_Stored_Files'
"""
class_title = ""
class_id = ""
if ("tab_related_collection" in retval.keys()):
for single_related_col in retval['tab_related_collection']:
if ("related_collection" in single_related_col.keys() and single_related_col[
'related_collection'] == "myclass"):
class_data = MYSY_GV.dbname['myclass'].find_one(
{'_id': ObjectId(single_related_col['related_collection_id']),
'valide': '1',
'partner_owner_recid': str(apprenant_data['partner_owner_recid'])}, {'title': 1, '_id':1})
if (class_data and "title" in class_data.keys()):
class_title = str(class_data['title'])
class_id = str(class_data['_id'])
ret_file['class_title'] = class_title
ret_file['class_id'] = class_id
RetObject.append(mycommon.JSONEncoder().encode(ret_file))
nb_val = nb_val + 1
@ -1630,7 +1727,6 @@ def Get_Ent_Student_List_object_owner_collection_Stored_Files(diction):
"""
Fonction de recuperation des pièces jointes d'objet en utilisant le 'file_name'
"""
def Get_Ent_Student_Stored_Downloaded_File(diction):
try:
full_file_path = ""
@ -2027,3 +2123,121 @@ def Get_Ent_Student_change_user_pwd(diction):
return False, "Impossible de mettre à jour le mot de passe"
"""
Fonction de recuperation des pièces jointes d'objet en utilisant le 'file_name'
"""
def Get_Ent_Student_Stored_Downloaded_File(diction):
try:
full_file_path = ""
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'file_name', 'apprenant_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', 'file_name', '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'})
file_name = ""
if ("file_name" in diction.keys()):
if diction['file_name']:
file_name = diction['file_name']
if(len(str(file_name)) > MYSY_GV.FILE_NAME_MAX_SIZE ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Fichier invalide, trop long = "+ str(file_name)+ ". le nom doit faire moins de 100 caractère")
return False, " - Nom de fichier trop long. Il doit faire moins de 100 caractères"
if( not file_name ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Fichier invalide = ", str(file_name))
return False, " - nom du fichier invalide "
full_path = MYSY_GV.upload_folder+str(file_name)
"""
Recuperation de la list des fichier dans la collection
"""
tmp_count = MYSY_GV.dbname['download_files'].count_documents({'full_path': str(full_path), 'valide': '1',
'partner_owner_recid':apprenant_data['partner_owner_recid']})
if (tmp_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Fichier invalide = ", str(full_path))
return False, " - Fichier invalide "
if os.path.exists(full_path):
print(" ### full_path = ", full_path)
return True, send_file(full_path, as_attachment=True)
else:
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Fichier invalide (2)= ", str(full_path))
return False, " - Fichier invalide (2) "
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, False

View File

@ -7828,7 +7828,7 @@ def Ent_Student_Store_files(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'tab_file_name', 'tab_inscrit_ids']
field_list = ['token', 'tab_file_name', 'tab_inscrit_ids', 'tab_ue_ids']
incom_keys = diction.keys()
for val in incom_keys:
@ -7869,9 +7869,20 @@ def Ent_Student_Store_files(diction):
"""
Recuperer la liste des inscrits qui ont un compte
"""
tab_session_id = []
tab_class_id = []
for val in diction['tab_inscrit_ids']:
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(val)), 'valide':'1',
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1, 'apprenant_id':1})
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1, 'apprenant_id':1,
'session_id':1, 'class_id':1})
if( "session_id" in inscrit_data and inscrit_data['session_id']):
tab_session_id.append(inscrit_data['session_id'])
if ("class_id" in inscrit_data and inscrit_data['class_id']):
tab_class_id.append(inscrit_data['class_id'])
if( inscrit_data and 'apprenant_id' in inscrit_data.keys() ):
@ -7890,11 +7901,11 @@ def Ent_Student_Store_files(diction):
for inscrit_id in tab_inscription_with_account_ids :
for file_name in diction['tab_file_name']:
print(" ## file_nale = ", file_name)
#print(" ## file_nale = ", file_name)
file_name_extract = os.path.basename(str(file_name))
print(" ## file_name_extract = ", file_name_extract)
#print(" ## file_name_extract = ", file_name_extract)
new_file = {}
new_file['token'] = diction['token']
@ -7906,8 +7917,13 @@ def Ent_Student_Store_files(diction):
new_file['object_owner_collection'] = "inscription"
new_file['object_owner_id'] = str(inscrit_id)
new_file['file_name_to_store'] = str(file_name)
new_file['related_collection_session'] = tab_session_id
new_file['related_collection_class'] = tab_class_id
# print(" ### new_file new_file = ", new_file)
if( "tab_ue_ids" in diction.keys() ):
new_file['related_collection_ue'] = diction['tab_ue_ids']
print(" ### new_file new_file = ", new_file)
local_status, local_retval = attached_file_mgt.Internal_Usage_Store_User_Downloaded_File(
MYSY_GV.upload_folder, new_file)
@ -7924,14 +7940,16 @@ def Ent_Student_Store_files(diction):
"""
Fonction qui recupere des fichier et un liste d'inscrit et publie
les documents dans l'ENT
les documents dans l'ENT.
on va aussi donner la possibilité de stoker une UE
"""
def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
try:
diction = strip_dictionary(diction)
field_list = ['token', 'list_email_dest', 'related_collection', 'list_inscription_id',
'ent_push_doc_message_notif', 'session_id']
'ent_push_doc_message_notif', 'session_id', 'tab_ue_ids']
incom_keys = diction.keys()
for val in incom_keys:
@ -7981,6 +7999,27 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
if( session_data and 'code_session' in session_data.keys()):
code_session_formation = session_data['code_session']
tab_ue_ids = []
if ("tab_ue_ids" in diction.keys()):
if diction['tab_ue_ids']:
my_ue_ids = diction['tab_ue_ids']
tab_ue_ids_work = str(my_ue_ids).split(",")
for tmp in tab_ue_ids_work:
if (tmp):
is_eu_count = MYSY_GV.dbname['unite_enseignement'].count_documents({'_id': ObjectId(str(tmp)),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])})
if (is_eu_count != 1):
myprint(
str(inspect.stack()[0][3]) + " L'unité d'enseignement " + str(val) + " est invalide ")
return False, " L'unité d'enseignement " + str(val) + " est invalide "
tab_ue_ids.append(tmp)
"""
@ -8096,6 +8135,7 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
local_diction['token'] = diction['token']
local_diction['tab_file_name'] = tab_saved_file_full_path
local_diction['tab_inscrit_ids'] = list_inscription_id
local_diction['tab_ue_ids'] = tab_ue_ids
local_status, local_retval = Ent_Student_Store_files(local_diction)
if (local_status is False):