parent
5fe7642c98
commit
eba5e2a16a
|
@ -4,12 +4,15 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="Init - 29/05/2025">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="Init - 29/05/2025 - FI">
|
||||
<change afterPath="$PROJECT_DIR$/financial_caracteristique_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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_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$/competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.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" />
|
||||
|
@ -29,6 +32,11 @@
|
|||
<option value="cherif <cherif.balde@yahoo.fr>" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="master" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
<option name="SIGN_OFF_COMMIT" value="true" />
|
||||
</component>
|
||||
|
@ -43,16 +51,16 @@
|
|||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Python.main.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"last_opened_file_path": "C:/Users/Cherif/Documents/myclass.com/Siteweb/Elyos_Ftion_Initiale/Ela_back/Back_Office_FI",
|
||||
"settings.editor.selected.configurable": "project.propVCSSupport.CommitDialog"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Python.main.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "master__Elyos__FI",
|
||||
"last_opened_file_path": "C:/Users/Cherif/Documents/myclass.com/Siteweb/Elyos_Ftion_Initiale/Ela_back/Back_Office_FI",
|
||||
"settings.editor.selected.configurable": "project.propVCSSupport.CommitDialog"
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\tools_cherif" />
|
||||
|
@ -445,7 +453,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="463" />
|
||||
<option name="localTasksCounter" value="464" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -487,7 +495,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="06-02-2025 - new_design_2025" />
|
||||
<MESSAGE value="08/02/205 - 22h30" />
|
||||
<MESSAGE value="10/02/205 - 21h" />
|
||||
<MESSAGE value="11/02/2025 - 15h30" />
|
||||
|
@ -512,6 +519,7 @@
|
|||
<MESSAGE value="13/05/2025 - 20h" />
|
||||
<MESSAGE value="14/05/2025 - 20h" />
|
||||
<MESSAGE value="Init - 29/05/2025" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Init - 29/05/2025" />
|
||||
<MESSAGE value="Init - 29/05/2025 - FI" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Init - 29/05/2025 - FI" />
|
||||
</component>
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
22
class_mgt.py
22
class_mgt.py
|
@ -3702,12 +3702,30 @@ def Get_Partner_All_Class_Few_Fields(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
"""
|
||||
Filtre uniquement pour la Formation continue
|
||||
"""
|
||||
filt_scope_class_id = {}
|
||||
tab_class_id_ObjectId = []
|
||||
if( "scope" in my_partner.keys() and "class_id" in my_partner['scope'].keys() and len(my_partner['scope']['class_id']) > 0 ):
|
||||
for tmp in my_partner['scope']['class_id'] :
|
||||
if( tmp ):
|
||||
tab_class_id_ObjectId.append((ObjectId(tmp)))
|
||||
|
||||
filt_scope_class_id['_id'] = {'$in':tab_class_id_ObjectId}
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
for retVal in MYSY_GV.dbname['myclass'].find(
|
||||
|
||||
|
||||
|
||||
|
||||
for retVal in MYSY_GV.dbname['myclass'].find( {"$and":[
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide':'1',
|
||||
'locked':'0'},
|
||||
'locked':'0'},filt_scope_class_id]},
|
||||
{'_id': 1, 'external_code': 1, 'internal_code': 1, 'internal_url': 1, }
|
||||
).sort([("_id", pymongo.DESCENDING), ]):
|
||||
# mycommon.myprint(str(retVal))
|
||||
|
|
|
@ -53,7 +53,7 @@ def Add_Competence(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'description', 'domaine', 'metier', 'commentaire', ]
|
||||
field_list = ['token', 'description', 'domaine', 'metier', 'commentaire', 'code' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -65,7 +65,7 @@ def Add_Competence(diction):
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'description', ]
|
||||
field_list_obligatoire = ['token', 'description', 'code' ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -86,6 +86,20 @@ def Add_Competence(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier que ce code de compétence n'est pas déjà utilisé
|
||||
"""
|
||||
is_competence_code_used = MYSY_GV.dbname['competence_liste'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_competence_code_used != 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le code de compétence "+str(diction['code'])+" est déjà utilisé ")
|
||||
return False, " Le code de compétence "+str(diction['code'])+" est déjà utilisé "
|
||||
|
||||
|
||||
mydata = {}
|
||||
|
||||
mydata = diction
|
||||
|
@ -96,8 +110,8 @@ def Add_Competence(diction):
|
|||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
mydata['date_created'] = str(datetime.now())
|
||||
mydata['created_by'] = str(my_partner['_id'])
|
||||
mydata['partner_owner_recid'] = str(my_partner['recid'])
|
||||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
@ -129,7 +143,7 @@ def Update_Competence(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'description', 'competence_id', 'domaine', 'metier', 'commentaire', ]
|
||||
field_list = ['token', 'description', 'competence_id', 'domaine', 'metier', 'commentaire', 'code' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -141,7 +155,7 @@ def Update_Competence(diction):
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'description', 'competence_id', ]
|
||||
field_list_obligatoire = ['token', 'description', 'competence_id', 'code']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -163,10 +177,28 @@ def Update_Competence(diction):
|
|||
if diction['competence_id']:
|
||||
competence_id = diction['competence_id']
|
||||
|
||||
|
||||
|
||||
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 le code de compétence n'est pas utilisé par une autre compétence autre que celle ci
|
||||
"""
|
||||
|
||||
is_competence_code_used = MYSY_GV.dbname['competence_liste'].count_documents({'code': str(diction['code']),
|
||||
'valide': '1',
|
||||
'_id':{'$ne':ObjectId(str(diction['competence_id']))},
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (is_competence_code_used != 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le code de compétence " + str(diction['code']) + " est déjà utilisé ")
|
||||
return False, " Le code de compétence " + str(diction['code']) + " est déjà utilisé "
|
||||
|
||||
|
||||
# Verifier que la compétence existe et est valide
|
||||
is_valide_opport = MYSY_GV.dbname['competence_liste'].count_documents({'_id':ObjectId(str(competence_id)),
|
||||
|
@ -264,6 +296,10 @@ def Get_Competence_no_filter(diction):
|
|||
|
||||
for New_retVal in MYSY_GV.dbname['competence_liste'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_retVal
|
||||
|
||||
if( "code" not in user.keys() ):
|
||||
user["code"] = "--"
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
|
|
@ -0,0 +1,399 @@
|
|||
"""
|
||||
Ce fichier permet de gerer les caracterisques financières
|
||||
d'une formation, d'une session ou toutes autre object metier.
|
||||
|
||||
Par exemple il permettra de gere sur une session :
|
||||
- les frais d'inscription
|
||||
- les frais de scolarité
|
||||
- les couts fixe (utiliser pour calculer la rentrabilité, etc).
|
||||
|
||||
IMPORTANT : Il ne s'agit aucunement de faire de la comptabilité mais gerer les aspect administratif finacier
|
||||
"""
|
||||
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
|
||||
"""
|
||||
Fonction d'ajout d'une caracteristique financière
|
||||
"""
|
||||
def Add_Financial_Caracteristique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code' , 'description', 'commentaire', 'montant',
|
||||
'related_collection', 'related_collection_id', 'type_cout',
|
||||
'inclus_calcul']
|
||||
|
||||
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', 'related_collection', 'related_collection_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier que ce code de la cara fin n'est pas déjà utilisé
|
||||
"""
|
||||
is_competence_code_used = MYSY_GV.dbname['financial_caracteristic'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_competence_code_used != 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le code "+str(diction['code'])+" est déjà utilisé ")
|
||||
return False, " Le code "+str(diction['code'])+" est déjà utilisé "
|
||||
|
||||
if( "montant" in diction.keys() and diction['montant']):
|
||||
local_status, valeur = mycommon.IsFloat(str(diction['montant']))
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le montant est incorrecte. la veleur attendue est un entier ou un decimal.")
|
||||
return False, " Le montant est incorrecte. la veleur attendue est un entier ou un decimal. "
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité de la related_collection et related_collection_id
|
||||
"""
|
||||
is_related_collection_id_valide = MYSY_GV.dbname[str(diction['related_collection'])].count_documents({'_id':ObjectId(str(diction['related_collection_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_related_collection_id_valide != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la related_collection_id est invalide ")
|
||||
return False, " L'identifiant de la related_collection_id est invalide "
|
||||
|
||||
|
||||
mydata = {}
|
||||
|
||||
mydata = diction
|
||||
del mydata['token']
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
mydata['date_created'] = str(datetime.now())
|
||||
mydata['created_by'] = str(my_partner['_id'])
|
||||
mydata['partner_owner_recid'] = str(my_partner['recid'])
|
||||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
||||
|
||||
|
||||
inserted_id = MYSY_GV.dbname['financial_caracteristic'].insert_one(mydata).inserted_id
|
||||
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer la caractéristique financière (2) ")
|
||||
return False, " Impossible de créer la caractéristique financière (2) "
|
||||
|
||||
return True, " La caractéristique financière 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 caractéristique financière "
|
||||
|
||||
|
||||
"""
|
||||
Fonction de mise à jour d'une Financial_Caracteristique
|
||||
"""
|
||||
def Update_Financial_Caracteristique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'code' , 'description', 'commentaire', 'montant', 'type_cout',
|
||||
'related_collection', 'related_collection_id', 'inclus_calcul'
|
||||
]
|
||||
|
||||
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', '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']
|
||||
|
||||
fin_ca_id = ""
|
||||
if ("_id" in diction.keys()):
|
||||
if diction['_id']:
|
||||
fin_ca_id = diction['_id']
|
||||
|
||||
|
||||
|
||||
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 le code de compétence n'est pas utilisée par une autre compétence autre que celle ci
|
||||
"""
|
||||
|
||||
is_fiance_ca_code_used = MYSY_GV.dbname['financial_caracteristic'].count_documents({'code': str(diction['code']),
|
||||
'valide': '1',
|
||||
'_id':{'$ne':ObjectId(str(diction['_id']))},
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (is_fiance_ca_code_used != 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le code " + str(diction['code']) + " est déjà utilisé ")
|
||||
return False, " Le code " + str(diction['code']) + " est déjà utilisé "
|
||||
|
||||
|
||||
# Verifier que la caracteristique existe et est valide
|
||||
is_valide_fin_ca = MYSY_GV.dbname['financial_caracteristic'].count_documents({'_id':ObjectId(str(fin_ca_id)),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_valide_fin_ca != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la caractéristique financière est invalide ")
|
||||
return False, " L'identifiant de la caractéristique financière est invalide "
|
||||
|
||||
|
||||
mydata = {}
|
||||
mydata = diction
|
||||
del mydata['token']
|
||||
del mydata['_id']
|
||||
|
||||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
|
||||
result = MYSY_GV.dbname['financial_caracteristic'].find_one_and_update(
|
||||
{'_id':ObjectId(str(fin_ca_id)),
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{"$set": mydata},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
if ("_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour la caractéristique financière (2) ")
|
||||
return False, " Impossible de mettre à jour la caractéristique financière (2) "
|
||||
|
||||
|
||||
|
||||
return True, " La caractéristique financière 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 caractéristique financière "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des Financial_Caracteristique d'un partner, sans filtres
|
||||
"""
|
||||
def Get_Financial_Caracteristique_no_filter(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'related_collection' , 'related_collection_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', 'related_collection' , 'related_collection_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
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0',
|
||||
'related_collection':str(diction['related_collection']), 'related_collection_id':str(diction['related_collection_id'])}
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['financial_caracteristic'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_retVal
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
#print(" #### RetObject = ", RetObject)
|
||||
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 caractéristique financières "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une compétence
|
||||
"""
|
||||
def Delete_List_Financial_Caracteristique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'tab_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', 'tab_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
|
||||
|
||||
|
||||
local_tab_ids = str(diction['tab_id']).split(",")
|
||||
tab_ids_ObjectID = []
|
||||
for tmp in local_tab_ids:
|
||||
if( tmp ):
|
||||
tab_ids_ObjectID.append(ObjectId(str(tmp)))
|
||||
|
||||
|
||||
qry = {'_id':{'$in':tab_ids_ObjectID}, 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
ret_del_ca_fin = MYSY_GV.dbname['financial_caracteristic'].delete_many(qry)
|
||||
|
||||
return True, "La caractéristique financière 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 compétence "
|
||||
|
79
main.py
79
main.py
|
@ -98,6 +98,7 @@ import base_partner_catalog_config as base_partner_catalog_config
|
|||
import equipe_team_mgt as equipe_team_mgt
|
||||
import base_class_calcul_note as base_class_calcul_note
|
||||
import jury_mgt as jury_mgt
|
||||
import financial_caracteristique_mgt as financial_caracteristique_mgt
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
@ -2227,7 +2228,7 @@ def Add_Update_SessionFormation():
|
|||
|
||||
"""
|
||||
API de mise à jour JUSTE de l'etape, notamment utilisé dans le mode kanban
|
||||
/!\ : Une session est modifiable tanque la facturation n'a pas demarré. Apres tous est bloqué
|
||||
WARNING : Une session est modifiable tanque la facturation n'a pas demarré. Apres tous est bloqué
|
||||
"""
|
||||
@app.route('/myclass/api/Update_SessionFormation_Only_Step/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
|
@ -2241,7 +2242,7 @@ def Update_SessionFormation_Only_Step():
|
|||
|
||||
"""
|
||||
API de mise à jour du parametrage d'automatisation d'envoi des documents
|
||||
/!\ : Une session est modifiable tanque la facturation n'a pas demarré. Apres tous est bloqué
|
||||
WARNING : Une session est modifiable tanque la facturation n'a pas demarré. Apres tous est bloqué
|
||||
"""
|
||||
@app.route('/myclass/api/Update_SessionFormation_Doc_Automatic_Setup/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
|
@ -2400,7 +2401,7 @@ def Get_Given_SessionFormation_From_Id():
|
|||
|
||||
"""
|
||||
API de suppression d'une session de formation :
|
||||
/!\ : il faut s'assurer qu'il n'y a aucune inscription avant de supprimer valide.
|
||||
WARNING : il faut s'assurer qu'il n'y a aucune inscription avant de supprimer valide.
|
||||
Et la session est supprimé, alors supprimer toutes inscriptions (annulée) associés
|
||||
Ensuite supprimer les affectations d'enseignants et de materiels associée
|
||||
"""
|
||||
|
@ -2781,7 +2782,7 @@ def get_Class_From_Internal_Url():
|
|||
|
||||
"""
|
||||
Cette API retourne une formation, en partant l'url de la formation
|
||||
/!\ : on ne fais pas de controle de recid (car c'est le bot admin qui doit l'utiliser (revoir cette logique plus tard)
|
||||
WARNING : on ne fais pas de controle de recid (car c'est le bot admin qui doit l'utiliser (revoir cette logique plus tard)
|
||||
"""
|
||||
@app.route('/myclass/api/get_Class_From_Url/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
|
@ -3764,7 +3765,7 @@ def recherche_business_price():
|
|||
"""
|
||||
Cette API verifie si un client mysy existe sur chamilo.
|
||||
Si le client n'existe pas, il le crée avec le pack et le bon nombre de formation
|
||||
/!\ : On stock dans mysy (collection partnair_account) l'id chamilo du user.
|
||||
WARNING : On stock dans mysy (collection partnair_account) l'id chamilo du user.
|
||||
le nom du champ est : mysy_lms_user_id/
|
||||
"""
|
||||
@app.route('/myclass/api/Check_MySy_LMS_Account/', methods=['POST','GET'])
|
||||
|
@ -7348,7 +7349,7 @@ def get_Agenda_Event_List_With_Filter():
|
|||
|
||||
"""
|
||||
API d'ajout ou mise à jour d'un evenement
|
||||
/!\ : Important :
|
||||
WARNING : Important :
|
||||
- Pour les eemployé et le materiel, on utilise le related_collection_recid
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Update_Agenda_Event/', methods=['POST','GET'])
|
||||
|
@ -7362,7 +7363,7 @@ def Add_Update_Agenda_Event():
|
|||
|
||||
"""
|
||||
API d'ajout ou mise à jour d'un evenement pour les apprenants
|
||||
/!\ : Important :
|
||||
WARNING : Important :
|
||||
- Pour les apprenant (inscription), on utilise 'related_collection_email' car la clé des apprenant est l'email
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Update_Agenda_Event_Stagiaire/', methods=['POST','GET'])
|
||||
|
@ -10539,7 +10540,7 @@ def Get_Given_Evaluation_Planification():
|
|||
"""
|
||||
API pour Supprimer une evaluation planifiée
|
||||
|
||||
/!\ : les regles de suppression ne sont pas encore implémentés
|
||||
WARNING : les regles de suppression ne sont pas encore implémentés
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Evaluation_Planification/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
|
@ -12766,6 +12767,60 @@ def Add_Update_UE_Jury_Observation():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter caractéristique financière à un related_collection / related_collection_id
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Financial_Caracteristique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Financial_Caracteristique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Financial_Caracteristique : payload = ",str(payload))
|
||||
status, retval = financial_caracteristique_mgt.Add_Financial_Caracteristique( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour caractéristique financière à un related_collection / related_collection_id
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Financial_Caracteristique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Financial_Caracteristique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Financial_Caracteristique : payload = ",str(payload))
|
||||
status, retval = financial_caracteristique_mgt.Update_Financial_Caracteristique( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des caractéristiques financières d'un couple related_collection / related_collection_id
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Financial_Caracteristique_no_filter/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Financial_Caracteristique_no_filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Financial_Caracteristique_no_filter : payload = ",str(payload))
|
||||
status, retval = financial_caracteristique_mgt.Get_Financial_Caracteristique_no_filter( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer une liste des caractéristiques financières d'un couple related_collection / related_collection_id
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_List_Financial_Caracteristique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_List_Financial_Caracteristique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_List_Financial_Caracteristique : payload = ",str(payload))
|
||||
status, retval = financial_caracteristique_mgt.Delete_List_Financial_Caracteristique( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
@ -12785,7 +12840,7 @@ if __name__ == '__main__':
|
|||
mycommon.myprint("++ LMS_BAS_URL " + str(MYSY_GV.LMS_BAS_URL) + " ++")
|
||||
|
||||
"""
|
||||
/!\ Dasactivé en dev pour pas consommer de ressource pr rien.
|
||||
WARNING Dasactivé en dev pour pas consommer de ressource pr rien.
|
||||
"""
|
||||
"""
|
||||
scheduler = BackgroundScheduler()
|
||||
|
@ -12798,7 +12853,7 @@ if __name__ == '__main__':
|
|||
scheduler.start()
|
||||
|
||||
|
||||
# /!\ IMPORTANT /!\ : Shut down the scheduler when exiting the app
|
||||
# WARNING IMPORTANT WARNING : Shut down the scheduler when exiting the app
|
||||
atexit.register(lambda: scheduler.shutdown())
|
||||
|
||||
"""
|
||||
|
@ -12822,7 +12877,7 @@ if __name__ == '__main__':
|
|||
# Start the scheduler
|
||||
scheduler.start()
|
||||
|
||||
# /!\ IMPORTANT /!\ : Shut down the scheduler when exiting the app
|
||||
# WARNING IMPORTANT WARNING : Shut down the scheduler when exiting the app
|
||||
atexit.register(lambda: scheduler.shutdown())
|
||||
|
||||
|
||||
|
@ -12844,7 +12899,7 @@ if __name__ == '__main__':
|
|||
# Start the scheduler
|
||||
scheduler.start()
|
||||
|
||||
# /!\ IMPORTANT /!\ : Shut down the scheduler when exiting the app
|
||||
# WARNING IMPORTANT WARNING : Shut down the scheduler when exiting the app
|
||||
atexit.register(lambda: scheduler.shutdown())
|
||||
|
||||
|
||||
|
|
|
@ -3575,15 +3575,16 @@ def Get_Entity_Question_List_With_Stat_For_Given_related_collection_id(diction):
|
|||
node['question_question'] = str(tmp['question'])
|
||||
node['class_id'] = str(retval['class_id'])
|
||||
|
||||
if (str(tmp['type']) in ['note', 'entier']):
|
||||
node['question_type'] = "Moyenne"
|
||||
if( 'type' in tmp.key() ):
|
||||
if (str(tmp['type']) in ['note', 'entier']):
|
||||
node['question_type'] = "Moyenne"
|
||||
|
||||
elif (str(tmp['type'])in ['bool']):
|
||||
node['question_type'] = "Somme"
|
||||
else:
|
||||
mycommon.myprint(
|
||||
" Le paramétrage de la question ne permet pas de déterminer la nature statistiques des données ")
|
||||
return False, " Le paramétrage de la question ne permet pas de déterminer la nature statistiques des données "
|
||||
elif (str(tmp['type'])in ['bool']):
|
||||
node['question_type'] = "Somme"
|
||||
else:
|
||||
mycommon.myprint(
|
||||
" Le paramétrage de la question ne permet pas de déterminer la nature statistiques des données ")
|
||||
return False, " Le paramétrage de la question ne permet pas de déterminer la nature statistiques des données "
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(node))
|
||||
|
|
|
@ -356,6 +356,7 @@ def Get_List_Unite_Enseignement_no_filter(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
||||
if (str(New_retVal['duration_unite']) == "heure"):
|
||||
user['duration_concat'] = str(New_retVal['duration']) + " h"
|
||||
elif (str(New_retVal['duration_unite']) == "jour"):
|
||||
|
@ -669,6 +670,41 @@ def Get_Given_Unite_Enseignement(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
||||
tab_competence = []
|
||||
tab_competence_code = []
|
||||
list_competence_code = ""
|
||||
tab_competence_JSON = []
|
||||
if( "niveau_competence" in user.keys() and user['niveau_competence']):
|
||||
tab_competence = str(user['niveau_competence']).split(",")
|
||||
|
||||
local_cpt = 0
|
||||
for tmp in tab_competence :
|
||||
if( tmp ):
|
||||
local_competence_data = MYSY_GV.dbname['competence_liste'].find_one({'_id':ObjectId(str(tmp)),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1, 'code':1})
|
||||
if(local_competence_data and "code" in local_competence_data.keys() ):
|
||||
tab_competence_code.append(str(local_competence_data['code']))
|
||||
local_node = {}
|
||||
local_node['id'] = str(local_cpt)
|
||||
local_node['_id'] = str(local_competence_data['_id'])
|
||||
local_node['code'] = str(local_competence_data['code'])
|
||||
local_node['label'] = str(local_competence_data['code'])
|
||||
|
||||
tab_competence_JSON.append(local_node)
|
||||
|
||||
|
||||
local_cpt = local_cpt +1
|
||||
|
||||
|
||||
list_competence_code = ",".join(tab_competence_code)
|
||||
user['list_competence_code'] = list_competence_code
|
||||
# C'est chiant, mais il faut reconstituer le JSON pour le front
|
||||
user['tab_competence_JSON'] = tab_competence_JSON
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue