parent
9214e0364b
commit
c92204accc
|
|
@ -4,11 +4,24 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="12/11/2025 - 22h30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="13/11/2025 - 22h30">
|
||||
<change afterPath="$PROJECT_DIR$/stage_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/model_planning_sequence_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/model_planning_sequence_mgt.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$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.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$/user_session.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_session.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -451,7 +464,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="511" />
|
||||
<option name="localTasksCounter" value="512" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -493,7 +506,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="ssqsdqsd" />
|
||||
<MESSAGE value="25/06/2025 - 18h" />
|
||||
<MESSAGE value="qsdssdd" />
|
||||
<MESSAGE value="ss" />
|
||||
|
|
@ -518,6 +530,7 @@
|
|||
<MESSAGE value="29/10/2025 - 22h" />
|
||||
<MESSAGE value="04/11/2025 - 12h" />
|
||||
<MESSAGE value="12/11/2025 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="12/11/2025 - 22h30" />
|
||||
<MESSAGE value="13/11/2025 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="13/11/2025 - 22h30" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -991,4 +991,13 @@ Priorité des messages d'alerte sur l'ENT
|
|||
2 ==> 'info'
|
||||
|
||||
"""
|
||||
ENT_MESSAGE_PRIORITE = ['0', '1', '2']
|
||||
ENT_MESSAGE_PRIORITE = ['0', '1', '2']
|
||||
|
||||
|
||||
"""
|
||||
Statut des stage
|
||||
0 : non réalisé
|
||||
1 : réalisé
|
||||
2 : Verrouillé
|
||||
"""
|
||||
STAGE_STATUS = ['0', '1', '2']
|
||||
|
|
@ -6038,7 +6038,7 @@ def Refuse_List_AttendeeInscription_with_motif(diction):
|
|||
},
|
||||
)
|
||||
|
||||
print(" ### inscription_id_data = ",inscription_id_data)
|
||||
#print(" ### inscription_id_data = ",inscription_id_data)
|
||||
if( inscription_id_data ):
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
|
|
|
|||
9164
Log/log_file.log
9164
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -576,7 +576,7 @@ def Add_Update_SessionFormation(diction):
|
|||
|
||||
if( local_retval1 is None or 'code_session' not in local_retval1.keys() or 'class_internal_url' not in local_retval1.keys() ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Cette session n'as pas de code session ")
|
||||
return False, "Impossible de récupérer le code de La promotion (1) "
|
||||
return False, "Impossible de récupérer le code de la session / promotion (1) "
|
||||
|
||||
existing_session_code = local_retval1['code_session']
|
||||
current_step = local_retval1['session_etape']
|
||||
|
|
@ -602,7 +602,7 @@ def Add_Update_SessionFormation(diction):
|
|||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Impossible d'ajouter/mettre à jour La promotion '" + str(
|
||||
diction['code_session']) + "' ")
|
||||
return False, "Impossible d'ajouter/mettre à jour La promotion '" + str(diction['code_session']) + "' "
|
||||
return False, "Impossible d'ajouter/mettre à jour La session / promotion '" + str(diction['code_session']) + "' "
|
||||
|
||||
new_step = ret_val['session_etape']
|
||||
|
||||
|
|
@ -720,14 +720,16 @@ def Add_Update_SessionFormation(diction):
|
|||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, " La promotion à bien été créée"
|
||||
if( "type_session" in diction.keys() and diction['type_session'] == '1'):
|
||||
return True, " La promotion à bien été créée"
|
||||
else:
|
||||
return True, " La session à bien été créée"
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de créer / mettre à jour la promotion de formation"
|
||||
return False, "Impossible de créer ou mettre à jour la session / promotion de formation"
|
||||
|
||||
|
||||
|
||||
|
|
@ -5562,7 +5564,7 @@ def Is_Corresponding_SessionFormation(diction):
|
|||
}
|
||||
]
|
||||
|
||||
print(" ##### myquery GetSessionFormation = "+str(myquery))
|
||||
#print(" ##### myquery GetSessionFormation = "+str(myquery))
|
||||
RetObject = []
|
||||
|
||||
nb_val = 0
|
||||
|
|
@ -6146,7 +6148,7 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
|
|||
|
||||
|
||||
for single_inscrit_no_client in liste_inscription_no_client :
|
||||
print(" ### traitement de l'inscrit : ",single_inscrit_no_client )
|
||||
#print(" ### traitement de l'inscrit : ",single_inscrit_no_client )
|
||||
#field_list_obligatoire = [ 'token', 'inscription_id', 'courrier_template_id', 'email_test', 'email_production' ]
|
||||
new_diction_no_client = {}
|
||||
new_diction_no_client['token'] = str(diction['token'])
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ def Get_List_object_owner_collection_Stored_Files(diction):
|
|||
|
||||
|
||||
|
||||
print(" ##### myquery = " + str(query2))
|
||||
#print(" ##### myquery = " + str(query2))
|
||||
RetObject = []
|
||||
nb_val = 0
|
||||
for retval in MYSY_GV.dbname['download_files'].find(query2).sort([("_id", pymongo.DESCENDING), ("document_display_order", pymongo.DESCENDING)]):
|
||||
|
|
|
|||
|
|
@ -2878,7 +2878,7 @@ def Cacul_Session_Note_Finale_For_calcul_Stanard(diction):
|
|||
'locked': '0'
|
||||
|
||||
},
|
||||
{"$set": {'rang': str("classement"), 'rang_calculation_date':str(datetime.now())}},
|
||||
{"$set": {'rang': str(classement), 'rang_calculation_date':str(datetime.now())}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4853,7 +4853,7 @@ def Get_Partner_All_Class_Few_Fields(diction):
|
|||
RetObject.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
print(" #### Get_Partner_All_Class_Few_Fields - return find_partner_class_like = : ", str(RetObject))
|
||||
#print(" #### Get_Partner_All_Class_Few_Fields - return find_partner_class_like = : ", str(RetObject))
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,11 @@ def Add_Message_To_Mail_Queue(tab_files, diction):
|
|||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
new_data['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
#print(" ### mail to store in queue = ", new_data)
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,10 @@ def Create_Empty_Internal_Mail(diction):
|
|||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
new_data['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['internal_mail'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
|
|
@ -216,7 +219,10 @@ def Add_Message_To_Internal_Mail(tab_files, diction):
|
|||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
new_data['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['internal_mail'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
|
|
@ -341,10 +347,15 @@ def Update_Message_To_Internal_Mail(tab_files, Folder, diction):
|
|||
if( tmp ):
|
||||
tab_message_id.append(tmp)
|
||||
|
||||
local_partner_owner_recid = ""
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
local_partner_owner_recid = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
local_partner_owner_recid = str(my_partner['recid'])
|
||||
# Recuperation des donnes smtp
|
||||
(local_stpm_status, local_SMTP_COUNT_smtpsrv, local_own_smtp_value, local_SMTP_COUNT_password,
|
||||
local_SMTP_COUNT_user, local_SMTP_COUNT_From_User,
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(my_partner['recid']))
|
||||
local_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(str(local_partner_owner_recid))
|
||||
|
||||
for local_message_id in tab_message_id :
|
||||
|
||||
|
|
@ -354,7 +365,7 @@ def Update_Message_To_Internal_Mail(tab_files, Folder, diction):
|
|||
is_massage_valide = MYSY_GV.dbname['internal_mail'].count_documents({'_id':ObjectId(str(local_message_id)),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'partner_owner_recid':str(local_partner_owner_recid),
|
||||
'statut':{'$ne':'1'}})
|
||||
|
||||
if( is_massage_valide != 1):
|
||||
|
|
@ -379,7 +390,10 @@ def Update_Message_To_Internal_Mail(tab_files, Folder, diction):
|
|||
|
||||
data_cle = {}
|
||||
data_cle['_id'] = ObjectId(local_id)
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
data_cle['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['statut'] = {'$ne': '1'}
|
||||
|
||||
|
||||
|
|
@ -550,7 +564,11 @@ def Get_List_User_Internal_Mail(diction):
|
|||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
data_cle['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
|
@ -625,16 +643,21 @@ def Get_List_Internal_Mail_Sent_By_User(diction):
|
|||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
data_cle['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['creation_by'] = str(diction['creation_by'])
|
||||
|
||||
qry = {"$and": [data_cle, {'from': {'$exists': True}},]}
|
||||
|
||||
print(" ### qryqry = ", qry)
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
|
|
@ -698,11 +721,17 @@ def Get_Nb_User_Internal_Mail_Not_Read(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
print(" my_partnermy_partner = ", my_partner)
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if( "type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
data_cle['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['liste_user_id_read'] = {'$ne':str(my_partner['_id'])}
|
||||
|
|
@ -711,6 +740,8 @@ def Get_Nb_User_Internal_Mail_Not_Read(diction):
|
|||
|
||||
query_qet_email_to_or_cc = [{'$match': {'$and': [data_cle, filt_to_user_or_cc_user]}}, { '$count': "nb_mail_non_lus" }]
|
||||
|
||||
print(" ## query_qet_email_to_or_cc = ", query_qet_email_to_or_cc)
|
||||
|
||||
nb_mail_non_lu = "0"
|
||||
for line in MYSY_GV.dbname['internal_mail'].aggregate(query_qet_email_to_or_cc):
|
||||
nb_mail_non_lu = str(line['nb_mail_non_lus'])
|
||||
|
|
@ -905,7 +936,11 @@ def Get_List_Internal_Destinataire(diction):
|
|||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
if ("type_user_collection" in my_partner.keys() and my_partner['type_user_collection'] == "user_account"):
|
||||
data_cle['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
else:
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
data_cle['active'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
|
|
|||
9
main.py
9
main.py
|
|
@ -218,8 +218,8 @@ def Ent_Student_login():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Ent_Student_login payload = ",payload)
|
||||
status, retval, firstconnexion, apprenant_id = us.Ent_Student_login(payload)
|
||||
return jsonify(status=status, message=retval, firstconnexion=firstconnexion, apprenant_id=apprenant_id)
|
||||
status, retval, firstconnexion, apprenant_id, user_account_id = us.Ent_Student_login(payload)
|
||||
return jsonify(status=status, message=retval, firstconnexion=firstconnexion, apprenant_id=apprenant_id, user_account_id=user_account_id)
|
||||
|
||||
|
||||
|
||||
|
|
@ -4141,7 +4141,7 @@ API de validation en masse des inscriptions
|
|||
def Accept_List_AttendeeInscription():
|
||||
# On CancelAttendeeInscription le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Accept_List_AttendeeInscription : payload = ",payload)
|
||||
print(" ### Accept_List_AttendeeInscription : payload = ",)
|
||||
localStatus, message= inscription.Accept_List_AttendeeInscription(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
|
@ -7447,7 +7447,6 @@ def Store_User_Downloaded_File():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Store_User_Downloaded_File payload = ",payload)
|
||||
print(request.files)
|
||||
|
||||
if request.method == 'POST':
|
||||
# Create variable for uploaded file
|
||||
|
|
@ -11267,7 +11266,7 @@ API pour Mise à jour les note evaluation
|
|||
def Update_Participant_Evaluation_Note():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Participant_Evaluation_Note payload = ",payload)
|
||||
print(" ### Update_Participant_Evaluation_Note payload = ",)
|
||||
status, retval = note_evaluation_mgt.Update_Participant_Evaluation_Note(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
|
|
|||
|
|
@ -665,6 +665,9 @@ def Get_Given_Sequence_Planning_Model_With_Option(diction):
|
|||
"""
|
||||
Cette fonction permet d'appliquer un nouveau planning à une session apres avoir
|
||||
choisir un planning modele
|
||||
|
||||
/!\ : Verifier si les UE du planning existe dans la formation ou on veut l'appliquer.
|
||||
Si l'ue n'existe pas, alors ne le copie pas,
|
||||
"""
|
||||
def Apply_Planning_Model_To_Session(diction):
|
||||
try:
|
||||
|
|
@ -706,6 +709,22 @@ def Apply_Planning_Model_To_Session(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
session_data_count = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1'})
|
||||
|
||||
if( session_data_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
|
||||
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1'})
|
||||
|
||||
|
||||
tab_sequence_modele = diction['tab_sequence_modele']
|
||||
tab_sequence_modele_JSON = ast.literal_eval(tab_sequence_modele)
|
||||
|
|
@ -727,6 +746,8 @@ def Apply_Planning_Model_To_Session(diction):
|
|||
|
||||
#print(" ### deleted_data.deleted_count = ", deleted_data.deleted_count )
|
||||
|
||||
warning_message = ""
|
||||
is_warning_message = "0"
|
||||
|
||||
"""
|
||||
Enregistrement du nouveau planning
|
||||
|
|
@ -765,8 +786,28 @@ def Apply_Planning_Model_To_Session(diction):
|
|||
|
||||
local_node['grp_apprenant_id'] = ""
|
||||
|
||||
if("local_ue_id" in new_sequence.keys() ):
|
||||
local_node['ue_id'] = new_sequence['local_ue_id']
|
||||
if("local_ue_id" in new_sequence.keys() and new_sequence['local_ue_id']):
|
||||
|
||||
"""
|
||||
Verifier si new_sequence['local_ue_id'] existant pour la formation a la quelle est liéé la session / promo
|
||||
"""
|
||||
class_id = session_data['class_id']
|
||||
# Verifier que la formation et l'ue de la formation existe et sont valides
|
||||
|
||||
is_existe_class_and_class_ue = MYSY_GV.dbname['myclass'].count_documents(
|
||||
{'_id': ObjectId(str(class_id)),
|
||||
'list_unite_enseignement._id': str(new_sequence['local_ue_id']),
|
||||
'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if( is_existe_class_and_class_ue > 0 ):
|
||||
local_node['ue_id'] = new_sequence['local_ue_id']
|
||||
else:
|
||||
local_node['ue_id'] = ""
|
||||
warning_message = "Certaines UE n'ont pas été dupliquées car elles ne sont pas paramétrées sur cette formation"
|
||||
is_warning_message = "1"
|
||||
|
||||
else:
|
||||
local_node['ue_id'] = ""
|
||||
|
||||
|
|
@ -784,8 +825,10 @@ def Apply_Planning_Model_To_Session(diction):
|
|||
|
||||
MYSY_GV.dbname['session_formation_sequence'].insert_one(local_node)
|
||||
|
||||
|
||||
return True, " Le planning a été correctement appliqué"
|
||||
if( is_warning_message == "1"):
|
||||
return True, " Le planning a été appliqué. Toutefois certaines UE n'ont pas été dupliquées car elles ne sont pas paramétrées sur cette formation"
|
||||
else:
|
||||
return True, " Le planning a été correctement appliqué"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
|
|||
|
|
@ -2061,7 +2061,10 @@ def Update_Participant_Evaluation_Note(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant de l'évaluation n'est pas valide ")
|
||||
return False, " L'identifiant de l'évaluation n'est pas valide "
|
||||
|
||||
JSON_tab_participant_note = ast.literal_eval(diction['tab_participant_note'])
|
||||
new_tab_participant_note = str(diction['tab_participant_note']).replace(":false,", ':"false",').replace(":true,", ':"true",')
|
||||
print(" ### new_tab_participant_note = ", new_tab_participant_note)
|
||||
|
||||
JSON_tab_participant_note = ast.literal_eval(new_tab_participant_note)
|
||||
|
||||
for val in JSON_tab_participant_note:
|
||||
if( '_id' in val.keys() and val['_id'] ):
|
||||
|
|
@ -2072,8 +2075,10 @@ def Update_Participant_Evaluation_Note(diction):
|
|||
else:
|
||||
new_data['note'] = "-1"
|
||||
|
||||
if ("publish" in val.keys()):
|
||||
new_data['publish'] = str(val['publish'])
|
||||
if ("publish" in val.keys() and str(val['publish']) == "false"):
|
||||
new_data['publish'] = False
|
||||
elif ("publish" in val.keys() and str(val['publish']) == "true"):
|
||||
new_data['publish'] = True
|
||||
else:
|
||||
new_data['publish'] = "0"
|
||||
|
||||
|
|
|
|||
|
|
@ -1521,7 +1521,7 @@ def Get_List_Ressource_Humaine_with_filter(diction):
|
|||
|
||||
filt_nom = {}
|
||||
if ("nom" in diction.keys() and diction['nom']):
|
||||
filt_nom = {'nom': {'$regex': str(diction['nom']), "$options": "i"}}
|
||||
filt_nom = {'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom'])), "$options": "i"}}
|
||||
|
||||
filt_type_rh = {}
|
||||
if ("type_rh" in diction.keys() and diction['type_rh']):
|
||||
|
|
@ -1531,16 +1531,16 @@ def Get_List_Ressource_Humaine_with_filter(diction):
|
|||
filt_email = {}
|
||||
if ("email" in diction.keys() and diction['email']):
|
||||
filt_email = {
|
||||
'email': {'$regex': str(diction['email']), "$options": "i"}}
|
||||
'email': {'$regex': mycommon.regex_replace_cartere(str(diction['email'])), "$options": "i"}}
|
||||
|
||||
sub_filt_formation = {}
|
||||
if ("formation" in diction.keys() and diction['formation']):
|
||||
sub_filt_formation = {
|
||||
'external_code': {'$regex': str(diction['formation']), "$options": "i"}, 'partner_owner_recid':str(my_partner['recid'])}
|
||||
'external_code': {'$regex': mycommon.regex_replace_cartere(str(diction['formation'])), "$options": "i"}, 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
sub_filt_session = {}
|
||||
if ("session" in diction.keys() and diction['session']):
|
||||
sub_filt_session = { 'code_session': {'$regex': str(diction['session']), "$options": "i"}, 'partner_owner_recid':str(my_partner['recid'])}
|
||||
sub_filt_session = { 'code_session': {'$regex': mycommon.regex_replace_cartere(str(diction['session'])), "$options": "i"}, 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
filt_competence = {}
|
||||
if( "competence" in diction.keys() and diction['competence']):
|
||||
|
|
|
|||
|
|
@ -0,0 +1,807 @@
|
|||
"""
|
||||
Ce fichier permet de gérer les stages d'un inscrit.
|
||||
Pour mémo un stage porte sur une UE, c'est a dire qu'un stage est defini par
|
||||
- UE,
|
||||
- Inscrit
|
||||
- Une entreprise partenaire
|
||||
- Date début et Fin
|
||||
- Un maitre de stage (autre RH)
|
||||
|
||||
Pour l'evaluation du stage se reporter à l'évaluation des UE.
|
||||
|
||||
Ce système permettre d'editer une convention de stage de la signer avec la signature electronique.
|
||||
|
||||
partner_client_tuteur_id => désigne le tuteur en entreprise
|
||||
internal_tuteur_id => designe le prof tuteur
|
||||
autre_disposition => Permet de saisir du texte comme 'assurance', 'horaires',
|
||||
'confidentialité', 'gratification', etc
|
||||
|
||||
statut :
|
||||
- 0 : stage non realisé par l'inscrit
|
||||
- 1 : stage realisé par l'inscrit
|
||||
"""
|
||||
import ast
|
||||
from zipfile import ZipFile
|
||||
|
||||
import bson
|
||||
import pymongo
|
||||
import xlsxwriter
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime, date
|
||||
|
||||
import partner_client
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
import csv
|
||||
import pandas as pd
|
||||
from pymongo import ReturnDocument
|
||||
import GlobalVariable as MYSY_GV
|
||||
from math import isnan
|
||||
import GlobalVariable as MYSY_GV
|
||||
import ela_index_bdd_classes as eibdd
|
||||
import email_mgt as email
|
||||
import jinja2
|
||||
from flask import send_file
|
||||
from xhtml2pdf import pisa
|
||||
from email.message import EmailMessage
|
||||
from email.mime.text import MIMEText
|
||||
from email import encoders
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
import attached_file_mgt
|
||||
|
||||
"""
|
||||
Ajout d'un stage
|
||||
"""
|
||||
def Add_Stage_Inscrit(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'eu_id', 'inscrit_id', 'session_id', 'partner_client_tuteur_id',
|
||||
'internal_tuteur_id', 'partner_client_id'
|
||||
'date_debut', 'date_fin', 'adresse', 'cp', 'ville',
|
||||
'pays', 'objectifs', 'objectifs', 'autre_disposition', 'comment']
|
||||
|
||||
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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'eu_id', 'inscrit_id', 'session_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 la liste des arguments ")
|
||||
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
|
||||
|
||||
|
||||
"""
|
||||
Si internal_tuteur_id, alors verifier la validité de l'enseignant tuteur de stage
|
||||
"""
|
||||
if( 'internal_tuteur_id' in diction.keys() and diction['internal_tuteur_id']):
|
||||
is_valide_internal_tuteur_id = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'_id': ObjectId(str(diction['internal_tuteur_id'])),
|
||||
'partner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_internal_tuteur_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'enseignant encadrant est invalide ")
|
||||
return False, " L'identifiant l'enseignant encadrant est invalide "
|
||||
|
||||
"""
|
||||
Si eu_id, alors verifier la validité de l'unité d'enseignement
|
||||
"""
|
||||
if ('eu_id' in diction.keys() and diction['eu_id']):
|
||||
is_valide_partner_client_id = MYSY_GV.dbname['unite_enseignement'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_partner_client_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'unité enseignement est invalide ")
|
||||
return False, " L'identifiant de l'unité enseignement est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Si partner_client_id, alors verifier la validité de l'entreprise
|
||||
"""
|
||||
if ('partner_client_id' in diction.keys() and diction['partner_client_id']):
|
||||
is_valide_partner_client_id = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_partner_client_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'entreprise est invalide ")
|
||||
return False, " L'identifiant de l'entreprise est invalide "
|
||||
|
||||
"""
|
||||
Si partner_client_tuteur_id, alors verifier la validité du tuteur en entreprise. c'est une ressource de 'autre rh'
|
||||
"""
|
||||
if ('partner_client_tuteur_id' in diction.keys() and diction['partner_client_tuteur_id']):
|
||||
is_valide_partner_client_id = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_client_tuteur_id'])),
|
||||
'partner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_partner_client_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du tuteur en entreprise est invalide ")
|
||||
return False, " L'identifiant du tuteur en entreprise est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Si session_id, verifier la validité de la session
|
||||
"""
|
||||
if ('session_id' in diction.keys() and diction['session_id']):
|
||||
is_valide_session_id = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if (is_valide_session_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la session (class) est invalide ")
|
||||
return False, " L'identifiant de la session (class) est invalide "
|
||||
|
||||
"""
|
||||
Si inscrit_id, verifier la validité de l'inscrit
|
||||
"""
|
||||
if ('inscrit_id' in diction.keys() and diction['inscrit_id']):
|
||||
is_valide_inscrit_id = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if (is_valide_inscrit_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
|
||||
return False, " L'identifiant de l'inscrit est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier que les date_debut et date_fin sont ok
|
||||
"""
|
||||
date_debut = str(diction['date_debut']).strip()[0:10]
|
||||
local_status = mycommon.CheckisDate_Hours(date_debut)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de début de stage n'est pas au format jj/mm/aaaa")
|
||||
|
||||
return False, " La date de fin stage n'est pas au format jj/mm/aaaa"
|
||||
|
||||
date_fin = str(diction['date_fin']).strip()[0:10]
|
||||
local_status = mycommon.CheckisDate_Hours(date_fin)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de fin n'est pas au format jj/mm/aaaa")
|
||||
|
||||
return False, " La date de fin n'est pas au format jj/mm/aaaa"
|
||||
|
||||
## Verification de la cohérence des dates. Date_du doit <= Date_au
|
||||
if (datetime.strptime(str(date_debut).strip(), '%d/%m/%Y %H:%M') > datetime.strptime(
|
||||
str(date_fin).strip(), '%d/%m/%Y %H:%M')):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La date debut " + str(date_debut) + " est postérieure à la date de fin " + str(date_fin) + " ")
|
||||
|
||||
return False, " La date debut " + str(date_debut) + " est postérieure à la date de fin " + str(date_fin) + " "
|
||||
|
||||
|
||||
|
||||
new_data = diction
|
||||
mytoken = diction['token']
|
||||
del diction['token']
|
||||
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
new_data[str(val)] = ""
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['statut'] = "0"
|
||||
new_data['create_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['inscription_stage'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer le stage (2) ")
|
||||
return False, " Impossible de créer le stage (2) "
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = mytoken
|
||||
history_event_dict['related_collection'] = "inscription_stage"
|
||||
history_event_dict['related_collection_recid'] = str(inserted_id)
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Création stage "
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, " Le stage a été correctement créé"
|
||||
|
||||
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 créer le stage "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'un stage
|
||||
"""
|
||||
def Update_Stage_Inscrit(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'stage_id', 'eu_id', 'inscrit_id', 'session_id', 'partner_client_tuteur_id',
|
||||
'internal_tuteur_id', 'partner_client_id'
|
||||
'date_debut', 'date_fin', 'adresse', 'cp', 'ville',
|
||||
'pays', 'objectifs', 'objectifs', 'autre_disposition', 'comment',
|
||||
'statut']
|
||||
|
||||
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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'stage_id', 'eu_id', 'inscrit_id', 'session_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 la liste des arguments ")
|
||||
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 stage à modifier
|
||||
"""
|
||||
is_valide_stage_id = MYSY_GV.dbname['inscription_stage'].count_documents(
|
||||
{'_id': ObjectId(str(diction['internal_tuteur_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_stage_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du stage est invalide ")
|
||||
return False, " L'identifiant du stage est invalide "
|
||||
|
||||
"""
|
||||
Verifier la validité du stage n'est pas verrouilée
|
||||
"""
|
||||
is_valide_stage_id_locked = MYSY_GV.dbname['inscription_stage'].count_documents(
|
||||
{'_id': ObjectId(str(diction['internal_tuteur_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'status':'2',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_stage_id_locked > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Les données de de stage sont verrouillées ")
|
||||
return False, " Les données de de stage sont verrouillées "
|
||||
|
||||
|
||||
|
||||
if ('statut' in diction.keys() and diction['statut']):
|
||||
if( str(diction['statut']).strip() not in MYSY_GV.STAGE_STATUS):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le statut du stage est invalide, les valeurs autorisées sont :"+str(MYSY_GV.STAGE_STATUS))
|
||||
return False, " Le statut du stage est invalide, les valeurs autorisées sont "+str(MYSY_GV.STAGE_STATUS)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Si internal_tuteur_id, alors verifier la validité de l'enseignant tuteur de stage
|
||||
"""
|
||||
if( 'internal_tuteur_id' in diction.keys() and diction['internal_tuteur_id']):
|
||||
is_valide_internal_tuteur_id = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'_id': ObjectId(str(diction['internal_tuteur_id'])),
|
||||
'partner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_internal_tuteur_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'enseignant encadrant est invalide ")
|
||||
return False, " L'identifiant l'enseignant encadrant est invalide "
|
||||
|
||||
"""
|
||||
Si eu_id, alors verifier la validité de l'unité d'enseignement
|
||||
"""
|
||||
if ('eu_id' in diction.keys() and diction['eu_id']):
|
||||
is_valide_partner_client_id = MYSY_GV.dbname['unite_enseignement'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_partner_client_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'unité enseignement est invalide ")
|
||||
return False, " L'identifiant de l'unité enseignement est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Si partner_client_id, alors verifier la validité de l'entreprise
|
||||
"""
|
||||
if ('partner_client_id' in diction.keys() and diction['partner_client_id']):
|
||||
is_valide_partner_client_id = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_partner_client_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'entreprise est invalide ")
|
||||
return False, " L'identifiant de l'entreprise est invalide "
|
||||
|
||||
"""
|
||||
Si partner_client_tuteur_id, alors verifier la validité du tuteur en entreprise. c'est une ressource de 'autre rh'
|
||||
"""
|
||||
if ('partner_client_tuteur_id' in diction.keys() and diction['partner_client_tuteur_id']):
|
||||
is_valide_partner_client_id = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_client_tuteur_id'])),
|
||||
'partner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_partner_client_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du tuteur en entreprise est invalide ")
|
||||
return False, " L'identifiant du tuteur en entreprise est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Si session_id, verifier la validité de la session
|
||||
"""
|
||||
if ('session_id' in diction.keys() and diction['session_id']):
|
||||
is_valide_session_id = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if (is_valide_session_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la session (class) est invalide ")
|
||||
return False, " L'identifiant de la session (class) est invalide "
|
||||
|
||||
"""
|
||||
Si inscrit_id, verifier la validité de l'inscrit
|
||||
"""
|
||||
if ('inscrit_id' in diction.keys() and diction['inscrit_id']):
|
||||
is_valide_inscrit_id = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if (is_valide_inscrit_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
|
||||
return False, " L'identifiant de l'inscrit est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que les date_debut et date_fin sont ok
|
||||
"""
|
||||
date_debut = str(diction['date_debut']).strip()[0:10]
|
||||
local_status = mycommon.CheckisDate_Hours(date_debut)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de début de stage n'est pas au format jj/mm/aaaa")
|
||||
|
||||
return False, " La date de fin stage n'est pas au format jj/mm/aaaa"
|
||||
|
||||
date_fin = str(diction['date_fin']).strip()[0:10]
|
||||
local_status = mycommon.CheckisDate_Hours(date_fin)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de fin n'est pas au format jj/mm/aaaa")
|
||||
|
||||
return False, " La date de fin n'est pas au format jj/mm/aaaa"
|
||||
|
||||
## Verification de la cohérence des dates. Date_du doit <= Date_au
|
||||
if (datetime.strptime(str(date_debut).strip(), '%d/%m/%Y %H:%M') > datetime.strptime(
|
||||
str(date_fin).strip(), '%d/%m/%Y %H:%M')):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La date debut " + str(date_debut) + " est postérieure à la date de fin " + str(date_fin) + " ")
|
||||
|
||||
return False, " La date debut " + str(date_debut) + " est postérieure à la date de fin " + str(date_fin) + " "
|
||||
|
||||
|
||||
|
||||
new_data = diction
|
||||
mytoken = diction['token']
|
||||
stage_id = str(diction['stage_id'])
|
||||
|
||||
del diction['token']
|
||||
del diction['stage_id']
|
||||
|
||||
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
ret_val = MYSY_GV.dbname['inscription_stage'].find_one_and_update({'_id': ObjectId(stage_id),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1'},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = mytoken
|
||||
history_event_dict['related_collection'] = "inscription_stage"
|
||||
history_event_dict['related_collection_recid'] = stage_id
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Mise à jour stage "
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, " Le stage a été correctement mis à jour"
|
||||
|
||||
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 mettre à jour le stage "
|
||||
|
||||
|
||||
"""
|
||||
Verrouillage et déverrouillage des données d'un stage
|
||||
"""
|
||||
def Lock_Unlock_Stage_Inscrit(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'stage_id', 'statut']
|
||||
|
||||
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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'stage_id', 'statut']
|
||||
|
||||
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 la liste des arguments ")
|
||||
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 stage à modifier
|
||||
"""
|
||||
is_valide_stage_id = MYSY_GV.dbname['inscription_stage'].count_documents(
|
||||
{'_id': ObjectId(str(diction['internal_tuteur_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_stage_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du stage est invalide ")
|
||||
return False, " L'identifiant du stage est invalide "
|
||||
|
||||
|
||||
|
||||
if ('statut' in diction.keys() and diction['statut']):
|
||||
if( str(diction['statut']).strip() not in MYSY_GV.STAGE_STATUS):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le statut du stage est invalide, les valeurs autorisées sont :"+str(MYSY_GV.STAGE_STATUS))
|
||||
return False, " Le statut du stage est invalide, les valeurs autorisées sont "+str(MYSY_GV.STAGE_STATUS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mytoken = diction['token']
|
||||
stage_id = str(diction['stage_id'])
|
||||
|
||||
new_data = {}
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['statut'] = str(diction['statut'])
|
||||
|
||||
|
||||
ret_val = MYSY_GV.dbname['inscription_stage'].find_one_and_update({'_id': ObjectId(stage_id),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1'},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = mytoken
|
||||
history_event_dict['related_collection'] = "inscription_stage"
|
||||
history_event_dict['related_collection_recid'] = stage_id
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Vérrouillage / Déverrouillage du stage. Nouvelle valeur "+str(str(diction['statut']))
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, " Le stage a été correctement mis à jour"
|
||||
|
||||
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 mettre à jour le stage "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des stage des stages d'un inscrit sans filter
|
||||
"""
|
||||
def Get_Stage_Inscrit_no_filter(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'inscrit_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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'inscrit_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 la liste des arguments ")
|
||||
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
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0', 'inscrit_id':str(diction['inscrit_id'])}
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['inscription_stage'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_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 compétences "
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une compétence
|
||||
"""
|
||||
def Delete_Given_Stage_Inscrit(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'inscrit_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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'inscrit_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 la liste des arguments ")
|
||||
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 l'existance de l'opportunité
|
||||
is_opportunit_valide = MYSY_GV.dbname['inscription_stage'].count_documents({'_id':ObjectId(str(diction['inscrit_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if (is_opportunit_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la compétence est invalide ")
|
||||
return False, " L'identifiant de la compétence est invalide "
|
||||
|
||||
qry = {'_id':ObjectId(str(diction['inscrit_id'])), 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
ret_del_competence = MYSY_GV.dbname['inscription_stage'].delete_many(qry)
|
||||
|
||||
return True, "Le stage 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 stage "
|
||||
|
||||
|
|
@ -1807,7 +1807,7 @@ def Get_List_Unite_Enseignement_Planif_lines(diction):
|
|||
'valide': '1', 'locked': '0',
|
||||
'ue_id':str(diction['ue_id'])}
|
||||
|
||||
print("### Get_List_Unite_Enseignement_Planif_lines find_qry = ", find_qry)
|
||||
#print("### Get_List_Unite_Enseignement_Planif_lines find_qry = ", find_qry)
|
||||
|
||||
for retval in MYSY_GV.dbname['unite_enseignement_planif'].find(find_qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ def Ent_Student_login(diction):
|
|||
for val in incom_keys:
|
||||
if str(val).lower() not in str(field_list).lower():
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" Le champ '" + val + "' n'existe pas, MAJ annulée")
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False, False
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
|
|
@ -220,7 +220,7 @@ def Ent_Student_login(diction):
|
|||
for val in field_list_obligatoire:
|
||||
if str(val).lower() not in diction:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False, False
|
||||
|
||||
query = {}
|
||||
# recuperation des paramettre
|
||||
|
|
@ -256,7 +256,7 @@ def Ent_Student_login(diction):
|
|||
|
||||
if (tmp != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" Login/mot de passe invalide " + str(query)+ " my_user.count() = "+str(tmp))
|
||||
return False, " Login/mot de passe invalide, merci de verifier votre saisie. ", False, False
|
||||
return False, " Login/mot de passe invalide, merci de verifier votre saisie. ", False, False, False
|
||||
|
||||
my_user = coll_name.find(query)
|
||||
|
||||
|
|
@ -330,12 +330,12 @@ def Ent_Student_login(diction):
|
|||
if ("_id" not in ret_val.keys()):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Impossible de récupérer les données de l'utilisateur (2)")
|
||||
return False, " Impossible de récupérer les données de l'utilisateur (2) ", False, False
|
||||
return False, " Impossible de récupérer les données de l'utilisateur (2) ", False, False, False
|
||||
|
||||
return True, str(my_token), str(user_firstconnexion), str(ret_val['apprenant_id'])
|
||||
return True, str(my_token), str(user_firstconnexion), str(ret_val['apprenant_id']), str(ret_val['_id'])
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" Impossible d'enregistrer le token " + my_token)
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False, False
|
||||
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Reference in New Issue