parent
f0f3759f78
commit
a5927683ad
|
|
@ -4,20 +4,13 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="25/02/26 - 19h30">
|
||||
<change afterPath="$PROJECT_DIR$/domaine_competence_pedagogique.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="26/02/26 - 19h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bloc_competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/bloc_competence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/domaine_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/domaine_formation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -461,7 +454,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="540" />
|
||||
<option name="localTasksCounter" value="541" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -503,7 +496,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="16/11/25 - 16h30" />
|
||||
<MESSAGE value="23/11/25 - 21h30" />
|
||||
<MESSAGE value="23/11/25 - 21h30dd" />
|
||||
<MESSAGE value="25/11/25 - 21h30dd" />
|
||||
|
|
@ -528,6 +520,7 @@
|
|||
<MESSAGE value="22/02/26 - 20h" />
|
||||
<MESSAGE value="24/02/26 - 19h30" />
|
||||
<MESSAGE value="25/02/26 - 19h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="25/02/26 - 19h30" />
|
||||
<MESSAGE value="26/02/26 - 19h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="26/02/26 - 19h30" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -118,6 +118,10 @@ def AddStagiairetoClass(diction):
|
|||
connected_user_id = my_partner['recid']
|
||||
|
||||
|
||||
if( "email" in diction.keys() and diction['email']):
|
||||
diction['email'] = str(diction['email']).strip().lower()
|
||||
|
||||
|
||||
#print(" #### my_partner = ", my_partner)
|
||||
|
||||
"""
|
||||
|
|
@ -1089,6 +1093,10 @@ def AddStagiairetoClass_from_marketplace(diction):
|
|||
|
||||
# print(" #### my_partner = ", my_partner)
|
||||
|
||||
|
||||
if( "email" in diction.keys() and diction['email']):
|
||||
diction['email'] = str(diction['email']).strip().lower()
|
||||
|
||||
"""
|
||||
Verifier que la formation est valide
|
||||
"""
|
||||
|
|
@ -1918,7 +1926,8 @@ def UpdateStagiairetoClass(diction):
|
|||
mytoken = str(diction['token']).strip()
|
||||
#query_key['token'] = diction['token']
|
||||
|
||||
|
||||
if( "email" in diction.keys() and diction['email']):
|
||||
diction['email'] = str(diction['email']).strip().lower()
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", mytoken)
|
||||
|
|
|
|||
2937
Log/log_file.log
2937
Log/log_file.log
File diff suppressed because it is too large
Load Diff
660
apprenant_mgt.py
660
apprenant_mgt.py
|
|
@ -91,6 +91,9 @@ def Add_Apprenant(diction):
|
|||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
if ("email" in diction.keys() and diction['email']):
|
||||
diction['email'] = str(diction['email']).strip().lower()
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
|
@ -200,7 +203,7 @@ def Add_Apprenant(diction):
|
|||
if val not in diction.keys():
|
||||
new_data[str(val)] = ""
|
||||
|
||||
|
||||
new_data['email'] = str(new_data['email']).strip().lower()
|
||||
new_data['valide'] = '1'
|
||||
new_data['locked'] = '0'
|
||||
new_data['archive'] = '0'
|
||||
|
|
@ -217,6 +220,39 @@ def Add_Apprenant(diction):
|
|||
if ("date_naissance" not in new_data.keys() or str(new_data['date_naissance']) == ""):
|
||||
new_data['date_naissance'] = "01/01/1900"
|
||||
|
||||
"""
|
||||
Creation du matricule de l'apprenant
|
||||
"""
|
||||
# Récuperation de la sequence de l'objet "apprenant_matricule" dans la collection : "mysy_sequence"
|
||||
retval_sequence_matricule_apprenant = MYSY_GV.dbname['mysy_sequence'].find_one(
|
||||
{'related_mysy_object': 'apprenant_matricule',
|
||||
'valide': '1', 'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (retval_sequence_matricule_apprenant is None):
|
||||
# Il n'y pas de sequence pour le partenaire, on va aller chercher la sequence par defaut
|
||||
retval_sequence_matricule_apprenant = MYSY_GV.dbname['mysy_sequence'].find_one(
|
||||
{'related_mysy_object': 'apprenant_matricule',
|
||||
'valide': '1', 'partner_owner_recid': 'default'})
|
||||
|
||||
apprenant_matricule = ""
|
||||
if (retval_sequence_matricule_apprenant is None or "current_val" not in retval_sequence_matricule_apprenant.keys()):
|
||||
mycommon.myprint(" WARNING : Impossible de récupérer la sequence 'apprenant_matricule' pour créer le matricule")
|
||||
else:
|
||||
current_seq_value = str(retval_sequence_matricule_apprenant['current_val'])
|
||||
new_sequence_value = int(mycommon.tryInt(current_seq_value)) + 1
|
||||
new_sequance_data_to_update = {'current_val': new_sequence_value}
|
||||
ret_val2 = MYSY_GV.dbname['mysy_sequence'].find_one_and_update(
|
||||
{'_id': ObjectId(str(retval_sequence_matricule_apprenant['_id'])), 'valide': '1'},
|
||||
{"$set": new_sequance_data_to_update},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
apprenant_matricule = retval_sequence_matricule_apprenant['prefixe'] + str(current_seq_value)
|
||||
|
||||
new_data['matricule'] = str(apprenant_matricule)
|
||||
|
||||
|
||||
del new_data['token']
|
||||
inserted_id = MYSY_GV.dbname['apprenant'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
|
|
@ -264,7 +300,7 @@ def Update_Apprenant(diction):
|
|||
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'civilite', 'date_naissance',
|
||||
'tuteur1_civilite', 'tuteur2_civilite',
|
||||
'is_handicap', 'is_droit_image', 'is_rgpd', 'nationalite', 'situation_famille', 'naissance_lieu', 'naissance_departement',
|
||||
'naissance_pays','num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite', 'telephone_bis',
|
||||
'naissance_pays','num_secu', 'identite_type', 'piece_identite_num', 'type_mobilite', 'telephone_bis', 'matricule'
|
||||
|
||||
]
|
||||
|
||||
|
|
@ -295,6 +331,9 @@ def Update_Apprenant(diction):
|
|||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
if ("email" in diction.keys() and diction['email']):
|
||||
diction['email'] = str(diction['email']).strip().lower()
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
|
@ -310,6 +349,24 @@ def Update_Apprenant(diction):
|
|||
return False, " L'identifiant de l'apprenant n'est pas valide ",
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du matricule de l'apprenant
|
||||
"""
|
||||
if( "matricule" in diction.keys() and diction['matricule']):
|
||||
# Verifier si le nouveau matricule n'est pas pris par quelqu'un d'autre
|
||||
is_apprenant_matricule_used = MYSY_GV.dbname['apprenant'].count_documents({'_id': {'$ne':ObjectId(str(diction['_id']))},
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'matricule':str(diction['matricule']),
|
||||
})
|
||||
|
||||
if(is_apprenant_matricule_used != 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le matricule '" + str(diction['matricule']) + "' est déjà utilisé ")
|
||||
return False, " Le matricule '" + str(diction['matricule']) + "' est déjà utilisé ",
|
||||
|
||||
|
||||
# Verifier que l'adresse email est valide
|
||||
if ("email" in diction.keys() and diction['email']):
|
||||
if (mycommon.isEmailValide(str(diction['email'])) is False):
|
||||
|
|
@ -380,6 +437,10 @@ def Update_Apprenant(diction):
|
|||
del new_data['token']
|
||||
del new_data['_id']
|
||||
|
||||
|
||||
if( "email" in new_data.keys()):
|
||||
new_data['email'] = str(new_data['email']).strip().lower()
|
||||
|
||||
new_data['valide'] = '1'
|
||||
new_data['locked'] = '0'
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
|
|
@ -485,6 +546,9 @@ def Get_Given_Apprenant_Data(diction):
|
|||
if ("archive" not in val.keys()):
|
||||
user['archive'] = "0"
|
||||
|
||||
if ("matricule" not in val.keys()):
|
||||
user['matricule'] = ""
|
||||
|
||||
if( "tuteur1_civilite" not in val.keys() ):
|
||||
user['tuteur1_civilite'] = ""
|
||||
elif(val['tuteur1_civilite'] not in MYSY_GV.CIVILITE ):
|
||||
|
|
@ -889,7 +953,7 @@ Recuperer la liste des apprenant avec des filtrer
|
|||
|
||||
def Get_Apprenant_List_Partner_with_filter(diction):
|
||||
try:
|
||||
field_list = ['token', 'nom', 'prenom', 'email', 'archive']
|
||||
field_list = ['token', 'nom', 'prenom', 'email', 'archive', 'matricule']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
|
@ -930,6 +994,11 @@ def Get_Apprenant_List_Partner_with_filter(diction):
|
|||
if ("prenom" in diction.keys()):
|
||||
filt_prenom = {'prenom': {'$regex': mycommon.regex_replace_cartere(str(diction['prenom'])), "$options": "i"}}
|
||||
|
||||
filt_matricule = {}
|
||||
if ("matricule" in diction.keys()):
|
||||
filt_matricule = {
|
||||
'matricule': {'$regex': mycommon.regex_replace_cartere(str(diction['matricule'])), "$options": "i"}}
|
||||
|
||||
filt_archive = {}
|
||||
if ("archive" in diction.keys() and (diction["archive"] == "0" or diction["archive"] == "")):
|
||||
filt_archive = {'archive': {'$ne': '1'}}
|
||||
|
|
@ -942,7 +1011,7 @@ def Get_Apprenant_List_Partner_with_filter(diction):
|
|||
|
||||
filt_class_partner_recid = {'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
query = [{'$match': {'$and': [filt_archive, filt_email, filt_nom, filt_prenom, {'partner_owner_recid': str(my_partner['recid'])}]}},
|
||||
query = [{'$match': {'$and': [filt_archive, filt_email, filt_nom, filt_prenom, filt_matricule, {'partner_owner_recid': str(my_partner['recid'])}]}},
|
||||
{'$sort': {'_id': -1}},
|
||||
]
|
||||
#print("#### Get_Apprenant_List_Partner_with_filter laa 01 : query = ", query)
|
||||
|
|
@ -953,6 +1022,10 @@ def Get_Apprenant_List_Partner_with_filter(diction):
|
|||
val['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
|
||||
|
||||
if ("matricule" not in retVal.keys()):
|
||||
val['matricule'] = ""
|
||||
|
||||
if ("archive" not in retVal.keys()):
|
||||
val['archive'] = "0"
|
||||
|
||||
|
|
@ -1869,7 +1942,7 @@ def Add_Apprenant_mass(file=None, Folder=None, diction=None):
|
|||
'tuteur2_email', 'tuteur2_telephone', 'opco', 'comment', 'tuteur1_adresse', 'tuteur1_cp',
|
||||
'tuteur1_ville', 'tuteur1_pays',
|
||||
'tuteur1_include_com', 'tuteur2_adresse', 'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays',
|
||||
'tuteur2_include_com']
|
||||
'tuteur2_include_com', 'matricule']
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
total_rows = len(df)
|
||||
|
|
@ -1897,231 +1970,262 @@ def Add_Apprenant_mass(file=None, Folder=None, diction=None):
|
|||
return False, " Le champ '" + val + "' n'est pas présent dans le fichier. Il est obligatoire "
|
||||
|
||||
x = range(0, total_rows)
|
||||
|
||||
is_valide_line = 0
|
||||
for n in x:
|
||||
mydata = {}
|
||||
mydata['prenom'] = str(df['prenom'].values[n])
|
||||
mydata['nom'] = str(df['nom'].values[n])
|
||||
mydata['email'] = str(df['email'].values[n])
|
||||
if( str(df['prenom'].values[n]) and str(df['nom'].values[n]) and str(df['email'].values[n])):
|
||||
mydata = {}
|
||||
mydata['prenom'] = str(df['prenom'].values[n])
|
||||
mydata['nom'] = str(df['nom'].values[n])
|
||||
mydata['email'] = str(df['email'].values[n]).lower()
|
||||
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys()):
|
||||
if (str(df['civilite'].values[n])):
|
||||
civilite = str(df['civilite'].values[n]).lower()
|
||||
mydata['civilite'] = civilite
|
||||
matricule = ""
|
||||
if ("matricule" in df.keys()):
|
||||
if (str(df['matricule'].values[n])):
|
||||
matricule = str(df['matricule'].values[n]).lower()
|
||||
matricule = matricule
|
||||
|
||||
if( str(civilite).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
"""
|
||||
Verifier que ce matricule n'est pas utilisé par une autre personne dans la base
|
||||
"""
|
||||
is_apprenant_matricule_used = MYSY_GV.dbname['apprenant'].count_documents(
|
||||
{'email': {'$ne': mydata['email']},
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'matricule': str(diction['matricule']),
|
||||
})
|
||||
|
||||
if (is_apprenant_matricule_used != 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Ligne " + str(n + 2) + " : Le matricule '" + str(
|
||||
diction['matricule']) + "' est déjà utilisé ")
|
||||
return False, " Ligne " + str(n + 2) + " : Le matricule '" + str(
|
||||
diction['matricule']) + "' est déjà utilisé ",
|
||||
|
||||
mydata['matricule'] = matricule
|
||||
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys()):
|
||||
if (str(df['civilite'].values[n])):
|
||||
civilite = str(df['civilite'].values[n]).lower()
|
||||
mydata['civilite'] = civilite
|
||||
|
||||
if( str(civilite).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
|
||||
|
||||
telephone = ""
|
||||
if ("telephone" in df.keys()):
|
||||
if (str(df['telephone'].values[n])):
|
||||
telephone = str(df['telephone'].values[n])
|
||||
mydata['telephone'] = telephone
|
||||
telephone = ""
|
||||
if ("telephone" in df.keys()):
|
||||
if (str(df['telephone'].values[n])):
|
||||
telephone = str(df['telephone'].values[n])
|
||||
mydata['telephone'] = telephone
|
||||
|
||||
employeur = ""
|
||||
if ("employeur" in df.keys()):
|
||||
if (str(df['employeur'].values[n])):
|
||||
employeur = str(df['employeur'].values[n])
|
||||
mydata['employeur'] = employeur
|
||||
employeur = ""
|
||||
if ("employeur" in df.keys()):
|
||||
if (str(df['employeur'].values[n])):
|
||||
employeur = str(df['employeur'].values[n])
|
||||
mydata['employeur'] = employeur
|
||||
|
||||
adresse = ""
|
||||
if ("adresse" in df.keys()):
|
||||
if (str(df['adresse'].values[n])):
|
||||
adresse = str(df['adresse'].values[n])
|
||||
mydata['adresse'] = adresse
|
||||
adresse = ""
|
||||
if ("adresse" in df.keys()):
|
||||
if (str(df['adresse'].values[n])):
|
||||
adresse = str(df['adresse'].values[n])
|
||||
mydata['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['code_postal'] = code_postal
|
||||
code_postal = ""
|
||||
if ("code_postal" in df.keys()):
|
||||
if (str(df['code_postal'].values[n])):
|
||||
code_postal = str(df['code_postal'].values[n])
|
||||
mydata['code_postal'] = code_postal
|
||||
|
||||
ville = ""
|
||||
if ("ville" in df.keys()):
|
||||
if (str(df['ville'].values[n])):
|
||||
ville = str(df['ville'].values[n])
|
||||
mydata['ville'] = ville
|
||||
ville = ""
|
||||
if ("ville" in df.keys()):
|
||||
if (str(df['ville'].values[n])):
|
||||
ville = str(df['ville'].values[n])
|
||||
mydata['ville'] = ville
|
||||
|
||||
pays = ""
|
||||
if ("pays" in df.keys()):
|
||||
if (str(df['pays'].values[n])):
|
||||
pays = str(df['pays'].values[n])
|
||||
mydata['pays'] = pays
|
||||
pays = ""
|
||||
if ("pays" in df.keys()):
|
||||
if (str(df['pays'].values[n])):
|
||||
pays = str(df['pays'].values[n])
|
||||
mydata['pays'] = pays
|
||||
|
||||
tuteur1_nom = ""
|
||||
if ("tuteur1_nom" in df.keys()):
|
||||
if (str(df['tuteur1_nom'].values[n])):
|
||||
tuteur1_nom = str(df['tuteur1_nom'].values[n])
|
||||
mydata['tuteur1_nom'] = tuteur1_nom
|
||||
tuteur1_nom = ""
|
||||
if ("tuteur1_nom" in df.keys()):
|
||||
if (str(df['tuteur1_nom'].values[n])):
|
||||
tuteur1_nom = str(df['tuteur1_nom'].values[n])
|
||||
mydata['tuteur1_nom'] = tuteur1_nom
|
||||
|
||||
tuteur1_prenom = ""
|
||||
if ("tuteur1_prenom" in df.keys()):
|
||||
if (str(df['tuteur1_prenom'].values[n])):
|
||||
tuteur1_prenom = str(df['tuteur1_prenom'].values[n])
|
||||
mydata['tuteur1_prenom'] = tuteur1_prenom
|
||||
tuteur1_prenom = ""
|
||||
if ("tuteur1_prenom" in df.keys()):
|
||||
if (str(df['tuteur1_prenom'].values[n])):
|
||||
tuteur1_prenom = str(df['tuteur1_prenom'].values[n])
|
||||
mydata['tuteur1_prenom'] = tuteur1_prenom
|
||||
|
||||
tuteur1_email = ""
|
||||
if ("tuteur1_email" in df.keys()):
|
||||
if (str(df['tuteur1_email'].values[n])):
|
||||
tuteur1_email = str(df['tuteur1_email'].values[n])
|
||||
mydata['tuteur1_email'] = tuteur1_email
|
||||
tuteur1_email = ""
|
||||
if ("tuteur1_email" in df.keys()):
|
||||
if (str(df['tuteur1_email'].values[n])):
|
||||
tuteur1_email = str(df['tuteur1_email'].values[n])
|
||||
mydata['tuteur1_email'] = tuteur1_email
|
||||
|
||||
tuteur1_telephone = ""
|
||||
if ("tuteur1_telephone" in df.keys()):
|
||||
if (str(df['tuteur1_telephone'].values[n])):
|
||||
tuteur1_telephone = str(df['tuteur1_telephone'].values[n])
|
||||
mydata['tuteur1_telephone'] = tuteur1_telephone
|
||||
tuteur1_telephone = ""
|
||||
if ("tuteur1_telephone" in df.keys()):
|
||||
if (str(df['tuteur1_telephone'].values[n])):
|
||||
tuteur1_telephone = str(df['tuteur1_telephone'].values[n])
|
||||
mydata['tuteur1_telephone'] = tuteur1_telephone
|
||||
|
||||
tuteur2_nom = ""
|
||||
if ("tuteur2_nom" in df.keys()):
|
||||
if (str(df['tuteur2_nom'].values[n])):
|
||||
tuteur2_nom = str(df['tuteur2_nom'].values[n])
|
||||
mydata['tuteur2_nom'] = tuteur2_nom
|
||||
tuteur2_nom = ""
|
||||
if ("tuteur2_nom" in df.keys()):
|
||||
if (str(df['tuteur2_nom'].values[n])):
|
||||
tuteur2_nom = str(df['tuteur2_nom'].values[n])
|
||||
mydata['tuteur2_nom'] = tuteur2_nom
|
||||
|
||||
tuteur2_prenom = ""
|
||||
if ("tuteur2_prenom" in df.keys()):
|
||||
if (str(df['tuteur2_prenom'].values[n])):
|
||||
tuteur2_prenom = str(df['tuteur2_prenom'].values[n])
|
||||
mydata['tuteur2_prenom'] = tuteur2_prenom
|
||||
tuteur2_prenom = ""
|
||||
if ("tuteur2_prenom" in df.keys()):
|
||||
if (str(df['tuteur2_prenom'].values[n])):
|
||||
tuteur2_prenom = str(df['tuteur2_prenom'].values[n])
|
||||
mydata['tuteur2_prenom'] = tuteur2_prenom
|
||||
|
||||
tuteur2_email = ""
|
||||
if ("tuteur2_email" in df.keys()):
|
||||
if (str(df['tuteur2_email'].values[n])):
|
||||
tuteur2_email = str(df['tuteur2_email'].values[n])
|
||||
mydata['tuteur2_email'] = tuteur2_email
|
||||
tuteur2_email = ""
|
||||
if ("tuteur2_email" in df.keys()):
|
||||
if (str(df['tuteur2_email'].values[n])):
|
||||
tuteur2_email = str(df['tuteur2_email'].values[n])
|
||||
mydata['tuteur2_email'] = tuteur2_email
|
||||
|
||||
tuteur2_telephone = ""
|
||||
if ("tuteur2_telephone" in df.keys()):
|
||||
if (str(df['tuteur2_telephone'].values[n])):
|
||||
tuteur2_telephone = str(df['tuteur2_telephone'].values[n])
|
||||
mydata['tuteur2_telephone'] = tuteur2_telephone
|
||||
tuteur2_telephone = ""
|
||||
if ("tuteur2_telephone" in df.keys()):
|
||||
if (str(df['tuteur2_telephone'].values[n])):
|
||||
tuteur2_telephone = str(df['tuteur2_telephone'].values[n])
|
||||
mydata['tuteur2_telephone'] = tuteur2_telephone
|
||||
|
||||
opco = ""
|
||||
if ("opco" in df.keys()):
|
||||
if (str(df['opco'].values[n])):
|
||||
opco = str(df['opco'].values[n])
|
||||
mydata['opco'] = opco
|
||||
opco = ""
|
||||
if ("opco" in df.keys()):
|
||||
if (str(df['opco'].values[n])):
|
||||
opco = str(df['opco'].values[n])
|
||||
mydata['opco'] = opco
|
||||
|
||||
tuteur1_adresse = ""
|
||||
if ("tuteur1_adresse" in df.keys()):
|
||||
if (str(df['tuteur1_adresse'].values[n])):
|
||||
tuteur1_adresse = str(df['tuteur1_adresse'].values[n])
|
||||
mydata['tuteur1_adresse'] = tuteur1_adresse
|
||||
tuteur1_adresse = ""
|
||||
if ("tuteur1_adresse" in df.keys()):
|
||||
if (str(df['tuteur1_adresse'].values[n])):
|
||||
tuteur1_adresse = str(df['tuteur1_adresse'].values[n])
|
||||
mydata['tuteur1_adresse'] = tuteur1_adresse
|
||||
|
||||
tuteur1_cp = ""
|
||||
if ("tuteur1_cp" in df.keys()):
|
||||
if (str(df['tuteur1_cp'].values[n])):
|
||||
tuteur1_cp = str(df['tuteur1_cp'].values[n])
|
||||
mydata['tuteur1_cp'] = tuteur1_cp
|
||||
tuteur1_cp = ""
|
||||
if ("tuteur1_cp" in df.keys()):
|
||||
if (str(df['tuteur1_cp'].values[n])):
|
||||
tuteur1_cp = str(df['tuteur1_cp'].values[n])
|
||||
mydata['tuteur1_cp'] = tuteur1_cp
|
||||
|
||||
tuteur1_ville = ""
|
||||
if ("tuteur1_ville" in df.keys()):
|
||||
if (str(df['tuteur1_ville'].values[n])):
|
||||
tuteur1_ville = str(df['tuteur1_ville'].values[n])
|
||||
mydata['tuteur1_ville'] = tuteur1_ville
|
||||
tuteur1_ville = ""
|
||||
if ("tuteur1_ville" in df.keys()):
|
||||
if (str(df['tuteur1_ville'].values[n])):
|
||||
tuteur1_ville = str(df['tuteur1_ville'].values[n])
|
||||
mydata['tuteur1_ville'] = tuteur1_ville
|
||||
|
||||
tuteur1_pays = ""
|
||||
if ("tuteur1_pays" in df.keys()):
|
||||
if (str(df['tuteur1_pays'].values[n])):
|
||||
tuteur1_pays = str(df['tuteur1_pays'].values[n])
|
||||
mydata['tuteur1_pays'] = tuteur1_pays
|
||||
tuteur1_pays = ""
|
||||
if ("tuteur1_pays" in df.keys()):
|
||||
if (str(df['tuteur1_pays'].values[n])):
|
||||
tuteur1_pays = str(df['tuteur1_pays'].values[n])
|
||||
mydata['tuteur1_pays'] = tuteur1_pays
|
||||
|
||||
tuteur1_include_com = ""
|
||||
if ("tuteur1_include_com" in df.keys()):
|
||||
if (str(df['tuteur1_include_com'].values[n])):
|
||||
tuteur1_include_com = str(df['tuteur1_include_com'].values[n])
|
||||
mydata['tuteur1_include_com'] = tuteur1_include_com
|
||||
tuteur1_include_com = ""
|
||||
if ("tuteur1_include_com" in df.keys()):
|
||||
if (str(df['tuteur1_include_com'].values[n])):
|
||||
tuteur1_include_com = str(df['tuteur1_include_com'].values[n])
|
||||
mydata['tuteur1_include_com'] = tuteur1_include_com
|
||||
|
||||
tuteur2_adresse = ""
|
||||
if ("tuteur2_adresse" in df.keys()):
|
||||
if (str(df['tuteur2_adresse'].values[n])):
|
||||
tuteur2_adresse = str(df['tuteur2_adresse'].values[n])
|
||||
mydata['tuteur2_adresse'] = tuteur2_adresse
|
||||
tuteur2_adresse = ""
|
||||
if ("tuteur2_adresse" in df.keys()):
|
||||
if (str(df['tuteur2_adresse'].values[n])):
|
||||
tuteur2_adresse = str(df['tuteur2_adresse'].values[n])
|
||||
mydata['tuteur2_adresse'] = tuteur2_adresse
|
||||
|
||||
tuteur2_cp = ""
|
||||
if ("tuteur2_cp" in df.keys()):
|
||||
if (str(df['tuteur2_cp'].values[n])):
|
||||
tuteur2_cp = str(df['tuteur2_cp'].values[n])
|
||||
mydata['tuteur2_cp'] = tuteur2_cp
|
||||
tuteur2_cp = ""
|
||||
if ("tuteur2_cp" in df.keys()):
|
||||
if (str(df['tuteur2_cp'].values[n])):
|
||||
tuteur2_cp = str(df['tuteur2_cp'].values[n])
|
||||
mydata['tuteur2_cp'] = tuteur2_cp
|
||||
|
||||
tuteur2_ville = ""
|
||||
if ("tuteur2_ville" in df.keys()):
|
||||
if (str(df['tuteur2_ville'].values[n])):
|
||||
tuteur2_ville = str(df['tuteur2_ville'].values[n])
|
||||
mydata['tuteur2_ville'] = tuteur2_ville
|
||||
tuteur2_ville = ""
|
||||
if ("tuteur2_ville" in df.keys()):
|
||||
if (str(df['tuteur2_ville'].values[n])):
|
||||
tuteur2_ville = str(df['tuteur2_ville'].values[n])
|
||||
mydata['tuteur2_ville'] = tuteur2_ville
|
||||
|
||||
tuteur2_pays = ""
|
||||
if ("tuteur2_pays" in df.keys()):
|
||||
if (str(df['tuteur2_pays'].values[n])):
|
||||
tuteur2_pays = str(df['tuteur2_pays'].values[n])
|
||||
mydata['tuteur2_pays'] = tuteur2_pays
|
||||
tuteur2_pays = ""
|
||||
if ("tuteur2_pays" in df.keys()):
|
||||
if (str(df['tuteur2_pays'].values[n])):
|
||||
tuteur2_pays = str(df['tuteur2_pays'].values[n])
|
||||
mydata['tuteur2_pays'] = tuteur2_pays
|
||||
|
||||
tuteur2_include_com = ""
|
||||
if ("tuteur2_include_com" in df.keys()):
|
||||
if (str(df['tuteur2_include_com'].values[n])):
|
||||
tuteur2_include_com = str(df['tuteur2_include_com'].values[n])
|
||||
mydata['tuteur2_include_com'] = tuteur2_include_com
|
||||
tuteur2_include_com = ""
|
||||
if ("tuteur2_include_com" in df.keys()):
|
||||
if (str(df['tuteur2_include_com'].values[n])):
|
||||
tuteur2_include_com = str(df['tuteur2_include_com'].values[n])
|
||||
mydata['tuteur2_include_com'] = tuteur2_include_com
|
||||
|
||||
comment = ""
|
||||
if ("comment" in df.keys()):
|
||||
if (str(df['comment'].values[n])):
|
||||
comment = str(df['comment'].values[n])
|
||||
mydata['comment'] = comment
|
||||
comment = ""
|
||||
if ("comment" in df.keys()):
|
||||
if (str(df['comment'].values[n])):
|
||||
comment = str(df['comment'].values[n])
|
||||
mydata['comment'] = comment
|
||||
|
||||
client_rattachement_id = ""
|
||||
client_rattachement_email = ""
|
||||
if ("client_rattachement_email" in df.keys()):
|
||||
if (str(df['client_rattachement_email'].values[n])):
|
||||
client_rattachement_email = str(df['client_rattachement_email'].values[n])
|
||||
client_rattachement_data = MYSY_GV.dbname['partner_client'].find_one({'email':str(client_rattachement_email),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{'_id':1})
|
||||
client_rattachement_id = ""
|
||||
client_rattachement_email = ""
|
||||
if ("client_rattachement_email" in df.keys()):
|
||||
if (str(df['client_rattachement_email'].values[n])):
|
||||
client_rattachement_email = str(df['client_rattachement_email'].values[n])
|
||||
client_rattachement_data = MYSY_GV.dbname['partner_client'].find_one({'email':str(client_rattachement_email),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{'_id':1})
|
||||
|
||||
if( '_id' in client_rattachement_data.keys()):
|
||||
client_rattachement_id = client_rattachement_data['_id']
|
||||
if( '_id' in client_rattachement_data.keys()):
|
||||
client_rattachement_id = client_rattachement_data['_id']
|
||||
|
||||
|
||||
|
||||
mydata['client_rattachement_id'] = client_rattachement_id
|
||||
mydata['client_rattachement_id'] = client_rattachement_id
|
||||
|
||||
|
||||
clean_dict = {k: mydata[k] for k in mydata if (str(mydata[k]) != "nan")}
|
||||
clean_dict = {k: mydata[k] for k in mydata if (str(mydata[k]) != "nan")}
|
||||
|
||||
clean_dict['token'] = diction['token']
|
||||
clean_dict['token'] = diction['token']
|
||||
|
||||
print("#### clean_dict ", clean_dict)
|
||||
email_to_check = ""
|
||||
if( "email" in clean_dict.keys() ):
|
||||
"""
|
||||
Si l'email existe on fait une mise à jour
|
||||
Si non on fait une insertion
|
||||
"""
|
||||
is_exist_apprenant = MYSY_GV.dbname['apprenant'].count_documents({'email':str(clean_dict['email']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
print("#### clean_dict ", clean_dict)
|
||||
email_to_check = ""
|
||||
if( "email" in clean_dict.keys() ):
|
||||
"""
|
||||
Si l'email existe on fait une mise à jour
|
||||
Si non on fait une insertion
|
||||
"""
|
||||
is_exist_apprenant = MYSY_GV.dbname['apprenant'].count_documents({'email':str(clean_dict['email']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_exist_apprenant <= 0 ):
|
||||
status, retval = Add_Apprenant(clean_dict)
|
||||
if (status is False):
|
||||
return status, retval
|
||||
else:
|
||||
is_exist_apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'email': str(clean_dict['email']),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
print(" ### is_exist_apprenant_data = ", is_exist_apprenant_data)
|
||||
clean_dict['_id'] = str(is_exist_apprenant_data['_id'])
|
||||
status, retval = Update_Apprenant(clean_dict)
|
||||
if (status is False):
|
||||
return status, retval
|
||||
if( is_exist_apprenant <= 0 ):
|
||||
status, retval = Add_Apprenant(clean_dict)
|
||||
if (status is False):
|
||||
return status, retval
|
||||
else:
|
||||
is_exist_apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'email': str(clean_dict['email']),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
print(" ### is_exist_apprenant_data = ", is_exist_apprenant_data)
|
||||
clean_dict['_id'] = str(is_exist_apprenant_data['_id'])
|
||||
status, retval = Update_Apprenant(clean_dict)
|
||||
if (status is False):
|
||||
return status, retval
|
||||
|
||||
|
||||
print(str(total_rows)+" participants ont été inserés")
|
||||
is_valide_line = is_valide_line + 1
|
||||
|
||||
return True, str(total_rows)+" apprenant ont été inserés / mis à jour"
|
||||
print(str(is_valide_line)+" participants ont été insérés")
|
||||
|
||||
return True, str(is_valide_line)+" apprenant ont été insérés / mis à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
@ -2152,102 +2256,128 @@ def Controle_Add_Apprenant_mass(saved_file=None, Folder=None, diction=None):
|
|||
'tuteur2_email', 'tuteur2_telephone', 'opco', 'comment', 'tuteur1_adresse', 'tuteur1_cp',
|
||||
'tuteur1_ville', 'tuteur1_pays',
|
||||
'tuteur1_include_com', 'tuteur2_adresse', 'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays',
|
||||
'tuteur2_include_com', 'token']
|
||||
'tuteur2_include_com', 'token', 'matricule']
|
||||
|
||||
x = range(0, total_rows)
|
||||
for n in x:
|
||||
mydata = {}
|
||||
mydata['prenom'] = str(df['prenom'].values[n])
|
||||
mydata['nom'] = str(df['nom'].values[n])
|
||||
mydata['email'] = str(df['email'].values[n])
|
||||
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys()):
|
||||
if (str(df['civilite'].values[n])):
|
||||
civilite = str(df['civilite'].values[n]).lower()
|
||||
mydata['civilite'] = civilite
|
||||
if (str(df['prenom'].values[n]) and str(df['nom'].values[n]) and str(df['email'].values[n])):
|
||||
|
||||
if (str(civilite).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
mydata = {}
|
||||
mydata['prenom'] = str(df['prenom'].values[n])
|
||||
mydata['nom'] = str(df['nom'].values[n])
|
||||
mydata['email'] = str(df['email'].values[n]).lower()
|
||||
|
||||
matricule = ""
|
||||
if ("matricule" in df.keys()):
|
||||
if (str(df['matricule'].values[n])):
|
||||
matricule = str(df['matricule'].values[n]).lower()
|
||||
matricule = matricule
|
||||
|
||||
"""
|
||||
Verifier que ce matricule n'est pas utilisé par une autre personne dans la base
|
||||
"""
|
||||
is_apprenant_matricule_used = MYSY_GV.dbname['apprenant'].count_documents(
|
||||
{'email': {'$ne': mydata['email']},
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'matricule': str(diction['matricule']),
|
||||
})
|
||||
|
||||
if (is_apprenant_matricule_used != 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Ligne "+ str( n + 2) + " : Le matricule '" + str(diction['matricule']) + "' est déjà utilisé ")
|
||||
return False, " Ligne "+ str( n + 2) + " : Le matricule '" + str(diction['matricule']) + "' est déjà utilisé ",
|
||||
|
||||
|
||||
if (len(str(mydata['nom']).strip()) < 2):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'nom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères.")
|
||||
return False, " Le champ 'nom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères. "
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys()):
|
||||
if (str(df['civilite'].values[n])):
|
||||
civilite = str(df['civilite'].values[n]).lower()
|
||||
mydata['civilite'] = civilite
|
||||
|
||||
if (len(str(mydata['prenom']).strip()) < 2):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'prenom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères.")
|
||||
return False, " Le champ 'prenom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères. "
|
||||
if (str(civilite).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys() and df['civilite'].values[n]):
|
||||
civilite = str(df['civilite'].values[n])
|
||||
if ( str(mydata['civilite']).lower() not in MYSY_GV.CIVILITE ):
|
||||
|
||||
if (len(str(mydata['nom']).strip()) < 2):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'civilite' de la ligne " + str(
|
||||
n + 2) + " est invalide ")
|
||||
return False, " Le champ 'civilite' de la ligne " + str(
|
||||
n + 2) + " est invalide. "
|
||||
str(inspect.stack()[0][3]) + " Le champ 'nom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères.")
|
||||
return False, " Le champ 'nom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères. "
|
||||
|
||||
|
||||
|
||||
tuteur1_email = ""
|
||||
if ("tuteur1_email" in df.keys() and df['tuteur1_email'].values[n]):
|
||||
tuteur1_email = str(df['tuteur1_email'].values[n])
|
||||
if (mycommon.isEmailValide(str(tuteur1_email)) is False):
|
||||
if (len(str(mydata['prenom']).strip()) < 2):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'adresse email du tuteur1 '"+str(tuteur1_email)+"' de la ligne " + str(
|
||||
n + 2) + " est invalide ")
|
||||
return False, " L'adresse email du tuteur1 '"+str(tuteur1_email)+"' de la ligne " + str(
|
||||
n + 2) + " est invalide "
|
||||
str(inspect.stack()[0][3]) + " Le champ 'prenom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères.")
|
||||
return False, " Le champ 'prenom' de la ligne " + str(
|
||||
n + 2) + " doit faire plus de deux caractères. "
|
||||
|
||||
tuteur2_email = ""
|
||||
if ("tuteur2_email" in df.keys() and df['tuteur2_email'].values[n]):
|
||||
tuteur2_email = str(df['tuteur2_email'].values[n])
|
||||
if (mycommon.isEmailValide(str(tuteur2_email)) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'adresse email du tuteur2 "+str(tuteur2_email)+" de la ligne " + str(
|
||||
n + 2) + " est invalide ")
|
||||
return False, " L'adresse email du tuteur2 "+str(tuteur2_email)+" de la ligne " + str(
|
||||
n + 2) + " est invalide "
|
||||
|
||||
client_rattachement_id = ""
|
||||
client_rattachement_email = ""
|
||||
if ("client_rattachement_email" in df.keys()):
|
||||
if (str(df['client_rattachement_email'].values[n])):
|
||||
client_rattachement_email = str(df['client_rattachement_email'].values[n])
|
||||
client_rattachement_data_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'email': str(client_rattachement_email),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (client_rattachement_data_count < 0):
|
||||
civilite = ""
|
||||
if ("civilite" in df.keys() and df['civilite'].values[n]):
|
||||
civilite = str(df['civilite'].values[n])
|
||||
if ( str(mydata['civilite']).lower() not in MYSY_GV.CIVILITE ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'email du client de rattachement de la ligne " + str(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'civilite' de la ligne " + str(
|
||||
n + 2) + " est invalide ")
|
||||
return False, " L'email du client de rattachement de la ligne " + str(
|
||||
n + 2) + " est invalide "
|
||||
return False, " Le champ 'civilite' de la ligne " + str(
|
||||
n + 2) + " est invalide. "
|
||||
|
||||
|
||||
is_exist_apprenant_locked = MYSY_GV.dbname['apprenant'].count_documents({'email': str(mydata['email']),
|
||||
'locked': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (is_exist_apprenant_locked > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'apprenant avec l'adresse email : "+str(mydata['email'])+" de la ligne " + str(
|
||||
n + 2) + " est verrouillé ")
|
||||
return False, " L'apprenant avec l'adresse email : "+str(mydata['email'])+" de la ligne " + str(
|
||||
n + 2) + " est verrouillé "
|
||||
tuteur1_email = ""
|
||||
if ("tuteur1_email" in df.keys() and df['tuteur1_email'].values[n]):
|
||||
tuteur1_email = str(df['tuteur1_email'].values[n])
|
||||
if (mycommon.isEmailValide(str(tuteur1_email)) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'adresse email du tuteur1 '"+str(tuteur1_email)+"' de la ligne " + str(
|
||||
n + 2) + " est invalide ")
|
||||
return False, " L'adresse email du tuteur1 '"+str(tuteur1_email)+"' de la ligne " + str(
|
||||
n + 2) + " est invalide "
|
||||
|
||||
tuteur2_email = ""
|
||||
if ("tuteur2_email" in df.keys() and df['tuteur2_email'].values[n]):
|
||||
tuteur2_email = str(df['tuteur2_email'].values[n])
|
||||
if (mycommon.isEmailValide(str(tuteur2_email)) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'adresse email du tuteur2 "+str(tuteur2_email)+" de la ligne " + str(
|
||||
n + 2) + " est invalide ")
|
||||
return False, " L'adresse email du tuteur2 "+str(tuteur2_email)+" de la ligne " + str(
|
||||
n + 2) + " est invalide "
|
||||
|
||||
client_rattachement_id = ""
|
||||
client_rattachement_email = ""
|
||||
if ("client_rattachement_email" in df.keys()):
|
||||
if (str(df['client_rattachement_email'].values[n])):
|
||||
client_rattachement_email = str(df['client_rattachement_email'].values[n])
|
||||
client_rattachement_data_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'email': str(client_rattachement_email),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (client_rattachement_data_count < 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'email du client de rattachement de la ligne " + str(
|
||||
n + 2) + " est invalide ")
|
||||
return False, " L'email du client de rattachement de la ligne " + str(
|
||||
n + 2) + " est invalide "
|
||||
|
||||
|
||||
is_exist_apprenant_locked = MYSY_GV.dbname['apprenant'].count_documents({'email': str(mydata['email']),
|
||||
'locked': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (is_exist_apprenant_locked > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'apprenant avec l'adresse email : "+str(mydata['email'])+" de la ligne " + str(
|
||||
n + 2) + " est verrouillé ")
|
||||
return False, " L'apprenant avec l'adresse email : "+str(mydata['email'])+" de la ligne " + str(
|
||||
n + 2) + " est verrouillé "
|
||||
|
||||
return True, str(total_rows) + " apprenants lus dans le fichier excel"
|
||||
|
||||
|
|
|
|||
30
class_mgt.py
30
class_mgt.py
|
|
@ -284,7 +284,7 @@ def add_class(diction):
|
|||
|
||||
referentiel_padagogique_id = ""
|
||||
if( "referentiel_padagogique_id" in diction.keys() and diction['referentiel_padagogique_id']):
|
||||
is_valide_referentiel_padagogique_id_count = MYSY_GV.dbname['referentiel_padagogique'].count_documents({'_id':ObjectId(str(diction['referentiel_padagogique_id'])),
|
||||
is_valide_referentiel_padagogique_id_count = MYSY_GV.dbname['bloc_competence'].count_documents({'_id':ObjectId(str(diction['referentiel_padagogique_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
|
|
@ -985,7 +985,7 @@ def update_class(diction):
|
|||
|
||||
if ("referentiel_padagogique_id" in diction.keys() ):
|
||||
if( diction['referentiel_padagogique_id'] ):
|
||||
is_valide_calculation_rule_id_count = MYSY_GV.dbname['referentiel_padagogique'].count_documents(
|
||||
is_valide_calculation_rule_id_count = MYSY_GV.dbname['bloc_competence'].count_documents(
|
||||
{'_id': ObjectId(str(diction['referentiel_padagogique_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
|
@ -4071,6 +4071,13 @@ def get_partner_class(diction):
|
|||
if ("published" not in retVal.keys()):
|
||||
retVal['published'] = "0"
|
||||
|
||||
if("referentiel_padagogique_id" in retVal.keys() and retVal['referentiel_padagogique_id']):
|
||||
is_valide_ref = MYSY_GV.dbname['bloc_competence'].count_documents({'_id':ObjectId(str(retVal['referentiel_padagogique_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_ref != 1):
|
||||
retVal['referentiel_padagogique_id'] = ""
|
||||
|
||||
if ("archive" not in retVal.keys()):
|
||||
retVal['archive'] = "0"
|
||||
|
|
@ -4359,6 +4366,15 @@ def get_partner_class_Without_Scope_Action(diction):
|
|||
if ("duration_unit" not in retVal.keys()):
|
||||
retVal['duration_unit'] = ""
|
||||
|
||||
if ("referentiel_padagogique_id" in retVal.keys() and retVal['referentiel_padagogique_id']):
|
||||
is_valide_ref = MYSY_GV.dbname['bloc_competence'].count_documents(
|
||||
{'_id': ObjectId(str(retVal['referentiel_padagogique_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_ref != 1):
|
||||
retVal['referentiel_padagogique_id'] = ""
|
||||
|
||||
if ("pourqui" not in retVal.keys()):
|
||||
retVal['pourqui'] = ""
|
||||
|
||||
|
|
@ -4676,6 +4692,16 @@ def find_partner_class_like(diction):
|
|||
retVal['presentiel'] = {'presentiel':'0', 'distantiel':'0'}
|
||||
|
||||
|
||||
if ("referentiel_padagogique_id" in retVal.keys() and retVal['referentiel_padagogique_id']):
|
||||
is_valide_ref = MYSY_GV.dbname['bloc_competence'].count_documents(
|
||||
{'_id': ObjectId(str(retVal['referentiel_padagogique_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_ref != 1):
|
||||
retVal['referentiel_padagogique_id'] = ""
|
||||
|
||||
|
||||
if ("metier" not in retVal.keys()):
|
||||
retVal['metier'] = ""
|
||||
|
||||
|
|
|
|||
|
|
@ -5631,6 +5631,8 @@ Mais ca permet d'envoir un systeme pleinement operationnel des l'activation du c
|
|||
- Configuration des catégorie de formation
|
||||
- Configuration des métiers de formation
|
||||
- Configuration des formulaire (positionnement, à chaud, froid, enseignant, etc
|
||||
|
||||
- Initialisation des séquence - mysy_sequence
|
||||
|
||||
"""
|
||||
def Configure_Partner_Init_Setup_No_Token(diction):
|
||||
|
|
@ -6021,6 +6023,30 @@ def Configure_Partner_Init_Setup_No_Token(diction):
|
|||
|
||||
myprint(" #### FIN CONFIGURATION DE " + str(cpt) + " FORMULAIRE(S) ")
|
||||
|
||||
"""
|
||||
13 - Configuration des séquence - mysy_sequence
|
||||
"""
|
||||
|
||||
# Suppression des sequence de formation qui existe pour ce partenaire
|
||||
MYSY_GV.dbname['mysy_sequence'].delete_many(
|
||||
{'partner_owner_recid': str(my_partner_data['recid'])})
|
||||
|
||||
"""
|
||||
Insertion des sequences pour ce partenaire
|
||||
"""
|
||||
cpt = 0
|
||||
for my_step_session in MYSY_GV.dbname['mysy_sequence'].find(
|
||||
{'partner_owner_recid': 'default', 'valide': '1'}, {'_id': 0}):
|
||||
new_step_session = my_step_session
|
||||
new_step_session['update_date'] = str(datetime.now())
|
||||
new_step_session['update_by'] = str(my_partner_data['_id'])
|
||||
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
|
||||
MYSY_GV.dbname['mysy_sequence'].insert_one(new_step_session)
|
||||
cpt = cpt + 1
|
||||
|
||||
myprint(" #### FIN CONFIGURATION DE " + str(cpt) + " SEQUENCE(S) ")
|
||||
|
||||
|
||||
return True, "La configuration fonctionnelle a été correctement faite"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue