18/11/2023 - 17h00
parent
9d3887bf7d
commit
894dcd1970
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/11/2023 - 21h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="17/11/2023 - 16h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/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$/base_specific_fields.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_specific_fields.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -76,13 +76,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00103" summary="12/09/2023 - 18h">
|
||||
<created>1694533712540</created>
|
||||
<option name="number" value="00103" />
|
||||
<option name="presentableId" value="LOCAL-00103" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1694533712541</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00104" summary="13/09/2023 - 18h">
|
||||
<created>1694620818831</created>
|
||||
<option name="number" value="00104" />
|
||||
|
@ -419,7 +412,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1700080381523</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="152" />
|
||||
<task id="LOCAL-00152" summary="17/11/2023 - 16h">
|
||||
<created>1700233488529</created>
|
||||
<option name="number" value="00152" />
|
||||
<option name="presentableId" value="LOCAL-00152" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700233488530</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="153" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -434,7 +434,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="06/10/2023 - 21h40" />
|
||||
<MESSAGE value="07/10/2023 - 16h40" />
|
||||
<MESSAGE value="07/10/2023 - 22h40" />
|
||||
<MESSAGE value="08/10/2023 - 22h40" />
|
||||
|
@ -459,6 +458,7 @@
|
|||
<MESSAGE value="15/11/2023 - 12h" />
|
||||
<MESSAGE value="15/11/2023 - 17h" />
|
||||
<MESSAGE value="15/11/2023 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="15/11/2023 - 21h" />
|
||||
<MESSAGE value="17/11/2023 - 16h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="17/11/2023 - 16h" />
|
||||
</component>
|
||||
</project>
|
|
@ -531,7 +531,7 @@ Par defaut il en y a 2 :
|
|||
- ressource_humaine et
|
||||
- ressource_materielle
|
||||
"""
|
||||
ALLOWED_AGENDA_RELATED_COLLECTION = ['ressource_humaine', 'ressource_materielle']
|
||||
ALLOWED_AGENDA_RELATED_COLLECTION = ['ressource_humaine', 'ressource_materielle', 'inscription']
|
||||
|
||||
"""
|
||||
Les types de location pour une session (intra ou extra ou autre)
|
||||
|
@ -544,3 +544,10 @@ Gestion des champs spécifique : Type de champs autorisé
|
|||
"""
|
||||
SPECIFIC_FIELD_TYPE = ['float', 'string']
|
||||
|
||||
"""
|
||||
Gestion des type d'evenement accepté dans un egend
|
||||
- absence
|
||||
- planning
|
||||
- etc
|
||||
"""
|
||||
AGENDA_EVENT_TYPE = ['absence', 'planning', 'autre', '']
|
1435
Log/log_file.log
1435
Log/log_file.log
File diff suppressed because it is too large
Load Diff
396
agenda.py
396
agenda.py
|
@ -42,6 +42,9 @@ from email import encoders
|
|||
|
||||
"""
|
||||
Cette fonction ajoute ou met à jour un eventement de l'agenda
|
||||
|
||||
/!\ : Important :
|
||||
- Pour les eemployé et le materiel, on utilise le related_collection_recid
|
||||
"""
|
||||
def Add_Update_Agenda_Event(diction):
|
||||
try:
|
||||
|
@ -50,7 +53,8 @@ def Add_Update_Agenda_Event(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'related_collection', 'event_title', 'event_start', 'event_end', 'related_collection_recid', 'comment']
|
||||
field_list = ['token', '_id', 'related_collection', 'event_title', 'event_start', 'event_end', 'related_collection_recid', 'comment',
|
||||
'event_type', 'justified']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -114,6 +118,11 @@ def Add_Update_Agenda_Event(diction):
|
|||
comment = str(diction['comment'])
|
||||
mydata['comment'] = comment
|
||||
|
||||
event_type = ""
|
||||
if ("event_type" in diction.keys()):
|
||||
event_type = str(diction['event_type'])
|
||||
mydata['event_type'] = event_type
|
||||
|
||||
|
||||
if( len(str(diction['_id']).strip()) > 0):
|
||||
# Verifier si l'id de l'evenement existe
|
||||
|
@ -157,6 +166,137 @@ def Add_Update_Agenda_Event(diction):
|
|||
return False, " Impossible d'ajouter ou mettre à jour l'événement "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction ajoute ou met à jour un eventement de l'agenda
|
||||
|
||||
/!\ : Important :
|
||||
- Pour les apprenant (inscription), on utilise 'related_collection_email' car la clé des apprenant est l'email
|
||||
"""
|
||||
def Add_Update_Agenda_Event_Stagiaire(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'related_collection', 'event_title', 'event_start', 'event_end', 'comment',
|
||||
'event_type', 'justified', 'related_collection_email']
|
||||
|
||||
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', 'related_collection', 'event_title', 'event_start', 'event_end', 'related_collection_email',]
|
||||
|
||||
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 et de l'acceptation d'un evement pour le 'related_collection'
|
||||
if( diction['related_collection'] not in MYSY_GV.ALLOWED_AGENDA_RELATED_COLLECTION):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - L'objet metier "+str(diction['related_collection'] )+" n'accepte pas de planning")
|
||||
return False, " L'objet metier "+str(diction['related_collection'] )+" n'accepte pas de planning "
|
||||
|
||||
|
||||
|
||||
# Verifier que 'related_collection_email' existe et est valide dans la collection 'related_collection'
|
||||
is_existe_valide_related_collection_recid = MYSY_GV.dbname[str(diction['related_collection'])].count_documents({'email':str(diction['related_collection_email']),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'status':'1'
|
||||
})
|
||||
|
||||
if( is_existe_valide_related_collection_recid <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - L'identifiant du 'related_collection_recid' n'est pas valide ")
|
||||
return False, " L'identifiant du 'related_collection_recid' n'est pas valide "
|
||||
|
||||
|
||||
mydata = {}
|
||||
mydata['related_collection'] = str(diction['related_collection'])
|
||||
mydata['related_collection_email'] = str(diction['related_collection_email'])
|
||||
mydata['event_title'] = str(diction['event_title'])
|
||||
mydata['event_start'] = str(diction['event_start'])
|
||||
mydata['event_end'] = str(diction['event_end'])
|
||||
|
||||
comment = ""
|
||||
if( "comment" in diction.keys()):
|
||||
comment = str(diction['comment'])
|
||||
mydata['comment'] = comment
|
||||
|
||||
event_type = ""
|
||||
if ("event_type" in diction.keys()):
|
||||
event_type = str(diction['event_type'])
|
||||
mydata['event_type'] = event_type
|
||||
|
||||
justified = ""
|
||||
if ("justified" in diction.keys()):
|
||||
justified = str(diction['justified'])
|
||||
mydata['justified'] = justified
|
||||
|
||||
|
||||
if( len(str(diction['_id']).strip()) > 0):
|
||||
# Verifier si l'id de l'evenement existe
|
||||
is_event_exist = MYSY_GV.dbname['agenda'].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
if( is_event_exist > 0 ):
|
||||
# L'eventement existe est valide, on autorise la mise à jour
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
update = MYSY_GV.dbname['agenda'].update_one({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'},
|
||||
{'$set':mydata}
|
||||
)
|
||||
|
||||
return True, " L'événement a été mis à jour"
|
||||
|
||||
else:
|
||||
# L'identifiant fournit est invalide, on refuse la mise à jour
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - L'identifiant de l'événement n'est pas valide ")
|
||||
return False, " L'identifiant de l'événement n'est pas valide "
|
||||
|
||||
else:
|
||||
# Il s'agit de la creation d'un evenement.
|
||||
mydata['partner_owner_recid'] = str(my_partner['recid'])
|
||||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
||||
insert = MYSY_GV.dbname['agenda'].insert_one(mydata)
|
||||
return True, " L'événement a été ajouté"
|
||||
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'ajouter ou mettre à jour l'événement "
|
||||
|
||||
"""
|
||||
Recuperation de la liste des agenda
|
||||
"""
|
||||
|
@ -217,6 +357,194 @@ def get_Agenda_Event_List(diction):
|
|||
return False, " Impossible de récupérer la liste des evenement "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de la liste des agenda pour un stagiaie
|
||||
"""
|
||||
def get_Agenda_Event_List_Stagiaire(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'related_collection', 'related_collection_email']
|
||||
|
||||
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', 'related_collection', 'related_collection_email']
|
||||
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['agenda'].find({'related_collection':str(diction['related_collection']), 'related_collection_email':str(diction['related_collection_email']),
|
||||
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}):
|
||||
|
||||
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 evenement "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction retourne la liste de eventment d'un user/materiel avec
|
||||
des filtre (exemple : event_type = absence, from start_date to end_date
|
||||
"""
|
||||
def get_Agenda_Event_List_With_Filter(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'related_collection', 'related_collection_recid', 'event_type', 'start_date', 'end_date']
|
||||
|
||||
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', 'related_collection', 'related_collection_recid']
|
||||
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
|
||||
|
||||
filt_event_type = {}
|
||||
if ("event_type" in diction.keys()):
|
||||
if( str(diction['event_type']).lower() not in MYSY_GV.AGENDA_EVENT_TYPE ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Le type d'evenement '" + str(diction['event_type']) + "' n'est pas autorisé ")
|
||||
return False, " Le type d'evenement '" + str(diction['event_type']) + "' n'est pas autorisé ",
|
||||
|
||||
filt_event_type = {'event_type':str(diction['event_type']).lower()}
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
for New_retVal in MYSY_GV.dbname['agenda'].find({'related_collection':str(diction['related_collection']), 'related_collection_recid':str(diction['related_collection_recid']),
|
||||
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}):
|
||||
|
||||
filter_date_debut = ""
|
||||
if ("start_date" in diction.keys()):
|
||||
if diction['start_date']:
|
||||
filter_date_debut = str(diction['start_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filter_date_debut)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de debut "+ str(filter_date_debut)+" n'est pas au format 'jj/mm/aaaa' ")
|
||||
return False, " La date de debut "+ str(filter_date_debut)+" n'est pas au format 'jj/mm/aaaa'"
|
||||
|
||||
|
||||
filter_date_fin = ""
|
||||
if ("end_date" in diction.keys()):
|
||||
if diction['end_date']:
|
||||
filter_date_fin = str(diction['end_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filter_date_fin)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de fin "+ str(filter_date_fin)+" n'est pas au format 'jj/mm/aaaa' ")
|
||||
return False, " La date de fin "+ str(filter_date_fin)+" n'est pas au format 'jj/mm/aaaa'"
|
||||
|
||||
|
||||
New_retVal_start_date = datetime.strptime(str(New_retVal['event_start'])[0:10], '%Y-%m-%d')
|
||||
New_retVal_end_date = datetime.strptime(str(New_retVal['event_end'])[0:10], '%Y-%m-%d')
|
||||
|
||||
print(" ### New_retVal_start_date = ", New_retVal_start_date)
|
||||
print(" ### New_retVal_end_date = ", New_retVal_end_date)
|
||||
|
||||
## Application des filtre de date
|
||||
if (filter_date_debut and filter_date_fin):
|
||||
|
||||
|
||||
if (New_retVal_start_date.strftime("%d/%m/%Y") >= datetime.strptime(str(filter_date_debut)[0:10], '%d/%m/%Y') and
|
||||
New_retVal_end_date <= datetime.strptime(str(filter_date_fin)[0:10], '%d/%m/%Y')):
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
elif (filter_date_debut):
|
||||
if (New_retVal_start_date.strftime("%d/%m/%Y") >= datetime.strptime(str(filter_date_debut)[0:10], '%d/%m/%Y')):
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
elif (filter_date_fin):
|
||||
if (New_retVal_end_date <= datetime.strptime(str(filter_date_fin)[0:10], '%d/%m/%Y')):
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
else:
|
||||
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 evenement "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction supprime un evenement
|
||||
"""
|
||||
|
@ -354,6 +682,72 @@ def get_Ressource_Info_Data(diction):
|
|||
|
||||
|
||||
|
||||
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 evenement "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction prends un id (_id de object), le type de ressource (employé ou materiel)
|
||||
et retourn les données de lobjet pour un stagiaire
|
||||
"""
|
||||
def get_Ressource_Info_Data_Satgiaire(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'related_collection', 'related_collection_email']
|
||||
|
||||
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', 'related_collection', 'related_collection_email']
|
||||
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[str(diction['related_collection'])].find({'email':str(diction['related_collection_email']),
|
||||
'partner_owner_recid':str(my_partner['recid']), 'status':'1'}):
|
||||
|
||||
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:
|
||||
|
|
62
main.py
62
main.py
|
@ -5349,7 +5349,7 @@ def Get_Collection_Eligible_Champ_Specific():
|
|||
|
||||
|
||||
"""
|
||||
API de la recuperation de la liste des evenement dans l'agenda (draft)
|
||||
API de la recuperation de la liste des evenement dans l'agenda
|
||||
"""
|
||||
@app.route('/myclass/api/get_Agenda_Event_List/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
|
@ -5361,8 +5361,38 @@ def get_Agenda_Event_List():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API de la recuperation de la liste des evenement dans l'agenda pour un stagiaire
|
||||
"""
|
||||
@app.route('/myclass/api/get_Agenda_Event_List_Stagiaire/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def get_Agenda_Event_List_Stagiaire():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### get_Agenda_Event_List_Stagiaire : payload = ",payload)
|
||||
status, retval = agenda.get_Agenda_Event_List_Stagiaire(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de la recuperation de la liste des evenement dans l'agenda avec des filtre
|
||||
"""
|
||||
@app.route('/myclass/api/get_Agenda_Event_List_With_Filter/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def get_Agenda_Event_List_With_Filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### get_Agenda_Event_List_With_Filter : payload = ",payload)
|
||||
status, retval = agenda.get_Agenda_Event_List_With_Filter(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API d'ajout ou mise à jour d'un evenement
|
||||
/!\ : Important :
|
||||
- Pour les eemployé et le materiel, on utilise le related_collection_recid
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Update_Agenda_Event/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
|
@ -5373,6 +5403,20 @@ def Add_Update_Agenda_Event():
|
|||
status, retval = agenda.Add_Update_Agenda_Event(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
"""
|
||||
API d'ajout ou mise à jour d'un evenement pour les apprenants
|
||||
/!\ : 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'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Update_Agenda_Event_Stagiaire():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Update_Agenda_Event_Stagiaire : payload = ",payload)
|
||||
status, retval = agenda.Add_Update_Agenda_Event_Stagiaire(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
""" API de suppression d'un evenement dans un agenda
|
||||
"""
|
||||
|
@ -5397,6 +5441,22 @@ def get_Ressource_Info_Data():
|
|||
status, retval = agenda.get_Ressource_Info_Data(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui retourne les data d'une ressource pour un stagiaire
|
||||
"""
|
||||
@app.route('/myclass/api/get_Ressource_Info_Data_Satgiaire/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def get_Ressource_Info_Data_Satgiaire():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### get_Ressource_Info_Data_Satgiaire : payload = ",payload)
|
||||
status, retval = agenda.get_Ressource_Info_Data_Satgiaire(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter ou modifier un parametrage : etape des sessions de formation
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue