16/11/2023 - 21h
parent
35f5b776fb
commit
bc916dd226
|
@ -1,8 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/11/2023 - 17h">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/11/2023 - 21h">
|
||||||
|
<change afterPath="$PROJECT_DIR$/base_partner_session_step.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -72,13 +76,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680804787304</updated>
|
<updated>1680804787304</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00102" summary="11/09/23 - 19h">
|
|
||||||
<created>1694451732112</created>
|
|
||||||
<option name="number" value="00102" />
|
|
||||||
<option name="presentableId" value="LOCAL-00102" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1694451732113</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00103" summary="12/09/2023 - 18h">
|
<task id="LOCAL-00103" summary="12/09/2023 - 18h">
|
||||||
<created>1694533712540</created>
|
<created>1694533712540</created>
|
||||||
<option name="number" value="00103" />
|
<option name="number" value="00103" />
|
||||||
|
@ -415,7 +412,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1700065909523</updated>
|
<updated>1700065909523</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="151" />
|
<task id="LOCAL-00151" summary="15/11/2023 - 21h">
|
||||||
|
<created>1700080381522</created>
|
||||||
|
<option name="number" value="00151" />
|
||||||
|
<option name="presentableId" value="LOCAL-00151" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1700080381523</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="152" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -430,7 +434,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="04/10/2023 - 21h40" />
|
|
||||||
<MESSAGE value="06/10/2023 - 21h40" />
|
<MESSAGE value="06/10/2023 - 21h40" />
|
||||||
<MESSAGE value="07/10/2023 - 16h40" />
|
<MESSAGE value="07/10/2023 - 16h40" />
|
||||||
<MESSAGE value="07/10/2023 - 22h40" />
|
<MESSAGE value="07/10/2023 - 22h40" />
|
||||||
|
@ -455,6 +458,7 @@
|
||||||
<MESSAGE value="14/11/2023 - 20h" />
|
<MESSAGE value="14/11/2023 - 20h" />
|
||||||
<MESSAGE value="15/11/2023 - 12h" />
|
<MESSAGE value="15/11/2023 - 12h" />
|
||||||
<MESSAGE value="15/11/2023 - 17h" />
|
<MESSAGE value="15/11/2023 - 17h" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="15/11/2023 - 17h" />
|
<MESSAGE value="15/11/2023 - 21h" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="15/11/2023 - 21h" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2053
Log/log_file.log
2053
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -118,13 +118,10 @@ def Add_Update_SessionFormation(diction):
|
||||||
if ("date_debut" in diction.keys()):
|
if ("date_debut" in diction.keys()):
|
||||||
mydata['date_debut'] = str(diction['date_debut'])[0:10]
|
mydata['date_debut'] = str(diction['date_debut'])[0:10]
|
||||||
|
|
||||||
etape = "0"
|
etape = ""
|
||||||
if ("session_etape" in diction.keys()):
|
if ("session_etape" in diction.keys()):
|
||||||
etape = str(diction['session_etape'])
|
etape = str(diction['session_etape'])
|
||||||
etape = str(mycommon.tryInt(etape))
|
|
||||||
if(str(etape) not in MYSY_GV.SESSION_ETAPE):
|
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - L'étape '"+str(diction['session_etape'])+"' n'est pas autorisée ")
|
|
||||||
return False, "L'étape '"+str(diction['session_etape'])+"' n'est pas autorisée "
|
|
||||||
|
|
||||||
mydata['session_etape'] = etape
|
mydata['session_etape'] = etape
|
||||||
|
|
||||||
|
@ -894,7 +891,7 @@ def GetAllValideSessionPartner_List(diction):
|
||||||
if( "session_etape" in retVal.keys()):
|
if( "session_etape" in retVal.keys()):
|
||||||
val['session_etape'] = retVal['session_etape']
|
val['session_etape'] = retVal['session_etape']
|
||||||
else:
|
else:
|
||||||
val['session_etape'] = "0"
|
val['session_etape'] = ""
|
||||||
|
|
||||||
if( "titre" in retVal.keys()):
|
if( "titre" in retVal.keys()):
|
||||||
val['titre'] = retVal['titre']
|
val['titre'] = retVal['titre']
|
||||||
|
@ -1119,7 +1116,7 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
||||||
if( "session_etape" in retVal.keys()):
|
if( "session_etape" in retVal.keys()):
|
||||||
val['session_etape'] = retVal['session_etape']
|
val['session_etape'] = retVal['session_etape']
|
||||||
else:
|
else:
|
||||||
val['session_etape'] = "0"
|
val['session_etape'] = ""
|
||||||
|
|
||||||
if( "session_status" in retVal.keys()):
|
if( "session_status" in retVal.keys()):
|
||||||
val['session_status'] = retVal['session_status']
|
val['session_status'] = retVal['session_status']
|
||||||
|
@ -1332,7 +1329,7 @@ def GetAllValideSessionPartner_List_no_filter(diction):
|
||||||
if( "session_etape" in retVal.keys()):
|
if( "session_etape" in retVal.keys()):
|
||||||
val['session_etape'] = retVal['session_etape']
|
val['session_etape'] = retVal['session_etape']
|
||||||
else:
|
else:
|
||||||
val['session_etape'] = "0"
|
val['session_etape'] = ""
|
||||||
|
|
||||||
if( "session_status" in retVal.keys()):
|
if( "session_status" in retVal.keys()):
|
||||||
val['session_status'] = retVal['session_status']
|
val['session_status'] = retVal['session_status']
|
||||||
|
@ -1812,7 +1809,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
||||||
if ("session_etape" in df.keys()):
|
if ("session_etape" in df.keys()):
|
||||||
if (str(df['session_etape'].values[n])):
|
if (str(df['session_etape'].values[n])):
|
||||||
session_etape = str(df['session_etape'].values[n]).strip()
|
session_etape = str(df['session_etape'].values[n]).strip()
|
||||||
session_etape = str(mycommon.tryInt(session_etape))
|
|
||||||
mydata['session_etape'] = session_etape
|
mydata['session_etape'] = session_etape
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -2826,12 +2823,12 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
||||||
session_status = str(mycommon.tryInt(session_status))
|
session_status = str(mycommon.tryInt(session_status))
|
||||||
mydata['session_status'] = session_status
|
mydata['session_status'] = session_status
|
||||||
|
|
||||||
session_etape = "0"
|
session_etape = ""
|
||||||
if ("session_etape" in df.keys()):
|
if ("session_etape" in df.keys()):
|
||||||
if (str(df['session_etape'].values[n])):
|
if (str(df['session_etape'].values[n])):
|
||||||
session_etape = str(df['session_etape'].values[n]).strip()
|
session_etape = str(df['session_etape'].values[n]).strip()
|
||||||
|
|
||||||
session_etape = str(mycommon.tryInt(session_etape))
|
|
||||||
mydata['session_etape'] = session_etape
|
mydata['session_etape'] = session_etape
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -0,0 +1,439 @@
|
||||||
|
"""
|
||||||
|
Dans ce fichier on gere les paramettrage des stapes d'une session de formation
|
||||||
|
Ceci permet à chaque partner de definir ses propres etapes
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
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 setup
|
||||||
|
"""
|
||||||
|
def Add_Update_Partner_session_step(diction):
|
||||||
|
try:
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', 'session_step_name', 'session_step_sequence', 'session_step_comment']
|
||||||
|
|
||||||
|
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', 'session_step_name', 'session_step_sequence']
|
||||||
|
|
||||||
|
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 liste ")
|
||||||
|
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 'session_step_sequence' est bien un entier
|
||||||
|
local_status, local_val = mycommon.IsInt(str(diction['session_step_sequence']))
|
||||||
|
if (local_status is False):
|
||||||
|
mycommon.myprint(" La sequence doit être un nombre entier")
|
||||||
|
return False, " La sequence doit être un nombre entier"
|
||||||
|
|
||||||
|
|
||||||
|
my_data = {}
|
||||||
|
my_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||||
|
my_data['session_step_name'] = str(diction['session_step_name'])
|
||||||
|
my_data['session_step_sequence'] = str(diction['session_step_sequence'])
|
||||||
|
|
||||||
|
if( "session_step_comment" in diction.keys()):
|
||||||
|
my_data['session_step_comment'] = str(diction['session_step_comment'])
|
||||||
|
|
||||||
|
my_data['valide'] = "1"
|
||||||
|
my_data['locked'] = "0"
|
||||||
|
my_data['date_update'] = str(datetime.now())
|
||||||
|
|
||||||
|
# La clé de la mise à jour est :
|
||||||
|
# my_data['partner_owner_recid']
|
||||||
|
# my_data['session_step_name']
|
||||||
|
|
||||||
|
result = MYSY_GV.dbname['base_partner_session_step'].find_one_and_update(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'session_step_name' : str(diction['session_step_name'])},
|
||||||
|
{"$set": my_data},
|
||||||
|
return_document=ReturnDocument.AFTER,
|
||||||
|
upsert=True,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return True, " La configuration a été correctement ajoutée / 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 d'ajouter la configuration "
|
||||||
|
|
||||||
|
"""
|
||||||
|
Suppression d'un point de configuraton à partir de l'_id
|
||||||
|
"""
|
||||||
|
|
||||||
|
def Delete_Partner_session_step(diction):
|
||||||
|
try:
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', '_id', 'session_step_name']
|
||||||
|
|
||||||
|
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', 'session_step_name']
|
||||||
|
|
||||||
|
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 liste ")
|
||||||
|
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
|
||||||
|
|
||||||
|
# Verification de l'existance du point de paramettrage à supprimer
|
||||||
|
Is_Setup_Exist = MYSY_GV.dbname['base_partner_session_step'].count_documents( {'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'session_step_name': str(diction['session_step_name']), '_id':ObjectId(str(my_partner['_id'])),
|
||||||
|
'valide':'1', 'locked':'0'})
|
||||||
|
|
||||||
|
if( Is_Setup_Exist < 0 ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - La configuration '" + str(
|
||||||
|
diction['session_step_name']) + "' n'est pas valide ")
|
||||||
|
return False, " La configuration '" + str(diction['session_step_name']) + "' n'est pas valide "
|
||||||
|
|
||||||
|
if (Is_Setup_Exist > 1):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - La configuration '" + str(
|
||||||
|
diction['session_step_name']) + "' correspond plusieurs documents. Suppression annulée ")
|
||||||
|
return False, " La configuration '" + str(
|
||||||
|
diction['session_step_name']) + "' correspond plusieurs documents. Suppression annulée "
|
||||||
|
|
||||||
|
|
||||||
|
delete_data = MYSY_GV.dbname['base_partner_session_step'].delete_one(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'session_step_name': str(diction['session_step_name']), '_id': ObjectId(str(diction['_id'])),
|
||||||
|
'valide': '1', 'locked': '0'})
|
||||||
|
|
||||||
|
if (delete_data is None or delete_data.deleted_count < 0):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - Impossible de supprimer le paramétrage (2) ")
|
||||||
|
return False, " Impossible de supprimer le paramétrage (2) ",
|
||||||
|
|
||||||
|
|
||||||
|
return True, " Le parmétrage 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 paramétrage "
|
||||||
|
|
||||||
|
"""
|
||||||
|
Recuperation de la liste des etapes de session d'un partenaire.
|
||||||
|
|
||||||
|
/!\ : Important :
|
||||||
|
Si il ya au moins une étape appartenant à un partenaire, alors on considere que partner
|
||||||
|
a activé la gestion des etapes de session.
|
||||||
|
|
||||||
|
Si il n'y a aucune ligne de paramettrage valide, alors on va aller chercher les etapes par defaut.
|
||||||
|
"""
|
||||||
|
def Get_List_Partner_Or_Default_session_step(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'existe pas")
|
||||||
|
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 liste ")
|
||||||
|
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
|
||||||
|
|
||||||
|
"""
|
||||||
|
/!\ On regarde si le partnenaire a au moins une etape de session de parametter
|
||||||
|
"""
|
||||||
|
is_partner_etape_session_count = MYSY_GV.dbname["base_partner_session_step"].count_documents({'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'})
|
||||||
|
if( is_partner_etape_session_count > 0 ):
|
||||||
|
RetObject = []
|
||||||
|
val_tmp = 1
|
||||||
|
for New_retVal in MYSY_GV.dbname['base_partner_session_step'].find(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}).sort(
|
||||||
|
[("session_step_sequence", pymongo.ASCENDING)]):
|
||||||
|
user = New_retVal
|
||||||
|
user['id'] = str(val_tmp)
|
||||||
|
val_tmp = val_tmp + 1
|
||||||
|
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||||
|
|
||||||
|
return True, RetObject
|
||||||
|
|
||||||
|
else:
|
||||||
|
RetObject = []
|
||||||
|
val_tmp = 1
|
||||||
|
for New_retVal in MYSY_GV.dbname['base_partner_session_step'].find({'partner_owner_recid':"default", 'valide':'1', 'locked':'0'}).sort([("session_step_sequence", pymongo.ASCENDING)]):
|
||||||
|
|
||||||
|
user = New_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 points de paramétrage "
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Recuperation de la liste des etapes de session d'un partenaire.
|
||||||
|
|
||||||
|
/!\ : Important :
|
||||||
|
Ici on recuperer exclivement les données du partenaire
|
||||||
|
"""
|
||||||
|
def Get_List_Partner_session_step(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'existe pas")
|
||||||
|
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 liste ")
|
||||||
|
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 = 1
|
||||||
|
for New_retVal in MYSY_GV.dbname['base_partner_session_step'].find(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}).sort(
|
||||||
|
[("session_step_sequence", pymongo.ASCENDING)]):
|
||||||
|
|
||||||
|
user = New_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 points de paramétrage "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Recuperation des informations d'un point de parametrage donnée
|
||||||
|
"""
|
||||||
|
def Get_Given_Partner_session_step(diction):
|
||||||
|
try:
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', 'session_step_name']
|
||||||
|
|
||||||
|
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'existe pas")
|
||||||
|
return False, " Les informations fournies sont incorrectes",
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des champs obligatoires
|
||||||
|
"""
|
||||||
|
field_list_obligatoire = ['token','session_step_name' ]
|
||||||
|
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 liste ")
|
||||||
|
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
|
||||||
|
|
||||||
|
if( str(diction['session_step_name']) not in MYSY_GV.PARTNER_BASE_session_step_name ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - La valeur '" + str(diction['session_step_name']) + "' n'est pas valide ")
|
||||||
|
return False, " Point de parametrage "+ str(diction['session_step_name']) + " invalide "
|
||||||
|
|
||||||
|
|
||||||
|
RetObject = []
|
||||||
|
|
||||||
|
param_retval_value = ""
|
||||||
|
|
||||||
|
qry_tva = {'partner_owner_recid':str(my_partner['recid']), 'valide':'1',
|
||||||
|
'locked':'0', 'session_step_name':str(diction['session_step_name'])}
|
||||||
|
|
||||||
|
#print(" ### qry_tva = ", qry_tva)
|
||||||
|
for New_retVal in MYSY_GV.dbname['base_partner_session_step'].find({'partner_owner_recid':str(my_partner['recid']), 'valide':'1',
|
||||||
|
'locked':'0', 'session_step_name':str(diction['session_step_name'])}):
|
||||||
|
user = New_retVal
|
||||||
|
param_retval_value = str(New_retVal['session_step_sequence'])
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Si la valeur est vide, alors on va aller chercher la configuration par default
|
||||||
|
"""
|
||||||
|
if( str(param_retval_value).strip() == ""):
|
||||||
|
for New_retVal in MYSY_GV.dbname['base_partner_session_step'].find(
|
||||||
|
{'partner_owner_recid': "default", 'valide': '1',
|
||||||
|
'locked': '0', 'session_step_name': str(diction['session_step_name'])}):
|
||||||
|
user = New_retVal
|
||||||
|
param_retval_value = str(New_retVal['session_step_sequence'])
|
||||||
|
|
||||||
|
retval_json = {}
|
||||||
|
retval_json['session_step_name'] = str(diction['session_step_name'])
|
||||||
|
retval_json['session_step_sequence'] = param_retval_value
|
||||||
|
|
||||||
|
RetObject.append(mycommon.JSONEncoder().encode(retval_json))
|
||||||
|
|
||||||
|
#print(" ### retval_json =", retval_json)
|
||||||
|
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 points de paramétrage "
|
62
main.py
62
main.py
|
@ -58,6 +58,7 @@ import partner_base_setup as partner_base_setup
|
||||||
import attached_file_mgt as attached_file_mgt
|
import attached_file_mgt as attached_file_mgt
|
||||||
import base_specific_fields as base_specific_fields
|
import base_specific_fields as base_specific_fields
|
||||||
import agenda as agenda
|
import agenda as agenda
|
||||||
|
import base_partner_session_step as base_partner_session_step
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
cors = CORS(app, resources={r"/foo": {"origins": "*"}})
|
cors = CORS(app, resources={r"/foo": {"origins": "*"}})
|
||||||
|
@ -5396,7 +5397,68 @@ def get_Ressource_Info_Data():
|
||||||
status, retval = agenda.get_Ressource_Info_Data(payload)
|
status, retval = agenda.get_Ressource_Info_Data(payload)
|
||||||
return jsonify(status=status, message=retval)
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
"""
|
||||||
|
API pour ajouter ou modifier un parametrage : etape des sessions de formation
|
||||||
|
"""
|
||||||
|
|
||||||
|
@app.route('/myclass/api/Add_Update_Partner_session_step/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Add_Update_Partner_session_step():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### base_partner_session_step payload = ",payload)
|
||||||
|
status, retval = base_partner_session_step.Add_Update_Partner_session_step(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
"""
|
||||||
|
API de suppression d'une étape de session
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Delete_Partner_session_step/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Delete_Partner_session_step():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Delete_Partner_session_step payload = ",payload)
|
||||||
|
status, retval = base_partner_session_step.Delete_Partner_session_step(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
"""
|
||||||
|
API pour recuperer la liste des etapes de session d'un partner
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Get_List_Partner_session_step/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Get_List_Partner_session_step():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Get_List_Partner_session_step payload = ",payload)
|
||||||
|
status, retval = base_partner_session_step.Get_List_Partner_session_step(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API qui permet de recuperer étape de session valide (celles partenaire s'il l'a configurer si non celles par default)
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Get_List_Partner_Or_Default_session_step/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Get_List_Partner_Or_Default_session_step():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Get_List_Partner_Or_Default_session_step payload = ",payload)
|
||||||
|
status, retval = base_partner_session_step.Get_List_Partner_Or_Default_session_step(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API de recuperation des données d'une étape session donnée
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Get_Given_Partner_session_step/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Get_Given_Partner_session_step():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Get_Given_Partner_session_step payload = ",payload)
|
||||||
|
status, retval = base_partner_session_step.Get_Given_Partner_session_step(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue