14/12/2023 - 16h16

master
cherif 2023-12-14 16:16:27 +01:00
parent ba7b22c095
commit e75863f00e
7 changed files with 2569 additions and 16 deletions

View File

@ -1,10 +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="13/12/2023 - 23h30">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="14/12/2023 - 08h30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.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$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -75,13 +78,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00121" summary="02/10/2023 - 13h30">
<created>1696246488625</created>
<option name="number" value="00121" />
<option name="presentableId" value="LOCAL-00121" />
<option name="project" value="LOCAL" />
<updated>1696246488625</updated>
</task>
<task id="LOCAL-00122" summary="02/10/2023 - 22h30">
<created>1696277765206</created>
<option name="number" value="00122" />
@ -418,7 +414,14 @@
<option name="project" value="LOCAL" />
<updated>1702506480595</updated>
</task>
<option name="localTasksCounter" value="170" />
<task id="LOCAL-00170" summary="14/12/2023 - 08h30">
<created>1702540046306</created>
<option name="number" value="00170" />
<option name="presentableId" value="LOCAL-00170" />
<option name="project" value="LOCAL" />
<updated>1702540046307</updated>
</task>
<option name="localTasksCounter" value="171" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -433,7 +436,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="13/11/2023 - 12h30" />
<MESSAGE value="13/11/2023 - 22h30" />
<MESSAGE value="14/11/2023 - 12h" />
<MESSAGE value="14/11/2023 - 20h" />
@ -458,6 +460,7 @@
<MESSAGE value="11/12/2023 - 20h30" />
<MESSAGE value="12/12/2023 - 22h30" />
<MESSAGE value="13/12/2023 - 23h30" />
<option name="LAST_COMMIT_MESSAGE" value="13/12/2023 - 23h30" />
<MESSAGE value="14/12/2023 - 08h30" />
<option name="LAST_COMMIT_MESSAGE" value="14/12/2023 - 08h30" />
</component>
</project>

View File

@ -54,7 +54,7 @@ def Add_Contact(diction):
"telephone", "website", "comment",'adr_adresse', 'adr_code_postal',
'adr_ville', 'adr_pays', 'type', 'telephone_mobile', 'linkedin',
'facebook', 'twitter', 'related_collection',
'prenom', 'fonction', 'civilite', 'related_collection_owner_id']
'prenom', 'fonction', 'civilite', 'related_collection_owner_id', 'include_com']
incom_keys = diction.keys()
for val in incom_keys:
@ -132,6 +132,11 @@ def Add_Contact(diction):
prenom = diction['prenom']
data['prenom'] = prenom
include_com = "0"
if ("include_com" in diction.keys()):
include_com = diction['include_com']
data['include_com'] = include_com
fonction = ""
if ("fonction" in diction.keys()):
@ -305,7 +310,7 @@ def Update_Contact(diction):
"telephone", "website", "comment",'adr_adresse', 'adr_code_postal',
'adr_ville', 'adr_pays', 'type', 'telephone_mobile', 'linkedin',
'facebook', 'twitter', 'prenom', 'fonction', 'civilite',
'_id']
'_id', 'include_com']
incom_keys = diction.keys()
@ -386,6 +391,12 @@ def Update_Contact(diction):
civilite = diction['civilite']
data_update['civilite'] = diction['civilite']
include_com = ""
if ("include_com" in diction.keys()):
include_com = diction['include_com']
data_update['include_com'] = diction['include_com']
prenom = ""
if ("prenom" in diction.keys()):
prenom = diction['prenom']
@ -665,3 +676,80 @@ def Get_Given_Contact(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 le contact "
"""
Fonction de suppression d'un contact
"""
def Delete_Given_Contact(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_id', 'related_collection', 'related_collection_owner_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', '_id', 'related_collection', 'related_collection_owner_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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_recid'] = str(my_partner['recid'])
data_cle['_id'] = ObjectId(str(diction['_id']))
data_cle['related_collection'] = str(diction['related_collection'])
data_cle['related_collection_recid'] = str(diction['related_collection_owner_id'])
data_cle['valide'] = "1"
data_cle['locked'] = "0"
# Verifier la validité du contact
is_contact_is_valide = MYSY_GV.dbname['contact'].count_documents(data_cle)
if( is_contact_is_valide != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du contact est invalide ")
return False, " L'identifiant du contact est invalide ",
# Supression à faire
MYSY_GV.dbname['contact'].delete_one( data_cle)
#print(" ### RetObject = ", RetObject)
return True, " Le contact a été correctement supprimé"
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 le contact "

File diff suppressed because it is too large Load Diff

View File

@ -4698,3 +4698,72 @@ def Duplicate_Class_from_internal_url(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 dupliquer la formation"
"""
Liste de deroulante des niveaux de formation
"""
def Get_List_Class_Niveau_Formation(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 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',]
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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = "default"
data_cle['valide'] = "1"
data_cle['locked'] = "0"
#print(" ### Get_Partner_List_Partner_Client data_cle = ", data_cle)
RetObject = []
val_tmp = 1
for retval in MYSY_GV.dbname['class_niveau_formation'].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 récupérer la liste des types des niveaux de formation"

51
main.py
View File

@ -2342,6 +2342,20 @@ def Duplicate_Class_from_internal_url():
return jsonify(status=localStatus, message=message )
"""
API pour recuperer la liste des niveaux de formation
"""
@app.route('/myclass/api/Get_List_Class_Niveau_Formation/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Class_Niveau_Formation():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Class_Niveau_Formation : payload = ",str(payload))
localStatus, message= cm.Get_List_Class_Niveau_Formation(payload)
return jsonify(status=localStatus, message=message )
"""
API d'envoi de la liste d'emargement
@ -3851,6 +3865,19 @@ def Delete_Client_Type():
return jsonify(status=localStatus, message=message)
"""
API de recuperation des contacts d'un client inclus dans la communication
"""
@app.route('/myclass/api/Get_Partner_Client_Communication_Contact/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Partner_Client_Communication_Contact():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Partner_Client_Communication_Contact : payload = ",payload)
localStatus, message = partner_client.Get_Partner_Client_Communication_Contact(payload)
return jsonify(status=localStatus, message=message)
"""
@ -3916,6 +3943,17 @@ def Get_Given_Contact():
localStatus, message = Contact.Get_Given_Contact(payload)
return jsonify(status=localStatus, message=message)
"""
API de suppression d'un contact
"""
@app.route('/myclass/api/Delete_Given_Contact/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Given_Contact():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Given_Contact : payload = ",payload)
localStatus, message = Contact.Delete_Given_Contact(payload)
return jsonify(status=localStatus, message=message)
"""
@ -4547,6 +4585,19 @@ def Get_List_Employee_Contrat():
return jsonify(status=status, message=retval)
""""
API de recuperation des types de contrat
"""
@app.route('/myclass/api/Get_Type_Contrat_List/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Type_Contrat_List():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Type_Contrat_List payload = ",payload)
status, retval = ressources_humaines.Get_Type_Contrat_List(payload)
return jsonify(status=status, message=retval)

View File

@ -25,6 +25,7 @@ import GlobalVariable as MYSY_GV
import ela_index_bdd_classes as eibdd
import email_mgt as email
import ast
import Contact as contact
def Add_Partner_Client(diction):
@ -1590,3 +1591,92 @@ def Delete_Client_Type(diction):
"""
Cette fonction retourne les contact d'un client qui
doivent etre inlus dans les communication .
Avec le fonction contact.Get_List_Entity_Contact(), on recuperer la liste des contacts
en suite on regarde le quel a la communication incluse
"""
def Get_Partner_Client_Communication_Contact(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token','_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','_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
# Verifier la validité du client
is_client_exist_valide = MYSY_GV.dbname['partner_client'].count_documents({"_id":ObjectId(str(diction['_id'])),
'valide': '1',
'locked':'0',
'partner_recid':str(my_partner['recid'])})
if( is_client_exist_valide <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - L'identifiant du client est invalide ")
return False, " L'identifiant du client est invalide ",
# field_list = ['token', 'related_collection', 'related_collection_owner_id']
new_diction = {}
new_diction['token'] = diction['token']
new_diction['related_collection'] = "partner_client"
new_diction['related_collection_owner_id'] = diction['_id']
new_diction['partner_recid'] = my_partner['recid']
new_diction['valide'] = "1"
new_diction['locked'] = "0"
new_diction['include_com'] = "1"
local_status, local_retval = contact.Get_List_Entity_Contact()
#print(" ### Get_Partner_List_Partner_Client data_cle = ", data_cle)
RetObject = []
val_tmp = 1
for retval in MYSY_GV.dbname['contact'].find(new_diction):
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 récupérer la liste des contacts du client inclus dans la communication "

View File

@ -3328,7 +3328,7 @@ def Add_Employee_Contrat(diction):
Verification des input acceptés
"""
field_list = ['token', 'rh_id', 'date_debut', 'date_fin', 'type_contrat',
'type_employe', 'cout', 'groupe_prix_achat_id']
'type_employe', 'cout', 'groupe_prix_achat_id', 'quantite', 'comment']
incom_keys = diction.keys()
for val in incom_keys:
@ -3431,7 +3431,7 @@ def Add_Employee_Contrat(diction):
'locked': '0',
'partner_owner_recid': str( my_partner['recid'])}
print(" #### qry = ", qry)
for retVal in MYSY_GV.dbname['ressource_humaine_contrat'].find({'rh_id': str(diction['rh_id']),
'valide': '1',
'locked': '0',
@ -3469,6 +3469,22 @@ def Add_Employee_Contrat(diction):
inspect.stack()[0][3]) + " Le cout n'est pas valide ")
return False, " Le cout n'est pas valide "
# S'il y a une quantité, verifier que le qté est un entie
if ("quantite" in diction.keys() and diction['quantite']):
local_status, local_retval = mycommon.IsFloat(diction['quantite'])
if (local_status is False):
mycommon.myprint(str(
inspect.stack()[0][3]) + " La quantite n'est pas valide ")
return False, " La quantite n'est pas valide "
# S'il y a un commentaire > 255 caractères
if ("comment" in diction.keys() and diction['comment']):
if (len(str(diction['comment'])) > 255):
mycommon.myprint(str(
inspect.stack()[0][3]) + " Le commentaire du contrat fait plus de 255 caractères ")
return False, " Le commentaire du contrat fait plus de 255 caractères "
new_data = diction
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -3505,7 +3521,7 @@ def Update_Employee_Contrat(diction):
Verification des input acceptés
"""
field_list = ['token', '_id', 'rh_id', 'date_debut', 'date_fin', 'type_contrat',
'type_employe', 'cout', 'groupe_prix_achat_id']
'type_employe', 'cout', 'groupe_prix_achat_id', 'quantite', 'comment']
incom_keys = diction.keys()
for val in incom_keys:
@ -3659,6 +3675,21 @@ def Update_Employee_Contrat(diction):
inspect.stack()[0][3]) + " Le cout n'est pas valide ")
return False, " Le cout n'est pas valide "
# S'il y a une quantité, verifier que le qté est un entie
if ("quantite" in diction.keys() and diction['quantite']):
local_status, local_retval = mycommon.IsFloat(diction['quantite'])
if (local_status is False):
mycommon.myprint(str(
inspect.stack()[0][3]) + " La quantite n'est pas valide ")
return False, " La quantite n'est pas valide "
# S'il y a un commentaire > 255 caractères
if ("comment" in diction.keys() and diction['comment']):
if (len(str(diction['comment'])) > 255 ):
mycommon.myprint(str(
inspect.stack()[0][3]) + " Le commentaire du contrat fait plus de 255 caractères ")
return False, " Le commentaire du contrat fait plus de 255 caractères "
local_id = diction['_id']
new_data = diction
del new_data['token']
@ -3928,3 +3959,71 @@ def Get_List_Employee_Contrat(diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de recuperer la liste des contrat "
"""
Cett fonction permet de recuperer les types de contrat
"""
def Get_Type_Contrat_List(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 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',]
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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = "default"
data_cle['valide'] = "1"
data_cle['locked'] = "0"
#print(" ### Get_Partner_List_Partner_Client data_cle = ", data_cle)
RetObject = []
val_tmp = 1
for retval in MYSY_GV.dbname['contrat_type'].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 récupérer la liste des types de contrat"