20/04/2026 - 20h30

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-04-20 20:01:11 +02:00
parent 6fbcf1d670
commit 3c44b91005
8 changed files with 4635 additions and 45 deletions

View File

@ -4,13 +4,13 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="18/04/2026 -19h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="19/04/2026 - 20h30">
<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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/stage_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/stage_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
</list>
@ -456,7 +456,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="562" />
<option name="localTasksCounter" value="563" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -498,7 +498,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="22/02/26 - 20h" />
<MESSAGE value="24/02/26 - 19h30" />
<MESSAGE value="25/02/26 - 19h30" />
<MESSAGE value="26/02/26 - 19h30" />
@ -523,6 +522,7 @@
<MESSAGE value="10/04/2026 - 18h" />
<MESSAGE value="17/04/2026 -19h" />
<MESSAGE value="18/04/2026 -19h" />
<option name="LAST_COMMIT_MESSAGE" value="18/04/2026 -19h" />
<MESSAGE value="19/04/2026 - 20h30" />
<option name="LAST_COMMIT_MESSAGE" value="19/04/2026 - 20h30" />
</component>
</project>

View File

@ -1211,4 +1211,11 @@ Gestion de stage : Status
'4' => Stage Cloturé (ici aucune modification n'est possible)
'-1' => Annulé
"""
STAGE_STATUS = ['', '0', '1', '2', '3', '4', '-1']
STAGE_STATUS = ['', '0', '1', '2', '3', '4', '-1']
"""
Dans le cadre de l'evaluation des stages,
On prevoir une evaluation par le tuteur de stage et
une evaluation par le tuteur ecole
"""
STAGE_TYPE_EVAL = ['eval_tuteur_entreprise', 'eval_tuteur_ecole']

View File

@ -12462,7 +12462,7 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
toaddrs = ",".join(tab_emails_destinataire)
queue_mail_diction['email_to'] = str(toaddrs)
print(" ### convention dans queu mail queue_mail_diction = ", queue_mail_diction)
#print(" ### convention dans queu mail queue_mail_diction = ", queue_mail_diction)
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
queue_mail_diction)

File diff suppressed because one or more lines are too long

View File

@ -1938,7 +1938,7 @@ def Get_Given_Personnalisable_Fields_By_template_ref_interne(diction):
RetObject = []
val_tmp = 1
#print(" ### data_cle = ", data_cle)
print(" ### data_cle = ", data_cle)
for retval in MYSY_GV.dbname['courrier_template_champ_config'].find(data_cle):
user = retval
user['id'] = str(val_tmp)

View File

@ -4809,7 +4809,8 @@ def Get_Dictionnary_data_For_Template(diction):
apprenant_liste_champ = ['prenom', 'nom', 'email', 'civilite', 'telephone', 'employeur', 'adresse', 'code_postal', 'ville', 'pays', 'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'opco', 'tuteur1_adresse', 'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'client_rattachement_id', 'photo_profil',
'date_naissance', 'naissance_departement', 'naissance_lieu', 'naissance_pays', 'nationalite', 'num_secu', 'piece_identite_num', 'situation_famille']
'date_naissance', 'naissance_departement', 'naissance_lieu', 'naissance_pays', 'nationalite', 'num_secu',
'piece_identite_num', 'situation_famille', 'matricule']
qry_apprenant = {'_id': {'$in': tab_apprenant_id, },
'valide': '1',
@ -4919,7 +4920,7 @@ def Get_Dictionnary_data_For_Template(diction):
'tuteur2_adresse', 'tuteur2_cp', 'tuteur2_email', 'tuteur2_nom', 'tuteur2_pays',
'tuteur2_prenom','civilite',
'tuteur2_telephone', 'tuteur2_ville','adresse', 'code_postal', 'ville', 'pays',
'memo', 'comment']
'memo', 'comment', 'date_naissance', 'num_secu', 'naissance_lieu']
for stagiaire_data in MYSY_GV.dbname['inscription'].find({'_id': {'$in': tab_stagiaire_id, },
@ -7186,6 +7187,7 @@ def Get_Courrier_Template_Include_Default_Data(diction):
'default_version':'1'}
courrier_template_data_count = MYSY_GV.dbname['courrier_template'].count_documents(Qry_courrier_template)
if( courrier_template_data_count > 0 ):

View File

@ -98,7 +98,7 @@ def Add_Stage_Inscrit(diction):
'internal_tuteur_id', 'partner_client_id', 'description',
'date_debut', 'date_fin', 'adresse', 'cp', 'ville',
'pays', 'objectif', 'autre_disposition', 'comment', 'telephone', 'email',
'condition_horaire', 'remuneration']
'condition_horaire', 'remuneration', 'mission_etudiant', 'contrainte']
incom_keys = diction.keys()
for val in incom_keys:
@ -193,7 +193,10 @@ def Add_Stage_Inscrit(diction):
qry_contact_client['partner_recid'] = my_partner['recid']
qry_contact_client['valide'] = "1"
qry_contact_client['locked'] = "0"
qry_contact_client['_id'] = ObjectId(str(diction['partner_client_tuteur_id']))
print(" QRY = ", qry_contact_client)
is_valide_partner_client_id = MYSY_GV.dbname['contact'].count_documents(
qry_contact_client)
@ -334,7 +337,7 @@ def Update_Stage_Inscrit(diction):
'internal_tuteur_id', 'partner_client_id', 'description',
'date_debut', 'date_fin', 'adresse', 'cp', 'ville',
'pays', 'objectif', 'autre_disposition', 'comment', 'telephone', 'email',
'condition_horaire', 'remuneration']
'condition_horaire', 'remuneration', 'mission_etudiant', 'contrainte']
incom_keys = diction.keys()
for val in incom_keys:
@ -469,6 +472,7 @@ def Update_Stage_Inscrit(diction):
qry_contact_client['partner_recid'] = my_partner['recid']
qry_contact_client['valide'] = "1"
qry_contact_client['locked'] = "0"
qry_contact_client['_id'] = ObjectId(str(diction['partner_client_tuteur_id']))
is_valide_partner_client_id = MYSY_GV.dbname['contact'].count_documents(
qry_contact_client)
@ -1233,6 +1237,7 @@ def Prepare_and_Send_Stage_Convention_For_Selected_Inscrit_By_PDF(diction):
local_diction['session_id'] = diction['session_id']
local_diction['courrier_template_id'] = diction['courrier_template_id']
local_diction['inscription_id'] = str(val)
local_diction['stage_id'] = str(diction['stage_id'])
# print(" #### Traitemnt de local_diction bb = ", local_diction)
local_status, local_full_file_name = Create_Stage_Convention_By_Etudiant_PDF(local_diction)
@ -1323,6 +1328,90 @@ def Create_Stage_Convention_By_Etudiant_PDF(diction):
if (local_status is not True):
return local_status, my_partner
is_valide_stage_id = MYSY_GV.dbname['inscription_stage'].count_documents(
{'_id': ObjectId(str(diction['stage_id'])),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'})
if (is_valide_stage_id != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du stage " + str(diction['stage_id']) + " est invalide ")
return False, " L'identifiant du stage est invalide "
stage_data = MYSY_GV.dbname['inscription_stage'].find_one(
{'_id': ObjectId(str(diction['stage_id'])),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'})
is_tuteur_entreprise_stage_mail_valide = ""
is_tuteur_ecole_stage_mail_valide = ""
if ("partner_client_tuteur_id" in stage_data.keys() and stage_data['partner_client_tuteur_id']):
tuteur_entreprise_data = MYSY_GV.dbname['contact'].find_one(
{'_id': ObjectId(stage_data['partner_client_tuteur_id']),
'partner_recid': str(my_partner['recid']),
})
if (not tuteur_entreprise_data or 'email' not in tuteur_entreprise_data.keys()):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Le tuteur en entreprise est invalide")
return False, " Le tuteur en entreprise est invalide "
if (mycommon.isEmailValide(tuteur_entreprise_data['email']) is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - L'adresse email du tuteur en entreprise est invalide")
return False, " L'adresse email du tuteur en entreprise " + str(
stage_data['partner_client_tuteur_id']) + " est invalide "
is_tuteur_entreprise_stage_mail_valide = "1"
if ("internal_tuteur_id" in stage_data.keys() and stage_data['internal_tuteur_id']):
tuteur_ecole_data = MYSY_GV.dbname['ressource_humaine'].find_one(
{'_id': ObjectId(stage_data['internal_tuteur_id']),
'partner_recid': str(my_partner['recid']),
})
if (not tuteur_ecole_data or 'email' not in tuteur_ecole_data.keys()):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Le tuteur à l'école est invalide")
return False, " Le tuteur à l'école est invalide "
if (mycommon.isEmailValide(tuteur_ecole_data['email']) is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - L'adresse email du tuteur à l'école est invalide")
return False, " L'adresse email du tuteur à l'école " + str(
tuteur_ecole_data['email']) + " est invalide "
is_tuteur_ecole_stage_mail_valide = "1"
if (is_tuteur_entreprise_stage_mail_valide != "1" or is_tuteur_ecole_stage_mail_valide != '1'):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'un des deux tuteurs a une adresse email invalide ")
return False, " L'un des deux tuteurs a une adresse email invalide "
tuteur_ecole_data = MYSY_GV.dbname['ressource_humaine'].find_one(
{'_id': ObjectId(stage_data['internal_tuteur_id']),
'partner_recid': str(my_partner['recid']),
})
tuteur_entreprise_data = MYSY_GV.dbname['contact'].find_one(
{'_id': ObjectId(stage_data['partner_client_tuteur_id']),
'partner_recid': str(my_partner['recid']),
})
# 1 - Verifier que le modele de courrier est bien editable par individu
@ -1340,8 +1429,6 @@ def Create_Stage_Convention_By_Etudiant_PDF(diction):
statgiaire_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(diction['inscription_id'])), 'status':'1',
'partner_owner_recid':str(my_partner['recid'])})
@ -1386,7 +1473,7 @@ def Create_Stage_Convention_By_Etudiant_PDF(diction):
tab_class = []
tab_class.append(class_data['_id'])
tab_client = [ObjectId(str(stage_data['partner_client_id']))]
# Creation du dictionnaire d'information à utiliser pour la creation du doc
convention_dictionnary_data = {}
@ -1395,7 +1482,7 @@ def Create_Stage_Convention_By_Etudiant_PDF(diction):
new_diction['list_stagiaire_id'] = tab_stagiaire
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_client_id'] = tab_client
new_diction['list_apprenant_id'] = tab_apprenant
@ -1406,11 +1493,17 @@ def Create_Stage_Convention_By_Etudiant_PDF(diction):
convention_dictionnary_data = local_retval
convention_dictionnary_data['tuteur_ecole_data'] = tuteur_ecole_data
convention_dictionnary_data['tuteur_entreprise_data'] = tuteur_entreprise_data
convention_dictionnary_data['stage_data'] = stage_data
body = {
"params": convention_dictionnary_data,
}
print(" #### body = ",body)
"""
Creation du ficier PDF
"""
@ -1824,15 +1917,9 @@ def Sent_Etudiant_Convention_Stage_By_Email(tab_files, Folder, diction):
tmp_tab = []
# print(" ### tab_apprenant_contact = ", tab_apprenant_contact)
for tmp in tab_apprenant_contact:
if ("email" in tmp.keys()):
tab_emails_destinataire.append((tmp['email']))
tab_emails_destinataire.append((tuteur_entreprise_data['email']))
if (len(tab_emails_destinataire) <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Aucune adresse email n'a pas été fournie.02 ")
return False, " Aucune adresse email n'a pas été fournie. 02"
# print(" ### tab_emails_destinataire = ", tab_emails_destinataire)
@ -1922,6 +2009,8 @@ def Sent_Etudiant_Convention_Stage_By_Email(tab_files, Folder, diction):
tab_class = []
tab_class.append(class_data['_id'])
tab_client = [ObjectId(str(stage_data['partner_client_id']))]
# Creation du dictionnaire d'information à utiliser pour la creation du doc
convention_dictionnary_data = {}
new_diction = {}
@ -1929,7 +2018,7 @@ def Sent_Etudiant_Convention_Stage_By_Email(tab_files, Folder, diction):
new_diction['list_stagiaire_id'] = tab_participant
new_diction['list_session_id'] = tab_session
new_diction['list_class_id'] = tab_class
new_diction['list_client_id'] = []
new_diction['list_client_id'] = tab_client
new_diction['list_apprenant_id'] = tab_apprenant
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
@ -1938,6 +2027,15 @@ def Sent_Etudiant_Convention_Stage_By_Email(tab_files, Folder, diction):
return local_status, local_retval
convention_dictionnary_data = local_retval
convention_dictionnary_data['tuteur_ecole_data'] = tuteur_ecole_data
convention_dictionnary_data['tuteur_entreprise_data'] = tuteur_entreprise_data
convention_dictionnary_data['stage_data'] = stage_data
if ("request_digital_signature" in diction.keys() and diction['request_digital_signature'] == "1"):
convention_dictionnary_data['digital_signature'] = "1"
else:
convention_dictionnary_data['digital_signature'] = "0"
if ("company_data" in local_retval.keys() and "societe_nom" in local_retval['company_data'].keys()):
company_name = local_retval['company_data']['societe_nom']
@ -2215,7 +2313,7 @@ def Sent_Etudiant_Convention_Stage_By_Email(tab_files, Folder, diction):
toaddrs = ",".join(tab_emails_destinataire)
queue_mail_diction['email_to'] = str(toaddrs)
print(" ### convention dans queu mail queue_mail_diction = ", queue_mail_diction)
#print(" ### convention dans queu mail queue_mail_diction = ", queue_mail_diction)
queue_and_internal_mail_status, queue_and_internal_mail_status = email_mgt.Individual_Mail_Store_Queu_And_Internal_Mail(
queue_mail_diction)

View File

@ -1887,7 +1887,7 @@ def Add_Specific_Survey_Tab_For_Stage_Evaluation(diction):
Verification des input acceptés
"""
field_list = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date', 'related_collection',
'related_collection_id', 'stage_id', 'inscription_id' ]
'related_collection_id', 'stage_id', 'inscription_id', 'stage_type_eval' ]
incom_keys = diction.keys()
for val in incom_keys:
@ -1896,7 +1896,7 @@ def Add_Specific_Survey_Tab_For_Stage_Evaluation(diction):
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
return False, " Les informations fournies sont incorrectes", False
field_list_obligatoire = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date']
field_list_obligatoire = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date', 'stage_type_eval']
for val in field_list_obligatoire:
if val not in diction:
@ -1914,6 +1914,12 @@ def Add_Specific_Survey_Tab_For_Stage_Evaluation(diction):
if (local_status is not True):
return local_status, my_partner, False
if( diction['stage_type_eval'] not in MYSY_GV.STAGE_TYPE_EVAL):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le type d'évaluation '" + str(diction['stage_type_eval']) + "' n'est pas autorisé pour les stages. Valeurs autorisées "+str(MYSY_GV.STAGE_TYPE_EVAL))
return False, " Le type d'évaluation '" + str(diction['stage_type_eval']) + "' n'est pas autorisé pour les stages. Valeurs autorisées "+str(MYSY_GV.STAGE_TYPE_EVAL), False
local_safe_survey_internal_code = mycommon.create_user_recid()
@ -1993,18 +1999,25 @@ def Add_Specific_Survey_Tab_For_Stage_Evaluation(diction):
MYSY_GV.dbname['survey'].delete_many({'partner_owner_recid':str(my_partner['recid']),
'session_id':str(diction['session_id']),
'survey_type':str(diction['survey_type']),
'stage_type_eval': str(diction['stage_type_eval']),
'inscription_id':str(diction['inscription_id'])})
server_diction = {}
server_diction['token'] = diction['token']
server_diction['session_id'] = diction['session_id']
server_diction['contact_id'] = str(stage_data['partner_client_tuteur_id'])
if(diction['stage_type_eval'] == "eval_tuteur_entreprise" ):
server_diction['contact_id'] = str(stage_data['partner_client_tuteur_id'])
elif(diction['stage_type_eval'] == "eval_tuteur_ecole" ):
server_diction['ressource_humaine_id'] = str(stage_data['internal_tuteur_id'])
server_diction['formulaire_id'] = diction['formulaire_id']
server_diction['survey_type'] = diction['survey_type']
server_diction['sending_date'] = diction['sending_date']
server_diction['inscrit_id'] = diction['inscription_id']
server_diction['stage_id'] = diction['stage_id']
server_diction['stage_type_eval'] = diction['stage_type_eval']
if ("related_collection" in diction.keys() and diction['related_collection']
and "related_collection_id" in diction.keys() and diction['related_collection_id']):
@ -2015,7 +2028,7 @@ def Add_Specific_Survey_Tab_For_Stage_Evaluation(diction):
server_diction['survey_internal_code'] = local_safe_survey_internal_code
# server_diction['survey_type'] = 'specific_survey'
print(" ### server_diction = ", server_diction)
print(" ### server_diction ttt = ", server_diction)
local_status, local_retval = Create_One_Survey_To_Inscrit(server_diction)
if (local_status is False):
return local_status, local_retval
@ -2455,7 +2468,8 @@ def Create_One_Survey_To_Inscrit(diction):
Verification des input acceptés
"""
field_list = ['session_id', 'token', 'inscrit_id', 'formulaire_id', 'survey_type', 'sending_date', 'related_collection',
'related_collection_id', 'class_id', 'survey_internal_code', 'client_id', 'contact_id', 'stage_id']
'related_collection_id', 'class_id', 'survey_internal_code', 'client_id', 'contact_id', 'stage_id', 'stage_type_eval',
'ressource_humaine_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -2486,7 +2500,6 @@ def Create_One_Survey_To_Inscrit(diction):
"""
Recuperer les données du formulaire
"""
my_formulaire_data = MYSY_GV.dbname['formulaire'].find_one({'_id':ObjectId(str(diction['formulaire_id'])),
'valide':'1',
'locked':'0',
@ -2533,7 +2546,8 @@ def Create_One_Survey_To_Inscrit(diction):
"""
Recuperer les données de l'inscrit ou du client
"""
if( "inscrit_id" in diction.keys() and diction['inscrit_id'] and "contact_id" not in diction.keys()):
if( "inscrit_id" in diction.keys() and diction['inscrit_id'] and "contact_id" not in diction.keys() and "ressource_humaine_id" not in diction.keys()):
my_inscrit_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(diction['inscrit_id'])),
'valide': '1',
'locked': '0',
@ -2598,7 +2612,7 @@ def Create_One_Survey_To_Inscrit(diction):
mycommon.myprint(" Impossible de créer l'enquete (2) ")
return False, " Impossible de créer l'enquete (2) "
elif ("client_id" in diction.keys() and diction['client_id']):
if ("client_id" in diction.keys() and diction['client_id'] and "contact_id" not in diction.keys() and "ressource_humaine_id" not in diction.keys()):
my_client_data = MYSY_GV.dbname['partner_client'].find_one({'_id': ObjectId(str(diction['client_id'])),
'valide': '1',
'partner_owner_recid': str(
@ -2659,7 +2673,7 @@ def Create_One_Survey_To_Inscrit(diction):
mycommon.myprint(" Impossible de créer l'enquete (2) ")
return False, " Impossible de créer l'enquete (2) "
elif ("contact_id" in diction.keys() and diction['contact_id'] and "inscrit_id" in diction.keys()):
if ("contact_id" in diction.keys() and diction['contact_id'] and "inscrit_id" in diction.keys() and 'stage_id' in diction.keys() and diction['stage_id'] ):
contact_data = MYSY_GV.dbname['contact'].find_one({'_id': ObjectId(str(diction['contact_id'])),
'valide': '1',
'partner_recid': str(
@ -2694,6 +2708,9 @@ def Create_One_Survey_To_Inscrit(diction):
if( 'stage_id' in diction.keys()):
new_survey_data['stage_id'] = str(diction['stage_id'])
if ('stage_type_eval' in diction.keys() and 'stage_id' in diction.keys() and diction['stage_id']):
new_survey_data['stage_type_eval'] = str(diction['stage_type_eval'])
if ("survey_internal_code" in diction.keys()):
new_survey_data['survey_internal_code'] = str(diction['survey_internal_code'])
else:
@ -2726,7 +2743,76 @@ def Create_One_Survey_To_Inscrit(diction):
mycommon.myprint(" Impossible de créer l'enquete (2) ")
return False, " Impossible de créer l'enquete (2) "
if ("ressource_humaine_id" in diction.keys() and diction['ressource_humaine_id'] and "inscrit_id" in diction.keys() and 'stage_id' in diction.keys() and diction['stage_id']):
ressource_humaine_data = MYSY_GV.dbname['ressource_humaine'].find_one({'_id': ObjectId(str(diction['ressource_humaine_id'])),
'valide': '1',
'partner_recid': str(
my_partner['recid'])})
if (ressource_humaine_data is None):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant ressource_humaine est invalide ")
return False, " L'identifiant ressource_humaine est invalide "
related_collection = ""
related_collection_id = ""
if ("related_collection" in diction.keys() and "related_collection_id" in diction.keys()):
related_collection = diction['related_collection']
related_collection_id = diction['related_collection_id']
new_survey_data = {}
new_survey_data['email'] = ressource_humaine_data['email']
new_survey_data['nom'] = ressource_humaine_data['nom']
new_survey_data['prenom'] = ressource_humaine_data['prenom']
new_survey_data['civilite'] = ressource_humaine_data['civilite']
new_survey_data['fonction'] = ressource_humaine_data['fonction']
new_survey_data['ressource_humaine_id'] = str(ressource_humaine_data['_id'])
new_survey_data['formulaire_id'] = str(diction['formulaire_id'])
new_survey_data['inscription_id'] = str(diction['inscrit_id'])
new_survey_data['partner_owner_recid'] = str(my_partner['recid'])
new_survey_data['session_id'] = str(diction['session_id'])
new_survey_data['class_id'] = str(my_class_data['_id'])
new_survey_data['survey_type'] = str(diction['survey_type'])
if( 'stage_id' in diction.keys()):
new_survey_data['stage_id'] = str(diction['stage_id'])
if ('stage_type_eval' in diction.keys() and 'stage_id' in diction.keys() and diction['stage_id']):
new_survey_data['stage_type_eval'] = str(diction['stage_type_eval'])
if ("survey_internal_code" in diction.keys()):
new_survey_data['survey_internal_code'] = str(diction['survey_internal_code'])
else:
new_survey_data['survey_internal_code'] = ""
new_survey_data['related_collection'] = str(related_collection)
new_survey_data['related_collection_id'] = str(related_collection_id)
new_survey_data['date_envoi'] = ""
new_survey_data['automatique_sending_request_date'] = str(diction['sending_date'])
new_survey_data['automatique_traitement'] = "1"
new_survey_data['automatique_traitement_done'] = "0"
new_survey_data['locked'] = "0"
new_survey_data['valide'] = "1"
new_survey_data['mode_envoi'] = ""
new_survey_data['statut'] = "0"
new_survey_data['type'] = "1"
new_survey_data['creation_date'] = str(datetime.now())
new_survey_data['update_by'] = str(my_partner['_id'])
new_survey_data['creation_by'] = str(my_partner['_id'])
new_survey_data['date_dernier_relance_auto'] = str(datetime.now().strftime("%d/%m/%Y"))
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
if (not inserted_id):
mycommon.myprint(" Impossible de créer l'enquete (2) ")
return False, " Impossible de créer l'enquete (2) "
return True, " L'enquete a été créée"
@ -3055,7 +3141,7 @@ def Send_Survey_TabIds(diction):
courrier_ref_interne = "EVAL_AUTRE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "stage_eval"):
courrier_ref_interne = "EVAL_AUTRE"
courrier_ref_interne = "EVAL_STAGE_ENTREPRISE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "specific_survey"):
if ("client_id" in local_survey_retval.keys() and local_survey_retval['client_id']):
@ -3321,7 +3407,7 @@ def Send_Survey_TabIds(diction):
courrier_ref_interne = "EVAL_AUTRE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "stage_eval"):
courrier_ref_interne = "EVAL_AUTRE"
courrier_ref_interne = "EVAL_STAGE_ENTREPRISE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval[ 'survey_type'] == "specific_survey"):
courrier_ref_interne = "SPECIFIC_SURVEY"
@ -3547,7 +3633,7 @@ def Automatic_Send_Survey_TabIds(diction):
courrier_ref_interne = "EVAL_AUTRE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "stage_eval"):
courrier_ref_interne = "EVAL_AUTRE"
courrier_ref_interne = "EVAL_STAGE_ENTREPRISE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "specific_survey"):
courrier_ref_interne = "SPECIFIC_SURVEY"
@ -3778,7 +3864,7 @@ def Automatic_Send_Survey_TabIds(diction):
courrier_ref_interne = "EVAL_AUTRE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "stage_eval"):
courrier_ref_interne = "EVAL_AUTRE"
courrier_ref_interne = "EVAL_STAGE_ENTREPRISE"
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "specific_survey"):
courrier_ref_interne = "SPECIFIC_SURVEY"
@ -4824,6 +4910,11 @@ def Export_To_Excel_Survey_with_filter_Tab_Survey_Id(diction):
"""
local_diction = {}
local_diction['ref_interne'] = "EVALUATION_MODEL_PDF"
# 20/04/206 - Gestion des stage en entreprise
if( diction['type'] == "Stage_Entreprise"):
local_diction['ref_interne'] = "EVALUATION_STAGE_ENTREPRISE_MODEL_PDF"
local_diction['type_doc'] = "pdf"
local_diction['partner_owner_recid'] = str(my_partner['recid'])
@ -4833,8 +4924,8 @@ def Export_To_Excel_Survey_with_filter_Tab_Survey_Id(diction):
if( "contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le modèle de courrier 'EVALUATION_MODEL_PDF' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'EVALUATION_MODEL_PDF' n'est pas correctement configuré "
str(inspect.stack()[0][3]) + " Le modèle de courrier "+str(local_diction['ref_interne'])+" n'est pas correctement configuré ")
return False, " Le modèle de courrier "+str(local_diction['ref_interne'])+" n'est pas correctement configuré "
# Stokage des nom de fichier à zipper
list_file_name_to_zip = []
@ -4938,6 +5029,10 @@ def Export_To_Excel_Survey_with_filter_Tab_Survey_Id(diction):
if (formateur_data and 'email' in formateur_data.keys()):
formateur_email = formateur_data['email']
if( "stage_type_eval" in Survey_Data.keys()):
param_survey_data['stage_type_eval'] = Survey_Data['stage_type_eval']
else:
param_survey_data['stage_type_eval'] = ""
param_survey_data['evaluation_formateur'] = evaluation_formateur
@ -4946,10 +5041,62 @@ def Export_To_Excel_Survey_with_filter_Tab_Survey_Id(diction):
param_survey_data['formateur_evalue_prenom'] = formateur_prenom
param_survey_data['formateur_evalue_email'] = formateur_email
if( "fonction" in param_survey_data.keys()):
param_survey_data['formateur_evalue_fonction'] = param_survey_data['fonction']
else:
param_survey_data['formateur_evalue_fonction'] = ""
if (Survey_Data['survey_type'] == "stage_eval" and 'inscription_id' in Survey_Data.keys() and Survey_Data['inscription_id'] ):
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(Survey_Data['inscription_id'])),
'partner_owner_recid':str(Survey_Data['partner_owner_recid'])})
if(inscrit_data and 'nom' in inscrit_data.keys()):
param_survey_data['etudiant_stage_entreprise_nom'] = inscrit_data['nom']
else:
param_survey_data['etudiant_stage_entreprise_nom'] = ""
if (inscrit_data and 'prenom' in inscrit_data.keys()):
param_survey_data['etudiant_stage_entreprise_prenom'] = inscrit_data['prenom']
else:
param_survey_data['etudiant_stage_entreprise_prenom'] = ""
if (inscrit_data and 'email' in inscrit_data.keys()):
param_survey_data['etudiant_stage_entreprise_email'] = inscrit_data['email']
else:
param_survey_data['etudiant_stage_entreprise_email'] = ""
if (Survey_Data['survey_type'] == "stage_eval" and 'stage_id' in Survey_Data.keys() and
Survey_Data['stage_id']):
stage_data = MYSY_GV.dbname['inscription_stage'].find_one(
{'_id': ObjectId(str(Survey_Data['stage_id'])),
'partner_owner_recid': str(Survey_Data['partner_owner_recid'])})
if (stage_data and 'date_debut' in stage_data.keys()):
param_survey_data['stage_date_debut'] = stage_data['date_debut']
else:
param_survey_data['stage_date_debut'] = ""
if (stage_data and 'date_fin' in stage_data.keys()):
param_survey_data['stage_date_fin'] = stage_data['date_fin']
else:
param_survey_data['stage_date_fin'] = ""
stage_entreprise_data = MYSY_GV.dbname['partner_client'].find_one(
{'_id': ObjectId(str(stage_data['partner_client_id'])),
'partner_owner_recid': str(Survey_Data['partner_owner_recid'])})
if (stage_entreprise_data and 'raison_sociale' in stage_entreprise_data.keys()):
param_survey_data['stage_raison_sociale'] = stage_entreprise_data['raison_sociale']
else:
param_survey_data['stage_raison_sociale'] = ""
"""
Recuperer les données de la formation
"""
Recuperer les données de la formation
"""
my_class_data = MYSY_GV.dbname['myclass'].find_one(
{'_id': ObjectId(str(Survey_Data['class_id'])),
'valide': '1',