23/11/23 - 13:30
parent
532c98415a
commit
fc4e13ff8d
|
@ -1,11 +1,11 @@
|
||||||
<?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="20/11/2023 - 21h00">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="22/11/2023 - 23h00">
|
||||||
<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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/base_config_modele_journee.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_config_modele_journee.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/base_config_modele_journee.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_config_modele_journee.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/base_partner_session_step.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_session_step.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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" />
|
||||||
|
@ -76,13 +76,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680804787304</updated>
|
<updated>1680804787304</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00106" summary="15/09/2023 - 12h">
|
|
||||||
<created>1694773383427</created>
|
|
||||||
<option name="number" value="00106" />
|
|
||||||
<option name="presentableId" value="LOCAL-00106" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1694773383428</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00107" summary="15/09/2023 - 18h">
|
<task id="LOCAL-00107" summary="15/09/2023 - 18h">
|
||||||
<created>1694793521821</created>
|
<created>1694793521821</created>
|
||||||
<option name="number" value="00107" />
|
<option name="number" value="00107" />
|
||||||
|
@ -419,7 +412,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1700513271611</updated>
|
<updated>1700513271611</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="155" />
|
<task id="LOCAL-00155" summary="22/11/2023 - 23h00">
|
||||||
|
<created>1700691598342</created>
|
||||||
|
<option name="number" value="00155" />
|
||||||
|
<option name="presentableId" value="LOCAL-00155" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1700691598344</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="156" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -434,7 +434,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="08/10/2023 - 22h40" />
|
|
||||||
<MESSAGE value="17/10/2023 - 22h40" />
|
<MESSAGE value="17/10/2023 - 22h40" />
|
||||||
<MESSAGE value="17/10/2023 - 22h45" />
|
<MESSAGE value="17/10/2023 - 22h45" />
|
||||||
<MESSAGE value="zzz" />
|
<MESSAGE value="zzz" />
|
||||||
|
@ -459,6 +458,7 @@
|
||||||
<MESSAGE value="17/11/2023 - 16h" />
|
<MESSAGE value="17/11/2023 - 16h" />
|
||||||
<MESSAGE value="18/11/2023 - 17h00" />
|
<MESSAGE value="18/11/2023 - 17h00" />
|
||||||
<MESSAGE value="20/11/2023 - 21h00" />
|
<MESSAGE value="20/11/2023 - 21h00" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="20/11/2023 - 21h00" />
|
<MESSAGE value="22/11/2023 - 23h00" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="22/11/2023 - 23h00" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
1990
Log/log_file.log
1990
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -145,13 +145,13 @@ def Add_Session_Sequence(diction):
|
||||||
'valide':'1',
|
'valide':'1',
|
||||||
'locked':'0'}):
|
'locked':'0'}):
|
||||||
|
|
||||||
print(" #### str(retVal['event_start']) = ", str(retVal['sequence_start']))
|
#print(" #### str(retVal['event_start']) = ", str(retVal['sequence_start']))
|
||||||
print(" #### str(retVal['event_end']) = ", str(retVal['sequence_end']))
|
#print(" #### str(retVal['event_end']) = ", str(retVal['sequence_end']))
|
||||||
|
|
||||||
New_retVal_start_date = datetime.strptime(str(retVal['sequence_start']), '%d/%m/%Y %H:%M').strftime("%d/%m/%Y %H:%M")
|
New_retVal_start_date = datetime.strptime(str(retVal['sequence_start']), '%d/%m/%Y %H:%M').strftime("%d/%m/%Y %H:%M")
|
||||||
New_retVal_end_date = datetime.strptime(str(retVal['sequence_end']), '%d/%m/%Y %H:%M').strftime("%d/%m/%Y %H:%M")
|
New_retVal_end_date = datetime.strptime(str(retVal['sequence_end']), '%d/%m/%Y %H:%M').strftime("%d/%m/%Y %H:%M")
|
||||||
print(" ### New_retVal_start_date = ", New_retVal_start_date)
|
#print(" ### New_retVal_start_date = ", New_retVal_start_date)
|
||||||
print(" ### New_retVal_end_date = ", New_retVal_end_date)
|
#print(" ### New_retVal_end_date = ", New_retVal_end_date)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -265,17 +265,17 @@ def Create_Automatic_Sequence(diction):
|
||||||
return False, "L'identifiant de la session n'est pas valide "
|
return False, "L'identifiant de la session n'est pas valide "
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Si le "jounree_modele_id" est vide, cela veut qu'il faut aller chercher le modele par default
|
Si le "jounree_modele_id" est vide, cela veut dire qu'il faut aller chercher le modele par default
|
||||||
"""
|
"""
|
||||||
jounree_modele_id = ""
|
jounree_modele_id = ""
|
||||||
if( str(diction['jounree_modele_id']) == "" ):
|
if( str(diction['jounree_modele_id']) == "" ):
|
||||||
jounree_modele_data = MYSY_GV.dbname['base_config_modele_journee'].find_one({'partner_owner_recid': str(my_partner['recid']),
|
jounree_modele_data = MYSY_GV.dbname['base_config_modele_journee'].find_one({'partner_owner_recid': str(my_partner['recid']),
|
||||||
'valide': '1', 'locked':'0', 'default':"1"})
|
'valide': '1', 'locked':'0'})
|
||||||
|
|
||||||
if( jounree_modele_data is None ):
|
if( jounree_modele_data is None ):
|
||||||
# On ne trouve pas de modele par defaut pour ce client. On va aller le chercher le modele par defaut de MySy
|
# On ne trouve pas de modele par defaut pour ce client. On va aller le chercher le modele par defaut de MySy
|
||||||
jounree_modele_data_mysy = MYSY_GV.dbname['base_config_modele_journee'].find_one(
|
jounree_modele_data_mysy = MYSY_GV.dbname['base_config_modele_journee'].find_one(
|
||||||
{'partner_owner_recid': "default", 'valide': '1', 'locked': '0', 'default': "1"})
|
{'partner_owner_recid': "default", 'valide': '1', 'locked': '0'})
|
||||||
|
|
||||||
if( jounree_modele_data_mysy is None ):
|
if( jounree_modele_data_mysy is None ):
|
||||||
mycommon.myprint(
|
mycommon.myprint(
|
||||||
|
@ -286,7 +286,6 @@ def Create_Automatic_Sequence(diction):
|
||||||
jounree_modele_id = str(jounree_modele_data_mysy['_id'])
|
jounree_modele_id = str(jounree_modele_data_mysy['_id'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
jounree_modele_id = str(jounree_modele_data['_id'])
|
jounree_modele_id = str(jounree_modele_data['_id'])
|
||||||
|
|
||||||
|
@ -301,7 +300,7 @@ def Create_Automatic_Sequence(diction):
|
||||||
str(inspect.stack()[0][3]) + " - Aucun modèle de journée n'est configuré dans le système (2) ")
|
str(inspect.stack()[0][3]) + " - Aucun modèle de journée n'est configuré dans le système (2) ")
|
||||||
return False, " Aucun modèle de journée n'est configuré dans le système (2) "
|
return False, " Aucun modèle de journée n'est configuré dans le système (2) "
|
||||||
|
|
||||||
print(" #### jounree_modele_id = ", jounree_modele_id)
|
|
||||||
|
|
||||||
# Verification de l'existence du modele de journée
|
# Verification de l'existence du modele de journée
|
||||||
is_existe_valide_journee_model_id = MYSY_GV.dbname["base_config_modele_journee"].count_documents(
|
is_existe_valide_journee_model_id = MYSY_GV.dbname["base_config_modele_journee"].count_documents(
|
||||||
|
@ -315,7 +314,7 @@ def Create_Automatic_Sequence(diction):
|
||||||
return False, " L'identifiant du modèle de journee n'est pas valide "
|
return False, " L'identifiant du modèle de journee n'est pas valide "
|
||||||
|
|
||||||
|
|
||||||
# Recuperation des data
|
# Recuperation des data de la journée modele
|
||||||
is_existe_valide_journee_model_data= MYSY_GV.dbname["base_config_modele_journee"].find_one(
|
is_existe_valide_journee_model_data= MYSY_GV.dbname["base_config_modele_journee"].find_one(
|
||||||
{'_id': ObjectId(str(jounree_modele_id)),
|
{'_id': ObjectId(str(jounree_modele_id)),
|
||||||
'partner_owner_recid': str(my_partner['recid']),
|
'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
@ -406,42 +405,51 @@ def Create_Automatic_Sequence(diction):
|
||||||
'partner_owner_recid': str(my_partner['recid']),})
|
'partner_owner_recid': str(my_partner['recid']),})
|
||||||
|
|
||||||
|
|
||||||
deleted_data_sequence = MYSY_GV.dbname['session_formation_sequence'].delete_many({'session_id': str(local_retval['session_id']),
|
deleted_data_sequence = MYSY_GV.dbname['session_formation_sequence'].delete_many({'session_id': str(diction['session_id']),
|
||||||
'partner_owner_recid': str(my_partner['recid']),})
|
'partner_owner_recid': str(my_partner['recid']),})
|
||||||
|
|
||||||
cpt = 10
|
cpt = 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for single_date in mycommon.daterange(date_debut_session, date_fin_session):
|
for single_date in mycommon.daterange(date_debut_session, date_fin_session):
|
||||||
print(single_date.strftime("%Y-%m-%d"))
|
print(single_date.strftime("%Y-%m-%d"))
|
||||||
print(single_date.strftime("%A"))
|
print(single_date.strftime("%A"))
|
||||||
|
|
||||||
if( str(single_date.strftime("%A")).lower() in liste_jours_travaille):
|
print(" Les date off sont : ", is_existe_valide_journee_model_data['date_off'])
|
||||||
|
date_jour = str(single_date.strftime("%Y-%m-%d"))
|
||||||
|
jour_name = single_date.strftime("%A")
|
||||||
|
|
||||||
|
# Recuperation des sequences associées à jour_name
|
||||||
|
jours_name_list_sequence = is_existe_valide_journee_model_data[jour_name]["tab_sequence"]
|
||||||
|
|
||||||
|
print(" ### les sequences du ", jour_name, " sont ", jours_name_list_sequence)
|
||||||
# Pour chaque sequence de la journée
|
# Pour chaque sequence de la journée
|
||||||
for local_val in is_existe_valide_journee_model_data['tab_sequence']:
|
if (date_jour not in is_existe_valide_journee_model_data['date_off']):
|
||||||
|
for local_val in jours_name_list_sequence :
|
||||||
|
|
||||||
sequence_data = {}
|
sequence_data = {}
|
||||||
sequence_data['token'] = diction['token']
|
sequence_data['token'] = diction['token']
|
||||||
sequence_data['session_id'] = diction['session_id']
|
sequence_data['session_id'] = diction['session_id']
|
||||||
sequence_data['sequence_title'] = "Seq_Auto_" + str(cpt)
|
sequence_data['sequence_title'] = "Seq_Auto_" + str(cpt)
|
||||||
sequence_data['sequence_start'] = str(single_date.strftime("%d/%m/%Y"))+" "+str(local_val['heure_debut']).strip()
|
sequence_data['sequence_start'] = str(single_date.strftime("%d/%m/%Y")) + " " + str(
|
||||||
sequence_data['sequence_end'] = str(single_date.strftime("%d/%m/%Y"))+" "+str(local_val['heure_fin']).strip()
|
local_val['heure_debut']).strip()
|
||||||
|
sequence_data['sequence_end'] = str(single_date.strftime("%d/%m/%Y")) + " " + str(
|
||||||
|
local_val['heure_fin']).strip()
|
||||||
|
|
||||||
#print(" ### sequence_data = ", sequence_data)
|
#print(" ### sequence_data = ", sequence_data)
|
||||||
|
|
||||||
local_status, local_val = Add_Session_Sequence(sequence_data)
|
local_status, local_val = Add_Session_Sequence(sequence_data)
|
||||||
|
|
||||||
if( local_status is False):
|
if (local_status is False):
|
||||||
mycommon.myprint(
|
mycommon.myprint(
|
||||||
str(inspect.stack()[0][ 3]) + " WARNING : " + str(local_val))
|
str(inspect.stack()[0][3]) + " WARNING : " + str(local_val))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cpt = cpt + 1
|
cpt = cpt + 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return True, " Les séquences ont été automatiquement créées "
|
return True, " Les séquences ont été automatiquement créées "
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -750,8 +758,6 @@ def Get_Given_Session_Sequence(diction):
|
||||||
"""
|
"""
|
||||||
Supprimer une sequence donnée
|
Supprimer une sequence donnée
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def Delete_Given_Session_Sequence(diction):
|
def Delete_Given_Session_Sequence(diction):
|
||||||
try:
|
try:
|
||||||
diction = mycommon.strip_dictionary(diction)
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
@ -827,6 +833,75 @@ def Delete_Given_Session_Sequence(diction):
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, " Impossible de supprimer la séquence"
|
return False, " Impossible de supprimer la séquence"
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Supprimer une sequence donnée en mass
|
||||||
|
"""
|
||||||
|
def Delete_Given_Session_Sequence_Mass(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'existe pas")
|
||||||
|
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 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
|
||||||
|
|
||||||
|
tab_id = ""
|
||||||
|
if ("tab_id" in diction.keys()):
|
||||||
|
if diction['tab_id']:
|
||||||
|
tab_id = str(diction['tab_id']).split(",")
|
||||||
|
|
||||||
|
for my_id in tab_id:
|
||||||
|
my_seq_data = {}
|
||||||
|
my_seq_data['token'] = diction['token']
|
||||||
|
my_seq_data['_id'] = str(my_id)
|
||||||
|
|
||||||
|
local_status, local_retval = Delete_Given_Session_Sequence(my_seq_data)
|
||||||
|
if (local_status is False):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - WARNING . " + str(local_retval))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return True, "Les sequences ont été supprimées en masse "
|
||||||
|
|
||||||
|
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 les séquences en masse"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Affectation d'une ressource (humaine ou materielle) a une sequence
|
Affectation d'une ressource (humaine ou materielle) a une sequence
|
||||||
"""
|
"""
|
||||||
|
@ -1006,7 +1081,7 @@ def Add_Sequence_Affectation_Ressource_Poste(diction):
|
||||||
data_agenda['event_type'] = "planning"
|
data_agenda['event_type'] = "planning"
|
||||||
data_agenda['sequence_session_id'] = str(sequence_session_existe_data['_id'])
|
data_agenda['sequence_session_id'] = str(sequence_session_existe_data['_id'])
|
||||||
|
|
||||||
print(" #### data_agenda to add = ", data_agenda)
|
#print(" #### data_agenda to add = ", data_agenda)
|
||||||
|
|
||||||
MYSY_GV.dbname['agenda'].insert_one(data_agenda)
|
MYSY_GV.dbname['agenda'].insert_one(data_agenda)
|
||||||
|
|
||||||
|
@ -1019,6 +1094,120 @@ def Add_Sequence_Affectation_Ressource_Poste(diction):
|
||||||
return False, " Impossible d'affecter la ressource à la sequence "
|
return False, " Impossible d'affecter la ressource à la sequence "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Affectation d'une ressource (humaine ou materielle) en masse à plusieurs sequence
|
||||||
|
"""
|
||||||
|
def Add_Sequence_Affectation_Ressource_Poste_Mass(diction):
|
||||||
|
try:
|
||||||
|
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', "tab_sequence_session_id", "poste", "comment", 'related_target_collection', 'related_target_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', 'tab_sequence_session_id', "poste", ]
|
||||||
|
|
||||||
|
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, " Toutes le information obligatoires n'ont pas été fournies"
|
||||||
|
|
||||||
|
token = ""
|
||||||
|
if ("token" in diction.keys()):
|
||||||
|
if diction['token']:
|
||||||
|
token = diction['token']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Recuperation du recid du partenaire
|
||||||
|
partner_recid = mycommon.get_parnter_recid_from_token(str(token))
|
||||||
|
if partner_recid is False:
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer le partner_recid")
|
||||||
|
return False, " Les informations d'identification sont invalides"
|
||||||
|
|
||||||
|
local_status, my_partner_data = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||||
|
if (local_status is not True):
|
||||||
|
return local_status, my_partner_data
|
||||||
|
|
||||||
|
tab_sequence_session_id = ""
|
||||||
|
if ("tab_sequence_session_id" in diction.keys()):
|
||||||
|
if diction['tab_sequence_session_id']:
|
||||||
|
tab_sequence_session_id = str(diction['tab_sequence_session_id']).split(",")
|
||||||
|
|
||||||
|
# Verifier que la sequence existe bien
|
||||||
|
for sequence_session_id in tab_sequence_session_id :
|
||||||
|
sequence_session_existe_count = MYSY_GV.dbname['session_formation_sequence'].count_documents({'_id':ObjectId(str(sequence_session_id)), 'partner_owner_recid':str(partner_recid),
|
||||||
|
'valide':'1', 'locked':'0'})
|
||||||
|
|
||||||
|
if( sequence_session_existe_count <= 0 ) :
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " - La sequence est invalide ")
|
||||||
|
return False, " La sequence est invalide "
|
||||||
|
|
||||||
|
if (sequence_session_existe_count > 1):
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " - Sequence incohérente. il a plusieurs sequences avec le meme id ")
|
||||||
|
return False, " Sequence incohérente. il a plusieurs sequences avec le meme id "
|
||||||
|
|
||||||
|
# Vu que toutes les sequences sont valides, on fait la mise à jour
|
||||||
|
for sequence_session_id in tab_sequence_session_id:
|
||||||
|
my_ressource_seq_data = {}
|
||||||
|
|
||||||
|
my_ressource_seq_data['token'] = diction['token']
|
||||||
|
my_ressource_seq_data['sequence_session_id'] = sequence_session_id
|
||||||
|
if( "poste" in diction.keys() ):
|
||||||
|
my_ressource_seq_data['poste'] = diction['poste']
|
||||||
|
else:
|
||||||
|
my_ressource_seq_data['poste'] = ""
|
||||||
|
|
||||||
|
if ("comment" in diction.keys()):
|
||||||
|
my_ressource_seq_data['comment'] = diction['comment']
|
||||||
|
else:
|
||||||
|
my_ressource_seq_data['comment'] = ""
|
||||||
|
|
||||||
|
if ("related_target_collection" in diction.keys()):
|
||||||
|
my_ressource_seq_data['related_target_collection'] = diction['related_target_collection']
|
||||||
|
else:
|
||||||
|
my_ressource_seq_data['related_target_collection'] = ""
|
||||||
|
|
||||||
|
if ("related_target_collection_id" in diction.keys()):
|
||||||
|
my_ressource_seq_data['related_target_collection_id'] = diction['related_target_collection_id']
|
||||||
|
else:
|
||||||
|
my_ressource_seq_data['related_target_collection_id'] = ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local_status, local_retval = Add_Sequence_Affectation_Ressource_Poste(my_ressource_seq_data)
|
||||||
|
if(local_status is False ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - WARNING . "+str(local_retval))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return True, " Les ressources ont bien été ajoutées en masse"
|
||||||
|
|
||||||
|
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'affecter la ressource à la sequence "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Mettre à jour une affectation de ressource
|
Mettre à jour une affectation de ressource
|
||||||
"""
|
"""
|
||||||
|
@ -1263,6 +1452,7 @@ def Delete_Sequence_Affectation_Ressource_Poste(diction):
|
||||||
return False, " Impossible de supprimer l'affectation de la ressource à la sequence "
|
return False, " Impossible de supprimer l'affectation de la ressource à la sequence "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Recuperer la liste des affectations de ressource à une sequence
|
Recuperer la liste des affectations de ressource à une sequence
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -132,7 +132,7 @@ def Add_Update_Modele_Journee(diction):
|
||||||
result = MYSY_GV.dbname['base_config_modele_journee'].insert_one(my_data_JSON)
|
result = MYSY_GV.dbname['base_config_modele_journee'].insert_one(my_data_JSON)
|
||||||
|
|
||||||
|
|
||||||
return True, " La configuration a été correctement ajoutée / Mise à jour"
|
return True, " La configuration a été correctement ajoutée / mise à jour"
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
|
30
main.py
30
main.py
|
@ -5592,6 +5592,21 @@ def Delete_Given_Session_Sequence():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API qui supprime une sequence à une session de formation en masse
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Delete_Given_Session_Sequence_Mass/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Delete_Given_Session_Sequence_Mass():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Delete_Given_Session_Sequence_Mass payload = ",payload)
|
||||||
|
status, retval = Session_Formation_Sequence.Delete_Given_Session_Sequence_Mass(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
API Affecter une ressource à une sequence (humaine ou materielle)
|
API Affecter une ressource à une sequence (humaine ou materielle)
|
||||||
"""
|
"""
|
||||||
|
@ -5604,6 +5619,21 @@ def Add_Sequence_Affectation_Ressource_Poste():
|
||||||
status, retval = Session_Formation_Sequence.Add_Sequence_Affectation_Ressource_Poste(payload)
|
status, retval = Session_Formation_Sequence.Add_Sequence_Affectation_Ressource_Poste(payload)
|
||||||
return jsonify(status=status, message=retval)
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API Affecter une ressource à une sequence (humaine ou materielle) en masse
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Add_Sequence_Affectation_Ressource_Poste_Mass/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Add_Sequence_Affectation_Ressource_Poste_Mass():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Add_Sequence_Affectation_Ressource_Poste_Mass payload = ",payload)
|
||||||
|
status, retval = Session_Formation_Sequence.Add_Sequence_Affectation_Ressource_Poste_Mass(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
API AMettre à jour une affectation de ressource
|
API AMettre à jour une affectation de ressource
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue