28/08/23 - 13h30
parent
f41d719e18
commit
5fd375b7a4
|
@ -1,13 +1,10 @@
|
|||
<?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="27/08/23 - 13h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="27/08/23 - 22h">
|
||||
<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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
@ -72,13 +69,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00037" summary="04/07/23 - 10h">
|
||||
<created>1688460514460</created>
|
||||
<option name="number" value="00037" />
|
||||
<option name="presentableId" value="LOCAL-00037" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1688460514460</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00038" summary="04/07/23 - 17h">
|
||||
<created>1688482338857</created>
|
||||
<option name="number" value="00038" />
|
||||
|
@ -415,7 +405,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1693136101569</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="86" />
|
||||
<task id="LOCAL-00086" summary="27/08/23 - 22h">
|
||||
<created>1693168933560</created>
|
||||
<option name="number" value="00086" />
|
||||
<option name="presentableId" value="LOCAL-00086" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1693168933560</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="87" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -430,7 +427,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="08/08/2023 - 16h" />
|
||||
<MESSAGE value="09/08/2023 - 21h" />
|
||||
<MESSAGE value="10/08/23 - 16h" />
|
||||
<MESSAGE value="11/08/23 - 16h" />
|
||||
|
@ -455,6 +451,7 @@
|
|||
<MESSAGE value="25/08/23 - 21h" />
|
||||
<MESSAGE value="26/08/23 - 20h" />
|
||||
<MESSAGE value="27/08/23 - 13h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="27/08/23 - 13h" />
|
||||
<MESSAGE value="27/08/23 - 22h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="27/08/23 - 22h" />
|
||||
</component>
|
||||
</project>
|
1309
Log/log_file.log
1309
Log/log_file.log
File diff suppressed because it is too large
Load Diff
17
main.py
17
main.py
|
@ -3680,6 +3680,23 @@ def Update_Ressource_Humaine():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API de suppression d'un employé
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Ressource_Humaine/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Ressource_Humaine():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Ressource_Humaine payload = ",payload)
|
||||
status, retval = ressources_humaines.Delete_Ressource_Humaine(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere la liste des ressources humaines d'un partenaire
|
||||
|
|
|
@ -518,6 +518,109 @@ def Update_Ressource_Humaine(diction):
|
|||
return False, " Impossible de mettre à jour les données "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une ressource humaine
|
||||
"""
|
||||
|
||||
def Delete_Ressource_Humaine(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'prenom', ]
|
||||
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
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', '_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']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(token)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ")
|
||||
return False, " Vous n'etes pas autorisé à utiliser cette API "
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_recid(partner_recid)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire. "
|
||||
|
||||
|
||||
"""
|
||||
Verification de l'existance de l'employée a supprimer
|
||||
"""
|
||||
existe_employee_count = MYSY_GV.dbname['ressource_humaine'].count_documents({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_recid': str(my_partner['recid']),})
|
||||
|
||||
if( existe_employee_count <= 0 ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Cet employé est invalide")
|
||||
return False, str(inspect.stack()[0][3]) + " -Cet employé est invalide "
|
||||
|
||||
"""
|
||||
Suppression des eventuels affectation de cet employé
|
||||
"""
|
||||
MYSY_GV.dbname['ressource_humaine_affectation'].delete_many({'related_collection_recid': (str(diction['_id'])),
|
||||
'partner_recid': str(my_partner['recid']),
|
||||
'related_collection':'ressource_humaine'})
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Si cet employé est manager d'autres employés, alors mettre à vide le champ 'superieur_hierarchie_id'
|
||||
"""
|
||||
MYSY_GV.dbname['ressource_humaine'].update_many({'superieur_hierarchie_id': str(diction['_id']),
|
||||
'partner_recid': str(my_partner['recid']),},
|
||||
{"$set":{"superieur_hierarchie_id":""}})
|
||||
|
||||
|
||||
"""
|
||||
Suppression de l'employé
|
||||
"""
|
||||
MYSY_GV.dbname['ressource_humaine'].delete_many({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_recid': str(my_partner['recid']),})
|
||||
|
||||
|
||||
|
||||
return True, " Les données a été correctement mises à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de mettre à jour les données "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de la liste des ressources humaines d'une entité en se basant sur
|
||||
|
@ -2026,9 +2129,9 @@ def Add_Affectation_Ressource_Humaine_Poste(diction):
|
|||
|
||||
|
||||
date_au = ""
|
||||
if ("date_fin" in diction.keys()):
|
||||
if ("date_au" in diction.keys()):
|
||||
if diction['date_au']:
|
||||
date_au = str(diction['date_fin'])[0:10]
|
||||
date_au = str(diction['date_au'])[0:10]
|
||||
local_status = mycommon.CheckisDate(date_au)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
|
@ -2097,7 +2200,7 @@ def Add_Affectation_Ressource_Humaine_Poste(diction):
|
|||
|
||||
my_data['date_du'] = str(date_du)
|
||||
my_data['date_au'] = str(date_au)
|
||||
my_data['valdie'] = "1"
|
||||
my_data['valide'] = "1"
|
||||
my_data['locked'] = "0"
|
||||
my_data['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
|
@ -2351,15 +2454,15 @@ def Delete_Affectation_Ressource_Humaine_Poste(diction):
|
|||
|
||||
|
||||
# Verifier l'existance de l'affectation
|
||||
affectation_existe_count = MYSY_GV.dbname['ressource_humaine_affectation'].count_documents( {'_id': str(diction['_id']), 'valide': "1",
|
||||
affectation_existe_count = MYSY_GV.dbname['ressource_humaine_affectation'].count_documents( {'_id': ObjectId(str(diction['_id'])), 'valide': "1",
|
||||
"locked":"0", 'partner_owner_recid':str(partner_recid)})
|
||||
|
||||
if( affectation_existe_count != 1 ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour cette affectation. Données incohérentes ")
|
||||
return False, " Impossible de mettre à jour cette affectation. Données incohérentes "
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de supprimer cette affectation. Données incohérentes ")
|
||||
return False, " Impossible de supprimer cette affectation. Données incohérentes "
|
||||
|
||||
|
||||
inserted_data = MYSY_GV.dbname['ressource_humaine_affectation'].delete_one( {'_id': str(diction['_id']), 'valide': "1", "locked":"0",
|
||||
inserted_data = MYSY_GV.dbname['ressource_humaine_affectation'].delete_one( {'_id': ObjectId(str(diction['_id'])), 'valide': "1", "locked":"0",
|
||||
'partner_owner_recid':str(partner_recid)}, )
|
||||
|
||||
if( inserted_data is None ):
|
||||
|
|
Loading…
Reference in New Issue