08/01/24 - 22h30
parent
12c7b652b0
commit
e432dcfd84
|
@ -4,10 +4,7 @@
|
|||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="06/01/24 - 20h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
1704
Log/log_file.log
1704
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -402,7 +402,7 @@ def Add_Ressource_Humaine(diction):
|
|||
prenom = diction['prenom']
|
||||
data['prenom'] = prenom
|
||||
|
||||
|
||||
date_naissance = ""
|
||||
if ("date_naissance" in diction.keys()):
|
||||
if diction['date_naissance']:
|
||||
date_naissance = str(diction['date_naissance']).strip()
|
||||
|
@ -593,6 +593,9 @@ def Add_Ressource_Humaine(diction):
|
|||
profil = diction['profil']
|
||||
|
||||
Rh_profil_count = MYSY_GV.dbname['ressource_humaine_profil'].count_documents({'profil_nom':str(profil), 'valide':'1', 'locked':'0'})
|
||||
|
||||
qry = {'profil_nom':str(profil), 'valide':'1', 'locked':'0'}
|
||||
|
||||
if( Rh_profil_count != 1):
|
||||
mycommon.myprint(
|
||||
"- Le type de profil "+str(profil)+" n'est pas autorisé")
|
||||
|
@ -667,7 +670,7 @@ def Update_Ressource_Humaine(diction):
|
|||
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")
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
|
||||
|
@ -750,6 +753,7 @@ def Update_Ressource_Humaine(diction):
|
|||
if ("civilite" in diction.keys()):
|
||||
data_update['civilite'] = diction['civilite']
|
||||
|
||||
date_naissance = ""
|
||||
if ("date_naissance" in diction.keys()):
|
||||
if diction['date_naissance']:
|
||||
date_naissance = str(diction['date_naissance']).strip()
|
||||
|
@ -761,7 +765,7 @@ def Update_Ressource_Humaine(diction):
|
|||
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)
|
||||
data_update['date_naissance'] = str(date_naissance)
|
||||
|
||||
|
||||
groupe_prix_achat_id = ""
|
||||
|
@ -828,13 +832,23 @@ def Update_Ressource_Humaine(diction):
|
|||
if ("superieur_hierarchie_id" in diction.keys()):
|
||||
data_update['superieur_hierarchie_id'] = diction['superieur_hierarchie_id']
|
||||
|
||||
|
||||
|
||||
profil = ""
|
||||
if ("profil" in diction.keys()):
|
||||
if diction['profil']:
|
||||
profil = diction['profil']
|
||||
data_update['profil'] = diction['profil']
|
||||
if (profil not in MYSY_GV.RESSOURCE_PROFIL):
|
||||
mycommon.myprint( "- Le type de profil " + str(profil) + " n'est pas autorisé")
|
||||
|
||||
Rh_profil_count = MYSY_GV.dbname['ressource_humaine_profil'].count_documents(
|
||||
{'profil_nom': str(profil), 'valide': '1', 'locked': '0'})
|
||||
|
||||
qry = {'profil_nom': str(profil), 'valide': '1', 'locked': '0'}
|
||||
|
||||
if (Rh_profil_count != 1):
|
||||
mycommon.myprint(
|
||||
"- Le type de profil " + str(profil) + " n'est pas autorisé")
|
||||
return False, "- Le type de profil " + str(profil) + " n'est pas autorisé"
|
||||
data_update['profil'] = profil
|
||||
|
||||
fonction = ""
|
||||
if ("fonction" in diction.keys()):
|
||||
|
@ -2103,7 +2117,7 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
|
|||
# Verification que les noms des colonne sont bien corrects"
|
||||
'''
|
||||
field_list = ['nom', 'prenom', 'email', 'telephone_mobile', 'telephone', 'profil', 'ismanager', 'superieur_hierarchie_email', 'civilite',
|
||||
'adresse', 'code_postal', 'ville', 'pays', 'facebook', 'fonction', 'linkedin', 'twitter']
|
||||
'adresse', 'code_postal', 'ville', 'pays', 'facebook', 'fonction', 'linkedin', 'twitter', 'date_naissance']
|
||||
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
|
@ -2148,13 +2162,19 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
|
|||
df['profil'].values[n]) + "- est invalide. Rapprochez de votre administrateur pour créer ce profil d'employé"
|
||||
|
||||
|
||||
mydata['ismanager'] = str(df['ismanager'].values[n])
|
||||
ismanager = str(df['ismanager'].values[n])
|
||||
|
||||
if( str(mydata['ismanager']).lower() not in ['1', '0', 'oui', 'non']):
|
||||
if( str(ismanager).lower() not in ['1', '0', 'oui', 'non']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ ismanager " + str(df['ismanager'].values[n]) + " est invalide. Les valeurs autorisées : 1, 0, oui, non")
|
||||
return False, " Le champ ismanager -" + str(df['ismanager'].values[n]) + "- est invalide. Les valeurs autorisées : 1, 0, oui, non"
|
||||
|
||||
if(str(ismanager) == "oui" ):
|
||||
mydata['ismanager'] = "1"
|
||||
elif (str(ismanager) == "non"):
|
||||
mydata['ismanager'] = "0"
|
||||
else:
|
||||
mydata['ismanager'] = ismanager
|
||||
|
||||
mydata['email'] = str(df['email'].values[n])
|
||||
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
|
||||
|
@ -2198,27 +2218,38 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
|
|||
|
||||
superieur_hierarchie_id = superieur_hierarchie_data['_id']
|
||||
|
||||
mydata['superieur_hierarchie_id'] = superieur_hierarchie_id
|
||||
|
||||
|
||||
mydata['superieur_hierarchie_id'] = superieur_hierarchie_id
|
||||
|
||||
mydata['token'] = str(my_token)
|
||||
|
||||
|
||||
telephone_mobile = ""
|
||||
if ("telephone_mobile" in df.keys()):
|
||||
if (str(df['telephone_mobile'].values[n])):
|
||||
telephone_mobile = str(df['telephone_mobile'].values[n])
|
||||
mydata['telephone_mobile'] = telephone_mobile
|
||||
mydata['telephone_mobile'] = telephone_mobile
|
||||
|
||||
date_naissance = ""
|
||||
if ("date_naissance" in df.keys()):
|
||||
if (str(df['date_naissance'].values[n])):
|
||||
date_naissance = str(df['date_naissance'].values[n])
|
||||
|
||||
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)
|
||||
|
||||
|
||||
telephone = ""
|
||||
if ("telephone" in df.keys()):
|
||||
if (str(df['telephone'].values[n])):
|
||||
telephone = str(df['telephone'].values[n])
|
||||
mydata['telephone'] = telephone
|
||||
mydata['telephone'] = telephone
|
||||
|
||||
civilite = "-1"
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys()):
|
||||
if (str(df['civilite'].values[n])):
|
||||
civilite = str(df['civilite'].values[n])
|
||||
|
@ -2229,69 +2260,63 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
|
|||
return False, " Le champ civilité -" + str(
|
||||
df['civilite'].values[n]) + "- est invalide. Les valeurs autorisées : 'm', 'mme', 'neutre' "
|
||||
|
||||
if( str(civilite).lower() == "m"):
|
||||
civilite = "1"
|
||||
elif (str(civilite).lower() == "mme"):
|
||||
civilite = "0"
|
||||
else:
|
||||
civilite = "-1"
|
||||
|
||||
mydata['civilite'] = civilite
|
||||
mydata['civilite'] = civilite
|
||||
|
||||
|
||||
ville = ""
|
||||
if ("ville" in df.keys()):
|
||||
if (str(df['ville'].values[n])):
|
||||
ville = str(df['ville'].values[n])
|
||||
mydata['adr_ville'] = ville
|
||||
mydata['adr_ville'] = ville
|
||||
|
||||
adresse = ""
|
||||
if ("adresse" in df.keys()):
|
||||
if (str(df['adresse'].values[n])):
|
||||
pays = str(df['adresse'].values[n])
|
||||
mydata['adr_adresse'] = adresse
|
||||
mydata['adr_adresse'] = adresse
|
||||
|
||||
code_postal = ""
|
||||
if ("code_postal" in df.keys()):
|
||||
if (str(df['code_postal'].values[n])):
|
||||
code_postal = str(df['code_postal'].values[n])
|
||||
mydata['adr_code_postal'] = code_postal
|
||||
mydata['adr_code_postal'] = code_postal
|
||||
|
||||
ville = ""
|
||||
if ("ville" in df.keys()):
|
||||
if (str(df['ville'].values[n])):
|
||||
ville = str(df['ville'].values[n])
|
||||
mydata['adr_ville'] = ville
|
||||
mydata['adr_ville'] = ville
|
||||
|
||||
pays = ""
|
||||
if ("pays" in df.keys()):
|
||||
if (str(df['pays'].values[n])):
|
||||
pays = str(df['pays'].values[n])
|
||||
mydata['adr_pays'] = pays
|
||||
mydata['adr_pays'] = pays
|
||||
|
||||
facebook = ""
|
||||
if ("facebook" in df.keys()):
|
||||
if (str(df['facebook'].values[n])):
|
||||
facebook = str(df['facebook'].values[n])
|
||||
mydata['facebook'] = facebook
|
||||
mydata['facebook'] = facebook
|
||||
|
||||
fonction = ""
|
||||
if ("fonction" in df.keys()):
|
||||
if (str(df['fonction'].values[n])):
|
||||
fonction = str(df['fonction'].values[n])
|
||||
mydata['fonction'] = fonction
|
||||
mydata['fonction'] = fonction
|
||||
|
||||
linkedin = ""
|
||||
if ("linkedin" in df.keys()):
|
||||
if (str(df['linkedin'].values[n])):
|
||||
linkedin = str(df['linkedin'].values[n])
|
||||
mydata['linkedin'] = linkedin
|
||||
mydata['linkedin'] = linkedin
|
||||
|
||||
twitter = ""
|
||||
if ("twitter" in df.keys()):
|
||||
if (str(df['twitter'].values[n])):
|
||||
linkedin = str(df['twitter'].values[n])
|
||||
mydata['twitter'] = twitter
|
||||
mydata['twitter'] = twitter
|
||||
|
||||
|
||||
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
|
||||
|
@ -2302,10 +2327,14 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
|
|||
'valide':'1', 'locked':'0'})
|
||||
if( is_employe_exist_count > 0):
|
||||
## Si l'adresse email exist deja en base, alors on fait une mise à jour
|
||||
is_employe_exist_data = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
is_employe_exist_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'email': str(mydata['email']), 'partner_recid': str(partner_recid),
|
||||
'valide': '1', 'locked': '0'}, {'_id'})
|
||||
clean_dict['id'] = str(is_employe_exist_data['_id'])
|
||||
'valide': '1', 'locked': '0'}, {'_id':1})
|
||||
|
||||
|
||||
clean_dict['_id'] = str(is_employe_exist_data['_id'])
|
||||
|
||||
|
||||
status, retval = Update_Ressource_Humaine(clean_dict)
|
||||
if (status is False):
|
||||
return status, retval
|
||||
|
@ -2382,8 +2411,8 @@ def Controle_Add_Ressource_Humaine_mass(saved_file=None, Folder=None, diction=No
|
|||
'''
|
||||
# Verification que les noms des colonne sont bien corrects"
|
||||
'''
|
||||
field_list = ['nom', 'prenom', 'email', 'telephone_mobile', 'telephone', 'profil', 'ismanager', 'superieur_hierarchie_email', 'civilite',
|
||||
'adresse', 'code_postal', 'ville', 'pays', 'facebook', 'fonction', 'linkedin', 'twitter']
|
||||
field_list = ['nom', 'prenom', 'email', 'telephone_mobile', 'telephone', 'profil', 'ismanager', 'superieur_hierarchie_email',
|
||||
'civilite', 'adresse', 'code_postal', 'ville', 'pays', 'facebook', 'fonction', 'linkedin', 'twitter', 'date_naissance']
|
||||
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
|
@ -2398,7 +2427,7 @@ def Controle_Add_Ressource_Humaine_mass(saved_file=None, Folder=None, diction=No
|
|||
for val in df.columns:
|
||||
if str(val).lower() not in field_list:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3])+" : entete du fichier csv. '" + val + "' n'est pas acceptée")
|
||||
str(inspect.stack()[0][3])+" : entete du fichier csv. Champ '" + val + "' n'est pas acceptée")
|
||||
return False, " Entete du fichier csv. '" + val + "' n'est pas acceptée"
|
||||
|
||||
# Verification des champs obligatoires dans le fichier
|
||||
|
@ -2498,7 +2527,7 @@ def Controle_Add_Ressource_Humaine_mass(saved_file=None, Folder=None, diction=No
|
|||
telephone = str(df['telephone'].values[n])
|
||||
mydata['telephone'] = telephone
|
||||
|
||||
civilite = "-1"
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys()):
|
||||
if (str(df['civilite'].values[n])):
|
||||
civilite = str(df['civilite'].values[n])
|
||||
|
@ -2509,16 +2538,22 @@ def Controle_Add_Ressource_Humaine_mass(saved_file=None, Folder=None, diction=No
|
|||
return False, " Le champ civilité -" + str(
|
||||
df['civilite'].values[n]) + "- est invalide. Les valeurs autorisées : 'm', 'mme', 'neutre' "
|
||||
|
||||
if( str(civilite).lower() == "m"):
|
||||
civilite = "1"
|
||||
elif (str(civilite).lower() == "mme"):
|
||||
civilite = "0"
|
||||
else:
|
||||
civilite = "-1"
|
||||
|
||||
mydata['civilite'] = civilite
|
||||
|
||||
date_naissance = ""
|
||||
if ("date_naissance" in df.keys()):
|
||||
if (str(df['date_naissance'].values[n])):
|
||||
date_naissance = str(df['date_naissance'].values[n])
|
||||
|
||||
local_status = mycommon.CheckisDate(date_naissance)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de naissance "+str(date_naissance)+" n'est pas au format 'jj/mm/aaaa' ")
|
||||
return False, " La date de naissance "+str(date_naissance)+" n'est pas au format 'jj/mm/aaaa' "
|
||||
|
||||
mydata['date_naissance'] = str(date_naissance)
|
||||
|
||||
ville = ""
|
||||
if ("ville" in df.keys()):
|
||||
|
|
Loading…
Reference in New Issue