22/05/2026 - 20h

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-22 20:16:20 +02:00
parent a204a601b1
commit c4883ff190
14 changed files with 14272 additions and 59 deletions

View File

@ -4,14 +4,20 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/05/2026 - 12h30">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/05/2026 - 20h30">
<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$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bloc_competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/bloc_competence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_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$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.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$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -456,7 +462,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="585" />
<option name="localTasksCounter" value="586" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -498,7 +504,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="17/04/2026 -19h" />
<MESSAGE value="18/04/2026 -19h" />
<MESSAGE value="19/04/2026 - 20h30" />
<MESSAGE value="20/04/2026 - 20h30" />
@ -523,6 +528,7 @@
<MESSAGE value="16/05/2026 - 13h30" />
<MESSAGE value="19/05/2026 - 20h30" />
<MESSAGE value="20/05/2026 - 12h30" />
<option name="LAST_COMMIT_MESSAGE" value="20/05/2026 - 12h30" />
<MESSAGE value="20/05/2026 - 20h30" />
<option name="LAST_COMMIT_MESSAGE" value="20/05/2026 - 20h30" />
</component>
</project>

View File

@ -1169,9 +1169,10 @@ Type de pièce d'identité
"permis", "label": "Permis Conduire",
"passport", "label": "Passport",
"autre", "label": "Autre",
"titre_sejour", "label": "Titre Séjour", "value": "titre_sejour"
"", "label": "",
"""
PICE_IDENTITE_TYPE = ['cni', 'permis', 'passport', 'autre', '']
PICE_IDENTITE_TYPE = ['cni', 'permis', 'passport', 'autre', 'titre_sejour' , '']
"""

View File

@ -2447,8 +2447,11 @@ def UpdateStagiairetoClass(diction):
str(inspect.stack()[0][
3]) + " La fréquence de facturation doit être " + str(MYSY_GV.INSCRIT_FREQUENCE_FACTURE))
return False, " La fréquence de facturation doit être " + str(MYSY_GV.INSCRIT_FREQUENCE_FACTURE)
frequence_facturation = diction['frequence_facturation']
elif( "frequence_facturation" in diction.keys() and diction[
'frequence_facturation'] in MYSY_GV.INSCRIT_FREQUENCE_FACTURE ):
frequence_facturation = diction['frequence_facturation']
mydata['frequence_facturation'] = frequence_facturation
if ("price" in diction.keys()):
@ -3022,7 +3025,11 @@ def UpdateStagiairetoClass(diction):
local_apprenant_id = ret_val2['apprenant_id']
new_apprenant_data = {}
tab_champ = ['civilite', 'nom', 'prenom', 'employeur', 'email', 'adresse', 'code_postal', 'ville',
'pays', 'ine', 'matricule', 'nom_fille', 'num_cvec', 'handicap_detail']
'pays', 'ine', 'matricule', 'nom_fille', 'num_cvec', 'handicap_detail', 'num_secu',
'is_handicap', 'nationalite', 'situation_famille', 'date_naissance', 'naissance_lieu',
'naissance_departement', 'naissance_pays', 'identite_type', 'piece_identite_num',
'is_rgpd', 'is_droit_image']
for field in tab_champ:
if( str(field) in ret_val2.keys()):
new_apprenant_data[str(field)] = ret_val2[str(field)]

File diff suppressed because it is too large Load Diff

View File

@ -2215,7 +2215,9 @@ def GetAllValideSessionPartner_List(diction):
}
},
{'$project': {"_id": 1, "order_header_ref_interne": 1, "external_code": 1,
"title": 1, "partner_owner_recid": 1, "valide": 1}
"title": 1, "partner_owner_recid": 1, "valide": 1,
'domaine': 1, 'lms_class_code': 1, 'duration': 1, 'duration_unit': 1,
}
},
],
'as': 'myclass_collection'
@ -2698,7 +2700,8 @@ def GetAllValideSessionPartner_List_filter_like(diction):
}
},
{'$project': {"_id": 1, "order_header_ref_interne": 1, "external_code": 1,
"title": 1, "partner_owner_recid": 1, "valide": 1}
"title": 1, "partner_owner_recid": 1, "valide": 1,
'domaine':1, 'lms_class_code':1, 'duration':1, 'duration_unit':1, }
},
],
'as': 'myclass_collection'
@ -3130,7 +3133,9 @@ def GetAllValideSessionPartner_List_no_filter(diction):
}
},
{'$project': {"_id": 1, "order_header_ref_interne": 1, "external_code": 1,
"title": 1, "partner_owner_recid": 1, "valide": 1}
"title": 1, "partner_owner_recid": 1, "valide": 1,
'domaine': 1, 'lms_class_code': 1, 'duration': 1, 'duration_unit': 1,
}
},
],
'as': 'myclass_collection'
@ -18168,21 +18173,34 @@ def Add_Update_UE_To_Session(diction):
"""
Verifier que l'UE est bien paramettrée sur la formation
"""
is_ue_in_class_count = MYSY_GV.dbname['myclass'].count_documents({'list_unite_enseignement._id':str(diction['ue_id']),
'list_unite_enseignement.diplome_id': str(local_diplome_id),
'_id': ObjectId(str(session_data['class_id'])),
'partner_owner_recid': my_partner[
'recid'],
'valide': '1',
'locked': '0',
})
is_ue_in_class_count = MYSY_GV.dbname['myclass'].count_documents({'_id': ObjectId(str(session_data['class_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'list_unite_enseignement': {
'$elemMatch': {
'_id': str(diction['ue_id']),
'diplome_id': str(local_diplome_id)
}
}
})
print(" ## is_ue_in_class_count = ", is_ue_in_class_count)
if (is_ue_in_class_count != 1 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " La configuration de l'UE sur la formation est invalide ")
return False, " La configuration de l'UE sur la formation est invalide "
local_couleur = "#3573CB"
local_competence_id = ""
local_domaine_competence_id = ""
for is_ue_in_class_data in MYSY_GV.dbname['myclass'].find(
{'list_unite_enseignement._id': str(diction['ue_id']),
'list_unite_enseignement.diplome_id': str(local_diplome_id),
@ -18196,6 +18214,7 @@ def Add_Update_UE_To_Session(diction):
if( "list_unite_enseignement" in is_ue_in_class_data.keys() ):
for local_data in is_ue_in_class_data['list_unite_enseignement']:
if( local_data['diplome_id'] == str(local_diplome_id) and local_data['_id'] == str(diction['ue_id']) ):
if( "domaine_competence_id" in local_data.keys() and local_data['domaine_competence_id']):
domaine_competence_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id':ObjectId(str(local_data['domaine_competence_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'couleur':1})
@ -18203,6 +18222,11 @@ def Add_Update_UE_To_Session(diction):
if( domaine_competence_data and 'couleur' in domaine_competence_data.keys() ):
local_couleur = domaine_competence_data['couleur']
local_domaine_competence_id = local_data['domaine_competence_id']
if ("competence_id" in local_data.keys() and local_data['competence_id']):
local_competence_id = local_data['competence_id']
#local_couleur = is_ue_in_class_data['list_unite_enseignement']['couleur']
@ -18219,14 +18243,19 @@ def Add_Update_UE_To_Session(diction):
is_ue_id_existe_class = 0
is_ue_id_existe_class = MYSY_GV.dbname['session_formation'].count_documents(
{'list_unite_enseignement._id': str(diction['ue_id']),
'list_unite_enseignement.diplome_id': str(local_diplome_id),
'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': my_partner[
'recid'],
{'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'list_unite_enseignement': {
'$elemMatch': {
'_id': str(diction['ue_id']),
'diplome_id': str(local_diplome_id)
}
}
})
if (is_ue_id_existe_class > 0):
update_session_ue = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': str(
@ -18243,6 +18272,8 @@ def Add_Update_UE_To_Session(diction):
{
'list_unite_enseignement.$[xxx].diplome_id': local_diplome_id,
'list_unite_enseignement.$[xxx].formateur_id': local_formateur_id,
'list_unite_enseignement.$[xxx].domaine_competence_id': local_domaine_competence_id,
'list_unite_enseignement.$[xxx].competence_id': local_competence_id,
'list_unite_enseignement.$[xxx].couleur': local_couleur,
'list_unite_enseignement.$[xxx].date_update': str(now),
'list_unite_enseignement.$[xxx].update_by': str(
@ -18286,6 +18317,10 @@ def Add_Update_UE_To_Session(diction):
new_data['formateur_id'] = local_formateur_id
new_data['diplome_id'] = local_diplome_id
new_data['couleur'] = local_couleur
new_data['domaine_competence_id'] = local_domaine_competence_id
new_data['competence_id'] = local_competence_id
new_data['_id'] = str(diction['ue_id'])
insert = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
@ -18531,7 +18566,7 @@ def Get_List_UE_Given_SessionFormation(diction):
'valide': '1',
}, {'list_unite_enseignement':1})
print(" ### session_data = ", session_data)
if(session_data and "list_unite_enseignement" in session_data.keys()):
for local_ue in session_data['list_unite_enseignement']:
@ -18594,6 +18629,20 @@ def Get_List_UE_Given_SessionFormation(diction):
user['diplome_id'] = str(diplome_id)
user['diplome_code'] = str(diplome_code)
if( "domaine_competence_id" in local_ue.keys() and local_ue['domaine_competence_id']):
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id':ObjectId(str(local_ue['domaine_competence_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'couleur':'1'})
if (domaine_competence_id_data and "couleur" in domaine_competence_id_data.keys()):
user['couleur'] = str(domaine_competence_id_data['couleur'])
else:
user['couleur'] = "#3573CB"
else:
user['couleur'] = "#3573CB"
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))

View File

