23/08/23 - 20h
parent
553d765a71
commit
57c997f3e4
|
@ -1,10 +1,19 @@
|
|||
<?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="22/08/23 - 13h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="22/08/23 - 20h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Activite.py" beforeDir="false" afterPath="$PROJECT_DIR$/Activite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -68,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00031" summary="02/06/23 - 22h">
|
||||
<created>1685735947619</created>
|
||||
<option name="number" value="00031" />
|
||||
<option name="presentableId" value="LOCAL-00031" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1685735947619</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00032" summary="05/06/23 - 15h">
|
||||
<created>1685969841934</created>
|
||||
<option name="number" value="00032" />
|
||||
|
@ -411,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1692702541118</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="80" />
|
||||
<task id="LOCAL-00080" summary="22/08/23 - 20h">
|
||||
<created>1692727228920</created>
|
||||
<option name="number" value="00080" />
|
||||
<option name="presentableId" value="LOCAL-00080" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1692727228921</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="81" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -426,7 +435,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="29/07/23 - 29h" />
|
||||
<MESSAGE value="30/07/23 - 17h" />
|
||||
<MESSAGE value="01/08/230- 21h" />
|
||||
<MESSAGE value="03/08/23 - 19h" />
|
||||
|
@ -451,6 +459,7 @@
|
|||
<MESSAGE value="21/08/23 - 15h" />
|
||||
<MESSAGE value="21/08/23 - 21h" />
|
||||
<MESSAGE value="22/08/23 - 13h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="22/08/23 - 13h" />
|
||||
<MESSAGE value="22/08/23 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="22/08/23 - 20h" />
|
||||
</component>
|
||||
</project>
|
|
@ -572,14 +572,14 @@ def Get_Given_Activite(diction):
|
|||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
print(" ### data_cle = ", data_cle)
|
||||
#print(" ### data_cle = ", data_cle)
|
||||
for retval in MYSY_GV.dbname['activite'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
print(" ### RetObject = ", RetObject)
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
|
|
@ -728,14 +728,14 @@ def Get_Given_Contact(diction):
|
|||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
print(" ### data_cle = ", data_cle)
|
||||
#print(" ### data_cle = ", data_cle)
|
||||
for retval in MYSY_GV.dbname['contact'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
print(" ### RetObject = ", RetObject)
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
|
|
@ -464,5 +464,5 @@ SESSION_ETAPE = ['-1', '0', '1', '2', '3', '4', '5']
|
|||
"""
|
||||
Les profils des ressources humaines autorisé
|
||||
"""
|
||||
RESSOURCE_PROFIL = ['enseignant', 'cadre', 'employe', 'autre']
|
||||
RESSOURCE_PROFIL = ['enseignant', 'cadre', 'employe', 'autre', '']
|
||||
|
||||
|
|
|
@ -4115,10 +4115,10 @@ def DeleteImage_Stagiaire_v2(diction=None):
|
|||
|
||||
query_delete = {"recid": image_recid,}
|
||||
|
||||
print(" ### query_delete = ", query_delete)
|
||||
|
||||
ret_val = coll_name.delete_one({"recid": image_recid,}, )
|
||||
|
||||
print(" ### detelete ret_val = ", ret_val)
|
||||
|
||||
|
||||
print(" ### recordClassImage_v2 :L'image a été correctement supprimée ")
|
||||
return True, "L'image a été correctement supprimée"
|
||||
|
@ -4127,7 +4127,7 @@ def DeleteImage_Stagiaire_v2(diction=None):
|
|||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "IMPOSSIBLE D'ENREGISTRER L'IMAGE "
|
||||
return False, "Impossible de supprimer l'image "
|
||||
|
||||
"""
|
||||
Cette fonction recuperer la liste des stagiaire d'un partenaire.
|
||||
|
|
1920
Log/log_file.log
1920
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -674,8 +674,16 @@ def GetAllValideSessionPartner_List(diction):
|
|||
val['_id'] = retVal['_id']
|
||||
val['code_session'] = retVal['code_session']
|
||||
|
||||
val['session_etape'] = retVal['session_etape']
|
||||
val['session_status'] = retVal['session_status']
|
||||
if( "session_etape" in retVal.keys()):
|
||||
val['session_etape'] = retVal['session_etape']
|
||||
else:
|
||||
val['session_etape'] = "0"
|
||||
|
||||
if( "session_status" in retVal.keys()):
|
||||
val['session_status'] = retVal['session_status']
|
||||
else:
|
||||
val['session_status'] = "0"
|
||||
|
||||
|
||||
val['date_debut'] = retVal['date_debut'][0:10]
|
||||
val['date_fin'] = retVal['date_fin'][0:10]
|
||||
|
|
79
main.py
79
main.py
|
@ -3678,6 +3678,21 @@ def Get_List_Ressource_Humaine():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere les differents type de profils pour des ressources humaines
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Profil_Ressource_Humaine/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Profil_Ressource_Humaine():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Profil_Ressource_Humaine payload = ",payload)
|
||||
status, retval = ressources_humaines.Get_List_Profil_Ressource_Humaine(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere une ressource humaine donnée
|
||||
"""
|
||||
|
@ -3703,6 +3718,70 @@ def Get_List_Ressource_Humaine_with_filter():
|
|||
status, retval = ressources_humaines.Get_List_Ressource_Humaine_with_filter(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
"""
|
||||
API qui retour la liste de managers (ismanager = 1)
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Manager_Ressource_Humaine/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Manager_Ressource_Humaine():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Manager_Ressource_Humaine payload = ",payload)
|
||||
status, retval = ressources_humaines.Get_List_Manager_Ressource_Humaine(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui enregistre/met à jour l'image d'une ressource humaine
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Ressource_Humaine_Image/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Ressource_Humaine_Image():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Ressource_Humaine_Image : payload = ",payload)
|
||||
|
||||
if request.method == 'POST':
|
||||
# Create variable for uploaded file
|
||||
if ('file_img' in request.files.keys()):
|
||||
file_img = request.files['file_img']
|
||||
else:
|
||||
file_img = None
|
||||
return False, "Aucun fichier image à enregistrer"
|
||||
|
||||
localStatus, message = ressources_humaines.Update_Ressource_Humaine_Image(file_img, MYSY_GV.upload_folder, payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
"""
|
||||
API qui supprime l'image de profil d'une ressource humaine
|
||||
"""
|
||||
@app.route('/myclass/api/DeleteImage_Ressource_Humaine/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def DeleteImage_Ressource_Humaine():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### DeleteImage_Ressource_Humaine payload = ",payload)
|
||||
status, retval = ressources_humaines.DeleteImage_Ressource_Humaine(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de l'image de profil d'un employee
|
||||
"""
|
||||
@app.route('/myclass/api/getRecoded_Employee_Image_from_front/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def getRecoded_Employee_Image_from_front():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### getRecodedStagiaireImage_from_front payload = ",payload)
|
||||
status, retval = ressources_humaines.getRecoded_Employee_Image_from_front(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -864,7 +864,7 @@ def Get_Given_Partner_Client(diction):
|
|||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
print(" ### RetObject = ", RetObject)
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
|
|
@ -80,8 +80,8 @@ def Upload_Save_CSV_File(file=None, Folder=None):
|
|||
Verification qu'il s'agit bien d'un fichier csv, dont le nom ne comporte pas de "."
|
||||
'''
|
||||
if(len(basename2) != 2 ):
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Le nom du fichier est incorret")
|
||||
return False, "Le nom du fichier est incorrect"
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Le nom du fichier est invalide")
|
||||
return False, "Le nom du fichier est invalide"
|
||||
|
||||
if( str(basename2[1]).lower() != "csv" ):
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Ce n'est pas un fichier csv")
|
||||
|
@ -123,12 +123,12 @@ def Upload_Save_IMG_File(file=None, Folder=None):
|
|||
Verification qu'il s'agit bien d'un fichier image ('jpg', 'jpeg', 'png', 'jpe', ...), dont le nom ne comporte pas de "."
|
||||
'''
|
||||
if(len(basename2) != 2 ):
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Le nom du fichier "+str(file.filename)+" est incorret")
|
||||
return False, None
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Le nom du fichier "+str(file.filename)+" est invalide")
|
||||
return False, "Le nom du fichier "+str(file.filename)+" est invalide "
|
||||
|
||||
if( str(basename2[1]).lower() not in MYSY_GV.IMG_FORMAT):
|
||||
myprint(str(inspect.stack()[0][3]) + " - : le ficier "+str(file.filename)+ ". L'extention '"+str(basename2[1])+"' n'est pas un fichier image. Les extentions autorisées sont :"+str(MYSY_GV.IMG_FORMAT))
|
||||
return False, None
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Le fichier "+str(file.filename)+ ". L'extention '"+str(basename2[1])+"' n'est pas un fichier image. Les extentions autorisées sont :"+str(MYSY_GV.IMG_FORMAT))
|
||||
return False, " Le fichier "+str(file.filename)+ ". L'extention '"+str(basename2[1])+"' n'est pas un fichier image. Les extentions autorisées sont :"+str(MYSY_GV.IMG_FORMAT)+" "
|
||||
|
||||
|
||||
|
||||
|
@ -164,12 +164,12 @@ def Upload_Save_IMG_PNG_File(file=None, Folder=None):
|
|||
Verification qu'il s'agit bien d'un fichier image (PNG), dont le nom ne comporte pas de "."
|
||||
'''
|
||||
if(len(basename2) != 2 ):
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Le nom du fichier "+str(file.filename)+" est incorret")
|
||||
return False, None
|
||||
myprint(str(inspect.stack()[0][3]) + " - : Le nom du fichier "+str(file.filename)+" est invalide")
|
||||
return False, " Le nom du fichier "+str(file.filename)+" est invalide "
|
||||
|
||||
if( str(basename2[1]).lower() not in MYSY_GV.IMG_PNG_FORMAT):
|
||||
myprint(str(inspect.stack()[0][3]) + " - : le ficier "+str(file.filename)+ ". L'extention '"+str(basename2[1])+"' n'est pas un fichier image. Les extentions autorisées sont :"+str(MYSY_GV.IMG_FORMAT))
|
||||
return False, None
|
||||
myprint(str(inspect.stack()[0][3]) + " - : le fichier "+str(file.filename)+ ". L'extention '"+str(basename2[1])+"' n'est pas un fichier image. Les extentions autorisées sont :"+str(MYSY_GV.IMG_FORMAT))
|
||||
return False, "Le fichier "+str(file.filename)+ ". L'extention '"+str(basename2[1])+"' n'est pas un fichier image. Les extentions autorisées sont :"+str(MYSY_GV.IMG_FORMAT)
|
||||
|
||||
new_basename2 = re.sub(r'[^a-zA-Z0-9]', '', str(basename2[0]))
|
||||
|
||||
|
@ -1781,9 +1781,9 @@ def recordClassImage_v2(file=None, Folder=None, diction=None):
|
|||
|
||||
|
||||
status, saved_file = Upload_Save_IMG_File(file, Folder)
|
||||
if (status == False):
|
||||
myprint("Impossible de recuperer correctement le fichier à importer")
|
||||
return False, "Impossible de recuperer correctement le fichier à importer"
|
||||
if (status is False):
|
||||
myprint(str(saved_file))
|
||||
return False, str(saved_file)
|
||||
|
||||
# " Lecture du fichier "
|
||||
#print(" Lecture du fichier : " + saved_file + ". le token est :" + str(mytoken))
|
||||
|
|
|
@ -40,13 +40,13 @@ def Add_Ressource_Humaine(diction):
|
|||
"""
|
||||
field_list = ['token', "nom", "email", "telephone", "website", "comment",'adr_adresse', 'adr_code_postal',
|
||||
'adr_ville', 'adr_pays', 'profil', 'telephone_mobile', 'linkedin',
|
||||
'facebook', 'twitter', 'prenom', 'fonction', 'civilite', 'resp_hierarchie_id']
|
||||
'facebook', 'twitter', 'prenom', 'fonction', 'civilite', 'superieur_hierarchie_id', 'ismanager']
|
||||
|
||||
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")
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
|
@ -117,19 +117,36 @@ def Add_Ressource_Humaine(diction):
|
|||
data['nom'] = diction['nom']
|
||||
|
||||
|
||||
|
||||
prenom = ""
|
||||
if ("prenom" in diction.keys()):
|
||||
if diction['prenom']:
|
||||
prenom = diction['prenom']
|
||||
data['prenom'] = diction['prenom']
|
||||
|
||||
ismanager = "0"
|
||||
if ("ismanager" in diction.keys()):
|
||||
if diction['ismanager']:
|
||||
ismanager = diction['ismanager']
|
||||
if( ismanager != "0" and ismanager != "1"):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Valeur du champ 'manager' invalide : "+str(ismanager)+". Les valeurs acceptée : 1 ou 0")
|
||||
return False, str(inspect.stack()[0][3]) + " - Valeur du champ 'manager' invalide : "+str(ismanager)+". Les valeurs acceptée : 1 ou 0"
|
||||
|
||||
ismanager = diction['ismanager']
|
||||
|
||||
data['ismanager'] = ismanager
|
||||
|
||||
fonction = ""
|
||||
if ("fonction" in diction.keys()):
|
||||
if diction['fonction']:
|
||||
fonction = diction['fonction']
|
||||
data['fonction'] = diction['fonction']
|
||||
|
||||
superieur_hierarchie_id = ""
|
||||
if ("superieur_hierarchie_id" in diction.keys()):
|
||||
if diction['superieur_hierarchie_id']:
|
||||
superieur_hierarchie_id = diction['superieur_hierarchie_id']
|
||||
data['superieur_hierarchie_id'] = diction['superieur_hierarchie_id']
|
||||
|
||||
civilite = ""
|
||||
if ("civilite" in diction.keys()):
|
||||
if diction['civilite']:
|
||||
|
@ -225,10 +242,11 @@ def Add_Ressource_Humaine(diction):
|
|||
if diction['profil']:
|
||||
profil = diction['profil']
|
||||
data['profil'] = diction['profil']
|
||||
if( profil not in MYSY_GV.RESSOURCE_PROFIL):
|
||||
Rh_profil_count = MYSY_GV.dbname['ressource_humaine_profil'].count_documents({'profil_nom':str(profil), 'valide':'1', 'locked':'0'})
|
||||
if( Rh_profil_count != 1):
|
||||
mycommon.myprint(
|
||||
"- Le type de profil "+str(type)+" n'est pas autorisé")
|
||||
return False, "- Le type de profil "+str(type)+" n'est pas autorisé"
|
||||
"- Le type de profil "+str(profil)+" n'est pas autorisé")
|
||||
return False, "- Le type de profil "+str(profil)+" n'est pas autorisé"
|
||||
|
||||
|
||||
data['valide'] = '1'
|
||||
|
@ -265,10 +283,11 @@ def Update_Ressource_Humaine(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "raison_sociale", "nom", "prenom", "email",
|
||||
field_list = ['token', "nom", "prenom", "email",
|
||||
"telephone", "website", "comment",'adr_adresse', 'adr_code_postal',
|
||||
'adr_ville', 'adr_pays', 'profil', 'telephone_mobile', 'linkedin',
|
||||
'facebook', 'twitter', '_id', 'prenom', 'fonction', 'civilite', 'resp_hierarchie_id']
|
||||
'facebook', 'twitter', '_id', 'prenom', 'fonction', 'civilite',
|
||||
'superieur_hierarchie_id', 'ismanager']
|
||||
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
@ -320,15 +339,13 @@ def Update_Ressource_Humaine(diction):
|
|||
Verification si cette adresse email n'existe pas deja pour ce partner
|
||||
"""
|
||||
|
||||
qry_update = {'email': str(diction['email']),
|
||||
'valide': '1', 'locked':'0', 'partner_recid': str(my_partner['recid']),
|
||||
'_id':str(my_partner['_id'])}
|
||||
qry_update = {'_id': ObjectId(str(diction['_id'])), 'valide': '1', 'locked': '0', 'partner_recid': str(my_partner['recid']),}
|
||||
|
||||
|
||||
|
||||
print(" ### qry_update aa = ", qry_update)
|
||||
|
||||
tmp_count = MYSY_GV.dbname['contact'].count_documents(qry_update)
|
||||
tmp_count = MYSY_GV.dbname['ressource_humaine'].count_documents(qry_update)
|
||||
if (tmp_count <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
|
@ -361,17 +378,36 @@ def Update_Ressource_Humaine(diction):
|
|||
if ("civilite" in diction.keys()):
|
||||
data_update['civilite'] = diction['civilite']
|
||||
|
||||
ismanager = "0"
|
||||
if ("ismanager" in diction.keys()):
|
||||
ismanager = diction['ismanager']
|
||||
if (ismanager != "0" and ismanager != "1"):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Valeur du champ 'manager' invalide : " + str(
|
||||
ismanager) + ". Les valeurs acceptée : 1 ou 0")
|
||||
return False, str(inspect.stack()[0][3]) + " - Valeur du champ 'manager' invalide : " + str(
|
||||
ismanager) + ". Les valeurs acceptée : 1 ou 0"
|
||||
|
||||
ismanager = diction['ismanager']
|
||||
|
||||
data_update['ismanager'] = ismanager
|
||||
|
||||
|
||||
|
||||
prenom = ""
|
||||
if ("prenom" in diction.keys()):
|
||||
data_update['prenom'] = diction['prenom']
|
||||
|
||||
superieur_hierarchie_id = ""
|
||||
if ("superieur_hierarchie_id" in diction.keys()):
|
||||
data_update['superieur_hierarchie_id'] = diction['superieur_hierarchie_id']
|
||||
|
||||
profil = ""
|
||||
if ("profil" in diction.keys()):
|
||||
profil = diction['profil']
|
||||
data_update['profil'] = diction['profil']
|
||||
if (profil not in MYSY_GV.RESSOURCE_PROFIL):
|
||||
mycommon.myprint( "- Le type de profil " + str(type) + " n'est pas autorisé")
|
||||
return False, "- Le type de profil " + str(type) + " n'est pas autorisé"
|
||||
mycommon.myprint( "- Le type de profil " + str(profil) + " n'est pas autorisé")
|
||||
return False, "- Le type de profil " + str(profil) + " n'est pas autorisé"
|
||||
|
||||
fonction = ""
|
||||
if ("fonction" in diction.keys()):
|
||||
|
@ -454,8 +490,7 @@ def Update_Ressource_Humaine(diction):
|
|||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {'_id': str(diction['_id']), 'valide': '1', 'locked': '0', 'partner_recid': str(my_partner['recid']),
|
||||
}
|
||||
data_cle = {'_id': ObjectId(str(diction['_id'])), 'valide': '1', 'locked': '0', 'partner_recid': str(my_partner['recid']),}
|
||||
|
||||
|
||||
inserted_id = ""
|
||||
|
@ -547,6 +582,30 @@ def Get_List_Ressource_Humaine(diction):
|
|||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
"""
|
||||
Si l'employé a un superieur_hierarchie_id, alors on va aller recuperer son nom et prenom.
|
||||
ce superieur est une ressource humaime
|
||||
"""
|
||||
superieur_hierarchie_nom = ""
|
||||
superieur_hierarchie_prenom = ""
|
||||
if( "superieur_hierarchie_id" in retval.keys() and retval['superieur_hierarchie_id']):
|
||||
hierarchi_data = MYSY_GV.dbname['ressource_humaine'].find_one({'_id':ObjectId(str(retval['superieur_hierarchie_id'])),
|
||||
'valide':'1', 'locked':'0'}, {'nom':1, 'prenom':1})
|
||||
if( hierarchi_data is None):
|
||||
superieur_hierarchie_nom = ""
|
||||
superieur_hierarchie_prenom = ""
|
||||
|
||||
else:
|
||||
if ("superieur_hierarchie_nom" in hierarchi_data.keys()):
|
||||
superieur_hierarchie_nom = hierarchi_data['superieur_hierarchie_nom']
|
||||
|
||||
if ("superieur_hierarchie_prenom" in hierarchi_data.keys()):
|
||||
superieur_hierarchie_prenom = hierarchi_data['superieur_hierarchie_prenom']
|
||||
|
||||
user['superieur_hierarchie_nom'] = superieur_hierarchie_nom
|
||||
user['superieur_hierarchie_prenom'] = superieur_hierarchie_prenom
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -557,6 +616,81 @@ def Get_List_Ressource_Humaine(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la liste des contact "
|
||||
|
||||
"""
|
||||
Recuperation de la liste des profils de ressources humaines
|
||||
"""
|
||||
def Get_List_Profil_Ressource_Humaine(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:
|
||||
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']
|
||||
|
||||
# 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"
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données de l'utilisateur. "
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['valide'] = "1"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['ressource_humaine_profil'].find(data_cle):
|
||||
user = 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 recuperer la liste des contact "
|
||||
|
||||
|
||||
"""
|
||||
|
@ -717,14 +851,40 @@ def Get_Given_Ressource_Humaine(diction):
|
|||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
print(" ### data_cle = ", data_cle)
|
||||
#print(" ### data_cle = ", data_cle)
|
||||
for retval in MYSY_GV.dbname['ressource_humaine'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
"""
|
||||
Si l'employé a un superieur_hierarchie_id, alors on va aller recuperer son nom et prenom.
|
||||
ce superieur est une ressource humaime
|
||||
"""
|
||||
|
||||
superieur_hierarchie_nom = ""
|
||||
superieur_hierarchie_prenom = ""
|
||||
if ("superieur_hierarchie_id" in retval.keys() and retval['superieur_hierarchie_id']):
|
||||
hierarchi_data_qry = {'_id': ObjectId(str(retval['superieur_hierarchie_id'])), 'valide': '1', 'locked': '0'}
|
||||
|
||||
hierarchi_data = MYSY_GV.dbname['ressource_humaine'].find_one( hierarchi_data_qry)
|
||||
|
||||
if (hierarchi_data is None):
|
||||
superieur_hierarchie_nom = ""
|
||||
superieur_hierarchie_prenom = ""
|
||||
|
||||
else:
|
||||
if ("nom" in hierarchi_data.keys()):
|
||||
superieur_hierarchie_nom = hierarchi_data['nom']
|
||||
|
||||
if ("prenom" in hierarchi_data.keys()):
|
||||
superieur_hierarchie_prenom = hierarchi_data['prenom']
|
||||
|
||||
user['superieur_hierarchie_nom'] = superieur_hierarchie_nom
|
||||
user['superieur_hierarchie_prenom'] = superieur_hierarchie_prenom
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
print(" ### RetObject = ", RetObject)
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
@ -733,3 +893,306 @@ def Get_Given_Ressource_Humaine(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la personne "
|
||||
|
||||
"""
|
||||
Cette fonction ajoute une image de profil d'un stagaire
|
||||
"""
|
||||
def Update_Ressource_Humaine_Image(file_img=None, Folder=None, diction=None):
|
||||
try:
|
||||
|
||||
# Dictionnaire des champs utilisables
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['token', 'file_img_recid', 'rh_id' ]
|
||||
|
||||
|
||||
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'est pas autorisé ")
|
||||
return False, " Le champ '" + val + "' n'est pas accepté "
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
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, " La valeur '" + val + "' n'est pas presente dans liste "
|
||||
|
||||
# recuperation des paramettre
|
||||
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
|
||||
|
||||
|
||||
|
||||
rh_id = ""
|
||||
if ("rh_id" in diction.keys()):
|
||||
if diction['rh_id']:
|
||||
rh_id = diction['rh_id']
|
||||
|
||||
|
||||
if( file_img ):
|
||||
recordimage_diction = {}
|
||||
recordimage_diction['token'] = diction['token']
|
||||
recordimage_diction['related_collection'] = "ressource_humaine"
|
||||
recordimage_diction['type_img'] = "user"
|
||||
recordimage_diction['related_collection_recid'] = str(rh_id)
|
||||
recordimage_diction['image_recid'] = diction['file_img_recid']
|
||||
|
||||
|
||||
local_status, local_message = mycommon.recordClassImage_v2(file_img, MYSY_GV.upload_folder, recordimage_diction)
|
||||
if( local_status is False):
|
||||
return local_status, local_message
|
||||
|
||||
return True, "L'image a été correctement enregistrée"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'enregistrer l'image"
|
||||
|
||||
"""
|
||||
Suppresion d'un image d'une ressource humaine
|
||||
"""
|
||||
def DeleteImage_Ressource_Humaine(diction=None):
|
||||
try:
|
||||
|
||||
# Dictionnaire des champs utilisables
|
||||
field_list = ['token', 'image_recid', ]
|
||||
incom_keys = diction.keys()
|
||||
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
for val in incom_keys:
|
||||
if str(val).lower() not in str(field_list).lower():
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas accepté dans cette API")
|
||||
return False, " Impossible de se connecter"
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['token', 'image_recid']
|
||||
for val in field_list_obligatoire:
|
||||
if str(val).lower() not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La valeur '" + val + "' n'est pas presente dans liste des champs")
|
||||
return False, "Impossible de se connecter"
|
||||
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
|
||||
# recuperation des paramettre
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
image_recid = ""
|
||||
if ("image_recid" in diction.keys()):
|
||||
if diction['image_recid']:
|
||||
image_recid = diction['image_recid']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# " Lecture du fichier "
|
||||
# print(" Lecture du fichier : " + saved_file + ". le token est :" + str(mytoken))
|
||||
nb_line = 0
|
||||
coll_name = MYSY_GV.dbname['mysy_images']
|
||||
|
||||
query_delete = {"recid": image_recid,}
|
||||
|
||||
|
||||
ret_val = coll_name.delete_one({"recid": image_recid,}, )
|
||||
|
||||
|
||||
|
||||
print(" ### recordClassImage_v2 :L'image a été correctement supprimée ")
|
||||
return True, "L'image a été correctement supprimée"
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de supprimer l'image "
|
||||
|
||||
|
||||
""" Recuperation de l'image d'un employé
|
||||
|
||||
/!\ important : on prend le 'related_collection_recid' comme le '_id' de la collection inscription
|
||||
"""
|
||||
def getRecoded_Employee_Image_from_front(diction=None):
|
||||
try:
|
||||
# Dictionnaire des champs utilisables
|
||||
field_list = ['token', 'rh_id', ]
|
||||
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, requete annulée")
|
||||
return False, " Impossible de recuperer les informations"
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['token', 'rh_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, " Impossible de recuperer les informations"
|
||||
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
qery_images = {'locked': '0', 'valide': '1', 'related_collection': 'ressource_humaine',
|
||||
'related_collection_recid': str(diction['rh_id'])}
|
||||
|
||||
print(" ### qery_images = ", qery_images)
|
||||
|
||||
RetObject = []
|
||||
employee_images = {}
|
||||
# Recuperation des image 'logo' et 'cachet' si le partenaire en a
|
||||
for retVal in MYSY_GV.dbname['mysy_images'].find(qery_images):
|
||||
if ('type_img' in retVal.keys()):
|
||||
if (retVal['type_img'] == "user"):
|
||||
employee_images['logo_img'] = retVal['img'].decode()
|
||||
employee_images['logo_img_recid'] = retVal['recid']
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(employee_images))
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recupérer l'image de l'employé "
|
||||
|
||||
|
||||
"""
|
||||
Cette fontion retourne la liste des manager
|
||||
les personne qui ont statut manager à 1
|
||||
"""
|
||||
def Get_List_Manager_Ressource_Humaine(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:
|
||||
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']
|
||||
|
||||
# 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"
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données de l'utilisateur. "
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['ismanager'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['valide'] = "1"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['ressource_humaine'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
"""
|
||||
Si l'employé a un superieur_hierarchie_id, alors on va aller recuperer son nom et prenom.
|
||||
ce superieur est une ressource humaime
|
||||
"""
|
||||
superieur_hierarchie_nom = ""
|
||||
superieur_hierarchie_prenom = ""
|
||||
if( "superieur_hierarchie_id" in retval.keys() and retval['superieur_hierarchie_id']):
|
||||
hierarchi_data = MYSY_GV.dbname['ressource_humaine'].find_one({'_id':ObjectId(str(retval['superieur_hierarchie_id'])),
|
||||
'valide':'1', 'locked':'0'}, {'nom':1, 'prenom':1})
|
||||
if( hierarchi_data is None):
|
||||
superieur_hierarchie_nom = ""
|
||||
superieur_hierarchie_prenom = ""
|
||||
|
||||
else:
|
||||
if ("superieur_hierarchie_nom" in hierarchi_data.keys()):
|
||||
superieur_hierarchie_nom = hierarchi_data['superieur_hierarchie_nom']
|
||||
|
||||
if ("superieur_hierarchie_prenom" in hierarchi_data.keys()):
|
||||
superieur_hierarchie_prenom = hierarchi_data['superieur_hierarchie_prenom']
|
||||
|
||||
user['superieur_hierarchie_nom'] = superieur_hierarchie_nom
|
||||
user['superieur_hierarchie_prenom'] = superieur_hierarchie_prenom
|
||||
|
||||
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 recuperer la liste des contact "
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ def get_customer_payement_cards(diction):
|
|||
|
||||
|
||||
|
||||
print(" ### RetObject = "+str( RetObject ))
|
||||
#print(" ### RetObject = "+str( RetObject ))
|
||||
|
||||
return True, RetObject, str(nb_carte)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue