31/12/2023- 18h

master
cherif 2023-12-31 18:06:14 +01:00
parent 32447fa2bd
commit 69a594865f
11 changed files with 4482 additions and 40 deletions

View File

@ -2,18 +2,17 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="29/12/2023- 12h">
<change afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dashbord_queries/formation_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/formation_tbd_qries.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.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$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" 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$/data_dict.csv" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/data_indexees_article_avis.csv" beforeDir="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$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@ -71,7 +71,7 @@ def AddStagiairetoClass(diction):
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com','date_naissance'
]
incom_keys = diction.keys()
@ -109,9 +109,8 @@ def AddStagiairetoClass(diction):
session_id = ""
if ("session_id" in diction.keys()):
if diction['session_id']:
mydata['session_id'] = str(diction['session_id']).strip()
session_id = str(diction['session_id']).strip()
mydata['session_id'] = session_id
"""
@ -137,6 +136,21 @@ def AddStagiairetoClass(diction):
apprenant_id = str(diction['apprenant_id']).strip()
mydata['apprenant_id'] = str(apprenant_id)
date_naissance = ""
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
local_status = mycommon.CheckisDate(date_naissance)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de naissance n'est pas au format 'jj/mm/aaaa' ")
return False, " La date de naissance n'est pas au format 'jj/mm/aaaa' "
mydata['date_naissance'] = str(date_naissance)
"""
Recuperation des info de la session de formation
@ -562,7 +576,8 @@ def UpdateStagiairetoClass(diction):
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'type_apprenant', 'civilite'
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'type_apprenant', 'civilite',
'date_naissance'
]
incom_keys = diction.keys()
@ -655,6 +670,21 @@ def UpdateStagiairetoClass(diction):
if ("civilite" in diction.keys()):
mydata['civilite'] = str(diction['civilite']).strip()
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
local_status = mycommon.CheckisDate(date_naissance)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de naissance n'est pas au format 'jj/mm/aaaa' ")
return False, " La date de naissance n'est pas au format 'jj/mm/aaaa' "
mydata['date_naissance'] = str(date_naissance)
if ("price" in diction.keys()):
mydata['price'] = str(diction['price']).strip()
@ -5933,6 +5963,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
val['civilite'] = ""
if( "modefinancement" in retVal.keys()):
val['modefinancement'] = retVal['modefinancement']
else:
@ -5954,6 +5985,32 @@ def Get_Statgaire_List_Partner_with_filter(diction):
else:
val['telephone'] = ""
if ("date_naissance" in retVal.keys()):
val['date_naissance'] = retVal['date_naissance']
else:
val['date_naissance'] = ""
if ("adresse" in retVal.keys()):
val['adresse'] = retVal['adresse']
else:
val['adresse'] = ""
if ("code_postal" in retVal.keys()):
val['code_postal'] = retVal['code_postal']
else:
val['code_postal'] = ""
if ("ville" in retVal.keys()):
val['ville'] = retVal['ville']
else:
val['ville'] = ""
if ("pays" in retVal.keys()):
val['pays'] = retVal['pays']
else:
val['pays'] = ""
val['status'] = retVal['status']
@ -6046,7 +6103,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
"""
if ('apprenant_collection' in retVal.keys() and len( retVal['apprenant_collection']) > 0):
if ("civilite" in retVal['apprenant_collection'][0].keys()):
val['civilite'] = str(retVal['apprenant_collection'][0]['ville'])
val['civilite'] = str(retVal['apprenant_collection'][0]['civilite'])
else:
val['civilite'] = ""
@ -6060,6 +6117,33 @@ def Get_Statgaire_List_Partner_with_filter(diction):
local_prenom = retVal['apprenant_collection'][0]['prenom']
val['prenom'] = local_prenom
if ("date_naissance" in retVal['apprenant_collection'][0].keys()):
val['date_naissance'] = retVal['apprenant_collection'][0]['date_naissance']
else:
val['date_naissance'] = ""
if ("adresse" in retVal['apprenant_collection'][0].keys()):
val['adresse'] = retVal['apprenant_collection'][0]['adresse']
else:
val['adresse'] = ""
if ("code_postal" in retVal['apprenant_collection'][0].keys()):
val['code_postal'] = retVal['apprenant_collection'][0]['code_postal']
else:
val['code_postal'] = ""
if ("ville" in retVal['apprenant_collection'][0].keys()):
val['ville'] = retVal['apprenant_collection'][0]['ville']
else:
val['ville'] = ""
if ("pays" in retVal['apprenant_collection'][0].keys()):
val['pays'] = retVal['apprenant_collection'][0]['pays']
else:
val['pays'] = ""
local_employeur = ""
if ("employeur" in retVal['apprenant_collection'][0].keys()):
local_employeur = retVal['apprenant_collection'][0]['employeur']

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ def Add_Apprenant(diction):
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'civilite'
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'civilite', 'date_naissance'
]
incom_keys = diction.keys()
@ -110,6 +110,20 @@ def Add_Apprenant(diction):
return False, " Il y a déjà un apprenant avec la même adresse email : '" + str(diction['email']) + "' "
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
local_status = mycommon.CheckisDate(date_naissance)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de naissance n'est pas au format 'jj/mm/aaaa' ")
return False, " La date de naissance n'est pas au format 'jj/mm/aaaa' "
# Verifier l'adresse email du tuteur 1
if ("tuteur1_email" in diction.keys() and diction['tuteur1_email']):
@ -215,7 +229,7 @@ def Update_Apprenant(diction):
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'civilite'
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'civilite', 'date_naissance'
]
incom_keys = diction.keys()
@ -267,6 +281,19 @@ def Update_Apprenant(diction):
str(inspect.stack()[0][3]) + " L'adresse email '" + str(diction['email']) + "' n'est pas valide")
return False, " L'adresse email '" + str(diction['email']) + "' n'est pas valide ",
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
local_status = mycommon.CheckisDate(date_naissance)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de naissance n'est pas au format 'jj/mm/aaaa' ")
return False, " La date de naissance n'est pas au format 'jj/mm/aaaa' "
# Verifier l'adresse email du tuteur 1
if ("tuteur1_email" in diction.keys() and diction['tuteur1_email']):
if (mycommon.isEmailValide(str(diction['tuteur1_email'])) is False):
@ -762,24 +789,25 @@ def Get_Apprenant_List_Partner_with_filter(diction):
filt_nom = {'nom': {'$regex': str(diction['nom']), "$options": "i"}}
filt_prenom = {}
if ("nom" in diction.keys()):
if ("prenom" in diction.keys()):
filt_prenom = {'prenom': {'$regex': str(diction['prenom']), "$options": "i"}}
filt_class_partner_recid = {'partner_owner_recid': str(my_partner['recid'])}
query = [{'$match': {'$and': [filt_email, filt_nom, {'partner_owner_recid': str(my_partner['recid'])}]}},
query = [{'$match': {'$and': [filt_email, filt_nom, filt_prenom, {'partner_owner_recid': str(my_partner['recid'])}]}},
]
print("#### Get_Apprenant_List_Partner_with_filter laa 01 : query = ", query)
RetObject = []
cpt = 1
for retVal in MYSY_GV.dbname['inscription'].aggregate(query):
for retVal in MYSY_GV.dbname['apprenant'].aggregate(query):
val = retVal
val['id'] = str(cpt)
cpt = cpt + 1
RetObject.append(mycommon.JSONEncoder().encode(val))
return True, RetObject
except Exception as e:

View File

@ -2328,10 +2328,19 @@ def get_partner_class(diction):
"""
val_tmp = 1
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"
currency = mycommon.Get_Partner_Currency(str(my_partner['recid']))
if (currency is False):
currency = ""
for retVal in coll_name.find( {"$and":[ {'valide':'1'},{'locked':'0'},
{'partner_owner_recid':user_recid} ,
filt_external_code, filt_title, filt_internal_url]},
{'programme':0, 'objectif':0, 'indexed':0, 'indexed_desc':0,
'indexed_obj':0, 'indexed_title':0, 'description':0}
):
#print(" #### retVal = ", retVal)
@ -2346,6 +2355,17 @@ def get_partner_class(diction):
if ("metier" not in retVal.keys()):
retVal['metier'] = ""
if ("duration" not in retVal.keys()):
retVal['duration'] = ""
if ("duration_unit" not in retVal.keys()):
retVal['duration_unit'] = ""
if ("pourqui" not in retVal.keys()):
retVal['pourqui'] = ""
if ("presentiel" not in retVal.keys()):
retVal['presentiel'] = {'presentiel':'0', 'distantiel':'0'}
if ("price" not in retVal.keys()):
retVal['price'] = "0"
@ -2416,6 +2436,15 @@ def get_partner_class(diction):
user['zone_diffusion_str'] = str(tmp_zone_diffusion[:-1])
if ("duration" in user.keys() and "duration_unit" in user.keys() and str(user['duration_unit']) == "jour" ):
duration_in_hour = mycommon.tryFloat(user['duration']) * mycommon.tryFloat(nb_hour_per_day)
if (duration_in_hour):
user['duration_in_hour'] = str(duration_in_hour)
else:
user['duration_in_hour'] = ""
user['currecny'] = currency
RetObject.append(JSONEncoder().encode(user))
val_tmp = val_tmp + 1
@ -2510,6 +2539,10 @@ def find_partner_class_like(diction):
Il dont obligatoirement est en mode connecté
'''
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({'token':str(diction['token'])})
if (local_status is not True):
return local_status, my_partner
user_recid = "None"
# Verification de la validité du token/mail dans le cas des user en mode connecté
if (len(str(my_token)) > 0):
@ -2550,12 +2583,27 @@ def find_partner_class_like(diction):
print(" ##### find_partner_class_like_local_qry = ", find_partner_class_like_local_qry)
"""
Recuperation du nombre d'heure par jour depuis la confif du 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"
currency = mycommon.Get_Partner_Currency(str(my_partner['recid']))
if (currency is False):
currency = ""
val_tmp = 1
for retVal in coll_name.find({"$and": [{'valide': '1'}, {'locked': '0'},
{'partner_owner_recid': user_recid},
filt_external_code, filt_title, filt_internal_url]},
{'programme':0, 'objectif': 0, 'indexed': 0, 'indexed_desc': 0,
'indexed_obj': 0, 'indexed_title': 0, 'description':0}
):
# mycommon.myprint(str(retVal))
#mycommon.myprint(str(retVal))
user = retVal
if ("title" not in retVal.keys()):
retVal['title'] = ""
@ -2563,7 +2611,20 @@ def find_partner_class_like(diction):
if ("domain" not in retVal.keys()):
retVal['domain'] = ""
if ("duration" not in retVal.keys()):
retVal['duration'] = ""
if ("duration_unit" not in retVal.keys()):
retVal['duration_unit'] = ""
if ("pourqui" not in retVal.keys()):
retVal['pourqui'] = ""
if ("presentiel" not in retVal.keys()):
retVal['presentiel'] = {'presentiel':'0', 'distantiel':'0'}
if ("metier" not in retVal.keys()):
retVal['metier'] = ""
@ -2586,8 +2647,6 @@ def find_partner_class_like(diction):
user['id'] = str(val_tmp)
'''
@ -2605,6 +2664,17 @@ def find_partner_class_like(diction):
i = i + 1
user['zone_diffusion_str'] = str(tmp_zone_diffusion[:-1])
if ("duration" in user.keys() and "duration_unit" in user.keys() and str(user['duration_unit']) == "jour" ):
duration_in_hour = mycommon.tryFloat(user['duration']) * mycommon.tryFloat(nb_hour_per_day)
if(duration_in_hour ):
user['duration_in_hour'] = str(duration_in_hour)
else:
user['duration_in_hour'] = ""
user['currecny'] = currency
RetObject.append(JSONEncoder().encode(user))
val_tmp = val_tmp + 1

View File

@ -1,5 +0,0 @@
,index,Mots,Occurence,Moyenne,id_formation
0,0,updat,1,0.25,Cmpt_01
1,1,descript,1,0.25,Cmpt_01
2,2,comptabilit,1,0.25,Cmpt_01
3,3,nul,1,0.25,Cmpt_01
1 index Mots Occurence Moyenne id_formation
2 0 0 updat 1 0.25 Cmpt_01
3 1 1 descript 1 0.25 Cmpt_01
4 2 2 comptabilit 1 0.25 Cmpt_01
5 3 3 nul 1 0.25 Cmpt_01

View File

@ -1,4 +0,0 @@
,index,mots,occurence,moyenne,id_formation,source_field,partner_owner_recid
0,0,achat,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
1,1,niveau,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
2,2,negociation,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
1 index mots occurence moyenne id_formation source_field partner_owner_recid
2 0 0 achat 1 0.33 178 title dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
3 1 1 niveau 1 0.33 178 title dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
4 2 2 negociation 1 0.33 178 title dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot

View File

@ -1,2 +0,0 @@
,index,mots,occurence,moyenne,id_article_avis,source_field
0,0,formation4,0,0.0,formation4,default
1 index mots occurence moyenne id_article_avis source_field
2 0 0 formation4 0 0.0 formation4 default

View File

@ -3081,6 +3081,11 @@ def GetAttendeeDetail_perSession(diction):
else:
my_retrun_dict['civilite'] = ""
if ("date_naissance" in local_Insc_retval.keys()):
my_retrun_dict['date_naissance'] = local_Insc_retval['date_naissance']
else:
my_retrun_dict['date_naissance'] = ""
if ("code_session" in local_Insc_retval['inscription_collectoin'][0].keys()):
my_retrun_dict['code_session'] = str(local_Insc_retval['inscription_collectoin'][0]['code_session'])
@ -3222,6 +3227,32 @@ def GetAttendeeDetail_perSession(diction):
local_prenom = local_Insc_retval['prenom']
my_retrun_dict['prenom'] = local_prenom
if ("date_naissance" in local_Insc_retval.keys()):
my_retrun_dict['date_naissance'] = local_Insc_retval['date_naissance']
else:
my_retrun_dict['date_naissance'] = ""
if ("adresse" in local_Insc_retval.keys()):
my_retrun_dict['adresse'] = local_Insc_retval['adresse']
else:
my_retrun_dict['adresse'] = ""
if ("code_postal" in local_Insc_retval.keys()):
my_retrun_dict['code_postal'] = local_Insc_retval['code_postal']
else:
my_retrun_dict['code_postal'] = ""
if ("ville" in local_Insc_retval.keys()):
my_retrun_dict['ville'] = local_Insc_retval['ville']
else:
my_retrun_dict['ville'] = ""
if ("pays" in local_Insc_retval.keys()):
my_retrun_dict['pays'] = local_Insc_retval['pays']
else:
my_retrun_dict['pays'] = ""
local_employeur = ""
if ("employeur" in local_Insc_retval.keys()):
local_employeur = local_Insc_retval['employeur']
@ -3332,6 +3363,11 @@ def GetAttendeeDetail_perSession(diction):
else:
my_retrun_dict['civilite'] = ""
if ("date_naissance" in local_Insc_retval['apprenant_collection'][0].keys()):
my_retrun_dict['date_naissance'] = str(local_Insc_retval['apprenant_collection'][0]['date_naissance'])
else:
my_retrun_dict['date_naissance'] = ""
local_nom = ""
if ("nom" in local_Insc_retval['apprenant_collection'][0].keys()):
local_nom = local_Insc_retval['apprenant_collection'][0]['nom']
@ -3342,6 +3378,32 @@ def GetAttendeeDetail_perSession(diction):
local_prenom = local_Insc_retval['apprenant_collection'][0]['prenom']
my_retrun_dict['prenom'] = local_prenom
if ("date_naissance" in local_Insc_retval['apprenant_collection'][0].keys()):
my_retrun_dict['date_naissance'] = local_Insc_retval['apprenant_collection'][0]['date_naissance']
else:
my_retrun_dict['date_naissance'] = ""
if ("adresse" in local_Insc_retval['apprenant_collection'][0].keys()):
my_retrun_dict['adresse'] = local_Insc_retval['apprenant_collection'][0]['adresse']
else:
my_retrun_dict['adresse'] = ""
if ("code_postal" in local_Insc_retval['apprenant_collection'][0].keys()):
my_retrun_dict['code_postal'] = local_Insc_retval['apprenant_collection'][0]['code_postal']
else:
my_retrun_dict['code_postal'] = ""
if ("ville" in local_Insc_retval['apprenant_collection'][0].keys()):
my_retrun_dict['ville'] = local_Insc_retval['apprenant_collection'][0]['ville']
else:
my_retrun_dict['ville'] = ""
if ("pays" in local_Insc_retval['apprenant_collection'][0].keys()):
my_retrun_dict['pays'] = local_Insc_retval['apprenant_collection'][0]['pays']
else:
my_retrun_dict['pays'] = ""
local_employeur = ""
if ("employeur" in local_Insc_retval['apprenant_collection'][0].keys()):
local_employeur = local_Insc_retval['apprenant_collection'][0]['employeur']
@ -4579,4 +4641,89 @@ def Get_Dictionnary_data_For_Template(diction):
return False, " Impossible de récupérer le dictionnaire pour les template"
"""
Recuperation du nombre d'heure par jour depuis la confif du partner
"""
def Get_Partner_Hour_Per_Day(partner_owner_recid):
try:
hour_per_day_value = "0"
hour_per_day = MYSY_GV.dbname['base_partner_setup'].find_one({'config_name':"partner_jour_heure",
'valide':'1',
'locked':'0',
'partner_owner_recid':str(partner_owner_recid)})
if(hour_per_day is None ):
myprint(str(
inspect.stack()[0][3]) + " WARNING : Le partner (partner_owner_recid = "+str(partner_owner_recid)+" ) n'a pas de configuration pour la convertion jour / heure."
" Utilisation de la convertion par defaut ")
hour_per_day = MYSY_GV.dbname['base_partner_setup'].find_one({'config_name': "partner_jour_heure",
'valide': '1',
'locked': '0',
'partner_owner_recid': "default"})
if (hour_per_day is None):
myprint(str(
inspect.stack()[0][3]) + " WARNING : Auncune configuration par defaut pour la convertion jour / heure."
" Fixation unilaterale à 1 jour = 7 h ")
hour_per_day_value = "7"
else:
hour_per_day_value = str(hour_per_day['config_value'])
else:
hour_per_day_value = str(hour_per_day['config_value'])
return hour_per_day_value
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False
"""
Recuperation de la devise du partner dans jour depuis la confif du partner
"""
def Get_Partner_Currency(partner_owner_recid):
try:
currency_value = "euro"
currency = MYSY_GV.dbname['base_partner_setup'].find_one({'config_name':"partner_devise",
'valide':'1',
'locked':'0',
'partner_owner_recid':str(partner_owner_recid)})
if(currency is None ):
myprint(str(
inspect.stack()[0][3]) + " WARNING : Le partner (partner_owner_recid = "+str(partner_owner_recid)+" ) n'a pas de configuration de devise."
" Utilisation de la devise par defaut du systeme")
currency = MYSY_GV.dbname['base_partner_setup'].find_one({'config_name': "partner_devise",
'valide': '1',
'locked': '0',
'partner_owner_recid': "default"})
if (currency is None):
myprint(str(
inspect.stack()[0][3]) + " WARNING : Auncune configuration par defaut pour la devise du systeme."
" Fixation unilaterale à l'euro ")
currency_value = "euro"
else:
currency_value = str(currency['config_value'])
else:
currency_value = str(currency['config_value'])
return currency_value
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False