@ -57,7 +57,7 @@ def Add_Session_Sequence(diction):
"""
field_list = ['token', 'session_id', 'sequence_title', 'sequence_start', 'sequence_end', 'agenda', 'objectif',
'commentaire', 'check_chevauchement', 'grp_apprenant_id', 'ue_id', 'type', 'ue_planif_line_id',
'mode_animation', 'volume_theorique', 'obligatoire']
'mode_animation', 'volume_theorique', 'obligatoire', 'domaine_competence_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -90,6 +90,20 @@ def Add_Session_Sequence(diction):
if (local_status is not True):
return local_status, my_partner
"""
Valididé du domaine de compétence
"""
if ("domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
is_existe_domaine_competence_id = MYSY_GV.dbname["domaine_competence_pedagogique"].count_documents(
{'_id': ObjectId(str(diction['domaine_competence_id'])),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'})
if (is_existe_domaine_competence_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - L'identifiant du domaine de compétence est invalide ")
return False, " L'identifiant du domaine de compétence est invalide "
# Verification de l'existence et de la session
is_existe_valide_session_id = MYSY_GV.dbname["session_formation"].count_documents({'_id':ObjectId(str(diction['session_id'])),
@ -102,6 +116,7 @@ def Add_Session_Sequence(diction):
return False, "L'identifiant de la session n'est pas valide "
# Recuperation des données de la session
is_existe_valide_session_id_data = MYSY_GV.dbname["session_formation"].find_one(
{'_id': ObjectId(str(diction['session_id'])),
@ -237,6 +252,10 @@ def Add_Session_Sequence(diction):
if ("objectif" in diction.keys()):
objectif = str(diction['objectif'])
domaine_competence_id = ""
if ("domaine_competence_id" in diction.keys()):
domaine_competence_id = str(diction['domaine_competence_id'])
mode_animation = ""
if ("mode_animation" in diction.keys()):
mode_animation = str(diction['mode_animation'])
@ -316,7 +335,7 @@ def Add_Session_Sequence(diction):
my_data['time_in_hour'] = str(delta_time_converted_in_hour)
my_data['volume_theorique'] = volume_theorique
my_data['domaine_competence_id'] = domaine_competence_id
my_data['agenda'] = agenda
my_data['objectif'] = objectif
my_data['commentaire'] = commentaire
@ -1408,7 +1427,7 @@ def Update_Session_Sequence(diction):
"""
field_list = ['token', '_id', 'session_id', 'sequence_title', 'sequence_start', 'sequence_end', 'agenda', 'objectif',
'commentaire', 'check_chevauchement', 'grp_apprenant_id', 'ue_id', 'type', 'ue_planif_line_id',
'mode_animation', 'volume_theorique', 'tab_grp_apprenant_ids', 'obligatoire']
'mode_animation', 'volume_theorique', 'tab_grp_apprenant_ids', 'obligatoire', 'domaine_competence_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -1442,6 +1461,21 @@ def Update_Session_Sequence(diction):
return local_status, my_partner
"""
Valididé du domaine de compétence
"""
if( "domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
is_existe_domaine_competence_id = MYSY_GV.dbname["domaine_competence_pedagogique"].count_documents(
{'_id': ObjectId(str(diction['domaine_competence_id'])),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'})
if (is_existe_domaine_competence_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - L'identifiant du domaine de compétence est invalide ")
return False, " L'identifiant du domaine de compétence est invalide "
# Verification de l'existence d'une sequence à mettre à jour
is_existe_valide_session_sequence_id = MYSY_GV.dbname["session_formation_sequence"].count_documents({'_id':ObjectId(str(diction['_id'])),
@ -1639,6 +1673,8 @@ def Update_Session_Sequence(diction):
if ("mode_animation" in diction.keys()):
update_data['mode_animation'] = str(diction['mode_animation'])
if ("domaine_competence_id" in diction.keys()):
update_data['domaine_competence_id'] = str(diction['domaine_competence_id'])
if ("commentaire" in diction.keys()):
update_data['commentaire'] = str(diction['commentaire'])
@ -1951,7 +1987,31 @@ def Get_Session_Sequence_List(diction):
liste_groupe_code = ""
"""
Recuperer la couleur du groupe
21/05/2026 : il faut aller chercher la config général qui
dit si le code couleur se fait par groupe d'apprenant ou par couleur
du BC / UE
"""
sequence_code_couleur_setup = "ue"
base_partner_setup_code_couleur = MYSY_GV.dbname['base_partner_setup'].find_one({'config_name':'sequence_code_couleur',
'partner_owner_recid':str(my_partner['recid'])})
if( base_partner_setup_code_couleur and "config_value" in base_partner_setup_code_couleur.keys()
and base_partner_setup_code_couleur['config_value'] in ['ue', 'grp_apprenant', '']):
sequence_code_couleur_setup = base_partner_setup_code_couleur['config_value']
domaine_competence_color = "#3573CB"
if ( sequence_code_couleur_setup == "ue"):
if( "domaine_competence_id" in New_retVal.keys() and New_retVal['domaine_competence_id']):
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id':ObjectId(str(New_retVal['domaine_competence_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'couleur':1})
if( domaine_competence_id_data and 'couleur' in domaine_competence_id_data.keys() ):
domaine_competence_color = domaine_competence_id_data['couleur']
user['domaine_competence_color'] = domaine_competence_color
user['sequence_code_couleur_setup'] = sequence_code_couleur_setup
tab_grp_apprenant_ids = []
if ("tab_grp_apprenant_ids" in user.keys() and user['tab_grp_apprenant_ids']):
for local_grp_apprenant in user['tab_grp_apprenant_ids'] :

View File

@ -88,7 +88,7 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
"""
field_list = ['token', 'file_business_object', 'file_name', 'status','object_owner_collection',
'object_owner_id', 'type_document', 'metadata_field', 'tab_key_word', 'admission_setup_document_id',
'is_secure_file']
'is_secure_file', 'file_date_expiration']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
@ -110,6 +110,29 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
if (local_status is not True):
return local_status, my_partner
file_date_expiration = "01/01/2099"
if ("file_date_expiration" in diction.keys()):
if diction['file_date_expiration']:
file_date_expiration = str(diction['file_date_expiration']).strip()
local_status = mycommon.CheckisDate(file_date_expiration)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date d'expiration n'est pas au format 'jj/mm/aaaa' ")
return False, " La date d'expiration n'est pas au format 'jj/mm/aaaa' "
mytoday = datetime.today().strftime("%d/%m/%Y")
if (datetime.strptime(str(file_date_expiration)[0:10], '%d/%m/%Y') < datetime.strptime(str(mytoday).strip(),
'%d/%m/%Y')):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date d'expiration du document est antérieure à la date du jour ")
return False, " La date d'expiration du document est antérieure à la date du jour "
basename = os.path.basename(file.filename)
basename2 = basename.split(".")
@ -232,6 +255,8 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
mydata['creation_date'] = str(datetime.now())
mydata['creation_by'] = str(my_partner['_id'])
mydata['file_date_expiration'] = str(file_date_expiration)
mydata['is_secure_file'] = str(is_secure_file)
if( "admission_setup_document_id" in diction.keys() ):
@ -1097,8 +1122,25 @@ def Get_List_object_owner_collection_Stored_Files(diction):
else:
ret_file['related_ftion_external_code'] = ""
ret_file['tab_related_collection'] = tab_related_collection
local_file_date_expiration = "01/01/2099"
if ("file_date_expiration" in retval.keys()):
local_file_date_expiration = retval['file_date_expiration']
ret_file['file_date_expiration'] = local_file_date_expiration
local_status = mycommon.CheckisDate(local_file_date_expiration)
file_expired = ''
if (local_status is True):
mytoday = datetime.today().strftime("%d/%m/%Y")
if (datetime.strptime(str(local_file_date_expiration)[0:10], '%d/%m/%Y') < datetime.strptime( str(mytoday).strip(), '%d/%m/%Y')):
file_expired = "1"
ret_file['file_expired'] = str(file_expired)
RetObject.append(mycommon.JSONEncoder().encode(ret_file))
nb_val = nb_val + 1

View File

@ -843,8 +843,23 @@ def get_user_account(diction):
RetObject = []
for retVal in coll_name.find({'token': str(token_value), 'locked': '0', 'active':'1'}):
mycommon.myprint(retVal)
user = retVal
local_apprenant_data = []
if( "apprenant_id" in user.keys() and user['apprenant_id']):
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({"_id":ObjectId(user['apprenant_id']),
'partner_owner_recid':user['partner_owner_recid']},
{ "nom": 1,"email": 1,"prenom": 1,"civilite": 1,"telephone": 1, "num_secu":1,
"adresse": 1,"code_postal": 1,"ville": 1,"pays": 1, "date_naissance":1, "is_handicap":1,
"is_droit_image":1, "is_rgpd":1, "situation_famille":1, "nom_fille":1,
"num_cvec":1, "matricule":1, "ine":1, "link_facebook":1, "link_linkedin":1, "link_twitter":1})
if(apprenant_data ):
local_apprenant_data = apprenant_data
user['apprenant_data'] = local_apprenant_data
RetObject.append(JSONEncoder().encode(user))
return True, RetObject

View File

@ -613,6 +613,7 @@ def Get_Ent_Student_Session_Sequence_List(diction):
if (local_status is not True):
return local_status, my_partner
filt_session = {}
if( 'session_id' in diction.keys() and diction['session_id']):
filt_session = {'session_id':str(diction['session_id'])}
@ -667,6 +668,13 @@ def Get_Ent_Student_Session_Sequence_List(diction):
if ("type" not in user.keys()):
user['type'] = ""
if ("obligatoire" not in user.keys()):
user['obligatoire'] = "0"
if ("volume_theorique" not in user.keys()):
user['volume_theorique'] = ""
if( "grp_apprenant_id" not in user.keys() ):
user['grp_apprenant_id'] = ""
@ -675,6 +683,7 @@ def Get_Ent_Student_Session_Sequence_List(diction):
"""
Recuperer la couleur du groupe
"""
grp_apprenant_id = ""
if( "grp_apprenant_id" in user.keys() and user['grp_apprenant_id']):
groupe_data = MYSY_GV.dbname['groupe_inscription'].find_one({'_id':ObjectId(str(user['grp_apprenant_id'])),
'valide':'1',
@ -690,12 +699,101 @@ def Get_Ent_Student_Session_Sequence_List(diction):
user['grp_apprenant_color'] = grp_apprenant_color
user['grp_apprenant_code'] = grp_apprenant_code
user['grp_apprenant_id'] = grp_apprenant_id
liste_groupe_code = ""
"""
Recuperer la couleur du groupe
21/05/2026 : il faut aller chercher la config général qui
dit si le code couleur se fait par groupe d'apprenant ou par couleur
du BC / UE
"""
sequence_code_couleur_setup = "ue"
base_partner_setup_code_couleur = MYSY_GV.dbname['base_partner_setup'].find_one(
{'config_name': 'sequence_code_couleur',
'partner_owner_recid': str(my_partner['partner_owner_recid'])})
if (base_partner_setup_code_couleur and "config_value" in base_partner_setup_code_couleur.keys()
and base_partner_setup_code_couleur['config_value'] in ['ue', 'grp_apprenant', '']):
sequence_code_couleur_setup = base_partner_setup_code_couleur['config_value']
domaine_competence_color = "#3573CB"
if (sequence_code_couleur_setup == "ue"):
if ("domaine_competence_id" in New_retVal.keys() and New_retVal['domaine_competence_id']):
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one(
{'_id': ObjectId(str(New_retVal['domaine_competence_id'])),
'partner_owner_recid': str(my_partner['partner_owner_recid'])}, {'couleur': 1})
if (domaine_competence_id_data and 'couleur' in domaine_competence_id_data.keys()):
domaine_competence_color = domaine_competence_id_data['couleur']
user['domaine_competence_color'] = domaine_competence_color
user['sequence_code_couleur_setup'] = sequence_code_couleur_setup
tab_grp_apprenant_ids = []
if ("tab_grp_apprenant_ids" in user.keys() and user['tab_grp_apprenant_ids']):
for local_grp_apprenant in user['tab_grp_apprenant_ids']:
groupe_data = MYSY_GV.dbname['groupe_inscription'].find_one(
{'_id': ObjectId(str(local_grp_apprenant['_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['partner_owner_recid'])},
{'code': 1, 'color': 1})
if (groupe_data and "color" in groupe_data.keys() and groupe_data['color']):
grp_apprenant_color = groupe_data['color']
if (groupe_data and "code" in groupe_data.keys() and groupe_data['code']):
liste_groupe_code = str(groupe_data['code']) + ", " + str(liste_groupe_code)
grp_apprenant_code = groupe_data['code']
if (groupe_data and '_id' in groupe_data.keys()):
tab_grp_apprenant_ids.append(str(groupe_data['_id']))
user['grp_apprenant_color'] = grp_apprenant_color
user['grp_apprenant_code'] = grp_apprenant_code
user['liste_groupe_code'] = liste_groupe_code
if ("mode_animation" not in user.keys()):
user['mode_animation'] = "0"
ue_titre = ""
ue_code = ""
eu_id = ""
if ("ue_id" not in user.keys()):
user['ue_id'] = ""
elif ("ue_id" in user.keys() and user['ue_id']):
"""
16/05/2026 - Verifier que cette UE est toujours rattachée à la session concernée
Important : ca permet de gerer les eventuelle suppression d'UE dans d'une session
"""
is_valide_UE_in_Session_count = MYSY_GV.dbname['session_formation'].count_documents(
{'list_unite_enseignement._id': str(user['ue_id']),
'_id': ObjectId(str(diction['session_id']))})
if (is_valide_UE_in_Session_count > 0):
eu_id_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id': ObjectId(str(user['ue_id'])),
'partner_owner_recid': str( my_partner['partner_owner_recid'])})
if (eu_id_data and "titre" in eu_id_data.keys()):
ue_titre = eu_id_data['titre']
if (eu_id_data and "code" in eu_id_data.keys()):
ue_code = eu_id_data['code']
if (eu_id_data and "_id" in eu_id_data.keys()):
eu_id = str(eu_id_data['_id'])
else:
ue_titre = ""
ue_code = ""
eu_id = ""
user['ue_code'] = ue_code
user['ue_titre'] = ue_titre
user['ue_id'] = eu_id
if ("unite_enseignement_planif_id" not in user.keys()):
user['unite_enseignement_planif_id'] = ""
@ -1226,8 +1324,90 @@ def Get_Ent_Student_Participant_Notes(diction):
]
#print("#### Get_List_Participant_Notes laa 01 : query = ", query)
for retval in MYSY_GV.dbname['note_evaluation_participant'].aggregate(query):
instant_t = datetime.now()
pipeline = [
{
"$match": {
"inscription_id": {
"$in": tab_my_inscription_ids
},
"partner_owner_recid": str(apprenant_data['partner_owner_recid']),
"publish": "1",
"is_validated": "1"
}
},
{
"$addFields": {
"mysy_publish_date": {
"$dateFromString": {
"dateString": "$publish_date",
"format": "%d/%m/%Y %H:%M",
"onError": None,
"onNull": None
}
}
}
},
{
"$match": {
"mysy_publish_date": {
"$lte": instant_t
}
}
},
{
"$sort": {
"_id": -1
}
},
{
"$lookup": {
"from": "note_evaluation",
"let": {
"evaluation_id": "$evaluation_id",
"partner_owner_recid": "$partner_owner_recid"
},
"pipeline": [
{
"$match": {
"$expr": {
"$and": [
{
"$eq": [
"$valide",
"1"
]
},
{
"$eq": [
"$_id",
{
"$convert": {
"input": "$$evaluation_id",
"to": "objectId",
"onError": None,
"onNull": None
}
}
]
}
]
}
}
}
],
"as": "note_evaluation_collection"
}
}
]
print("#### Get_List_Participant_Notes pipeline laa 01 : query = ", pipeline)
for retval in MYSY_GV.dbname['note_evaluation_participant'].aggregate(pipeline):
if( "note_evaluation_collection" in retval.keys() ):
print(" ## ii retval['note_evaluation_collection'] = ", retval['note_evaluation_collection'])
user = {}
nom_apprenant = ""
prenom_apprenant = ""
@ -1987,7 +2167,7 @@ def Get_Ent_Student_update_user_account(diction):
'''
field_list = ['adr_street', 'adr_city', 'adr_zip', 'adr_country', 'mob_phone','link_facebook',
'link_twitter', 'token', 'prenom', 'nom', 'birthday','link_linkedin', 'apprenant_id',
'type_connexion', 'rh_id']
'type_connexion', 'rh_id', 'date_naissance', 'num_cvec', 'civilite', 'nom_fille', 'date_naissance']
incom_keys=diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
@ -2006,6 +2186,10 @@ def Get_Ent_Student_update_user_account(diction):
mycommon.myprint(" MAJ de diction "+str(diction))
global_apprenant_id = ""
global_apprenant_partner_owner_recid = ""
global_apprenant_email = ""
if( diction['type_connexion'] == "apprenant"):
"""
Verifier la validité de l'apprenant
@ -2021,11 +2205,17 @@ def Get_Ent_Student_update_user_account(diction):
3]) + " L'identifiant de l'apprenant est invalide ")
return False, " L'identifiant de l'apprenant est invalide ",
global_apprenant_id = str(diction['apprenant_id'])
apprenant_data = MYSY_GV.dbname['apprenant'].find_one(
{'_id': ObjectId(str(diction['apprenant_id'])),
'valide': '1',
'locked': '0'})
global_apprenant_partner_owner_recid = str(apprenant_data['partner_owner_recid'])
global_apprenant_email = str(apprenant_data['email'])
elif( diction['type_connexion'] == "tuteur"):
"""
@ -2048,6 +2238,10 @@ def Get_Ent_Student_update_user_account(diction):
'locked': '0'})
"""
22/05/2026 - On va aussi mettre à jour le dossier apprenant
"""
dictionnary_for_apprenant = {}
coll_name = MYSY_GV.dbname['user_account']
@ -2060,33 +2254,33 @@ def Get_Ent_Student_update_user_account(diction):
myemail = ""
if ("adr_street" in diction.keys()):
if( str(diction['adr_street']) ):
dictionnary['adr_street'] = str(diction['adr_street'])
dictionnary['adr_street'] = str(diction['adr_street'])
dictionnary_for_apprenant['adresse'] = str(diction['adr_street'])
if ("adr_city" in diction.keys()):
if (str(diction['adr_city'])):
dictionnary['adr_city'] = str(diction['adr_city'])
dictionnary['adr_city'] = str(diction['adr_city'])
dictionnary_for_apprenant['ville'] = str(diction['adr_city'])
if( "adr_zip" in diction.keys() ):
if (str(diction['adr_zip'])):
dictionnary['adr_zip'] = str(diction['adr_zip'])
dictionnary['adr_zip'] = str(diction['adr_zip'])
dictionnary_for_apprenant['code_postal'] = str(diction['adr_zip'])
if ("adr_country" in diction.keys()):
if (str(diction['adr_country'])):
dictionnary['adr_country'] = str(diction['adr_country'])
dictionnary['adr_country'] = str(diction['adr_country'])
dictionnary_for_apprenant['pays'] = str(diction['adr_country'])
if ("mob_phone" in diction.keys()):
if (str(diction['mob_phone'])):
dictionnary['mob_phone'] = str(diction['mob_phone'])
dictionnary['mob_phone'] = str(diction['mob_phone'])
dictionnary_for_apprenant['telephone'] = str(diction['mob_phone'])
if ("link_facebook" in diction.keys()):
if (str(diction['link_facebook'])):
dictionnary['link_facebook'] = str(diction['link_facebook'])
dictionnary['link_facebook'] = str(diction['link_facebook'])
dictionnary_for_apprenant['link_facebook'] = str(diction['link_facebook'])
if ("link_twitter" in diction.keys()):
if (str(diction['link_twitter'])):
dictionnary['link_twitter'] = str(diction['link_twitter'])
dictionnary['link_twitter'] = str(diction['link_twitter'])
dictionnary_for_apprenant['link_twitter'] = str(diction['link_twitter'])
if ("token" in diction.keys()):
if (str(diction['token'])):
@ -2097,20 +2291,34 @@ def Get_Ent_Student_update_user_account(diction):
myemail = str(diction['email'])
if ("prenom" in diction.keys()):
if (str(diction['prenom'])):
dictionnary['prenom'] = str(diction['prenom'])
dictionnary['prenom'] = str(diction['prenom'])
dictionnary_for_apprenant['prenom'] = str(diction['prenom'])
if ("nom" in diction.keys()):
if (str(diction['nom'])):
dictionnary['nom'] = str(diction['nom'])
dictionnary['nom'] = str(diction['nom'])
dictionnary_for_apprenant['nom'] = str(diction['nom'])
if ("birthday" in diction.keys()):
if (str(diction['birthday'])):
dictionnary['birthday'] = str(diction['birthday'])
if ("date_naissance" in diction.keys()):
dictionnary['birthday'] = str(diction['date_naissance'])
dictionnary_for_apprenant['date_naissance'] = str(diction['date_naissance'])
if ("link_linkedin" in diction.keys()):
if (str(diction['link_linkedin'])):
dictionnary['link_linkedin'] = str(diction['link_linkedin'])
dictionnary['link_linkedin'] = str(diction['link_linkedin'])
dictionnary_for_apprenant['link_linkedin'] = str(diction['link_linkedin'])
if ("num_cvec" in diction.keys()):
dictionnary_for_apprenant['num_cvec'] = str(diction['num_cvec'])
if ("civilite" in diction.keys()):
dictionnary['civilite'] = str(diction['civilite'])
dictionnary_for_apprenant['civilite'] = str(diction['civilite'])
if ("num_cvec" in diction.keys()):
dictionnary_for_apprenant['num_cvec'] = str(diction['num_cvec'])
if ("nom_fille" in diction.keys()):
dictionnary['nom_fille'] = str(diction['nom_fille'])
dictionnary_for_apprenant['nom_fille'] = str(diction['nom_fille'])
@ -2161,7 +2369,186 @@ def Get_Ent_Student_update_user_account(diction):
return_document=ReturnDocument.AFTER
)
if (ret_val and ret_val['_id']):
if (ret_val and ret_val['_id'] and len(str(global_apprenant_id)) > 5 ):
"""
22/05/2026 - Mise à jour de l'apprenant, si c'est un apprenant qui est connecté
IMPORTANT :
On va mettre à jour toutes les inscriptions dont date_du <= TODAY_DAYE <= date_au.
L'idée des recuperer toutes les inscrition dont les sessiosn sont valides
"""
pipeline_valide_inscription_by_date_session = [
{
"$match": {
"partner_owner_recid": str(global_apprenant_partner_owner_recid),
"apprenant_id": str(global_apprenant_id),
"email": str(global_apprenant_email),
"valide": "1",
"locked": "0"
}
},
{
"$lookup": {
"from": "session_formation",
"let": {
"local_session_id": "$session_id",
"local_partner_owner_recid": "$partner_owner_recid"
},
"pipeline": [
{
"$match": {
"$expr": {
"$and": [
{
"$eq": [
"$_id",
{
"$convert": {
"input": "$$local_session_id",
"to": "objectId",
"onError": None,
"onNull": None
}
}
]
},
{
"$eq": [
"$partner_owner_recid",
"$$local_partner_owner_recid"
]
},
{
"$eq": ["$valide", "1"]
},
{
"$eq": ["$archive", "0"]
}
]
}
}
},
{
"$addFields": {
"mysy_date_debut": {
"$dateFromString": {
"dateString": "$date_debut",
"format": "%d/%m/%Y",
"onError": None,
"onNull": None
}
},
"mysy_date_fin": {
"$dateFromString": {
"dateString": "$date_fin",
"format": "%d/%m/%Y",
"onError": None,
"onNull": None
}
},
"mysy_today": {
"$dateTrunc": {
"date": "$$NOW",
"unit": "day"
}
}
}
},
{
"$match": {
"$expr": {
"$and": [
{
"$lte": [
"$mysy_date_debut",
"$mysy_today"
]
},
{
"$gte": [
"$mysy_date_fin",
"$mysy_today"
]
}
]
}
}
},
{
"$project": {
"_id": 1,
"code_session": 1,
"titre": 1,
"date_debut": 1,
"date_fin": 1,
"session_status": 1,
"session_etape": 1
}
}
],
"as": "session_formation_collection"
}
},
{
"$match": {
"session_formation_collection.0": {
"$exists": True
}
}
},
{
"$addFields": {
"session_formation": {
"$arrayElemAt": [
"$session_formation_collection",
0
]
}
}
},
{
"$project": {
"_id": 1
}
},
{
"$sort": {
"_id": -1
}
}
]
tab_valide_inscription_ObjectId = []
for local_inscr in MYSY_GV.dbname["inscription"].aggregate(pipeline_valide_inscription_by_date_session):
tab_valide_inscription_ObjectId.append(ObjectId(str(local_inscr['_id'])))
dictionnary_for_apprenant['update_date'] = str(datetime.now())
dictionnary_for_apprenant['update_by'] = str(my_partner['_id'])
print(" ### dictionnary_for_apprenant = ", dictionnary_for_apprenant)
result_apprenant = MYSY_GV.dbname['apprenant'].find_one_and_update(
{'_id': ObjectId(str(global_apprenant_id)),
'partner_owner_recid': global_apprenant_partner_owner_recid},
{"$set": dictionnary_for_apprenant},
upsert=False,
return_document=ReturnDocument.AFTER
)
result_inscrit = MYSY_GV.dbname['inscription'].update_many(
{'_id':{'$in':tab_valide_inscription_ObjectId},
'partner_owner_recid': global_apprenant_partner_owner_recid},
{"$set": dictionnary_for_apprenant},
)
print(" result_inscrit update = ", result_inscrit.modified_count)
mycommon.myprint(str(inspect.stack()[0][3]) + " -La modif a bien ete faite =" + str(ret_val['_id']))
return True, " Le compte utilisateur a ete mis à jour"
else:
@ -2700,3 +3087,63 @@ def Get_Ent_Student_total_Heure_Absence(diction):
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 "
"""
Cette fonction recuperer l'image de profil d'un inscrit en partant de l'ENT
"""
def Get_Ent_Student_Apprenant_IMG_Profil(diction):
try:
"""
Verification de la liste 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 ne sont pas correctes"
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 ",
qery_images = {'locked': '0', 'valide': '1', 'related_collection': 'apprenant',
'related_collection_recid': str(diction['apprenant_id'])}
# print(" ### qery_images = ", qery_images)
RetObject = []
partner_images = {}
# Recuperation des image 'logo' et 'cachet' si le partenaire en a
for retVal in MYSY_GV.dbname['mysy_images'].find(qery_images):
if ('type_img' in retVal.keys()):
if (retVal['type_img'] == "user"):
partner_images['logo_img'] = retVal['img'].decode()
partner_images['logo_img_recid'] = retVal['recid']
RetObject.append(mycommon.JSONEncoder().encode(partner_images))
return True, RetObject
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 recuperer l'image de profil de l'apprenant"

View File

@ -1426,6 +1426,177 @@ def Get_Type_Groupe_Apprenant(diction):
"""
Cette fonction permet de recuperer la liste des groupe auxquels
appartient un inscrit
"""
def Get_Inscrit_List_Groupe(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'inscrit_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', 'inscrit_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'inscrit
"""
is_valide_inscrit = MYSY_GV.dbname['inscription'].count_documents({'_id':ObjectId(str(diction['inscrit_id'])),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0'})
if( is_valide_inscrit != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de l'inscrit est invalide ")
return False, " L'identifiant de l'inscrit est invalide",
pipeline = [
{
"$match": {
"partner_owner_recid": "43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89",
"inscription_id": str(diction['inscrit_id']),
"valide": "1",
"locked": "0"
}
},
{
"$lookup": {
"from": "groupe_inscription",
"let": {
"groupe_id": "$groupe_inscription_id",
"owner": "$partner_owner_recid"
},
"pipeline": [
{
"$match": {
"$expr": {
"$and": [
{
"$eq": [
{"$toString": "$_id"},
"$$groupe_id"
]
},
{
"$eq": [
"$partner_owner_recid",
"$$owner"
]
},
{
"$eq": [
"$valide",
"1"
]
},
{
"$eq": [
"$locked",
"0"
]
}
]
}
}
},
{
"$project": {
"_id": 1,
"code": 1,
"nom": 1,
"description": 1,
"type_groupe_code": 1,
"class_id": 1,
"session_id": 1,
"color": 1
}
}
],
"as": "groupe_data"
}
},
{
"$unwind": {
"path": "$groupe_data",
"preserveNullAndEmptyArrays": False
}
},
{
"$project": {
"_id": 1,
"groupe_inscription_id": 1,
"delegue_level": 1,
"type_groupe_code": 1,
"date_ajout_groupe": 1,
"groupe_code": "$groupe_data.code",
"groupe_nom": "$groupe_data.nom",
"groupe_description": "$groupe_data.description",
"groupe_type_code": "$groupe_data.type_groupe_code"
}
},
{
"$sort": {
"groupe_nom": 1
}
}
]
print(" QRYYY pipeline == ", pipeline)
#result = list(MYSY_GV.dbname["groupe_inscription_membre"].aggregate(pipeline))
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname["groupe_inscription_membre"].aggregate(pipeline):
user = retval
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) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer les groupe d'apprenants "
"""
Fonction qui permet d'exporter les membres d'un groupe dans un fichier excel
"""

54
main.py
View File

@ -5560,6 +5560,8 @@ def getRecodedStagiaireImage_from_front():
status, retval = inscription.getRecodedStagiaireImage_from_front(payload)
return jsonify(status=status, message=retval)
"""
API qui supprime l'image de profil d'un stagiaire
"""
@ -12475,6 +12477,23 @@ def Get_Type_Groupe_Apprenant():
"""
API pour recuperer la liste des groupe auxquels
appartient un inscrit
"""
@app.route('/myclass/api/Get_Inscrit_List_Groupe/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Inscrit_List_Groupe():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Inscrit_List_Groupe payload = ",payload)
status, retval = groupe_inscrit_mgt.Get_Inscrit_List_Groupe(payload)
return jsonify(status=status, message=retval)
"""
API pour exporter les membres d'un groupe d'inscrits
"""
@ -13518,6 +13537,23 @@ def ENT_Enable_RH_Account():
return jsonify(status=status, message=retval)
"""
API permet ermet de créer un tuteur inexistant
et de lui attribuer le role de tuteur a l'apprenant
en une seule fois
"""
@app.route('/myclass/api/Create_RH_And_Add_List_Insc_Tutore/', methods=['POST','GET'])
@crossdomain(origin='*')
def Create_RH_And_Add_List_Insc_Tutore():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Create_RH_And_Add_List_Insc_Tutore payload = ",payload)
status, retval = ressources_humaines.Create_RH_And_Add_List_Insc_Tutore(payload)
return jsonify(status=status, message=retval)
"""
API permet de recuperer les data du partenaire proprietaire d'un sous domaine
@ -15350,6 +15386,24 @@ def Get_Ent_Student_total_Heure_Absence():
return jsonify(status=status, message=retval)
"""
API pour recuperer l'image de profil de l'apprenant pour l'ENT
"""
@app.route('/myclass/api/Get_Ent_Student_Apprenant_IMG_Profil/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Ent_Student_Apprenant_IMG_Profil():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Ent_Student_Apprenant_IMG_Profil : payload = ",str(payload))
status, retval = ent_student_common.Get_Ent_Student_Apprenant_IMG_Profil( payload)
return jsonify(status=status, message=retval)
"""
API - Gestion ENT Apprenant : pour publier des document dans l'espace ENT des apprenants
"""

View File

@ -3524,6 +3524,12 @@ def GetAttendeeDetail_perSession(diction):
else:
my_retrun_dict['piece_identite_num'] = ""
if ("identite_type" in local_Insc_retval.keys()):
my_retrun_dict['identite_type'] = local_Insc_retval['identite_type']
else:
my_retrun_dict['identite_type'] = ""
if ("situation_famille" in local_Insc_retval.keys()):
my_retrun_dict['situation_famille'] = local_Insc_retval['situation_famille']
else:

View File

@ -560,6 +560,10 @@ def Add_Ressource_Humaine(diction):
if ("civilite" in diction.keys()):
if diction['civilite']:
civilite = str(diction['civilite']).lower()
if (str(civilite) not in MYSY_GV.CIVILITE):
civilite = "neutre"
data['civilite'] = civilite
@ -841,7 +845,11 @@ def Update_Ressource_Humaine(diction):
civilite = ""
if ("civilite" in diction.keys()):
data_update['civilite'] = str(diction['civilite']).lower()
civilite = str(diction['civilite']).lower()
if (str(civilite) not in MYSY_GV.CIVILITE):
civilite = "neutre"
data_update['civilite'] = civilite
date_naissance = ""
if ("date_naissance" in diction.keys()):
@ -964,8 +972,11 @@ def Update_Ressource_Humaine(diction):
civilite = ""
if ("civilite" in diction.keys()):
civilite = diction['civilite']
data_update['civilite'] = diction['civilite']
civilite = str(diction['civilite']).lower()
if (str(civilite) not in MYSY_GV.CIVILITE):
civilite = "neutre"
data_update['civilite'] = civilite
adr_adresse = ""
if ("adr_adresse" in diction.keys()):
@ -7876,3 +7887,231 @@ def ENT_Enable_RH_Account(diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible désactiver les accès ENT "
"""
Cette fonction permet de créer un tuteur inexistant
et de lui attribuer le role de tuteur a l'apprenant
en une seule fois
"""
def Create_RH_And_Add_List_Insc_Tutore(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'role', 'inscription_id', 'include_com', 'comment',
'rh_nom', 'rh_prenom', 'rh_email', 'rh_tel', 'rh_civilite',]
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', 'role', 'inscription_id', 'include_com', 'comment',
'rh_nom', 'rh_prenom', 'rh_email', 'rh_tel', 'rh_civilite',
]
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
"""
Creation du compte 'autre rh'
"""
print(" ## qry = ", {'email': mycommon.regex_replace_cartere(str(diction['rh_email']).lower()),
'partner_recid':str(my_partner['recid'])})
is_existe_rh_by_email = MYSY_GV.dbname['ressource_humaine'].count_documents( {'email': mycommon.regex_replace_cartere(str(diction['rh_email']).lower()),
'partner_recid':str(my_partner['recid'])})
if( is_existe_rh_by_email > 0 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + "Cette adresse e-mail est déjà associée à une personne enregistrée. Veuillez en saisir une autre ou vérifier la fiche existante.")
return False, " Cette adresse e-mail est déjà associée à une personne enregistrée. Veuillez en saisir une autre ou vérifier la fiche existante.",
new_rh_data = {}
new_rh_data['nom'] = diction['rh_nom']
new_rh_data['prenom'] = diction['rh_prenom']
new_rh_data['email'] = str(diction['rh_email']).lower()
new_rh_data['telephone'] = str(diction['rh_tel'])
new_rh_data['type_rh'] = "1"
new_rh_data['date_naissance'] = "01/01/1900"
civilite = "neutre"
if ("rh_civilite" in diction.keys()):
if diction['rh_civilite']:
civilite = str(diction['rh_civilite']).strip().lower()
if (str(civilite) not in MYSY_GV.CIVILITE):
civilite = "neutre"
new_rh_data['civilite'] = str(civilite)
new_rh_data['valide'] = '1'
new_rh_data['locked'] = '0'
new_rh_data['creation_date'] = str(datetime.now())
new_rh_data['creation_by'] = str(my_partner['_id'])
new_rh_data['is_partner_admin_account'] = "0"
# Creation du RecId
new_rh_data['recid'] = mycommon.create_user_recid()
new_rh_data['partner_recid'] = str(my_partner['recid'])
inserted_id = ""
inserted_id = MYSY_GV.dbname['ressource_humaine'].insert_one(new_rh_data).inserted_id
if (not inserted_id):
mycommon.myprint(
" Impossible de créer le tuteur ")
return False, " Impossible de créer le tuteur "
"""
# 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'] = str(diction['token'])
history_event_dict['related_collection'] = "ressource_humaine"
history_event_dict['related_collection_recid'] = str(inserted_id)
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = " Création "
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 la ressource humaine (email): " + str(
diction['email']))
if( diction['role'] not in MYSY_GV.TUTORAT_ROLE):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le role de totorat est invalide "+str(diction['role'])+" not in "+ str(MYSY_GV.TUTORAT_ROLE))
return False, " Le role de totorat est invalide",
"""
Verifier la validité de l'inscription
"""
is_valide_inscription = MYSY_GV.dbname['inscription'].count_documents({'_id':ObjectId(diction['inscription_id']),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0'})
if (is_valide_inscription != 1):
mycommon.myprint(str(
inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
return False, " L'identifiant de inscrit est invalide ",
inscription_data = MYSY_GV.dbname['inscription'].find_one(
{'_id': ObjectId(diction['inscription_id']),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'})
"""
check validité RH
"""
is_rh_valide = MYSY_GV.dbname['ressource_humaine'].count_documents({"_id":ObjectId(str(inserted_id)),
'partner_recid':my_partner['recid'],
})
if( is_rh_valide != 1):
mycommon.myprint(str(
inspect.stack()[0][3]) + " L'identifiant RH est invalide ")
return False, " L'identifiant RH est invalide ",
is_rh_valide = MYSY_GV.dbname['ressource_humaine'].count_documents({"_id": ObjectId(str(inserted_id)),
'partner_recid': my_partner['recid'],
'tab_inscription_id.inscription_id': str(
diction['inscription_id'])})
"""
Pour eviter les doubons, on supprimer un eventuel inscrit deja présent
"""
MYSY_GV.dbname['ressource_humaine'].update_one({'partner_recid': str(my_partner['recid']),
'valide': '1', 'locked': '0',
'_id': ObjectId(str(inserted_id)),
},
{"$pull": {"tab_inscription_id": {"inscription_id": diction['inscription_id']}}},
)
new_inscrit_totore = {}
new_inscrit_totore['inscription_id'] = diction['inscription_id']
new_inscrit_totore['role'] = diction['role']
new_inscrit_totore['include_com'] = diction['include_com']
if( "comment" in diction.keys()):
new_inscrit_totore['comment'] = diction['comment']
else:
new_inscrit_totore['comment'] = ""
new_inscrit_totore['creation_by'] = str(my_partner['_id'])
new_inscrit_totore['date_creation'] = str(datetime.now())
update = MYSY_GV.dbname['ressource_humaine'].update_one({'partner_recid': str(my_partner['recid']),
'valide': '1', 'locked': '0',
'_id': ObjectId(str(inserted_id)),
},
{
'$push': {
"tab_inscription_id": {'$each': [new_inscrit_totore]},
}
},
)
# Logguer l'event
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
# print(" ####### laaaa diction = ", diction)
history_event_dict = {}
history_event_dict['token'] = token
history_event_dict['related_collection'] = "ressource_humaine"
history_event_dict['related_collection_recid'] = str(inserted_id)
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Ajout du role de tutorat pour l'inscrit " + str(
inscription_data['nom']) + " - " + str(inscription_data['prenom']) + " - " + str(inscription_data['email'])
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, " L'inscrit a été correctement ajouté "
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 d'ajouter l'inscrit tutoré "

View File

@ -1054,6 +1054,11 @@ def Get_List_Unite_Enseignement_Of_Given_Class_From_Session_Id(diction):
user['class_id'] = str(New_retVal['_id'])
user['internal_url'] = str(New_retVal['internal_url'])
if ("couleur" in local_val.keys()):
user['couleur'] = str(local_val['couleur'])
else:
user['couleur'] = "#3573CB"
"""
Recuperation des données associées à cette UE
"""
@ -1252,6 +1257,27 @@ def Get_List_Unite_Enseignement_Of_Given_Session_Id(diction):
user['diplome_id'] = str(diplome_id)
user['diplome_code'] = str(diplome_code)
if ("competence_id" in local_val.keys()):
user['competence_id'] = str(local_val['competence_id'])
else:
user['competence_id'] = ""
if ("domaine_competence_id" in local_val.keys() and local_val['domaine_competence_id']):
user['domaine_competence_id'] = str(local_val['domaine_competence_id'])
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one(
{'_id': ObjectId(str(local_val['domaine_competence_id'])),
'partner_owner_recid': str(my_partner['recid'])}, {'couleur': 1})
if (domaine_competence_id_data and "couleur" in domaine_competence_id_data.keys()):
user['couleur'] = str(domaine_competence_id_data['couleur'])
else:
user['couleur'] = "#3573CB"
else:
user['domaine_competence_id'] = ""
user['couleur'] = "#3573CB"
RetObject.append(mycommon.JSONEncoder().encode(user))