parent
e8db1b8918
commit
c06f114fa7
|
|
@ -4,17 +4,18 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="27/04/26 - 19h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="28/04/26 - 19h">
|
||||
<change afterPath="$PROJECT_DIR$/Categorie_apprenant.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/Finance_mode_mgt.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/Type_apprenant_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$/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$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/groupe_client_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_client_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/notes_apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/notes_apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.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" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -458,7 +459,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="569" />
|
||||
<option name="localTasksCounter" value="570" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -500,7 +501,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="01/03/26 - 13h30" />
|
||||
<MESSAGE value="07/03/26 - 16h" />
|
||||
<MESSAGE value="08/03/26 - 20h" />
|
||||
<MESSAGE value="10/03/26 - 20h" />
|
||||
|
|
@ -525,6 +525,7 @@
|
|||
<MESSAGE value="24/04/26 - 19h" />
|
||||
<MESSAGE value="26/04/26 - 19h" />
|
||||
<MESSAGE value="27/04/26 - 19h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="27/04/26 - 19h" />
|
||||
<MESSAGE value="28/04/26 - 19h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="28/04/26 - 19h" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,470 @@
|
|||
"""
|
||||
Ce fichier permet de gerer lesCategorie d'etudiant / apprenant
|
||||
Collection : categorie_apprenant
|
||||
- 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'une categorie d'apprenant
|
||||
"""
|
||||
def Add_Categorie_Apprenant(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['categorie_apprenant'].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['categorie_apprenant'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer la catégorie d'apprenants (2) ")
|
||||
return False, " Impossible de créer la catégorie d'apprenants (2) "
|
||||
|
||||
|
||||
return True, " La catégorie d'apprenants a été correctement ajoutée"
|
||||
|
||||
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 la catégorie d'apprenants"
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'une categorie d'apprenant
|
||||
"""
|
||||
def Update_Categorie_Apprenant(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['categorie_apprenant'].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 de la catégorie d'apprenants invalide ")
|
||||
return False, " L'identifiant de la catégorie d'apprenants invalide "
|
||||
|
||||
|
||||
# Verifier que code n'est pas pris par un autre domaine
|
||||
is_existe_class_domaine = MYSY_GV.dbname['categorie_apprenant'].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['categorie_apprenant'].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 la catégorie d'apprenants (2) ")
|
||||
return False, " Impossible de mettre à jour lla catégorie d'apprenants (2) "
|
||||
|
||||
return True, " La catégorie d'apprenants a été correctement mise à 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 la catégorie d'apprenants "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une categorie d'apprenant
|
||||
regles :
|
||||
Si la condition (_id) n'est pas utiliser dans les collection
|
||||
- inscription
|
||||
- admission_session_inscrit
|
||||
"""
|
||||
|
||||
def Delete_Categorie_Apprenant(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['categorie_apprenant'].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 de la catégorie d'apprenants est invalide ")
|
||||
return False, "L'identifiant de la catégorie d'apprenants est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que le type d'apprenant n'est pas utilisé (collection : inscription)
|
||||
"""
|
||||
is_domaine_in_myclass = MYSY_GV.dbname['inscription'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'categorie_apprenant_id':str(diction['_id'])})
|
||||
|
||||
|
||||
if( is_domaine_in_myclass > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La catégorie d'apprenants est utilisée par "+str(is_domaine_in_myclass)+" inscrit(s) ")
|
||||
return False, "La catégorie d'apprenants est utilisée par "+str(is_domaine_in_myclass)+" inscrit(s) "
|
||||
|
||||
"""
|
||||
Verifier que le type d'apprenant n'est pas utilisé (collection : admission_session_inscrit)
|
||||
"""
|
||||
is_domaine_in_myclass = MYSY_GV.dbname['admission_session_inscrit'].count_documents(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'categorie_apprenant_id': str(diction['_id'])})
|
||||
|
||||
if (is_domaine_in_myclass > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La catégorie d'apprenants est utilisée par " + str(
|
||||
is_domaine_in_myclass) + " candidat(s) ")
|
||||
return False, " La catégorie d'apprenants est utilisée par " + str(is_domaine_in_myclass) + " candidat(s) "
|
||||
|
||||
|
||||
|
||||
|
||||
delete = MYSY_GV.dbname['categorie_apprenant'].delete_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
||||
|
||||
return True, " La catégorie d'apprenants a été correctement supprimée"
|
||||
|
||||
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 La catégorie d'apprenants "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des categories d'apprenant d'un partenaire
|
||||
"""
|
||||
def Get_List_Categorie_Apprenant(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['categorie_apprenant'].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 catégories d'apprenants "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données d'une categorie d'apprenant
|
||||
"""
|
||||
def Get_Given_Categorie_Apprenant(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['categorie_apprenant'].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 de la catégorie d'apprenant "
|
||||
|
||||
|
|
@ -0,0 +1,470 @@
|
|||
"""
|
||||
Ce fichier permet de gerer les modes de financement
|
||||
Collection : financement_mode
|
||||
- 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 mode de financement
|
||||
"""
|
||||
def Add_Financement_Mode(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['financement_mode'].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['financement_mode'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer le mode de financement (2) ")
|
||||
return False, " Impossible de créer le mode de financement (2) "
|
||||
|
||||
|
||||
return True, " Le mode de financement 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 mode de financement "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'un mode de financement
|
||||
"""
|
||||
def Update_Financement_Mode(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['financement_mode'].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 mode de financement invalide ")
|
||||
return False, " L'identifiant du mode de financement est invalide "
|
||||
|
||||
|
||||
# Verifier que code n'est pas pris par un autre domaine
|
||||
is_existe_class_domaine = MYSY_GV.dbname['financement_mode'].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['financement_mode'].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 mode de financement (2) ")
|
||||
return False, " Impossible de mettre à jour le mode de financement (2) "
|
||||
|
||||
return True, " Le mode de financement 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 mode de financement "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'un mode de financement
|
||||
regles :
|
||||
Si la condition (_id) n'est pas utiliser dans les collection
|
||||
- inscription
|
||||
- admission_session_inscrit
|
||||
"""
|
||||
|
||||
def Delete_Financement_Mode(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['financement_mode'].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 mode de financement est invalide ")
|
||||
return False, "L'identifiant du mode de financement est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que le type d'apprenant n'est pas utilisé (collection : inscription)
|
||||
"""
|
||||
is_domaine_in_myclass = MYSY_GV.dbname['inscription'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'financement_mode_id':str(diction['_id'])})
|
||||
|
||||
|
||||
if( is_domaine_in_myclass > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le mode de financement est utilisé par "+str(is_domaine_in_myclass)+" inscrit(s) ")
|
||||
return False, " Le mode de financement est utilisé par "+str(is_domaine_in_myclass)+" inscrit(s) "
|
||||
|
||||
"""
|
||||
Verifier que le type d'apprenant n'est pas utilisé (collection : admission_session_inscrit)
|
||||
"""
|
||||
is_domaine_in_myclass = MYSY_GV.dbname['admission_session_inscrit'].count_documents(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'financement_mode_id': str(diction['_id'])})
|
||||
|
||||
if (is_domaine_in_myclass > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le mode de financement est utilisé par " + str(
|
||||
is_domaine_in_myclass) + " candidat(s) ")
|
||||
return False, " Le mode de financement est utilisé par " + str(is_domaine_in_myclass) + " candidat(s) "
|
||||
|
||||
|
||||
|
||||
|
||||
delete = MYSY_GV.dbname['financement_mode'].delete_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
||||
|
||||
return True, "Le mode de financement 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 mode de financement "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des mode de financement d'un partenaire
|
||||
"""
|
||||
def Get_List_Financement_Mode(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['financement_mode'].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 modes de financement "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données d'un mode de financement
|
||||
"""
|
||||
def Get_Given_Financement_Mode(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['financement_mode'].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 mode de financement "
|
||||
|
||||
5660
Log/log_file.log
5660
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,470 @@
|
|||
"""
|
||||
Ce fichier permet de gerer les type d'apprenants
|
||||
Collection : type_apprenant
|
||||
- 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 type d'apprenant
|
||||
"""
|
||||
def Add_Type_Apprenant(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['type_apprenant'].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['type_apprenant'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer le groupe de clients (2) ")
|
||||
return False, " Impossible de créer le groupe de clients (2) "
|
||||
|
||||
|
||||
return True, " Le type d'apprenants 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 type d'apprenant "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'un type d'apprenant
|
||||
"""
|
||||
def Update_Type_Apprenant(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['type_apprenant'].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 type d'apprenant invalide ")
|
||||
return False, " L'identifiant du type d'apprenant est invalide "
|
||||
|
||||
|
||||
# Verifier que code n'est pas pris par un autre domaine
|
||||
is_existe_class_domaine = MYSY_GV.dbname['type_apprenant'].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['type_apprenant'].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 type d'apprenant (2) ")
|
||||
return False, " Impossible de mettre à jour le type d'apprenant (2) "
|
||||
|
||||
return True, " Le type d'apprenant 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 type d'apprenant "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'un type d'apprenant
|
||||
regles :
|
||||
Si la condition (_id) n'est pas utiliser dans les collection
|
||||
- inscription
|
||||
- admission_session_inscrit
|
||||
"""
|
||||
|
||||
def Delete_Type_Apprenant(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['type_apprenant'].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 type d'apprenant est invalide ")
|
||||
return False, "L'identifiant type d'apprenant est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que le type d'apprenant n'est pas utilisé (collection : inscription)
|
||||
"""
|
||||
is_domaine_in_myclass = MYSY_GV.dbname['inscription'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'type_apprenant_id':str(diction['_id'])})
|
||||
|
||||
|
||||
if( is_domaine_in_myclass > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le type d'apprenant est utilisé par "+str(is_domaine_in_myclass)+" inscrit(s) ")
|
||||
return False, " Le type d'apprenant est utilisé par "+str(is_domaine_in_myclass)+" inscrit(s) "
|
||||
|
||||
"""
|
||||
Verifier que le type d'apprenant n'est pas utilisé (collection : admission_session_inscrit)
|
||||
"""
|
||||
is_domaine_in_myclass = MYSY_GV.dbname['admission_session_inscrit'].count_documents(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'type_apprenant_id': str(diction['_id'])})
|
||||
|
||||
if (is_domaine_in_myclass > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le type d'apprenant est utilisé par " + str(
|
||||
is_domaine_in_myclass) + " candidat(s) ")
|
||||
return False, " Le type d'apprenant est utilisé par " + str(is_domaine_in_myclass) + " candidat(s) "
|
||||
|
||||
|
||||
|
||||
|
||||
delete = MYSY_GV.dbname['type_apprenant'].delete_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
||||
|
||||
return True, "Le type d'apprenant 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 type d'apprenant "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des types d'apprenant d'un partenaire
|
||||
"""
|
||||
def Get_List_Type_Apprenant(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['type_apprenant'].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 types d'apprenants "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données d'un type d'apprenant
|
||||
"""
|
||||
def Get_Given_Type_Apprenant(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['type_apprenant'].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 type d'apprenant "
|
||||
|
||||
|
|
@ -2022,7 +2022,6 @@ def Add_Apprenant_mass(file=None, Folder=None, diction=None):
|
|||
if ("matricule" in df.keys()):
|
||||
if (str(df['matricule'].values[n])):
|
||||
matricule = str(df['matricule'].values[n]).lower()
|
||||
matricule = matricule
|
||||
|
||||
"""
|
||||
Verifier que ce matricule n'est pas utilisé par une autre personne dans la base
|
||||
|
|
@ -2032,7 +2031,7 @@ def Add_Apprenant_mass(file=None, Folder=None, diction=None):
|
|||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'matricule': str(diction['matricule']),
|
||||
'matricule': matricule,
|
||||
})
|
||||
|
||||
if (is_apprenant_matricule_used != 0):
|
||||
|
|
@ -2311,7 +2310,6 @@ def Controle_Add_Apprenant_mass(saved_file=None, Folder=None, diction=None):
|
|||
if ("matricule" in df.keys()):
|
||||
if (str(df['matricule'].values[n])):
|
||||
matricule = str(df['matricule'].values[n]).lower()
|
||||
matricule = matricule
|
||||
|
||||
"""
|
||||
Verifier que ce matricule n'est pas utilisé par une autre personne dans la base
|
||||
|
|
@ -2321,7 +2319,7 @@ def Controle_Add_Apprenant_mass(saved_file=None, Folder=None, diction=None):
|
|||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'matricule': str(diction['matricule']),
|
||||
'matricule': matricule,
|
||||
})
|
||||
|
||||
if (is_apprenant_matricule_used != 0):
|
||||
|
|
|
|||
|
|
@ -4253,12 +4253,12 @@ def get_partner_class_Without_Scope_Action(diction):
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive']
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive', 'is_ftion_initiale']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " - get_partner_class : Le champ '" + val + "' n'existe pas, Creation formation annulée")
|
||||
3]) + " - get_partner_class : Le champ '" + val + "' n'existe pas.")
|
||||
return False, " Impossible de récupérer la formation"
|
||||
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ def Update_Groupe_Client(diction):
|
|||
" Impossible de mettre à jour le groupe de clients (2) ")
|
||||
return False, " Impossible de mettre à jour le groupe de clients (2) "
|
||||
|
||||
return True, " Le groupe de clients a été correctement mise à jour"
|
||||
return True, " Le groupe de clients a été correctement mis à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
|
|||
214
main.py
214
main.py
|
|
@ -115,6 +115,9 @@ import competence_pedagogique as competence_pedagogique
|
|||
import bloc_competence as bloc_competence
|
||||
import domaine_competence_pedagogique as domaine_competence_pedagogique
|
||||
import stage_mgt as stage_mgt
|
||||
import Type_apprenant_mgt as Type_apprenant_mgt
|
||||
import Finance_mode_mgt as Finance_mode_mgt
|
||||
import Categorie_apprenant as Categorie_apprenant
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
|
@ -17457,6 +17460,217 @@ def Prepare_and_Send_Stage_Convention_For_Selected_Inscrit_By_Email():
|
|||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un type d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Type_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Type_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Type_Apprenant payload = ",payload)
|
||||
status, retval = Type_apprenant_mgt.Add_Type_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour un type d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Type_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Type_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Type_Apprenant payload = ",payload)
|
||||
status, retval = Type_apprenant_mgt.Update_Type_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer un type d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Type_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Type_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Type_Apprenant payload = ",payload)
|
||||
status, retval = Type_apprenant_mgt.Delete_Type_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour recupérer la liste des types d'apprenant d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Type_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Type_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Type_Apprenant payload = ",payload)
|
||||
status, retval = Type_apprenant_mgt.Get_List_Type_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour recupérer les données d'un types d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Type_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Type_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Type_Apprenant payload = ",payload)
|
||||
status, retval = Type_apprenant_mgt.Get_Given_Type_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un mode de financement
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Financement_Mode/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Financement_Mode():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Financement_Mode payload = ",payload)
|
||||
status, retval = Finance_mode_mgt.Add_Financement_Mode(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour un mode de financement
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Financement_Mode/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Financement_Mode():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Financement_Mode payload = ",payload)
|
||||
status, retval = Finance_mode_mgt.Update_Financement_Mode(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer un mode de financement
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Financement_Mode/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Financement_Mode():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Financement_Mode payload = ",payload)
|
||||
status, retval = Finance_mode_mgt.Delete_Financement_Mode(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour récuperer la liste des mode de financement d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Financement_Mode/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Financement_Mode():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Financement_Mode payload = ",payload)
|
||||
status, retval = Finance_mode_mgt.Get_List_Financement_Mode(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour récuperer les données d'un mode de financement
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Financement_Mode/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Financement_Mode():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Financement_Mode payload = ",payload)
|
||||
status, retval = Finance_mode_mgt.Get_Given_Financement_Mode(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter une categorie d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Categorie_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Categorie_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Categorie_Apprenant payload = ",payload)
|
||||
status, retval = Categorie_apprenant.Add_Categorie_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour une categorie d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Categorie_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Categorie_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Categorie_Apprenant payload = ",payload)
|
||||
status, retval = Categorie_apprenant.Update_Categorie_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer une categorie d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Categorie_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Categorie_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Categorie_Apprenant payload = ",payload)
|
||||
status, retval = Categorie_apprenant.Delete_Categorie_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour récuprer la liste des categories d'apprenant d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Categorie_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Categorie_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Categorie_Apprenant payload = ",payload)
|
||||
status, retval = Categorie_apprenant.Get_List_Categorie_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour récuprer les données d'une categorie d'apprenant
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Categorie_Apprenant/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Categorie_Apprenant():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Categorie_Apprenant payload = ",payload)
|
||||
status, retval = Categorie_apprenant.Get_Given_Categorie_Apprenant(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
||||
|
|
|
|||
|
|
@ -1351,6 +1351,8 @@ def Get_List_Ressource_Humaine(diction):
|
|||
user['superieur_hierarchie_nom'] = superieur_hierarchie_nom
|
||||
user['superieur_hierarchie_prenom'] = superieur_hierarchie_prenom
|
||||
|
||||
user['superieur_hierarchie_nom_prenom'] = str(superieur_hierarchie_nom) + " " + str(superieur_hierarchie_prenom)
|
||||
|
||||
# Recuperation du groupe de prix d'achat si il existe.
|
||||
groupe_prix_achat_code = ""
|
||||
if ("groupe_prix_achat_id" in retval.keys() and retval['groupe_prix_achat_id']):
|
||||
|
|
@ -1888,6 +1890,22 @@ def Get_List_Ressource_Humaine_with_filter(diction):
|
|||
user['is_ent_compte'] = compte_ent
|
||||
user['is_ent_compte_locked'] = compte_ent_locked
|
||||
|
||||
superieur_hierarchique_nom = ""
|
||||
superieur_hierarchique_prenom = ""
|
||||
if ("superieur_hierarchie_id" in user.keys() and user['superieur_hierarchie_id']):
|
||||
superieur_hierarchie_id_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(user['superieur_hierarchie_id']),
|
||||
'partner_recid': str(my_partner['recid'])}, {'nom': 1, 'prenom': 1})
|
||||
|
||||
if (superieur_hierarchie_id_data and "nom" in superieur_hierarchie_id_data.keys()):
|
||||
superieur_hierarchique_nom = superieur_hierarchie_id_data['nom']
|
||||
|
||||
if (superieur_hierarchie_id_data and "prenom" in superieur_hierarchie_id_data.keys()):
|
||||
superieur_hierarchique_prenom = superieur_hierarchie_id_data['prenom']
|
||||
|
||||
user['superieur_hierarchie_nom_prenom'] = str(superieur_hierarchique_nom) + " " + str(
|
||||
superieur_hierarchique_prenom)
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
|
@ -2056,7 +2074,19 @@ def Get_List_Ressource_Humaine_no_filter(diction):
|
|||
user['is_ent_compte'] = compte_ent
|
||||
user['is_ent_compte_locked'] = compte_ent_locked
|
||||
|
||||
superieur_hierarchique_nom = ""
|
||||
superieur_hierarchique_prenom = ""
|
||||
if( "superieur_hierarchie_id" in user.keys() and user['superieur_hierarchie_id']):
|
||||
superieur_hierarchie_id_data = MYSY_GV.dbname['ressource_humaine'].find_one({'_id':ObjectId(user['superieur_hierarchie_id']),
|
||||
'partner_recid':str(my_partner['recid'])}, {'nom':1, 'prenom':1})
|
||||
|
||||
if( superieur_hierarchie_id_data and "nom" in superieur_hierarchie_id_data.keys() ):
|
||||
superieur_hierarchique_nom = superieur_hierarchie_id_data['nom']
|
||||
|
||||
if (superieur_hierarchie_id_data and "prenom" in superieur_hierarchie_id_data.keys()):
|
||||
superieur_hierarchique_prenom = superieur_hierarchie_id_data['prenom']
|
||||
|
||||
user['superieur_hierarchie_nom_prenom'] = str(superieur_hierarchique_nom)+ " "+str(superieur_hierarchique_prenom)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
"""06/09 /2024 - peut etre ne pas exclure les comptes admin
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
'vh_td', 'semestre', 'note_ue_calculation_rule_id', 'is_module']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -162,16 +162,17 @@ def Add_Unite_Enseignement(diction):
|
|||
inserted_id = MYSY_GV.dbname['unite_enseignement'].insert_one(mydata).inserted_id
|
||||
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer l'unité d'enseignement (2) ")
|
||||
return False, " Impossible de créer l'unité d'enseignement (2) "
|
||||
mycommon.myprint(" Impossible de créer le document (2) ")
|
||||
return False, " Impossible de créer le document (2) "
|
||||
|
||||
return True, " L'unité d'enseignement a été correctement ajoutée "
|
||||
|
||||
return True, " Le document 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 l'UE "
|
||||
return False, " Impossible de créer le document "
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -189,7 +190,7 @@ 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']
|
||||
'vh_cm', 'vh_tp', 'vh_tpg', 'vh_td', 'semestre', 'note_ue_calculation_rule_id', 'is_module']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -237,8 +238,8 @@ def Update_Unite_Enseignement(diction):
|
|||
|
||||
if( is_valide_opport != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'UE est invalide ")
|
||||
return False, " L'identifiant de l'UE est invalide "
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du document est invalide ")
|
||||
return False, " L'identifiant du document est invalide "
|
||||
|
||||
|
||||
if ("note_ue_calculation_rule_id" in diction.keys() and diction['note_ue_calculation_rule_id']):
|
||||
|
|
@ -265,8 +266,8 @@ def Update_Unite_Enseignement(diction):
|
|||
|
||||
if( is_new_code_exist_with_orther_id and str(is_new_code_exist_with_orther_id['_id']) != ue_id ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le code de l'UE '"+str(diction['code'])+" est déjà utilisé ")
|
||||
return False, " Le code de l'UE '"+str(diction['code'])+" est déjà utilisé "
|
||||
str(inspect.stack()[0][3]) + " Le code du document '"+str(diction['code'])+" est déjà utilisé ")
|
||||
return False, " Le code du document '"+str(diction['code'])+" est déjà utilisé "
|
||||
|
||||
|
||||
|
||||
|
|
@ -288,18 +289,18 @@ def Update_Unite_Enseignement(diction):
|
|||
)
|
||||
if ("_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour l'UE (2) ")
|
||||
return False, " Impossible de mettre à jour l'UE (2) "
|
||||
" Impossible de mettre à jour le document (2) ")
|
||||
return False, " Impossible de mettre à jour le document (2) "
|
||||
|
||||
|
||||
|
||||
return True, " L'UE a été correctement mise à jour "
|
||||
return True, " Le document 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 l'UE "
|
||||
return False, " Impossible de mettre à jour le document "
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -406,7 +407,7 @@ def Get_List_Unite_Enseignement_no_filter(diction):
|
|||
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 unites d'enseignement "
|
||||
return False, " Impossible de récupérer la liste des documents "
|
||||
|
||||
|
||||
|
||||
|
|
@ -421,7 +422,7 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'titre']
|
||||
field_list = ['token', 'code', 'titre', 'is_module']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -458,12 +459,18 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
if ("code" in diction.keys()):
|
||||
filt_code = {'code': {'$regex': str(diction['code']), "$options": "i"}}
|
||||
|
||||
filt_is_module = {}
|
||||
if ("is_module" in diction.keys() and diction['is_module'] == "1") :
|
||||
filt_is_module = {'is_module': "1"}
|
||||
else:
|
||||
filt_is_module = {'is_module': {'$ne':'1'}}
|
||||
|
||||
filt_titre = {}
|
||||
if ("titre" in diction.keys()):
|
||||
filt_titre = {'titre': {'$regex': str(diction['titre']), "$options": "i"}}
|
||||
|
||||
query = [{'$match': {
|
||||
'$and': [filt_code, filt_titre, {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'} ]}},
|
||||
'$and': [filt_code, filt_titre, filt_is_module, {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'} ]}},
|
||||
{'$sort': {'_id': -1}},
|
||||
]
|
||||
|
||||
|
|
@ -524,7 +531,7 @@ def Get_List_Unite_Enseignement_with_filter(diction):
|
|||
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 unites d'enseignement "
|
||||
return False, " Impossible de récupérer la liste des documents "
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -582,7 +589,7 @@ def Delete_Given_Unite_Enseignement(diction):
|
|||
if (is_ue_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'UE est invalide ")
|
||||
return False, " L'identifiant de l'UE est invalide "
|
||||
return False, " L'identifiant du document est invalide "
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -635,13 +642,13 @@ def Delete_Given_Unite_Enseignement(diction):
|
|||
"""
|
||||
ret_del_ue_planif = MYSY_GV.dbname['unite_enseignement_planif'].delete_many({'ue_id':str(diction['_id'])})
|
||||
|
||||
return True, "L'UE a été correctement supprimée"
|
||||
return True, "Le document 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 l'UE "
|
||||
return False, " Impossible de supprimer le document "
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -743,7 +750,7 @@ def Get_Given_Unite_Enseignement(diction):
|
|||
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 de l'unite d'enseignement "
|
||||
return False, " Impossible de récupérer les données "
|
||||
|
||||
|
||||
|
||||
|
|
@ -888,7 +895,7 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
|
|||
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 unites d'enseignement de la formation "
|
||||
return False, " Impossible de récupérer la liste des document "
|
||||
|
||||
|
||||
|
||||
|
|
@ -1029,7 +1036,7 @@ def Get_List_Unite_Enseignement_Of_Given_Class_From_Session_Id(diction):
|
|||
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 unites d'enseignement de la formation "
|
||||
return False, " Impossible de récupérer la liste des documents "
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue