15/05/2026 - 17h30

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-15 17:47:04 +02:00
parent 829b8b3e3e
commit 351b833c40
11 changed files with 12347 additions and 141 deletions

View File

@ -4,12 +4,18 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="qsd">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="13/05/26 - 17h">
<change afterPath="$PROJECT_DIR$/Diplome_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Relance_client_facture.py" beforeDir="false" afterPath="$PROJECT_DIR$/Relance_client_facture.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_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$/bloc_competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/bloc_competence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.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" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -453,7 +459,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="580" />
<option name="localTasksCounter" value="581" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -495,7 +501,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="26/03/2026 - 12h" />
<MESSAGE value="23/03/26 - 20h" />
<MESSAGE value="04/04/26 - 20h" />
<MESSAGE value="07/04/2026 - 14h" />
@ -520,6 +525,7 @@
<MESSAGE value="10/05/2026 - 12h30" />
<MESSAGE value="11/05/2026 -22h" />
<MESSAGE value="qsd" />
<option name="LAST_COMMIT_MESSAGE" value="qsd" />
<MESSAGE value="13/05/26 - 17h" />
<option name="LAST_COMMIT_MESSAGE" value="13/05/26 - 17h" />
</component>
</project>

439
Diplome_mgt.py Normal file
View File

@ -0,0 +1,439 @@
"""
Ce fichier permet de gerer les diplomes que préparer un partenaire
Collection : diplome
- code
- description
"""
import bson
import pymongo
from pymongo import MongoClient
import json
from bson import ObjectId
import re
from datetime import datetime
import prj_common as mycommon
import secrets
import inspect
import sys, os
import csv
import pandas as pd
from pymongo import ReturnDocument
import GlobalVariable as MYSY_GV
from math import isnan
import GlobalVariable as MYSY_GV
import ela_index_bdd_classes as eibdd
import email_mgt as email
import jinja2
from flask import send_file
from xhtml2pdf import pisa
from email.message import EmailMessage
from email.mime.text import MIMEText
from email import encoders
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
"""
Ajout d'un diplome
"""
def Add_Diplome(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'code', 'description',]
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', 'code',]
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 que ce code n'existe pas déjà
is_existe_class_domaine = MYSY_GV.dbname['diplome'].count_documents({'code':str(diction['code']),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])})
if( is_existe_class_domaine > 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " ce code '" + str(diction['code']) + "' existe déjà ")
return False, " Ce code '" + str(diction['code']) + "' existe déjà "
new_data = diction
del diction['token']
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['creation_date'] = str(datetime.now())
new_data['creation_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
inserted_id = MYSY_GV.dbname['diplome'].insert_one(new_data).inserted_id
if (not inserted_id):
mycommon.myprint(
" Impossible de créer le diplome (2) ")
return False, " Impossible de créer le diplome (2) "
return True, " Le diplome 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 de créer le diplome "
"""
Mise à jour d'un diplome
"""
def Update_Diplome(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_id', 'code', 'description',]
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', '_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
new_data = diction
# Verifier que la domaine
is_existe_cdtion_paiement = MYSY_GV.dbname['diplome'].count_documents(
{'_id': ObjectId(str(diction['_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_existe_cdtion_paiement < 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du diplome est invalide ")
return False, " L'identifiant du diplome est invalide "
# Verifier que code n'est pas pris par un autre domaine
is_existe_class_domaine = MYSY_GV.dbname['diplome'].count_documents({'code': str(diction['code']),
'valide': '1',
'partner_owner_recid': str(
my_partner['recid']),
"_id": {"$ne": ObjectId(
str(diction['_id']))}
})
if (is_existe_class_domaine > 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le code '" + str(diction['code']) + "' existe déjà ")
return False, " Le code '" + str(diction['code']) + "' existe déjà "
local_id = str(diction['_id'])
del diction['token']
del diction['_id']
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
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['diplome'].find_one_and_update(
data_cle,
{"$set": new_data},
upsert=False,
return_document=ReturnDocument.AFTER
)
if ("_id" not in result.keys()):
mycommon.myprint(
" Impossible de mettre à jour le diplome (2) ")
return False, " Impossible de mettre à jour le diplome (2) "
return True, " Lediplome a été correctement mis à jour"
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 mettre à jour le diplome "
"""
Suppression d'un mode de Diplome
regles :
Si la condition (_id) n'est pas utiliser dans les collection
- xxxxxx
"""
def Delete_Diplome(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_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', '_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
is_existe_class_domaine = MYSY_GV.dbname['diplome'].count_documents(
{'_id': ObjectId(str(diction['_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_existe_class_domaine < 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du diplome est invalide ")
return False, "L'identifiant du diplome est invalide "
delete = MYSY_GV.dbname['diplome'].delete_one({'_id': ObjectId(str(diction['_id'])),
'partner_owner_recid': str(my_partner['recid']),
}, )
return True, "Le diplome a été correctement supprimé"
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 supprimer le diplome "
"""
Recuperer la liste des Diplomes d'un partenaire
"""
def Get_List_Diplome(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', ]
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', ]
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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['valide'] = "1"
data_cle['locked'] = "0"
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['diplome'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
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 la liste des diplomes "
"""
Recuperer les données d'un Diplome
"""
def Get_Given_Diplome(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_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', '_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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['valide'] = "1"
data_cle['locked'] = "0"
data_cle['_id'] = ObjectId(str(diction['_id']))
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['diplome'].find(data_cle):
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 données du diplome "

View File

@ -17,7 +17,9 @@ from pymongo import MongoClient
import json
from bson import ObjectId
import re
from datetime import datetime, date
from datetime import datetime, date, time
from werkzeug.utils import secure_filename
import apprenant_mgt
import groupe_inscrit_mgt
@ -48,6 +50,9 @@ from zipfile import ZipFile
import partner_client as partner_client
import E_Sign_Document as E_Sign_Document
import survey_mgt
import shutil
from werkzeug.utils import secure_filename
"""
Enregistrement d'un stagiaire
@ -87,7 +92,8 @@ def AddStagiairetoClass(diction):
'is_handicap', 'is_droit_image', 'is_rgpd', 'nationalite', 'situation_famille', 'naissance_lieu',
'naissance_departement',
'naissance_pays', 'num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite',
'telephone_bis', 'frequence_facturation', 'ine', 'matricule', 'modefinancement_id', 'type_apprenant_id'
'telephone_bis', 'frequence_facturation', 'ine', 'matricule', 'modefinancement_id', 'type_apprenant_id',
'nom_fille', 'num_cvec', 'handicap_detail', 'employeur_id', 'categorie_id'
]
incom_keys = diction.keys()
@ -204,7 +210,30 @@ def AddStagiairetoClass(diction):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Le type d'apprenant est invalide ")
return False, " Le type d'apprenant est invalide "
if ("employeur_id" in diction.keys() and diction['employeur_id']):
is_valide_employeur_id = MYSY_GV.dbname['partner_client'].count_documents(
{'_id': ObjectId(str(diction['employeur_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_employeur_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " L'employeur est invalide ")
return False, " L'employeur est invalide "
if ("categorie_id" in diction.keys() and diction['categorie_id']):
is_valide_categorie_id = MYSY_GV.dbname['categorie_apprenant'].count_documents(
{'_id': ObjectId(str(diction['categorie_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_categorie_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " La catégorie de l'apprenant est invalide ")
return False, " La catégorie de l'apprenant est invalide "
#print(" #### my_partner V2 = ", my_partner)
@ -238,17 +267,45 @@ def AddStagiairetoClass(diction):
comment = str(diction['comment']).strip()
mydata['comment'] = comment
nom_fille = ""
if ("nom_fille" in diction.keys()):
if diction['nom_fille']:
nom_fille = str(diction['nom_fille']).strip()
mydata['nom_fille'] = nom_fille
num_cvec = ""
if ("num_cvec" in diction.keys()):
if diction['num_cvec']:
comment = str(diction['num_cvec']).strip()
mydata['num_cvec'] = num_cvec
handicap_detail = ""
if ("handicap_detail" in diction.keys()):
if diction['handicap_detail']:
handicap_detail = str(diction['handicap_detail']).strip()
mydata['handicap_detail'] = handicap_detail
type_apprenant_id = ""
if ("type_apprenant_id" in diction.keys()):
type_apprenant_id = str(diction['type_apprenant_id']).strip()
type_apprenant_id = str(diction['type_apprenant_id'])
mydata['type_apprenant_id'] = type_apprenant_id
modefinancement_id = ""
if ("modefinancement_id" in diction.keys()):
modefinancement_id = str(diction['modefinancement_id']).strip()
modefinancement_id = str(diction['modefinancement_id'])
mydata['modefinancement_id'] = modefinancement_id
employeur_id = ""
if ("employeur_id" in diction.keys()):
employeur_id = str(diction['employeur_id'])
mydata['employeur_id'] = employeur_id
categorie_id = ""
if ("categorie_id" in diction.keys()):
categorie_id = str(diction['categorie_id'])
mydata['categorie_id'] = categorie_id
ine = ""
@ -2143,7 +2200,8 @@ def UpdateStagiairetoClass(diction):
'naissance_departement',
'naissance_pays', 'num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite',
'telephone_bis', 'frequence_facturation', 'update_dossier_apprenant', 'ine', 'matricule',
'modefinancement_id', 'type_apprenant_id'
'modefinancement_id', 'type_apprenant_id', 'nom_fille', 'num_cvec', 'handicap_detail',
'employeur_id', 'categorie_id'
]
@ -2213,6 +2271,31 @@ def UpdateStagiairetoClass(diction):
return False, " Le type d'apprenant est invalide "
if ("employeur_id" in diction.keys() and diction['employeur_id']):
is_valide_employeur_id = MYSY_GV.dbname['partner_client'].count_documents(
{'_id': ObjectId(str(diction['employeur_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_employeur_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " L'employeur est invalide ")
return False, " L'employeur est invalide "
if ("categorie_id" in diction.keys() and diction['categorie_id']):
is_valide_categorie_id = MYSY_GV.dbname['categorie_apprenant'].count_documents(
{'_id': ObjectId(str(diction['categorie_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_categorie_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " La catégorie de l'apprenant est invalide ")
return False, " La catégorie de l'apprenant est invalide "
"""
Verifier qu'il n'y pas un étudiant avec le meme INE (Identifiant National Étudiant)
"""
@ -2309,9 +2392,26 @@ def UpdateStagiairetoClass(diction):
if ("matricule" in diction.keys()):
mydata['matricule'] = str(diction['matricule']).strip()
if ("nom_fille" in diction.keys()):
mydata['nom_fille'] = str(diction['nom_fille']).strip()
if ("num_cvec" in diction.keys()):
mydata['num_cvec'] = str(diction['num_cvec']).strip()
if ("handicap_detail" in diction.keys()):
mydata['handicap_detail'] = str(diction['handicap_detail']).strip()
if ("type_apprenant_id" in diction.keys()):
mydata['type_apprenant_id'] = str(diction['type_apprenant_id']).strip()
mydata['type_apprenant_id'] = str(diction['type_apprenant_id'])
if ("categorie_id" in diction.keys()):
mydata['categorie_id'] = str(diction['categorie_id'])
if ("employeur_id" in diction.keys()):
mydata['employeur_id'] = str(diction['employeur_id'])
if ("modefinancement_id" in diction.keys()):
mydata['modefinancement_id'] = str(diction['modefinancement_id']).strip()
@ -2922,7 +3022,7 @@ 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']
'pays', 'ine', 'matricule', 'nom_fille', 'num_cvec', 'handicap_detail']
for field in tab_champ:
if( str(field) in ret_val2.keys()):
new_apprenant_data[str(field)] = ret_val2[str(field)]
@ -2939,8 +3039,6 @@ def UpdateStagiairetoClass(diction):
)
return True, "Les données du stagiaire ont été correctement mise à jour"
@ -4714,7 +4812,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
{'code': mode_financement_code,
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
'partner_owner_recid': str(partner_recid)})
if (mode_financement_data and '_id' in mode_financement_data.keys()):
mode_financement_id = str(mode_financement_data['_id'])
@ -4737,7 +4835,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
{'code': type_apprenant_code,
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
'partner_owner_recid': str(partner_recid)})
if (type_apprenant_data and '_id' in type_apprenant_data.keys()):
type_apprenant_id = str(type_apprenant_data['_id'])
@ -9432,7 +9530,7 @@ def Update_Stagiaire_Image(file_img=None, Folder=None, diction=None):
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
# field_list.
'''
field_list = ['token', 'file_img_recid', 'class_internal_url', 'session_id', 'email' ]
field_list = ['token', 'file_img_recid', 'class_internal_url', 'session_id', 'email', ]
incom_keys = diction.keys()
@ -9490,6 +9588,8 @@ def Update_Stagiaire_Image(file_img=None, Folder=None, diction=None):
"""
A present que le partenaire est mis à jour / créé, on va mettre à jour les image logo et image cachet s'il y en a
"""
if( file_img ):
recordimage_diction = {}
recordimage_diction['token'] = diction['token']
@ -9503,12 +9603,14 @@ def Update_Stagiaire_Image(file_img=None, Folder=None, diction=None):
if( local_status is False):
return local_status, local_message
return True, "L'image du stagiaire a été correctement enregistrée"
return True, "L'image a été correctement enregistrée"
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 d'enregistrer l'image du stagiaire"
return False, "Impossible d'enregistrer l'image"
@ -11585,6 +11687,21 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
memo = local_Insc_retval['memo']
my_retrun_dict['memo'] = memo
handicap_detail = ""
if ("handicap_detail" in local_Insc_retval.keys()):
handicap_detail = local_Insc_retval['handicap_detail']
my_retrun_dict['handicap_detail'] = handicap_detail
nom_fille = ""
if ("nom_fille" in local_Insc_retval.keys()):
nom_fille = local_Insc_retval['nom_fille']
my_retrun_dict['nom_fille'] = nom_fille
num_cvec = ""
if ("num_cvec" in local_Insc_retval.keys()):
num_cvec = local_Insc_retval['handicap_detail']
my_retrun_dict['num_cvec'] = num_cvec
ine = ""
if ("ine" in local_Insc_retval.keys()):
@ -11635,6 +11752,34 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
my_retrun_dict['type_apprenant_id'] = type_apprenant_id
###
# ---------
employeur_id = ""
if ("employeur_id" in local_Insc_retval.keys() and local_Insc_retval['employeur_id']):
valide_employeur_count = MYSY_GV.dbname['partner_client'].count_documents(
{'_id': ObjectId(str(local_Insc_retval['employeur_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if (valide_employeur_count == 1):
employeur_id = local_Insc_retval['employeur_id']
my_retrun_dict['employeur_id'] = employeur_id
categorie_id = ""
if ("categorie_id" in local_Insc_retval.keys() and local_Insc_retval['categorie_id']):
valide_categorie_count = MYSY_GV.dbname['categorie_apprenant'].count_documents(
{'_id': ObjectId(str(local_Insc_retval['categorie_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if (valide_categorie_count == 1):
categorie_id = local_Insc_retval['categorie_id']
my_retrun_dict['categorie_id'] = categorie_id
# -------
local_telephone = ""

File diff suppressed because it is too large Load Diff

View File

@ -61,7 +61,7 @@ def Add_Apprenant(diction):
'is_handicap', 'is_droit_image', 'is_rgpd', 'nationalite', 'situation_famille', 'naissance_lieu',
'naissance_departement',
'naissance_pays', 'num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite',
'telephone_bis', 'matricule', 'ine'
'telephone_bis', 'matricule', 'ine', 'nom_fille', 'num_cvec', 'handicap_detail'
]
incom_keys = diction.keys()
@ -304,7 +304,8 @@ def Update_Apprenant(diction):
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'civilite', 'date_naissance',
'tuteur1_civilite', 'tuteur2_civilite',
'is_handicap', 'is_droit_image', 'is_rgpd', 'nationalite', 'situation_famille', 'naissance_lieu', 'naissance_departement',
'naissance_pays','num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite', 'telephone_bis', 'matricule', 'ine'
'naissance_pays','num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite', 'telephone_bis', 'matricule', 'ine',
'nom_fille', 'num_cvec', 'handicap_detail'
]

View File

@ -75,6 +75,7 @@ Important : : 24/12/2024
(ce champs n'est pas obligatoire)
- metadata_field : est un champs de texte qui prends au maximum 500 caractère pour stocker des metadata pour effectuer des recherches
- 'is_secure_file' permet de dire si un fichier est sécurisé
"""
def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
try:
@ -86,7 +87,8 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
Verification des input acceptés
"""
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']
'object_owner_id', 'type_document', 'metadata_field', 'tab_key_word', 'admission_setup_document_id',
'is_secure_file']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
@ -147,6 +149,10 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
if diction['object_owner_collection']:
object_owner_collection = diction['object_owner_collection']
is_secure_file = ""
if ("is_secure_file" in diction.keys() and diction['is_secure_file'] in ['0', '1', '']):
is_secure_file = str(diction['is_secure_file'])
type_document = ""
if ("type_document" in diction.keys()):
if diction['type_document']:
@ -226,6 +232,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['is_secure_file'] = str(is_secure_file)
if( "admission_setup_document_id" in diction.keys() ):
mydata['admission_setup_document_id'] = str(diction['admission_setup_document_id'])
@ -268,7 +276,7 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
"""
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', 'related_collection_ue',
'related_collection_session', 'related_collection_class']
'related_collection_session', 'related_collection_class', 'is_secure_file']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
@ -357,6 +365,10 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
if diction['document_display_order']:
document_display_order = diction['document_display_order']
is_secure_file = ""
if ("is_secure_file" in diction.keys() and diction['is_secure_file'] in ['0', '1', '']):
is_secure_file = diction['is_secure_file']
"""
La table des mots clés contient au max 5 mots, chanque mot ne doit pas faire plus 50 caracactères
@ -439,6 +451,8 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
mydata['creation_date'] = str(datetime.now())
mydata['creation_by'] = str(my_partner['_id'])
mydata['is_secure_file'] = str(is_secure_file)
ret_val = MYSY_GV.dbname['download_files'].find_one_and_update({'file_business_object': str(file_business_object),
'object_owner_collection':str(object_owner_collection),
'object_owner_id':str(object_owner_id),
@ -519,7 +533,7 @@ def Get_Stored_Downloaded_File(diction):
if( not file_name ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Fichier invalide = ", str(file_name))
3]) + " - Fichier invalide ")
return False, " - nom du fichier invalide "
@ -528,8 +542,20 @@ def Get_Stored_Downloaded_File(diction):
"""
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':my_partner['recid']})
default_qry = {'full_path': str(full_path), 'valide': '1',
'partner_owner_recid':my_partner['recid']}
user_has_acces_to_secure_doc = MYSY_GV.dbname['user_access_right'].count_documents(
{'module_name': 'file_secure', 'user_id': str(my_partner['ressource_humaine_id']),
'valide': '1', 'read': True})
if (user_has_acces_to_secure_doc != 1):
# l'utilisateur n'as pas le droit de voir les fichier sécurisé
default_qry = {'full_path': str(full_path), 'valide': '1', 'is_secure_file': {'$ne': '1'},
'partner_owner_recid': my_partner['recid']}
tmp_count = MYSY_GV.dbname['download_files'].count_documents(default_qry)
if (tmp_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
@ -539,7 +565,6 @@ def Get_Stored_Downloaded_File(diction):
if os.path.exists(full_path):
print(" ### full_path = ", full_path)
return True, send_file(full_path, as_attachment=True)
else:
@ -617,9 +642,22 @@ def Get_Stored_Downloaded_File_From_Id(diction):
"""
Verifier la validité de l'identifiant
"""
is_valide_download_files = MYSY_GV.dbname["download_files"].count_documents({'_id':ObjectId(str(diction['_id'])),
'valide':'1',
'partner_owner_recid':my_partner['recid']})
"""
Recuperation de la list des fichier dans la collection
"""
default_qry = {'_id':ObjectId(str(diction['_id'])), 'valide':'1','partner_owner_recid':my_partner['recid']}
user_has_acces_to_secure_doc = MYSY_GV.dbname['user_access_right'].count_documents(
{'module_name': 'file_secure', 'user_id': str(my_partner['ressource_humaine_id']),
'valide': '1', 'read':True})
if (user_has_acces_to_secure_doc != 1):
# l'utilisateur n'as pas le droit de voir les fichier sécurisé
default_qry = {'_id':ObjectId(str(diction['_id'])), 'valide':'1','partner_owner_recid':my_partner['recid'], 'is_secure_file': {'$ne': '1'}}
is_valide_download_files = MYSY_GV.dbname["download_files"].count_documents(default_qry)
if(is_valide_download_files != 1 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du fichier est invalide ")
@ -632,6 +670,14 @@ def Get_Stored_Downloaded_File_From_Id(diction):
'partner_owner_recid': my_partner['recid']})
if( "is_secure_file" in is_valide_download_files_data and is_valide_download_files_data['is_secure_file'] == "1"):
# Faire un controle d'acces sécurisé
user_secure_acces = MYSY_GV.dbname['user_access_right'].count_documents({'module_name':'file_secure', 'user_id':str(my_partner['ressource_humaine_id']),
'valide':'1', 'read':True})
if( user_secure_acces != 1):
return False, " Vos droits ne sont pas suffisants pour visualiser ce fichier "
file_name = ""
if( "file_name" in is_valide_download_files_data.keys() ):
@ -646,10 +692,9 @@ def Get_Stored_Downloaded_File_From_Id(diction):
full_path = str(file_name)
print(" ## full_path === ", full_path)
if os.path.exists(full_path):
print(" ### full_path = ", full_path)
return True, send_file(full_path, as_attachment=True)
else:
@ -843,24 +888,41 @@ def Get_List_object_owner_collection_Stored_Files(diction):
str(inspect.stack()[0][3]) + " Il manque des informations obligatoires ")
return False, " Les informations fournies sont incorrectes",
"""
filt_securised_doc = {}
user_has_acces_to_secure_doc = MYSY_GV.dbname['user_access_right'].count_documents(
{'module_name': 'file_secure', 'user_id': str(my_partner['ressource_humaine_id']),
'valide': '1', 'read': True})
my_query = {}
if( object_owner_collection and object_owner_id):
query2 = {"$or": [
{'object_owner_collection': object_owner_collection, 'object_owner_id': object_owner_id, 'valide': '1',
'partner_owner_recid': str(my_partner['recid'])},
{'tab_related_collection.related_collection': object_owner_collection,
'tab_related_collection.related_collection_id': object_owner_id, 'valide': '1',
'partner_owner_recid': str(my_partner['recid'])}
if (user_has_acces_to_secure_doc != 1):
query2 = {"$or": [
{'object_owner_collection': object_owner_collection, 'object_owner_id': object_owner_id, 'valide': '1',
'partner_owner_recid': str(my_partner['recid']), 'is_secure_file':{'$ne':'1'}},
{'tab_related_collection.related_collection': object_owner_collection,
'tab_related_collection.related_collection_id': object_owner_id, 'valide': '1',
'partner_owner_recid': str(my_partner['recid']), 'is_secure_file':{'$ne':'1'}}
]}
else:
query2 = {"$or": [
{'object_owner_collection': object_owner_collection, 'object_owner_id': object_owner_id,
'valide': '1',
'partner_owner_recid': str(my_partner['recid']), },
{'tab_related_collection.related_collection': object_owner_collection,
'tab_related_collection.related_collection_id': object_owner_id, 'valide': '1',
'partner_owner_recid': str(my_partner['recid']), }
]}
else:
query2 = {}
query2['valide'] = "1"
query2['partner_owner_recid'] = str(my_partner['recid'])
if (user_has_acces_to_secure_doc != 1):
query2['is_secure_file'] = {'$ne':'1'}
#print(" ##### myquery = " + str(query2))
#print(" ##### myquery = " + str(query2)) zzzzzzzz
RetObject = []
nb_val = 0
for retval in MYSY_GV.dbname['download_files'].find(query2).sort([("_id", pymongo.DESCENDING), ("document_display_order", pymongo.DESCENDING)]):
@ -872,6 +934,13 @@ def Get_List_object_owner_collection_Stored_Files(diction):
ret_file['file_business_object'] = retval['file_business_object']
if ("is_secure_file" in retval.keys()):
ret_file['is_secure_file'] = retval['is_secure_file']
else:
ret_file['is_secure_file'] = "0"
if ("creation_date" in retval.keys()):
ret_file['creation_date'] = retval['creation_date']
else:
@ -1304,7 +1373,11 @@ def Delete_Entity_Stored_Downloaded_File(diction):
"""
Cette fonction permet de recuperer une liste de documents
avec plusieurs filtre
avec plusieurs filtre.
15/05/2026 - Si l'utilisateur n'a pas le droit : 'module_name':'file_secure',
alors on ne lui retroune pas le fichier.
"""
@ -1581,10 +1654,19 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
}
}
filt_securised_doc = {}
user_has_acces_to_secure_doc = MYSY_GV.dbname['user_access_right'].count_documents(
{'module_name': 'file_secure', 'user_id': str(my_partner['ressource_humaine_id']),
'valide': '1', 'read': True})
if( user_has_acces_to_secure_doc != 1):
# l'utilisateur n'as pas le droit de voir les fichier sécurisé
filt_securised_doc = {'is_secure_file':{'$ne':'1'}}
my_query = {'$and': [ filt_object_owner_collection, filt_filter_object_owner_id, filt_date_creation,
filt_type_document, filt_session_code,filt_partner_client_nom, filt_file_business_object,
filt_class_external_code, filt_nom_prenom_mail_inscrit, {'partner_owner_recid': str(my_partner['recid']),
filt_class_external_code, filt_nom_prenom_mail_inscrit, filt_securised_doc, {'partner_owner_recid': str(my_partner['recid']),
'valide':'1'}]}
new_query = ([ {"$addFields": {
@ -1618,6 +1700,12 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
ret_file['file_business_object'] = retval['file_business_object']
if ("is_secure_file" in retval.keys()):
ret_file['is_secure_file'] = retval['is_secure_file']
else:
ret_file['is_secure_file'] = "0"
if ("creation_date" in retval.keys()):
ret_file['creation_date'] = retval['creation_date']
else:
@ -1859,10 +1947,13 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token(diction):
"""
Sans token, on n'affiche pas le fichier sécurisés
"""
filt_securised_doc = {'is_secure_file': {'$ne': '1'}}
my_query = {'$and': [filt_object_owner_collection, filt_filter_object_owner_id,
filt_type_document, filt_file_business_object,
filt_type_document, filt_file_business_object,filt_securised_doc
]}
new_query = ([
@ -1887,6 +1978,11 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token(diction):
ret_file['file_business_object'] = retval['file_business_object']
if ("is_secure_file" in retval.keys()):
ret_file['is_secure_file'] = retval['is_secure_file']
else:
ret_file['is_secure_file'] = "0"
if ("creation_date" in retval.keys()):
ret_file['creation_date'] = retval['creation_date']
else:

View File

@ -462,6 +462,25 @@ def Get_Given_bloc_competence(diction):
local_node['creation_date'] = str(ue_competence['creation_date'])
if( "semestre" in ue_competence.keys() ):
local_node['semestre'] = str(ue_competence['semestre'])
else:
local_node['semestre'] = ""
local_diplome_id = ""
local_diplome_code = ""
if( "diplome_id" in ue_competence.keys() and ue_competence['diplome_id']):
diplome_data = MYSY_GV.dbname['diplome'].find_one({'_id':ObjectId(str(ue_competence['diplome_id'])),
'partner_owner_recid':str(my_partner['recid'])})
if( diplome_data and "code" in diplome_data.keys()):
local_diplome_id = str(diplome_data['_id'])
local_diplome_code = str(diplome_data['code'])
local_node['diplome_id'] = local_diplome_id
local_node['diplome_code'] = local_diplome_code
tab_ue_competence_with_code.append(local_node)
# Gestion d'un domaine de compétence
@ -499,6 +518,25 @@ def Get_Given_bloc_competence(diction):
local_node['creation_date'] = str(ue_competence['creation_date'])
if ("semestre" in ue_competence.keys()):
local_node['semestre'] = str(ue_competence['semestre'])
else:
local_node['semestre'] = ""
local_diplome_id = ""
local_diplome_code = ""
if ("diplome_id" in ue_competence.keys() and ue_competence['diplome_id']):
diplome_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(str(ue_competence['diplome_id'])),
'partner_owner_recid': str(my_partner['recid'])})
if (diplome_data and "code" in diplome_data.keys()):
local_diplome_id = str(diplome_data['_id'])
local_diplome_code = str(diplome_data['code'])
local_node['diplome_id'] = local_diplome_id
local_node['diplome_code'] = local_diplome_code
tab_ue_competence_with_code.append(local_node)
@ -862,7 +900,8 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'bloc_competence_id', 'ue_id', 'competence_id', 'domaine_competence_id', 'type_association']
field_list = ['token', 'bloc_competence_id', 'ue_id', 'competence_id', 'domaine_competence_id',
'type_association', 'semestre', 'diplome_id']
"""
type_association = "1" => association avec un domaine de compétence
@ -901,6 +940,17 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
return local_status, my_partner
if( "diplome_id" in diction.keys() and diction['diplome_id']):
is_valide_diplome_id = MYSY_GV.dbname['diplome'].count_documents({'_id':ObjectId(str(diction['diplome_id'])),
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_diplome_id != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le diplome est invalide ")
return False, " Le diplome est invalide"
"""
Traitement d'un association avec compétence
"""
@ -1121,6 +1171,17 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
new_data['competence_id'] = ""
new_data['domaine_competence_id'] = str(diction['domaine_competence_id'])
if( "semestre" in diction.keys() ):
new_data['semestre'] = diction['semestre']
else:
new_data['semestre'] = ""
if ("diplome_id" in diction.keys()):
new_data['diplome_id'] = diction['diplome_id']
else:
new_data['diplome_id'] = ""
new_data['valide'] = "1"
new_data['creation_by'] = str(my_partner['_id'])
new_data['creation_date'] = str(datetime.now())

69
main.py
View File

@ -120,6 +120,7 @@ import Finance_mode_mgt as Finance_mode_mgt
import Categorie_apprenant as Categorie_apprenant
import Type_groupe_inscrit_mgt as Type_groupe_inscrit_mgt
import Relance_client_facture as Relance_client_facture
import Diplome_mgt as Diplome_mgt
import base_document_automatic_setup as base_document_automatic_setup
@ -17889,6 +17890,74 @@ def Get_List_Relance_with_filter():
"""
API pour créer un diplome
"""
@app.route('/myclass/api/Add_Diplome/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_Diplome():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_Diplome payload = ",payload)
status, retval = Diplome_mgt.Add_Diplome(payload)
return jsonify(status=status, message=retval)
"""
API pour mettre à jour un diplome
"""
@app.route('/myclass/api/Update_Diplome/', methods=['POST','GET'])
@crossdomain(origin='*')
def Update_Diplome():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Update_Diplome payload = ",payload)
status, retval = Diplome_mgt.Update_Diplome(payload)
return jsonify(status=status, message=retval)
"""
API pour supprimer un diplome
"""
@app.route('/myclass/api/Delete_Diplome/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Diplome():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Diplome payload = ",payload)
status, retval = Diplome_mgt.Delete_Diplome(payload)
return jsonify(status=status, message=retval)
"""
API pour recuperer la liste des diplomes d'un partners
"""
@app.route('/myclass/api/Get_List_Diplome/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Diplome():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Diplome payload = ",payload)
status, retval = Diplome_mgt.Get_List_Diplome(payload)
return jsonify(status=status, message=retval)
"""
API pour recuperer les données d'un diplomes
"""
@app.route('/myclass/api/Get_Given_Diplome/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Given_Diplome():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Given_Diplome payload = ",payload)
status, retval = Diplome_mgt.Get_Given_Diplome(payload)
return jsonify(status=status, message=retval)
if __name__ == '__main__':
print(" debut api")

View File

@ -3410,7 +3410,7 @@ def Get_List_Apprenant_Notes_With_Filter(diction):
for val in MYSY_GV.dbname['inscription'].find({'apprenant_id':{'$in': tab_my_apprenant_ids } ,
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['partner_owner_recid'])}):
'partner_owner_recid':str(my_partner['recid'])}):
concerned_tab_inscription_id.append((str(val['_id'])))
if(len(concerned_tab_inscription_id) > 0 ):

View File

@ -2118,6 +2118,38 @@ def recordClassImage_v2(file=None, Folder=None, diction=None):
myprint(" IMPOSSIBLE D'ENREGISTRER L'IMAGE")
return False, "IMPOSSIBLE D'ENREGISTRER L'IMAGE "
"""
14/05/2026 - mettre à jour l'image de l'apprenant associe
"""
if( related_collection == "inscription" and related_collection_recid ):
inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(related_collection_recid)),
'valide':'1',
'apprenant_id':{'$ne':''},
'partner_owner_recid':str(my_partner['recid'])}, {'apprenant_id'})
if(inscription_data and 'apprenant_id' in inscription_data.keys() and inscription_data['apprenant_id'] ):
new_diction = {}
new_diction['img'] = strimg
new_diction['related_collection'] = 'apprenant'
new_diction['related_collection_recid'] = str(inscription_data['apprenant_id'])
new_diction['valide'] = '1'
new_diction['update_date'] = str(datetime.now())
new_diction['locked'] = "0"
new_diction['recid'] = image_recid
new_diction['type_img'] = type_img
ret_val = coll_name.find_one_and_update(
{"recid": image_recid, "related_collection_recid": inscription_data['apprenant_id'],
"valide": "1", "locked": "0", "related_collection": 'apprenant',
"type_img": str(type_img)},
{"$set": new_diction},
upsert=True,
return_document=ReturnDocument.AFTER
)
return True, "L'image a été correctement enregistrée"
@ -3507,99 +3539,7 @@ def GetAttendeeDetail_perSession(diction):
my_retrun_dict['type_mobilite'] = ""
"""
# Tuteurs
if ("tuteur1_nom" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_nom'] = local_Insc_retval['tuteur1_nom']
else:
my_retrun_dict['tuteur1_nom'] = ""
if ("tuteur1_prenom" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_prenom'] = local_Insc_retval['tuteur1_prenom']
else:
my_retrun_dict['tuteur1_prenom'] = ""
if ("tuteur1_email" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_email'] = local_Insc_retval['tuteur1_email']
else:
my_retrun_dict['tuteur1_email'] = ""
if ("tuteur1_telephone" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_telephone'] = local_Insc_retval['tuteur1_telephone']
else:
my_retrun_dict['tuteur1_telephone'] = ""
if ("tuteur1_adresse" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_adresse'] = local_Insc_retval['tuteur1_adresse']
else:
my_retrun_dict['tuteur1_adresse'] = ""
if ("tuteur1_cp" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_cp'] = local_Insc_retval['tuteur1_cp']
else:
my_retrun_dict['tuteur1_cp'] = ""
if ("tuteur1_ville" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_ville'] = local_Insc_retval['tuteur1_ville']
else:
my_retrun_dict['tuteur1_ville'] = ""
if ("tuteur1_pays" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_pays'] = local_Insc_retval['tuteur1_pays']
else:
my_retrun_dict['tuteur1_pays'] = ""
if ("tuteur1_include_com" in local_Insc_retval.keys()):
my_retrun_dict['tuteur1_include_com'] = local_Insc_retval['tuteur1_include_com']
else:
my_retrun_dict['tuteur1_include_com'] = ""
if ("tuteur2_nom" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_nom'] = local_Insc_retval['tuteur2_nom']
else:
my_retrun_dict['tuteur2_nom'] = ""
if ("tuteur2_prenom" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_prenom'] = local_Insc_retval['tuteur2_prenom']
else:
my_retrun_dict['tuteur2_prenom'] = ""
if ("tuteur2_email" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_email'] = local_Insc_retval['tuteur2_email']
else:
my_retrun_dict['tuteur2_email'] = ""
if ("tuteur2_telephone" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_telephone'] = local_Insc_retval['tuteur2_telephone']
else:
my_retrun_dict['tuteur2_telephone'] = ""
if ("tuteur2_adresse" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_adresse'] = local_Insc_retval['tuteur2_adresse']
else:
my_retrun_dict['tuteur2_adresse'] = ""
if ("tuteur2_cp" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_cp'] = local_Insc_retval['tuteur2_cp']
else:
my_retrun_dict['tuteur2_cp'] = ""
if ("tuteur2_ville" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_ville'] = local_Insc_retval['tuteur2_ville']
else:
my_retrun_dict['tuteur2_ville'] = ""
if ("tuteur2_pays" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_pays'] = local_Insc_retval['tuteur2_pays']
else:
my_retrun_dict['tuteur2_pays'] = ""
if ("tuteur2_include_com" in local_Insc_retval.keys()):
my_retrun_dict['tuteur2_include_com'] = local_Insc_retval['tuteur2_include_com']
else:
my_retrun_dict['tuteur2_include_com'] = ""
"""
if ("certification_send_date" in local_Insc_retval.keys()):
if (str(local_Insc_retval['certification_send_date'])):
@ -3662,6 +3602,22 @@ def GetAttendeeDetail_perSession(diction):
my_retrun_dict['comment'] = comment
nom_fille = ""
if ("nom_fille" in local_Insc_retval.keys()):
nom_fille = local_Insc_retval['nom_fille']
my_retrun_dict['nom_fille'] = nom_fille
num_cvec = ""
if ("num_cvec" in local_Insc_retval.keys()):
num_cvec = local_Insc_retval['num_cvec']
my_retrun_dict['num_cvec'] = num_cvec
handicap_detail = ""
if ("handicap_detail" in local_Insc_retval.keys()):
handicap_detail = local_Insc_retval['handicap_detail']
my_retrun_dict['handicap_detail'] = handicap_detail
local_telephone = ""
if ("telephone" in local_Insc_retval.keys()):
local_telephone = local_Insc_retval['telephone']
@ -3710,6 +3666,37 @@ def GetAttendeeDetail_perSession(diction):
my_retrun_dict['type_apprenant_code'] = type_apprenant_code
my_retrun_dict['type_apprenant_id'] = type_apprenant_id
#---------
employeur_id = ""
if ("employeur_id" in local_Insc_retval.keys() and local_Insc_retval['employeur_id']):
valide_employeur_count = MYSY_GV.dbname['partner_client'].count_documents(
{'_id': ObjectId(str(local_Insc_retval['employeur_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if (valide_employeur_count == 1):
employeur_id = local_Insc_retval['employeur_id']
my_retrun_dict['employeur_id'] = employeur_id
categorie_id = ""
if ("categorie_id" in local_Insc_retval.keys() and local_Insc_retval['categorie_id']):
valide_categorie_count = MYSY_GV.dbname['categorie_apprenant'].count_documents(
{'_id': ObjectId(str(local_Insc_retval['categorie_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if (valide_categorie_count == 1):
categorie_id = local_Insc_retval['categorie_id']
my_retrun_dict['categorie_id'] = categorie_id
#-------
###
local_opco = ""

View File

@ -65,7 +65,7 @@ def Add_Unite_Enseignement(diction):
field_list = ['token', 'code', 'titre', 'description', 'objectif', 'prerequis', 'programme', 'methode_pedagogique', 'methode_evaluation',
'support', 'duration', 'duration_unite', 'domain_id', 'bloc' ,
'ects', 'seuil_validation', 'niveau_competence', 'vh_cm', 'vh_tp', 'vh_tpg',
'vh_td', 'semestre', 'note_ue_calculation_rule_id', 'is_module']
'vh_td', 'semestre', 'note_ue_calculation_rule_id', 'is_module', 'conclusive']
incom_keys = diction.keys()
for val in incom_keys:
@ -157,7 +157,8 @@ def Add_Unite_Enseignement(diction):
del mydata['token']
if( "conclusive" not in mydata.keys() or mydata['conclusive'] not in ['0', '1', '']):
mydata['conclusive'] = "0"
inserted_id = MYSY_GV.dbname['unite_enseignement'].insert_one(mydata).inserted_id
@ -190,7 +191,8 @@ def Update_Unite_Enseignement(diction):
field_list = ['token', '_id', 'code', 'titre', 'description', 'objectif', 'prerequis', 'programme',
'methode_pedagogique', 'methode_evaluation', 'support', 'duration', 'duration_unite',
'domain_id', 'bloc', 'ects', 'seuil_validation', 'niveau_competence',
'vh_cm', 'vh_tp', 'vh_tpg', 'vh_td', 'semestre', 'note_ue_calculation_rule_id', 'is_module']
'vh_cm', 'vh_tp', 'vh_tpg', 'vh_td', 'semestre', 'note_ue_calculation_rule_id', 'is_module',
'conclusive']
incom_keys = diction.keys()
for val in incom_keys:
@ -276,6 +278,8 @@ def Update_Unite_Enseignement(diction):
del mydata['token']
del mydata['_id']
if ("conclusive" in mydata.keys() or mydata['conclusive'] not in ['0', '1', '']):
mydata['conclusive'] = "0"
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
@ -378,6 +382,9 @@ def Get_List_Unite_Enseignement_no_filter(diction):
if ("bloc" not in user.keys()):
user['bloc'] = ""
if ("conclusive" not in user.keys()):
user['conclusive'] = "0"
"""
Recuperer le nombre de lignes de planification
"""
@ -502,6 +509,9 @@ def Get_List_Unite_Enseignement_with_filter(diction):
if ("bloc" not in user.keys()):
user['bloc'] = ""
if ("conclusive" not in user.keys()):
user['conclusive'] = "0"
"""
Recuperer le nombre de lignes de planification
"""
@ -707,6 +717,8 @@ def Get_Given_Unite_Enseignement(diction):
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if ("conclusive" not in user.keys()):
user['conclusive'] = "0"
tab_competence = []
tab_competence_code = []
@ -886,6 +898,8 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
user['seuil_validation'] = "99"
RetObject.append(mycommon.JSONEncoder().encode(user))