11/01/24 - 21h30
parent
cccb5b8540
commit
d2b69a2fab
|
@ -1,13 +1,13 @@
|
|||
<?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="08/01/24 - 22h30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="09/01/24 - 19h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/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" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -77,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00143" summary="11/11/2023 - 17h">
|
||||
<created>1699718029739</created>
|
||||
<option name="number" value="00143" />
|
||||
<option name="presentableId" value="LOCAL-00143" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699718029739</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00144" summary="11/11/2023 - 23h">
|
||||
<created>1699740510545</created>
|
||||
<option name="number" value="00144" />
|
||||
|
@ -420,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1704750040592</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="192" />
|
||||
<task id="LOCAL-00192" summary="09/01/24 - 19h30">
|
||||
<created>1704825095909</created>
|
||||
<option name="number" value="00192" />
|
||||
<option name="presentableId" value="LOCAL-00192" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1704825095911</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="193" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -435,7 +435,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="08/12/2023 - 22h30" />
|
||||
<MESSAGE value="11/12/2023 - 20h30" />
|
||||
<MESSAGE value="12/12/2023 - 22h30" />
|
||||
<MESSAGE value="13/12/2023 - 23h30" />
|
||||
|
@ -460,6 +459,7 @@
|
|||
<MESSAGE value="05/01/24 - 20h30" />
|
||||
<MESSAGE value="06/01/24 - 20h30" />
|
||||
<MESSAGE value="08/01/24 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="08/01/24 - 22h30" />
|
||||
<MESSAGE value="09/01/24 - 19h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="09/01/24 - 19h30" />
|
||||
</component>
|
||||
</project>
|
|
@ -4952,7 +4952,9 @@ def AcceptAttendeeInscription(diction):
|
|||
2 - L'inscription de l'utilisateur à la formation.
|
||||
|
||||
"""
|
||||
return_message = ""
|
||||
return_message = " Inscription validée avec warning : "
|
||||
is_warning_message = 0
|
||||
|
||||
if( str(lms_class_code) != ""):
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
|
@ -4966,7 +4968,8 @@ def AcceptAttendeeInscription(diction):
|
|||
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " WARNING : le compte LSM n'a pas été correctement crée")
|
||||
return_message = return_message + " le compte LSM n'a pas été correctement crée. "
|
||||
return_message = return_message + " - Le compte LSM n'a pas été correctement crée. \n"
|
||||
is_warning_message = 1
|
||||
else:
|
||||
# Mettre à jour la collection "inscription" en ajoutant local_participant_lms_id et et le mot de passe
|
||||
print(" ### Mise à jour 'inscription' pour inscription_line_id = ", str(diction['inscription_id']),
|
||||
|
@ -4998,7 +5001,8 @@ def AcceptAttendeeInscription(diction):
|
|||
if (local_status2 is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " WARNING : Impossbile de finaliser l'inscription dans le LMS")
|
||||
return_message = return_message + " Impossbile de finaliser l'inscription dans le LMS. "
|
||||
return_message = return_message + " - Impossbile de finaliser l'inscription dans le LMS. "+str(local_message2)+" \n"
|
||||
is_warning_message = 1
|
||||
else:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " TOP, l'inscription dans le LMS a ete correctement faite")
|
||||
|
@ -5006,7 +5010,8 @@ def AcceptAttendeeInscription(diction):
|
|||
else:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - WARNING : Impossible de mettre à jour le compte LMS ")
|
||||
return_message = return_message + " Impossible de mettre à jour le compte LMS."
|
||||
return_message = return_message + " - Impossible de mettre à jour le compte LMS. \n"
|
||||
is_warning_message = 1
|
||||
|
||||
|
||||
|
||||
|
@ -5100,7 +5105,8 @@ def AcceptAttendeeInscription(diction):
|
|||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - WARNING : Impossible d'envoyer le mail de notification pour " + str(
|
||||
diction['email']))
|
||||
return_message = return_message + str(" Impossible d'envoyer le mail de notification pour : " + str(diction['email']))
|
||||
return_message = return_message + str(" - Impossible d'envoyer le mail de notification pour : " + str(diction['email'])+" \n")
|
||||
is_warning_message = 1
|
||||
|
||||
|
||||
|
||||
|
@ -5117,33 +5123,146 @@ def AcceptAttendeeInscription(diction):
|
|||
new_apprenant_diction['nom'] = inscription_data['nom']
|
||||
new_apprenant_diction['email'] = inscription_data['email']
|
||||
new_apprenant_diction['prenom'] = inscription_data['prenom']
|
||||
new_apprenant_diction['civilite'] = inscription_data['civilite']
|
||||
new_apprenant_diction['telephone'] = inscription_data['telephone']
|
||||
new_apprenant_diction['employeur'] = inscription_data['employeur']
|
||||
new_apprenant_diction['client_rattachement_id'] = inscription_data['client_rattachement_id']
|
||||
new_apprenant_diction['adresse'] = inscription_data['adresse']
|
||||
new_apprenant_diction['code_postal'] = inscription_data['code_postal']
|
||||
new_apprenant_diction['ville'] = inscription_data['ville']
|
||||
new_apprenant_diction['pays'] = inscription_data['pays']
|
||||
new_apprenant_diction['tuteur1_nom'] = inscription_data['tuteur1_nom']
|
||||
new_apprenant_diction['tuteur1_prenom'] = inscription_data['tuteur1_prenom']
|
||||
new_apprenant_diction['tuteur1_email'] = inscription_data['tuteur1_email']
|
||||
new_apprenant_diction['tuteur1_telephone'] = inscription_data['tuteur1_telephone']
|
||||
new_apprenant_diction['tuteur2_nom'] = inscription_data['tuteur2_nom']
|
||||
new_apprenant_diction['tuteur2_prenom'] = inscription_data['tuteur2_prenom']
|
||||
new_apprenant_diction['tuteur2_email'] = inscription_data['tuteur2_email']
|
||||
new_apprenant_diction['tuteur2_telephone'] = inscription_data['tuteur2_telephone']
|
||||
new_apprenant_diction['opco'] = inscription_data['opco']
|
||||
new_apprenant_diction['tuteur1_adresse'] = inscription_data['tuteur1_adresse']
|
||||
new_apprenant_diction['tuteur1_cp'] = inscription_data['tuteur1_cp']
|
||||
new_apprenant_diction['tuteur1_ville'] = inscription_data['tuteur1_ville']
|
||||
new_apprenant_diction['tuteur1_pays'] = inscription_data['tuteur1_pays']
|
||||
new_apprenant_diction['tuteur1_include_com'] = inscription_data['tuteur1_include_com']
|
||||
new_apprenant_diction['tuteur2_adresse'] = inscription_data['tuteur2_adresse']
|
||||
new_apprenant_diction['tuteur2_cp'] = inscription_data['tuteur2_cp']
|
||||
new_apprenant_diction['tuteur2_ville'] = inscription_data['tuteur2_ville']
|
||||
new_apprenant_diction['tuteur2_pays'] = inscription_data['tuteur2_pays']
|
||||
new_apprenant_diction['tuteur2_include_com'] = inscription_data['tuteur2_include_com']
|
||||
|
||||
if( "civilite" in inscription_data.keys()):
|
||||
new_apprenant_diction['civilite'] = inscription_data['civilite']
|
||||
else:
|
||||
new_apprenant_diction['civilite'] = ""
|
||||
|
||||
if("telephone" in inscription_data.keys()):
|
||||
new_apprenant_diction['telephone'] = inscription_data['telephone']
|
||||
else:
|
||||
new_apprenant_diction['telephone'] = ""
|
||||
|
||||
if ("employeur" in inscription_data.keys()):
|
||||
new_apprenant_diction['employeur'] = inscription_data['employeur']
|
||||
else:
|
||||
new_apprenant_diction['employeur'] = ""
|
||||
|
||||
if("client_rattachement_id" in inscription_data.keys()):
|
||||
new_apprenant_diction['client_rattachement_id'] = inscription_data['client_rattachement_id']
|
||||
else:
|
||||
new_apprenant_diction['client_rattachement_id'] = ""
|
||||
|
||||
|
||||
if("adresse" in inscription_data.keys()):
|
||||
new_apprenant_diction['adresse'] = inscription_data['adresse']
|
||||
else:
|
||||
new_apprenant_diction['adresse'] = ""
|
||||
|
||||
|
||||
if("code_postal" in inscription_data.keys()):
|
||||
new_apprenant_diction['code_postal'] = inscription_data['code_postal']
|
||||
else:
|
||||
new_apprenant_diction['code_postal'] = ""
|
||||
|
||||
if("ville" in inscription_data.keys()):
|
||||
new_apprenant_diction['ville'] = inscription_data['ville']
|
||||
else:
|
||||
new_apprenant_diction['ville'] = ""
|
||||
|
||||
if("pays" in inscription_data.keys()):
|
||||
new_apprenant_diction['pays'] = inscription_data['pays']
|
||||
else:
|
||||
new_apprenant_diction['pays'] = ""
|
||||
|
||||
if("tuteur1_nom" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_nom'] = inscription_data['tuteur1_nom']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_nom'] = ""
|
||||
|
||||
if("tuteur1_prenom" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_prenom'] = inscription_data['tuteur1_prenom']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_prenom'] = ""
|
||||
|
||||
if("tuteur1_email" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_email'] = inscription_data['tuteur1_email']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_email'] = ""
|
||||
|
||||
if("tuteur1_telephone" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_telephone'] = inscription_data['tuteur1_telephone']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_telephone'] = ""
|
||||
|
||||
if("tuteur2_nom" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_nom'] = inscription_data['tuteur2_nom']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_nom'] = ""
|
||||
|
||||
if("tuteur2_email" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_prenom'] = inscription_data['tuteur2_email']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_prenom'] = ""
|
||||
|
||||
|
||||
if("tuteur2_email" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_email'] = inscription_data['tuteur2_email']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_email'] = ""
|
||||
|
||||
if ("tuteur2_telephone" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_telephone'] = inscription_data['tuteur2_telephone']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_telephone'] = ""
|
||||
|
||||
|
||||
if ("opco" in inscription_data.keys()):
|
||||
new_apprenant_diction['opco'] = inscription_data['opco']
|
||||
else:
|
||||
new_apprenant_diction['opco'] = ""
|
||||
|
||||
if ("tuteur1_adresse" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_adresse'] = inscription_data['tuteur1_adresse']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_adresse'] = ""
|
||||
|
||||
if ("tuteur1_cp" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_cp'] = inscription_data['tuteur1_cp']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_cp'] = ""
|
||||
|
||||
if ("tuteur1_ville" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_ville'] = inscription_data['tuteur1_ville']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_ville'] = ""
|
||||
|
||||
if ("tuteur1_pays" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_pays'] = inscription_data['tuteur1_pays']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_pays'] = ""
|
||||
|
||||
if ("tuteur1_include_com" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_include_com'] = inscription_data['tuteur1_include_com']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_include_com'] = "0"
|
||||
|
||||
if ("tuteur2_adresse" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_adresse'] = inscription_data['tuteur2_adresse']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_adresse'] = ""
|
||||
|
||||
if ("tuteur2_cp" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_cp'] = inscription_data['tuteur2_cp']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_cp'] = ""
|
||||
|
||||
if ("tuteur2_ville" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_ville'] = inscription_data['tuteur2_ville']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_ville'] = ""
|
||||
|
||||
|
||||
if ("tuteur2_pays" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_pays'] = inscription_data['tuteur2_pays']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_pays'] = ""
|
||||
|
||||
if ("tuteur2_include_com" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_include_com'] = inscription_data['tuteur2_include_com']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_include_com'] = "0"
|
||||
|
||||
"""
|
||||
# Si la personne de cette inscription existe deja dans la collection appenant, alors on fait une mise à jour.
|
||||
|
@ -5206,7 +5325,7 @@ def AcceptAttendeeInscription(diction):
|
|||
upsert=False,
|
||||
)
|
||||
|
||||
if (return_message.strip() != ""):
|
||||
if (is_warning_message == 1):
|
||||
return True, return_message
|
||||
|
||||
|
||||
|
@ -9176,7 +9295,7 @@ def Export_Inscription_To_Excel_From_from_List_Id(diction):
|
|||
print(" #### qry = ", qery_match)
|
||||
list_class_datas = MYSY_GV.dbname['myclass'].find({'_id': {'$in': tab_id},
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'locked': '0'}, {'_id': 0,
|
||||
}, {'_id': 0,
|
||||
'valide': 0, 'locked': 0})
|
||||
|
||||
pipe_qry = ([
|
||||
|
|
1860
Log/log_file.log
1860
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -1155,6 +1155,10 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
nb_hour_per_day = mycommon.Get_Partner_Hour_Per_Day(str(my_partner['recid']))
|
||||
if (nb_hour_per_day is False):
|
||||
nb_hour_per_day = "7"
|
||||
|
||||
|
||||
filt_class_title = {}
|
||||
if ("class_title" in diction.keys()):
|
||||
|
@ -2932,7 +2936,7 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
pays = ""
|
||||
if ("pays" in df.keys()):
|
||||
if (str(df['pays'].values[n])):
|
||||
local_adresse = str(df['pays'].values[n]).strip()
|
||||
pays = str(df['pays'].values[n]).strip()
|
||||
mydata['pays'] = pays
|
||||
|
||||
contenu_ftion = ""
|
||||
|
|
13
main.py
13
main.py
|
@ -5094,6 +5094,19 @@ def Get_List_Ressource_Materielle_with_filter():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API Pour récuperer la liste des ressources (humaines ou materielles) rattachée
|
||||
à une ressource materiel (ex : la liste des ordinateurs d'une salle)
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Ressource_Materielle_Rattachement/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Ressource_Materielle_Rattachement():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Ressource_Materielle_Rattachement payload = ",payload)
|
||||
status, retval = ressources_materiels.Get_List_Ressource_Materielle_Rattachement(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API de creation d'une commande client d'un partner
|
||||
|
|
|
@ -976,11 +976,13 @@ def getRecoded_Materielle_Image_from_front(diction=None):
|
|||
|
||||
|
||||
""""
|
||||
récupérer les affectations d'un employé
|
||||
récupérer les affectations d'un materiel
|
||||
:!\ : Pour le moment une affectation ne peut concerner que
|
||||
- Une formation (collection : myclass) ou
|
||||
- Une session de formation (collection session_formation) ou
|
||||
- Un materiel
|
||||
- rien du tout (cela veut dire que la fonction concene le partenaire, donc l'ecole.
|
||||
|
||||
exemple : Directeur des etude, etc)
|
||||
"""
|
||||
def Get_List_Ressource_Materielle_Affectation(diction):
|
||||
|
@ -1070,6 +1072,21 @@ def Get_List_Ressource_Materielle_Affectation(diction):
|
|||
related_target_collection_id_nom = str(affectation_target_data["prenom"]+" "+affectation_target_data["nom"])
|
||||
related_target_collection_object = "Employe"
|
||||
|
||||
|
||||
# 11/01/2024 - Update : affectation d'un materiel a un materiel
|
||||
# Si l'affectation concerne un materiel (oui car un materiel peut rattaché à un materiel)
|
||||
elif (retval["related_target_collection"] == "ressource_materielle"):
|
||||
# Si l'affectation concerne un materiel
|
||||
affectation_target_data = MYSY_GV.dbname[retval["related_target_collection"]].find_one(
|
||||
{"_id": ObjectId(str(retval["related_target_collection_id"])),
|
||||
'partner_recid': str(partner_recid),
|
||||
'valide': '1'})
|
||||
|
||||
if (affectation_target_data is not None):
|
||||
related_target_collection_id_nom = str(
|
||||
affectation_target_data["ref_interne"] + " " + affectation_target_data["nom"])
|
||||
related_target_collection_object = "Materiel"
|
||||
|
||||
user['related_target_collection_id_nom'] = related_target_collection_id_nom
|
||||
user['related_target_collection_object'] = related_target_collection_object
|
||||
|
||||
|
@ -1619,7 +1636,7 @@ Cette API permet de récupérer la liste des 'related_target_collection_object'
|
|||
et de les formater pour une utilisation simple coté front.
|
||||
|
||||
les collections cibles sont :
|
||||
- les formations et les sessions de formation.
|
||||
- les formations et les sessions de formation, les employé et le materiel (oui la cas ou un PC est affecté à une salle)
|
||||
|
||||
ex :
|
||||
{
|
||||
|
@ -1705,6 +1722,24 @@ def Get_Related_Target_Materiel_Collection_Data(diction):
|
|||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(retval_data))
|
||||
|
||||
# Recuperation des données du materiel (ceci permet d'affectuer un materiel à une salles de réunion par exmple)
|
||||
for retval in MYSY_GV.dbname['ressource_materielle'].find({'partner_recid': str(partner_recid),
|
||||
'valide': '1'}, {'_id': 1, 'ref_interne': 1, 'nom':1}):
|
||||
retval_data = {}
|
||||
retval_data['related_target_collection'] = "ressource_materielle"
|
||||
retval_data['related_target_collection_id'] = str(retval['_id'])
|
||||
nom = ""
|
||||
ref_interne = ""
|
||||
if( "nom" in retval.keys()):
|
||||
nom = retval['nom']
|
||||
|
||||
if ("ref_interne" in retval.keys()):
|
||||
ref_interne = retval['ref_interne']
|
||||
|
||||
|
||||
retval_data['related_target_collection_id_nom'] = str(str(nom+" "+ref_interne))
|
||||
RetObject.append(mycommon.JSONEncoder().encode(retval_data))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
|
@ -1978,3 +2013,105 @@ def Get_List_Ressource_Materielle_with_filter(diction):
|
|||
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 contact "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recuperer les ressources associées à une ressource materielle
|
||||
Ex : les composants d'un salle
|
||||
- projecteur
|
||||
- table
|
||||
- ordinateur
|
||||
- etc
|
||||
"""
|
||||
def Get_List_Ressource_Materielle_Rattachement(diction):
|
||||
try:
|
||||
field_list_obligatoire = [ 'token', 'rm_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, " La valeur '" + val + "' n'est pas presente dans liste"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(str(my_token))
|
||||
if partner_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible d'imprimer la fiche detaillée")
|
||||
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
|
||||
|
||||
|
||||
|
||||
qry_affectation = {'partner_owner_recid':str(my_partner_data['recid']),
|
||||
'related_target_collection':'ressource_materielle', 'related_target_collection_id':str(diction['rm_id']),
|
||||
'valide':'1', 'locked':'0'}
|
||||
|
||||
|
||||
print(" ### qry_affectation = ",qry_affectation)
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['ressource_materielle_affectation'].find(qry_affectation):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
related_target_collection_id_nom = ""
|
||||
related_target_collection_object = ""
|
||||
|
||||
# Si le rattachement a un 'related_target_collection_id', alors cela veut dire qu'il faut aller chercher
|
||||
# la cible de cette affection.
|
||||
if( "related_collection_recid" in retval.keys() and "related_collection" in retval.keys()):
|
||||
if( retval["related_collection_recid"] and retval["related_collection"]):
|
||||
|
||||
|
||||
# Si l'affectation concerne un salarié
|
||||
if (retval["related_collection"] == "ressource_humaine"):
|
||||
# Si l'affectation concerne un salarié
|
||||
affectation_target_data = MYSY_GV.dbname[retval["related_collection"]].find_one(
|
||||
{"_id": ObjectId(str(retval["related_collection_recid"])),
|
||||
'partner_recid': str(partner_recid),
|
||||
'valide': '1'})
|
||||
|
||||
if (affectation_target_data is not None):
|
||||
related_target_collection_id_nom = str(affectation_target_data["prenom"]+" "+affectation_target_data["nom"])
|
||||
related_target_collection_object = "Employe"
|
||||
|
||||
|
||||
# 11/01/2024 - Update : affectation d'un materiel a un materiel
|
||||
# Si l'affectation concerne un materiel (oui car un materiel peut rattaché à un materiel)
|
||||
elif (retval["related_collection"] == "ressource_materielle"):
|
||||
# Si l'affectation concerne un materiel
|
||||
affectation_target_data = MYSY_GV.dbname[retval["related_collection"]].find_one(
|
||||
{"_id": ObjectId(str(retval["related_collection_recid"])),
|
||||
'partner_recid': str(partner_recid),
|
||||
'valide': '1'})
|
||||
|
||||
if (affectation_target_data is not None):
|
||||
related_target_collection_id_nom = str(
|
||||
affectation_target_data["ref_interne"] + " " + affectation_target_data["nom"])
|
||||
related_target_collection_object = "Materiel"
|
||||
|
||||
user['related_target_collection_id_nom'] = related_target_collection_id_nom
|
||||
user['related_target_collection_object'] = related_target_collection_object
|
||||
|
||||
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 affectations de l'employé "
|
||||
|
|
Loading…
Reference in New Issue