View File

@ -186,7 +186,7 @@ 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', 'superieur_hierarchie_id', 'ismanager',
'groupe_prix_achat_id', 'prix_achat', 'type_contrat', 'gategorie'
'groupe_prix_achat_id', 'prix_achat', 'type_contrat', 'gategorie', 'date_naissance'
]
incom_keys = diction.keys()
@ -257,6 +257,21 @@ def Add_Ressource_Humaine(diction):
data['prenom'] = prenom
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
local_status = mycommon.CheckisDate(date_naissance)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de naissance n'est pas au format 'jj/mm/aaaa' ")
return False, " La date de naissance n'est pas au format 'jj/mm/aaaa' "
data['date_naissance'] = str(date_naissance)
groupe_prix_achat_id = ""
if ("groupe_prix_achat_id" in diction.keys()):
if diction['groupe_prix_achat_id']:
@ -498,7 +513,8 @@ def Update_Ressource_Humaine(diction):
"telephone", "website", "comment",'adr_adresse', 'adr_code_postal',
'adr_ville', 'adr_pays', 'profil', 'telephone_mobile', 'linkedin',
'facebook', 'twitter', '_id', 'prenom', 'fonction', 'civilite',
'superieur_hierarchie_id', 'ismanager', 'groupe_prix_achat_id', 'prix_achat', 'type_contrat', 'gategorie']
'superieur_hierarchie_id', 'ismanager', 'groupe_prix_achat_id', 'prix_achat', 'type_contrat',
'gategorie', 'date_naissance']
incom_keys = diction.keys()
@ -588,6 +604,20 @@ def Update_Ressource_Humaine(diction):
if ("civilite" in diction.keys()):
data_update['civilite'] = diction['civilite']
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
local_status = mycommon.CheckisDate(date_naissance)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de naissance n'est pas au format 'jj/mm/aaaa' ")
return False, " La date de naissance n'est pas au format 'jj/mm/aaaa' "
data_update['date_naissance'] = str(date_naissance)
groupe_prix_achat_id = ""
if ("groupe_prix_achat_id" in diction.keys()):
groupe_prix_achat_id = diction['groupe_prix_achat_id']

View File

@ -1,3 +1,4 @@
import ast
import pymongo
import zeep
@ -795,13 +796,103 @@ def mysylmsdb():
def test_web_service(diction):
try:
if( diction ):
print(" ### diction dans la fonction = ", diction)
else:
print(" ### diction dans la fonction est vide")
"""
Algorithme :
1 - Pour chaque employé, aller chercher ses contrats valides de la periode. Completer ce tableaux avec les données du contrat
mettre dans une tableau en local
2 - Pour chaque tache de l'employée, aller chercher le contrat qui correspond à la periode de la tache
- Peupler ce tableau avec : tache (agenda), contrat (data), employé (data)
"""
return True, "Test WebService OK Diction = "+str(diction)
local_qry = ( [
{ '$match': {'_id':ObjectId('6509a1adaca6e5023d7af487')}},
{'$lookup': {
'from': 'agenda',
'let': { 'rh_id': {'$toString': '$_id'} , 'rh_partner_owner_recid':'$partner_recid'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ['$valide', '1']},
{'$eq': ['$related_collection_recid', '$$rh_id']},
{'$eq': ['$partner_owner_recid', '$$rh_partner_owner_recid']}
]
}
}
},
{"$project": {"_id": 0,} }
],
'as': 'collection_agenda'
}
},
{'$lookup': {
'from': 'ressource_humaine_contrat',
'let': { 'rh_id': {'$toString': '$_id'} , 'rh_partner_owner_recid':'$partner_recid'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ['$valide', '1']},
{'$eq': ['$rh_id', '$$rh_id']},
{'$eq': ['$partner_owner_recid', '$$rh_partner_owner_recid']}
]
}
}
},
{"$project": {"_id": 0,} }
],
'as': 'collection_ressource_humaine_contrat'
}
},
])
cpt = 0
for retval in MYSY_GV.dbname['ressource_humaine'].aggregate(local_qry):
print(" ### retval = ",retval)
cpt = cpt +1
del retval['_id']
#del retval['collection_agenda']['_id']
#del retval['collection_ressource_humaine_contrat']['_id']
print(" ### retval = ", retval)
json_string = json.dumps(retval)
#json_object = json.loads(str(retval))
json_formatted_str = json.dumps(retval, indent=2)
print(json_formatted_str)
print(' on a '+str(cpt)+' lignes ')
return True, "Test WebService OK Diction "
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()