04/05/2026 - 13h

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-04 13:10:06 +02:00
parent c06f114fa7
commit b59da6f8ca
20 changed files with 25924 additions and 182 deletions

View File

@ -4,18 +4,27 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="28/04/26 - 19h">
<change afterPath="$PROJECT_DIR$/Categorie_apprenant.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Finance_mode_mgt.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Type_apprenant_mgt.py" afterDir="false" />
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="29/04/26 - 21h">
<change afterPath="$PROJECT_DIR$/Type_groupe_inscrit_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$/Dashbord_queries/BPF.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/BPF.py" 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$/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$/groupe_client_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_client_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Type_apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Type_apprenant_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$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_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$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/statistics.py" beforeDir="false" afterPath="$PROJECT_DIR$/statistics.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -459,7 +468,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="570" />
<option name="localTasksCounter" value="571" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -501,7 +510,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="07/03/26 - 16h" />
<MESSAGE value="08/03/26 - 20h" />
<MESSAGE value="10/03/26 - 20h" />
<MESSAGE value="14/03/2026 - 22h" />
@ -526,6 +534,7 @@
<MESSAGE value="26/04/26 - 19h" />
<MESSAGE value="27/04/26 - 19h" />
<MESSAGE value="28/04/26 - 19h" />
<option name="LAST_COMMIT_MESSAGE" value="28/04/26 - 19h" />
<MESSAGE value="29/04/26 - 21h" />
<option name="LAST_COMMIT_MESSAGE" value="29/04/26 - 21h" />
</component>
</project>

View File

@ -714,10 +714,299 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
tab_formateur_rh_sous_traitant_nom_prenom_mail = []
tab_formateur_rh_sous_traitant_total_heure = 0
E_pipe_qry_ressource_humaine__ressource_humaine_contrat_v2 = [
{
"$project": {
"_id": 1,
"partner_recid": 1,
"nom": 1,
"prenom": 1,
"fonction": 1,
"email": 1,
}
},
{
"$lookup": {
"from": "ressource_humaine_contrat",
"let": {
"rh_id": {"$toString": "$_id"},
"rh_partner_owner_recid": "$partner_recid",
},
"pipeline": [
{
"$addFields": {
"date_debut_clean": {
"$trim": {
"input": {"$ifNull": ["$date_debut", ""]}
}
},
"date_fin_clean": {
"$trim": {
"input": {"$ifNull": ["$date_fin", ""]}
}
},
}
},
{
"$addFields": {
"date_debut_parts": {
"$split": ["$date_debut_clean", "/"]
},
"date_fin_parts": {
"$split": ["$date_fin_clean", "/"]
},
}
},
{
"$addFields": {
"mysy_contrat_date_debut": {
"$cond": [
{"$eq": [{"$size": "$date_debut_parts"}, 3]},
{
"$dateFromParts": {
"year": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_debut_parts",
2,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"month": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_debut_parts",
1,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"day": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_debut_parts",
0,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
}
},
None,
]
},
"mysy_contrat_date_fin": {
"$cond": [
{"$eq": [{"$size": "$date_fin_parts"}, 3]},
{
"$dateFromParts": {
"year": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_fin_parts",
2,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"month": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_fin_parts",
1,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"day": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_fin_parts",
0,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
}
},
None,
]
},
}
},
{
"$match": {
"$expr": {
"$and": [
{"$eq": ["$valide", "1"]},
{"$eq": ["$rh_id", "$$rh_id"]},
{
"$eq": [
"$partner_owner_recid",
"$$rh_partner_owner_recid",
]
},
{
"$ne": [
"$mysy_contrat_date_debut",
None,
]
},
{
"$ne": [
"$mysy_contrat_date_fin",
None,
]
},
{
"$gt": [
"$mysy_contrat_date_fin",
filt_periode_start_date_ISODATE,
]
},
{
"$lt": [
"$mysy_contrat_date_debut",
filt_periode_end_date_ISODATE,
]
},
]
}
}
},
{
"$project": {
"_id": 1,
"rh_id": 1,
"date_debut": 1,
"date_fin": 1,
"type_contrat": 1,
"type_employe": 1,
"cout": 1,
"periodicite": 1,
"mysy_contrat_date_debut": 1,
"mysy_contrat_date_fin": 1,
}
},
],
"as": "collection_ressource_humaine_contrat",
}
},
{
"$unwind": "$collection_ressource_humaine_contrat"
},
{
"$lookup": {
"from": "agenda",
"let": {
"rh_id": {"$toString": "$_id"},
"rh_partner_owner_recid": "$partner_recid",
},
"pipeline": [
{
"$addFields": {
"agenda_event_date_debut": {
"$dateFromString": {
"dateString": {
"$substr": ["$event_start", 0, 10]
},
"format": "%Y-%m-%d",
"onError": None,
"onNull": None,
}
},
"agenda_event_date_fin": {
"$dateFromString": {
"dateString": {
"$substr": ["$event_end", 0, 10]
},
"format": "%Y-%m-%d",
"onError": None,
"onNull": None,
}
},
}
},
{
"$match": {
"$expr": {
"$and": [
{"$eq": ["$valide", "1"]},
{
"$eq": [
"$related_collection_recid",
"$$rh_id",
]
},
{
"$eq": [
"$partner_owner_recid",
"$$rh_partner_owner_recid",
]
},
{"$eq": ["$event_type", "planning"]},
{
"$ne": [
"$agenda_event_date_debut",
None,
]
},
{
"$ne": [
"$agenda_event_date_fin",
None,
]
},
{
"$gte": [
"$agenda_event_date_debut",
filt_periode_start_date_ISODATE,
]
},
{
"$lt": [
"$agenda_event_date_fin",
filt_periode_end_date_ISODATE,
]
},
]
}
}
},
],
"as": "collection_agenda",
}
},
]
print(" ### E_pipe_qry_ressource_humaine__ressource_humaine_contrat = ", E_pipe_qry_ressource_humaine__ressource_humaine_contrat)
print(" ### E_pipe_qry_ressource_humaine__ressource_humaine_contrat = ", E_pipe_qry_ressource_humaine__ressource_humaine_contrat_v2)
for retval in MYSY_GV.dbname['ressource_humaine'].aggregate(
E_pipe_qry_ressource_humaine__ressource_humaine_contrat):
E_pipe_qry_ressource_humaine__ressource_humaine_contrat_v2):
#print(" ### retval (employé ayant un contrat valide) = ", retval)
formateur_id = str(retval['_id'])
@ -1949,10 +2238,299 @@ def Prepare_and_Print_BPF_PDF(diction):
tab_formateur_rh_sous_traitant_nom_prenom_mail = []
tab_formateur_rh_sous_traitant_total_heure = 0
E_pipe_qry_ressource_humaine__ressource_humaine_contrat_v2 = [
{
"$project": {
"_id": 1,
"partner_recid": 1,
"nom": 1,
"prenom": 1,
"fonction": 1,
"email": 1,
}
},
{
"$lookup": {
"from": "ressource_humaine_contrat",
"let": {
"rh_id": {"$toString": "$_id"},
"rh_partner_owner_recid": "$partner_recid",
},
"pipeline": [
{
"$addFields": {
"date_debut_clean": {
"$trim": {
"input": {"$ifNull": ["$date_debut", ""]}
}
},
"date_fin_clean": {
"$trim": {
"input": {"$ifNull": ["$date_fin", ""]}
}
},
}
},
{
"$addFields": {
"date_debut_parts": {
"$split": ["$date_debut_clean", "/"]
},
"date_fin_parts": {
"$split": ["$date_fin_clean", "/"]
},
}
},
{
"$addFields": {
"mysy_contrat_date_debut": {
"$cond": [
{"$eq": [{"$size": "$date_debut_parts"}, 3]},
{
"$dateFromParts": {
"year": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_debut_parts",
2,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"month": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_debut_parts",
1,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"day": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_debut_parts",
0,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
}
},
None,
]
},
"mysy_contrat_date_fin": {
"$cond": [
{"$eq": [{"$size": "$date_fin_parts"}, 3]},
{
"$dateFromParts": {
"year": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_fin_parts",
2,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"month": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_fin_parts",
1,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
"day": {
"$convert": {
"input": {
"$arrayElemAt": [
"$date_fin_parts",
0,
]
},
"to": "int",
"onError": None,
"onNull": None,
}
},
}
},
None,
]
},
}
},
{
"$match": {
"$expr": {
"$and": [
{"$eq": ["$valide", "1"]},
{"$eq": ["$rh_id", "$$rh_id"]},
{
"$eq": [
"$partner_owner_recid",
"$$rh_partner_owner_recid",
]
},
{
"$ne": [
"$mysy_contrat_date_debut",
None,
]
},
{
"$ne": [
"$mysy_contrat_date_fin",
None,
]
},
{
"$gt": [
"$mysy_contrat_date_fin",
filt_periode_start_date_ISODATE,
]
},
{
"$lt": [
"$mysy_contrat_date_debut",
filt_periode_end_date_ISODATE,
]
},
]
}
}
},
{
"$project": {
"_id": 1,
"rh_id": 1,
"date_debut": 1,
"date_fin": 1,
"type_contrat": 1,
"type_employe": 1,
"cout": 1,
"periodicite": 1,
"mysy_contrat_date_debut": 1,
"mysy_contrat_date_fin": 1,
}
},
],
"as": "collection_ressource_humaine_contrat",
}
},
{
"$unwind": "$collection_ressource_humaine_contrat"
},
{
"$lookup": {
"from": "agenda",
"let": {
"rh_id": {"$toString": "$_id"},
"rh_partner_owner_recid": "$partner_recid",
},
"pipeline": [
{
"$addFields": {
"agenda_event_date_debut": {
"$dateFromString": {
"dateString": {
"$substr": ["$event_start", 0, 10]
},
"format": "%Y-%m-%d",
"onError": None,
"onNull": None,
}
},
"agenda_event_date_fin": {
"$dateFromString": {
"dateString": {
"$substr": ["$event_end", 0, 10]
},
"format": "%Y-%m-%d",
"onError": None,
"onNull": None,
}
},
}
},
{
"$match": {
"$expr": {
"$and": [
{"$eq": ["$valide", "1"]},
{
"$eq": [
"$related_collection_recid",
"$$rh_id",
]
},
{
"$eq": [
"$partner_owner_recid",
"$$rh_partner_owner_recid",
]
},
{"$eq": ["$event_type", "planning"]},
{
"$ne": [
"$agenda_event_date_debut",
None,
]
},
{
"$ne": [
"$agenda_event_date_fin",
None,
]
},
{
"$gte": [
"$agenda_event_date_debut",
filt_periode_start_date_ISODATE,
]
},
{
"$lt": [
"$agenda_event_date_fin",
filt_periode_end_date_ISODATE,
]
},
]
}
}
},
],
"as": "collection_agenda",
}
},
]
print(" ### E_pipe_qry_ressource_humaine__ressource_humaine_contrat = ",
E_pipe_qry_ressource_humaine__ressource_humaine_contrat)
E_pipe_qry_ressource_humaine__ressource_humaine_contrat_v2 )
for retval in MYSY_GV.dbname['ressource_humaine'].aggregate(
E_pipe_qry_ressource_humaine__ressource_humaine_contrat):
E_pipe_qry_ressource_humaine__ressource_humaine_contrat_v2 ):
# print(" ### retval (employé ayant un contrat valide) = ", retval)
formateur_id = str(retval['_id'])

View File

@ -1112,8 +1112,9 @@ Tutorat d'un inscrit : Les roles autorisés
1 : Tuteur légal
2 : Tuteur scolaire
3 : Autre
4 : Tuteur pédagogique
"""
TUTORAT_ROLE = ['0', '1', '2', '3', '']
TUTORAT_ROLE = ['0', '1', '2', '3', '4', '']
"""
@ -1218,4 +1219,11 @@ 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']
STAGE_TYPE_EVAL = ['eval_tuteur_entreprise', 'eval_tuteur_ecole']
"""
Gestion Ressource humaine : Type RH
type_rh = 1 ==> Autre RH (ex : parent d'eleves, etc)
"""

View File

@ -87,7 +87,7 @@ def AddStagiairetoClass(diction):
'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', 'frequence_facturation', 'ine', 'matricule'
'telephone_bis', 'frequence_facturation', 'ine', 'matricule', 'modefinancement_id', 'type_apprenant_id'
]
incom_keys = diction.keys()
@ -180,6 +180,32 @@ def AddStagiairetoClass(diction):
diction['token'] = my_partner['token']
if( "modefinancement_id" in diction.keys() and diction['modefinancement_id']):
is_valide_modefinancement_id = MYSY_GV.dbname['financement_mode'].count_documents({'_id':ObjectId(str(diction['modefinancement_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_modefinancement_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Le mode de financement est invalide ")
return False, " Le mode de financement est invalide "
if ("type_apprenant_id" in diction.keys() and diction['type_apprenant_id']):
is_valide_type_apprenant_id = MYSY_GV.dbname['type_apprenant'].count_documents(
{'_id': ObjectId(str(diction['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_type_apprenant_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Le type d'apprenant est invalide ")
return False, " Le type d'apprenant est invalide "
#print(" #### my_partner V2 = ", my_partner)
mydata = {}
@ -212,6 +238,19 @@ def AddStagiairetoClass(diction):
comment = str(diction['comment']).strip()
mydata['comment'] = comment
type_apprenant_id = ""
if ("type_apprenant_id" in diction.keys()):
type_apprenant_id = str(diction['type_apprenant_id']).strip()
mydata['type_apprenant_id'] = type_apprenant_id
modefinancement_id = ""
if ("modefinancement_id" in diction.keys()):
modefinancement_id = str(diction['modefinancement_id']).strip()
mydata['modefinancement_id'] = modefinancement_id
ine = ""
if ("ine" in diction.keys()):
if diction['ine']:
@ -815,6 +854,16 @@ def AddStagiairetoClass(diction):
mail_data['session_id'] = diction['session_id']
mail_data['inscription_id'] = ret_val['_id']
if ("modefinancement" in diction.keys()):
mail_data['modefinancement'] = diction['modefinancement']
else:
mail_data['modefinancement'] = ""
if ("opco" in diction.keys()):
mail_data['opco'] = diction['opco']
else:
mail_data['opco'] = ""
#print(" ### l'inscription est ok, il faut declencher l'envoi des email a "+str(mail_data))
"""
26/02/2025 :
@ -957,7 +1006,7 @@ def AddStagiairetoClass(diction):
new_apprenant_diction = diction
champ_to_delete = [ 'class_internal_url', 'session_id', 'inscription_validation_date', 'apprenant_id', 'status',
'modefinancement', 'type_apprenant', 'financeur_rattachement_id',
'quotation_id', 'facture_client_rattachement_id', 'tab_ue_ids', 'price']
'quotation_id', 'facture_client_rattachement_id', 'tab_ue_ids', 'price', 'modefinancement_id', 'type_apprenant_id']
for val in champ_to_delete:
if( val in new_apprenant_diction.keys()):
del new_apprenant_diction[str(val)]
@ -1109,7 +1158,8 @@ def AddStagiairetoClass_from_marketplace(diction):
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'date_naissance',
'financeur_rattachement_id', 'tuteur1_civilite', 'tuteur2_civilite', 'quotation_id',
'facture_client_rattachement_id', 'tab_ue_ids', 'memo', 'comment'
'facture_client_rattachement_id', 'tab_ue_ids', 'memo', 'comment', 'modefinancement_id',
'type_apprenant_id'
]
incom_keys = diction.keys()
@ -1186,6 +1236,31 @@ def AddStagiairetoClass_from_marketplace(diction):
diction['token'] = my_partner['token']
if ("modefinancement_id" in diction.keys() and diction['modefinancement_id']):
is_valide_modefinancement_id = MYSY_GV.dbname['financement_mode'].count_documents(
{'_id': ObjectId(str(diction['modefinancement_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_modefinancement_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Le mode de financement est invalide ")
return False, " Le mode de financement est invalide "
if ("type_apprenant_id" in diction.keys() and diction['type_apprenant_id']):
is_valide_type_apprenant_id = MYSY_GV.dbname['type_apprenant'].count_documents(
{'_id': ObjectId(str(diction['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_type_apprenant_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Le type d'apprenant est invalide ")
return False, " Le type d'apprenant est invalide "
# print(" #### my_partner V2 = ", my_partner)
mydata = {}
@ -1349,6 +1424,17 @@ def AddStagiairetoClass_from_marketplace(diction):
employeur = str(diction['employeur']).strip()
mydata['employeur'] = employeur
type_apprenant_id = ""
if ("type_apprenant_id" in diction.keys()):
type_apprenant_id = str(diction['type_apprenant_id']).strip()
mydata['type_apprenant_id'] = type_apprenant_id
modefinancement_id = ""
if ("modefinancement_id" in diction.keys()):
modefinancement_id = str(diction['modefinancement_id']).strip()
mydata['modefinancement_id'] = modefinancement_id
telephone = ""
if ("telephone" in diction.keys() and diction['telephone']):
telephone = str(diction['telephone']).strip()
@ -1673,6 +1759,16 @@ def AddStagiairetoClass_from_marketplace(diction):
mail_data['inscription_id'] = ret_val['_id']
mail_data['inscription_from_marketplace'] = "1"
if( "modefinancement" in diction.keys()):
mail_data['modefinancement'] = diction['modefinancement']
else:
mail_data['modefinancement'] = ""
if ("opco" in diction.keys()):
mail_data['opco'] = diction['opco']
else:
mail_data['opco'] = ""
# print(" ### l'inscription est ok, il faut declencher l'envoi des email a "+str(mail_data))
"""
@ -1843,6 +1939,16 @@ def AddStagiairetoClass_from_marketplace(diction):
notif_mail_dic['formateur_email'] = formateur_email
if( "modefinancement" in diction.keys):
notif_mail_dic['modefinancement'] = diction['modefinancement']
else:
notif_mail_dic['modefinancement'] = ""
if ("opco" in diction.keys):
notif_mail_dic['opco'] = diction['opco']
else:
notif_mail_dic['opco'] = ""
# Envoi de l'email de notification au formateur
local_status, local_message = email_session.Notification_partner_Pre_incription_mail(notif_mail_dic)
@ -1891,7 +1997,7 @@ def AddStagiairetoClass_from_marketplace(diction):
champ_to_delete = ['class_internal_url', 'session_id', 'inscription_validation_date', 'apprenant_id',
'status',
'modefinancement', 'type_apprenant', 'financeur_rattachement_id',
'quotation_id', 'facture_client_rattachement_id', 'tab_ue_ids', 'price']
'quotation_id', 'facture_client_rattachement_id', 'tab_ue_ids', 'price', 'modefinancement_id', 'type_apprenant_id']
for val in champ_to_delete:
if (val in new_apprenant_diction.keys()):
del new_apprenant_diction[str(val)]
@ -2036,7 +2142,8 @@ def UpdateStagiairetoClass(diction):
'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', 'frequence_facturation', 'update_dossier_apprenant', 'ine', 'matricule'
'telephone_bis', 'frequence_facturation', 'update_dossier_apprenant', 'ine', 'matricule',
'modefinancement_id', 'type_apprenant_id'
]
@ -2081,6 +2188,31 @@ def UpdateStagiairetoClass(diction):
partner_recid = my_partner['recid']
if ("modefinancement_id" in diction.keys() and diction['modefinancement_id']):
is_valide_modefinancement_id = MYSY_GV.dbname['financement_mode'].count_documents(
{'_id': ObjectId(str(diction['modefinancement_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_modefinancement_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Le mode de financement est invalide ")
return False, " Le mode de financement est invalide "
if ("type_apprenant_id" in diction.keys() and diction['type_apprenant_id']):
is_valide_type_apprenant_id = MYSY_GV.dbname['type_apprenant'].count_documents(
{'_id': ObjectId(str(diction['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_type_apprenant_id != 1):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Le type d'apprenant est invalide ")
return False, " Le type d'apprenant est invalide "
"""
Verifier qu'il n'y pas un étudiant avec le meme INE (Identifiant National Étudiant)
"""
@ -2128,6 +2260,10 @@ def UpdateStagiairetoClass(diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Un utilisateur avec cette adresse e-mail est déjà inscrit à cette formation.")
return False, " Un utilisateur avec cette adresse e-mail est déjà inscrit à cette formation. "
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - l'adresse email " + str(diction['email']) + " n'est pas valide")
return False, " L'adresse email " + str(diction['email']) + " n'est pas valide "
object_id = ""
@ -2135,6 +2271,10 @@ def UpdateStagiairetoClass(diction):
if diction['_id']:
object_id = str(diction['_id']).strip()
query_key['_id'] = ObjectId (str(diction['_id']).strip())
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
return False, " L'identifiant de l'inscrit est invalide "
myinternal_url = ""
if ("class_internal_url" in diction.keys()):
@ -2159,18 +2299,23 @@ def UpdateStagiairetoClass(diction):
mydata['session_id'] = str(diction['session_id']).strip()
if ("nom" in diction.keys()):
if diction['nom']:
mydata['nom'] = str(diction['nom']).strip()
user_nom = str(diction['nom']).strip()
mydata['nom'] = str(diction['nom']).strip()
user_nom = str(diction['nom']).strip()
if ("ine" in diction.keys()):
if diction['ine']:
mydata['ine'] = str(diction['ine']).strip()
mydata['ine'] = str(diction['ine']).strip()
if ("matricule" in diction.keys()):
if diction['matricule']:
mydata['matricule'] = str(diction['matricule']).strip()
mydata['matricule'] = str(diction['matricule']).strip()
if ("type_apprenant_id" in diction.keys()):
mydata['type_apprenant_id'] = str(diction['type_apprenant_id']).strip()
if ("modefinancement_id" in diction.keys()):
mydata['modefinancement_id'] = str(diction['modefinancement_id']).strip()
if ("civilite" in diction.keys()):
@ -3359,6 +3504,18 @@ def SendPre_InscriptionEmail(diction):
local_status, local_message = email_session.Pre_incription_training_confirmation_mail(data_mail)
if( "modefinancement" in diction.keys() ):
data_mail['modefinancement'] = diction['modefinancement']
else:
data_mail['modefinancement'] = ""
if ("opco" in diction.keys()):
data_mail['opco'] = diction['opco']
else:
data_mail['opco'] = ""
# Envoi de l'email de notification au formateur
local_status, local_message = email_session.Notification_partner_Pre_incription_mail(data_mail)
@ -4018,7 +4175,8 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
'''
field_list = ['formation_code_externe', 'code_session', 'prenom', 'nom', 'employeur',
'telephone', 'email', 'modefinancement','opco', 'status', 'prix', 'adresse', 'code_postal', 'ville',
'pays', 'client_rattachement_email', 'client_rattachement_nom', 'type_apprenant', 'civilite', 'date_naissance']
'pays', 'client_rattachement_email', 'client_rattachement_nom', 'type_apprenant', 'civilite', 'date_naissance',
'mode_financement_code', 'type_apprenant_code']
# Controle du nombre de lignes dans le fichier.
@ -4126,6 +4284,55 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
opco = str(df['opco'].values[n])
mydata['opco'] = opco
#####
mode_financement_id = ""
if ("mode_financement_code" in df.keys()):
if (str(df['mode_financement_code'].values[n])):
mode_financement_code = str(df['mode_financement_code'].values[n])
mode_financement_data = MYSY_GV.dbname['financement_mode'].find_one({'code':mode_financement_code,
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if(mode_financement_data and '_id' in mode_financement_data.keys() ):
mode_financement_id = str(mode_financement_data['_id'])
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " Ligne : " + str(
n + 2) + ". Le code du mode de financement :" + str(
mode_financement_code) + " est invalide.")
return False, " Ligne : " + str(
n + 2) + ". Le code du mode de financement :" + str(
mode_financement_code) + " est invalide."
mydata['modefinancement_id'] = mode_financement_id
type_apprenant_id = ""
if ("type_apprenant_code" in df.keys()):
if (str(df['type_apprenant_code'].values[n])):
type_apprenant_code = str(df['type_apprenant_code'].values[n])
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'code': type_apprenant_code,
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (type_apprenant_data and '_id' in type_apprenant_data.keys()):
type_apprenant_id = str(type_apprenant_data['_id'])
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " Ligne : " + str(
n + 2) + ". Le code du type d'apprenant :" + str(
type_apprenant_code) + " est invalide.")
return False, " Ligne : " + str(
n + 2) + ". Le code du type d'apprenant :" + str(
type_apprenant_code) + " est invalide."
mydata['type_apprenant_id'] = type_apprenant_id
###
# Verifier que le type d'apprenant est bien valide
type_apprenant = "0"
if ("type_apprenant" in df.keys()):
@ -4405,7 +4612,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
'telephone', 'email', 'modefinancement', 'opco', 'status', 'prix', 'adresse', 'code_postal',
'ville',
'pays', 'client_rattachement_email', 'client_rattachement_nom', 'type_apprenant', 'civilite',
'date_naissance']
'date_naissance', 'mode_financement_code', 'type_apprenant_code']
# Controle du nombre de lignes dans le fichier.
total_rows = len(df)
@ -4498,6 +4705,54 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
civilite) + " est invalide. Les valeurs acceptées sont : " + str(MYSY_GV.CIVILITE)
#####
mode_financement_id = ""
if ("mode_financement_code" in df.keys()):
if (str(df['mode_financement_code'].values[n])):
mode_financement_code = str(df['mode_financement_code'].values[n])
mode_financement_data = MYSY_GV.dbname['financement_mode'].find_one(
{'code': mode_financement_code,
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (mode_financement_data and '_id' in mode_financement_data.keys()):
mode_financement_id = str(mode_financement_data['_id'])
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " Ligne : " + str(
n + 2) + ". Le code du mode de financement :" + str(
mode_financement_code) + " est invalide.")
return False, " Ligne : " + str(
n + 2) + ". Le code du mode de financement :" + str(
mode_financement_code) + " est invalide."
mydata['modefinancement_id'] = mode_financement_id
type_apprenant_id = ""
if ("type_apprenant_code" in df.keys()):
if (str(df['type_apprenant_code'].values[n])):
type_apprenant_code = str(df['type_apprenant_code'].values[n])
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'code': type_apprenant_code,
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (type_apprenant_data and '_id' in type_apprenant_data.keys()):
type_apprenant_id = str(type_apprenant_data['_id'])
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " Ligne : " + str(
n + 2) + ". Le code du type d'apprenant :" + str(
type_apprenant_code) + " est invalide.")
return False, " Ligne : " + str(
n + 2) + ". Le code du type d'apprenant :" + str(
type_apprenant_code) + " est invalide."
mydata['type_apprenant_id'] = type_apprenant_id
###
modefinancement = ""
if ("modefinancement" in df.keys()):
if (str(df['modefinancement'].values[n])):
@ -7877,7 +8132,7 @@ Fontion de validation / acceptation d'une inscription
A la validation, on regarde si l'inscription a un 'client_rattachement_id' alors on considère qu'il
s'agit d'une inscription pour un client, on met le champ 'entreprise' à '1', si non à '0'
03/10/2026 - S'il s'agit d'une promotion, alors apres l'acceptation de l'inscrit
10/03/2026 - S'il s'agit d'une promotion, alors apres l'acceptation de l'inscrit
on va l'jouter au groupe "promo" associé
"""
def AcceptAttendeeInscription(diction):
@ -8531,24 +8786,32 @@ def AcceptAttendeeInscription(diction):
"""
10/03/2026 - s'il s'agit d'une promo, alors on inscrit la personne si on a un groupe "type_promo"
on va recuperer le type de groupe (groupe_inscription_type) ayant is_promotion_grp = '1'
"""
if( "type_session" in local_session and local_session['type_session'] == "1"):
groupe_promo = MYSY_GV.dbname['groupe_inscription'].find_one({'type_groupe_code':'PROMO_GRP',
'session_id':str(local_session['_id']),
groupe_inscription_type_promo_data = MYSY_GV.dbname['groupe_inscription_type'].find_one({'is_promotion_grp':'1',
'valide':'1','locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( groupe_inscription_type_promo_data ):
groupe_promo = MYSY_GV.dbname['groupe_inscription'].find_one({'groupe_inscription_type_id':str(groupe_inscription_type_promo_data['_id']),
'session_id':str(local_session['_id']),
'partner_owner_recid':str(my_partner['recid'])})
if( groupe_promo):
local_diction = {}
local_diction['token'] = diction['token']
local_diction['_id'] = str(groupe_promo['_id'])
local_diction['tab_inscriptions_ids'] = str(diction['inscription_id'])
add_to_groupe_status, add_to_groupe_retval = groupe_inscrit_mgt.Add_Update_Groupe_Inscrit_Membres(local_diction)
if (add_to_groupe_status is False):
mycommon.myprint(str(
inspect.stack()[0][3]) + " WARNING : Impossible d'ajouter l'inscrit "+str(diction['inscription_id'])+" au groupe promo")
if( groupe_promo):
local_diction = {}
local_diction['token'] = diction['token']
local_diction['_id'] = str(groupe_promo['_id'])
local_diction['tab_inscriptions_ids'] = str(diction['inscription_id'])
add_to_groupe_status, add_to_groupe_retval = groupe_inscrit_mgt.Add_Update_Groupe_Inscrit_Membres(local_diction)
if (add_to_groupe_status is False):
mycommon.myprint(str(
inspect.stack()[0][3]) + " WARNING : Impossible d'ajouter l'inscrit "+str(diction['inscription_id'])+" au groupe promo")
@ -10239,6 +10502,42 @@ def Get_Statgaire_List_Partner_with_filter(diction):
val['email'] = retVal['email']
###
modefinancement_code = ""
modefinancement_id = ""
if ("modefinancement_id" in retVal.keys() and retVal['modefinancement_id']):
modefinancement_data = MYSY_GV.dbname['financement_mode'].find_one(
{'_id': ObjectId(str(retVal['modefinancement_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(retVal['partner_owner_recid'])})
if (modefinancement_data and "code" in modefinancement_data.keys()):
modefinancement_code = str(modefinancement_data['code'])
modefinancement_id = str(modefinancement_data['_id'])
val['modefinancement_code'] = modefinancement_code
val['modefinancement_id'] = modefinancement_id
type_apprenant_code = ""
type_apprenant_id = ""
if ("type_apprenant_id" in retVal.keys() and retVal['type_apprenant_id']):
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'_id': ObjectId(str(retVal['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(retVal['partner_owner_recid'])})
if (type_apprenant_data and "code" in type_apprenant_data.keys()):
type_apprenant_code = str(type_apprenant_data['code'])
type_apprenant_id = str(type_apprenant_data['_id'])
val['type_apprenant_code'] = type_apprenant_code
val['type_apprenant_id'] = type_apprenant_id
###
if ("civilite" in retVal.keys()):
val['civilite'] = str(retVal['civilite']).lower()
else:
@ -10701,6 +11000,41 @@ def Get_Statgaire_List_Partner_with_filter_light(diction):
val['email'] = retVal['email']
###
modefinancement_code = ""
modefinancement_id = ""
if ("modefinancement_id" in retVal.keys() and retVal['modefinancement_id']):
modefinancement_data = MYSY_GV.dbname['financement_mode'].find_one(
{'_id': ObjectId(str(retVal['modefinancement_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(retVal['partner_owner_recid'])})
if (modefinancement_data and "code" in modefinancement_data.keys()):
modefinancement_code = str(modefinancement_data['code'])
modefinancement_id = str(modefinancement_data['_id'])
val['modefinancement_code'] = modefinancement_code
val['modefinancement_id'] = modefinancement_id
type_apprenant_code = ""
type_apprenant_id = ""
if ("type_apprenant_id" in retVal.keys() and retVal['type_apprenant_id']):
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'_id': ObjectId(str(retVal['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(retVal['partner_owner_recid'])})
if (type_apprenant_id and "code" in type_apprenant_id.keys()):
type_apprenant_code = str(type_apprenant_data['code'])
type_apprenant_id = str(type_apprenant_data['_id'])
val['type_apprenant_code'] = type_apprenant_code
val['type_apprenant_id'] = type_apprenant_id
###
if ("civilite" in retVal.keys()):
val['civilite'] = str(retVal['civilite']).lower()
else:
@ -11241,8 +11575,40 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
comment = local_Insc_retval['comment']
my_retrun_dict['comment'] = comment
###
modefinancement_code = ""
modefinancement_id = ""
if ("modefinancement_id" in local_Insc_retval.keys() and local_Insc_retval['modefinancement_id']):
modefinancement_data = MYSY_GV.dbname['financement_mode'].find_one(
{'_id': ObjectId(str(local_Insc_retval['modefinancement_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if (modefinancement_data and "code" in modefinancement_data.keys()):
modefinancement_code = str(modefinancement_data['code'])
modefinancement_id = str(modefinancement_data['_id'])
my_retrun_dict['modefinancement_code'] = modefinancement_code
my_retrun_dict['modefinancement_id'] = modefinancement_id
type_apprenant_code = ""
type_apprenant_id = ""
if ("type_apprenant_id" in local_Insc_retval.keys() and local_Insc_retval['type_apprenant_id']):
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'_id': ObjectId(str(local_Insc_retval['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if (type_apprenant_data and "code" in type_apprenant_data.keys()):
type_apprenant_code = str(type_apprenant_data['code'])
type_apprenant_id = str(type_apprenant_data['_id'])
my_retrun_dict['type_apprenant_code'] = type_apprenant_code
my_retrun_dict['type_apprenant_id'] = type_apprenant_id
###
local_telephone = ""
@ -15849,6 +16215,41 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction
val['email'] = retVal['email']
###
modefinancement_code = ""
modefinancement_id = ""
if ("modefinancement_id" in retVal.keys() and retVal['modefinancement_id']):
modefinancement_data = MYSY_GV.dbname['financement_mode'].find_one(
{'_id': ObjectId(str(retVal['modefinancement_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(retVal['partner_owner_recid'])})
if (modefinancement_data and "code" in modefinancement_data.keys()):
modefinancement_code = str(modefinancement_data['code'])
modefinancement_id = str(modefinancement_data['_id'])
val['modefinancement_code'] = modefinancement_code
val['modefinancement_id'] = modefinancement_id
type_apprenant_code = ""
type_apprenant_id = ""
if ("type_apprenant_id" in retVal.keys() and retVal['type_apprenant_id']):
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'_id': ObjectId(str(retVal['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(retVal['partner_owner_recid'])})
if (type_apprenant_id and "code" in type_apprenant_id.keys()):
type_apprenant_code = str(type_apprenant_data['code'])
type_apprenant_id = str(type_apprenant_data['_id'])
val['type_apprenant_code'] = type_apprenant_code
val['type_apprenant_id'] = type_apprenant_id
###
if ("civilite" in retVal.keys()):
val['civilite'] = str(retVal['civilite']).lower()
else:

File diff suppressed because one or more lines are too long

View File

@ -103,7 +103,7 @@ def Add_Update_SessionFormation(diction):
# Verifier la validité du token
retval = mycommon.check_partner_token_validity("", my_token)
if retval is False:
return "Err_Connexion", " La promotion de connexion n'est pas valide"
return "Err_Connexion", " La connexion n'est pas valide"
data_for_check_connexion = {'token':my_token}
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
@ -730,20 +730,32 @@ def Add_Update_SessionFormation(diction):
promo_code = "Grp_Promotion"
promo_nom = "Grp Promotion"
group_diction = {}
group_diction['token'] = diction['token']
group_diction['code'] = promo_code
group_diction['nom'] = promo_nom
group_diction['type_groupe_code'] = "PROMO_GRP"
group_diction['class_id'] = str(class_id)
group_diction['session_id'] = str(local_inserted_id)
group_diction['color'] = "#071c53"
groupe_inscription_type_promo_data = MYSY_GV.dbname['groupe_inscription_type'].find_one(
{'is_promotion_grp': '1',
'valide': '1', 'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
local_status, local_retval = groupe_inscrit_mgt.Add_Groupe_Inscrit(group_diction)
if (groupe_inscription_type_promo_data):
group_diction = {}
group_diction['token'] = diction['token']
group_diction['code'] = promo_code
group_diction['nom'] = promo_nom
group_diction['class_id'] = str(class_id)
group_diction['session_id'] = str(local_inserted_id)
if ('code_couleur' in groupe_inscription_type_promo_data.keys()):
group_diction['color'] = str(groupe_inscription_type_promo_data['code_couleur'])
else:
group_diction['color'] = ""
if( local_status is False):
mycommon.myprint(
str(inspect.stack()[0][3]) + " WARNING : Impossible de créer le groupe promotion lié à la session_id '" + str(local_inserted_id) + "' ")
group_diction['groupe_inscription_type_id'] = str(groupe_inscription_type_promo_data['_id'])
print(" ## creation grp : group_diction = ", group_diction)
local_status, local_retval = groupe_inscrit_mgt.Add_Groupe_Inscrit(group_diction)
if( local_status is False):
mycommon.myprint(
str(inspect.stack()[0][3]) + " WARNING : Impossible de créer le groupe promotion lié à la session_id '" + str(local_inserted_id) + "' ")
@ -6235,22 +6247,33 @@ def Duplicate_List_Session_Formation(diction):
promo_code = "Grp_Promotion"
promo_nom = "Grp Promotion"
group_diction = {}
group_diction['token'] = diction['token']
group_diction['code'] = promo_code
group_diction['nom'] = promo_nom
group_diction['type_groupe_code'] = "PROMO_GRP"
group_diction['class_id'] = str(is_class_data['_id'])
group_diction['session_id'] = str(local_retval_new_session_data.inserted_id)
group_diction['color'] = "#EAFAF4"
groupe_inscription_type_promo_data = MYSY_GV.dbname['groupe_inscription_type'].find_one(
{'is_promotion_grp': '1',
'valide': '1', 'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
local_status, local_retval_groupe = groupe_inscrit_mgt.Add_Groupe_Inscrit(group_diction)
if (groupe_inscription_type_promo_data):
group_diction = {}
group_diction['token'] = diction['token']
group_diction['code'] = promo_code
group_diction['nom'] = promo_nom
group_diction['class_id'] = str(is_class_data['_id'])
group_diction['session_id'] = str(local_retval_new_session_data.inserted_id)
if( 'code_couleur' in groupe_inscription_type_promo_data.keys()):
group_diction['color'] = str(groupe_inscription_type_promo_data['code_couleur'])
else:
group_diction['color'] = ""
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING : Impossible de créer le groupe de promotion lié à la session_id '" + str(
local_retval_new_session_data.inserted_id) + "' ")
group_diction['groupe_inscription_type_id'] = str(groupe_inscription_type_promo_data['_id'])
print(" ## duplicaa : group_diction = ", str(group_diction))
local_status, local_retval_groupe = groupe_inscrit_mgt.Add_Groupe_Inscrit(group_diction)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING : Impossible de créer le groupe de promotion lié à la session_id '" + str(
local_retval_new_session_data.inserted_id) + "' ")
"""
# Ajout de l'evenement dans l'historique

View File

@ -1993,7 +1993,6 @@ def Get_Session_Sequence_List(diction):
tab_ressource_humaine = []
tab_ressource_materiel = []
for local_affectation in MYSY_GV.dbname['session_formation_sequence_affectation'].find({'sequence_session_id':str(New_retVal['_id']),
'partner_owner_recid':str(my_partner['recid'])}):

View File

@ -106,8 +106,8 @@ def Add_Type_Apprenant(diction):
inserted_id = MYSY_GV.dbname['type_apprenant'].insert_one(new_data).inserted_id
if (not inserted_id):
mycommon.myprint(
" Impossible de créer le groupe de clients (2) ")
return False, " Impossible de créer le groupe de clients (2) "
" Impossible de créer le type d'apprenant (2) ")
return False, " Impossible de créer le type d'apprenant (2) "
return True, " Le type d'apprenants a été correctement ajouté"

528
Type_groupe_inscrit_mgt.py Normal file
View File

@ -0,0 +1,528 @@
"""
Ce fichier permet de gerer les type de groupe d'inscrits à un promo.
Par exemple :
- groupe TD
- groupr TP
- Groupe Classe
- Groupe Promo
etc
Collection : type_groupe_inscrit
- code
- description,
- code_couleur
"""
import bson
import pymongo
from pymongo import MongoClient
import json
from bson import ObjectId
import re
from datetime import datetime
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
"""
Ajout d'un type de groupe d'inscrit
- important : Il ne doit exister qu'un seul type de groupe avec is_promotion_grp = 1
"""
def Add_Type_Groupe_Inscrit(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'code', 'description', 'code_couleur', 'is_promotion_grp']
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', 'code',]
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 que ce code n'existe pas déjà
is_existe_class_domaine = MYSY_GV.dbname['groupe_inscription_type'].count_documents({'code':str(diction['code']),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])})
if( is_existe_class_domaine > 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " ce code '" + str(diction['code']) + "' existe déjà ")
return False, " Ce code '" + str(diction['code']) + "' existe déjà "
"""
Si c'est type de groupe promo, verifier qu'il n'y pas un autre groupe
important : Il ne doit exister qu'un seul type de groupe avec is_promotion_grp = 1
"""
if( "is_promotion_grp" in diction.keys() and diction['is_promotion_grp'] == '1' ):
# Verifier que ce code n'existe pas déjà
is_existe_class_domaine_is_promotion = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'code': {'$ne':str(diction['code'])},
'valide': '1',
'is_promotion_grp':'1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_existe_class_domaine_is_promotion > 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Vous avez déjà un groupe de type 'Promotion' ")
return False, " Vous avez déjà un groupe de type 'Promotion' "
new_data = diction
del diction['token']
new_data['valide'] = "1"
new_data['locked'] = "0"
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 ("is_promotion_grp" in diction.keys() and diction['is_promotion_grp'] not in ['0', '1']):
new_data['is_promotion_grp'] = '0'
if ("code_couleur" not in new_data.keys() or new_data['code_couleur'] == ""):
new_data['code_couleur'] = "#bed3f2"
inserted_id = MYSY_GV.dbname['groupe_inscription_type'].insert_one(new_data).inserted_id
if (not inserted_id):
mycommon.myprint(
" Impossible de créer le type de groupe (2) ")
return False, " Impossible de créer le type de groupe (2) "
return True, " Le type de groupe a été correctement ajouté"
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 type de groupe "
"""
Mise à jour d'un type de groupe d'inscrit
- important : Il ne doit exister qu'un seul type de groupe avec is_promotion_grp = 1
"""
def Update_Type_Groupe_Inscrit(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_id', 'code', 'description', 'code_couleur', 'is_promotion_grp']
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', '_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
new_data = diction
# Verifier que la domaine
is_existe_cdtion_paiement = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'_id': ObjectId(str(diction['_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_existe_cdtion_paiement < 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du type d'apprenant invalide ")
return False, " L'identifiant du type d'apprenant est invalide "
# Verifier que code n'est pas pris par un autre domaine
is_existe_class_domaine = MYSY_GV.dbname['groupe_inscription_type'].count_documents({'code': str(diction['code']),
'valide': '1',
'partner_owner_recid': str(
my_partner['recid']),
"_id": {"$ne": ObjectId(
str(diction['_id']))}
})
if (is_existe_class_domaine > 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le code '" + str(diction['code']) + "' existe déjà ")
return False, " Le code '" + str(diction['code']) + "' existe déjà "
"""
Si c'est type de groupe promo, verifier qu'il n'y pas un autre groupe
important : Il ne doit exister qu'un seul type de groupe avec is_promotion_grp = 1
"""
if ("is_promotion_grp" in diction.keys() and diction['is_promotion_grp'] == '1'):
# Verifier que ce code n'existe pas déjà
is_existe_class_domaine_is_promotion = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'code': {'$ne': str(diction['code'])},
'valide': '1',
'is_promotion_grp': '1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_existe_class_domaine_is_promotion > 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Vous avez déjà un groupe de type 'Promotion' ")
return False, " Vous avez déjà un groupe de type 'Promotion' "
local_id = str(diction['_id'])
del diction['token']
del diction['_id']
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
if ("is_promotion_grp" in diction.keys() and diction['is_promotion_grp'] not in ['0', '1']):
new_data['is_promotion_grp'] = '0'
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['_id'] = ObjectId(local_id)
data_cle['valide'] = "1"
data_cle['locked'] = "0"
result = MYSY_GV.dbname['groupe_inscription_type'].find_one_and_update(
data_cle,
{"$set": new_data},
upsert=False,
return_document=ReturnDocument.AFTER
)
if ("_id" not in result.keys()):
mycommon.myprint(
" Impossible de mettre à jour le type de groupe (2) ")
return False, " Impossible de mettre à jour le type de groupe (2) "
return True, " Le type de groupe 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 type de groupe "
"""
Suppression d'type de groupe d'inscrit
regles :
Si la condition (_id) n'est pas utiliser dans les collection
- groupe_inscription
"""
def Delete_Type_Groupe_Inscrit(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_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', '_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
is_existe_class_domaine = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'_id': ObjectId(str(diction['_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_existe_class_domaine < 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant type de groupe est invalide ")
return False, "L'identifiant type de groupe est invalide "
"""
Verifier que le type d'apprenant n'est pas utilisé (collection : groupe_inscription)
"""
is_domaine_in_myclass = MYSY_GV.dbname['groupe_inscription'].count_documents({'partner_owner_recid':my_partner['recid'],
'valide':'1',
'type_groupe_inscrit_id':str(diction['_id'])})
if( is_domaine_in_myclass > 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le type de groupe est utilisé par "+str(is_domaine_in_myclass)+" groupe(s) ")
return False, " Le type de groupe est utilisé par "+str(is_domaine_in_myclass)+" groupe(s) "
delete = MYSY_GV.dbname['groupe_inscription_type'].delete_one({'_id': ObjectId(str(diction['_id'])),
'partner_owner_recid': str(my_partner['recid']),
}, )
return True, "Le type de groupe 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 type de groupe "
"""
Recuperer la liste des type de groupe d'inscrit d'un partenaire
"""
def Get_List_Type_Groupe_Inscrit(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', ]
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', ]
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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['valide'] = "1"
data_cle['locked'] = "0"
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['groupe_inscription_type'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if ("code_couleur" not in user.keys() or user['code_couleur'] == ""):
user['code_couleur'] = "#bed3f2"
if ("is_promotion_grp" not in user.keys() or user['is_promotion_grp'] == ""):
user['is_promotion_grp'] = "0"
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 types de groupe d'inscrit "
"""
Recuperer les données d'un type de groupe d'inscrit
"""
def Get_Given_Type_Groupe_Inscrit(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_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', '_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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['valide'] = "1"
data_cle['locked'] = "0"
data_cle['_id'] = ObjectId(str(diction['_id']))
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['groupe_inscription_type'].find(data_cle):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if ("code_couleur" not in user.keys() or user['code_couleur'] == ""):
user['code_couleur'] = "#bed3f2"
if ("is_promotion_grp" not in user.keys() or user['is_promotion_grp'] == ""):
user['is_promotion_grp'] = "0"
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 les données du type de groupe "

View File

@ -1075,6 +1075,10 @@ def Pre_incription_training_confirmation_mail(diction):
session_hybrid = ""
my_company_data = MYSY_GV.dbname['partnair_account'].find_one(
{'recid': str(diction['partner_owner_recid']), 'is_partner_admin_account': '1', 'active': '1',
'locked': '0'},
{'_id': 1, 'nom': 1})
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
@ -1108,6 +1112,27 @@ def Pre_incription_training_confirmation_mail(diction):
templateEnv = jinja2.Environment(loader=templateLoader)
TEMPLATE_FILE = "Template/MySy_confirmation_Pre_inscription_formation_tpl.html"
template = templateEnv.get_template(TEMPLATE_FILE)
# Creation du dictionnaire d'information à utiliser pour la creation du doc
convention_dictionnary_data = {}
new_diction = {}
new_diction['token'] = diction['token']
new_diction['list_stagiaire_id'] = []
new_diction['list_session_id'] = [ObjectId(str(diction['session_id']))]
new_diction['list_class_id'] = []
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = []
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
if (local_status is False):
return local_status, local_retval
local_company_data = []
if (local_retval and 'company_data' in local_retval.keys()):
local_company_data = local_retval['company_data']
# This data can come from database query
body = {
"params":{"nom": str(diction['nom']),
@ -1124,6 +1149,7 @@ def Pre_incription_training_confirmation_mail(diction):
"email": str(diction['email']),
"session_ondemande": str(session_ondemande),
"code_session": str(diction['code_session']),
"company_data": local_company_data
},
}
@ -1242,9 +1268,6 @@ def Pre_incription_training_confirmation_mail(diction):
else:
my_company_data = MYSY_GV.dbname['partnair_account'].find_one(
{'recid': str(diction['partner_owner_recid']), 'is_partner_admin_account': '1', 'active': '1', 'locked': '0'},
{'_id':1, 'nom':1})
if( my_company_data and "nom" in my_company_data.keys() and my_company_data['nom']):
company_name = my_company_data['nom']
@ -1421,6 +1444,45 @@ def Notification_partner_Pre_incription_mail(diction):
#templateEnv = jinja2.Environment(loader=templateLoader)
#TEMPLATE_FILE = "Template/MySy_Notif_Partner_Pre_inscription_formation_tpl.html"
#template = templateEnv.get_template(TEMPLATE_FILE)
modefinancement = ""
if ("modefinancement" in diction.keys()):
if( str(diction['modefinancement']).lower() == "cpf"):
modefinancement = "CPF"
elif (str(diction['modefinancement']).lower() == "perso"):
modefinancement = "Fonds Propres"
elif (str(diction['modefinancement']).lower() == "entreprise"):
modefinancement = "Mon entreprise"
elif (str(diction['modefinancement']).lower() == "mixte_cpf_perso"):
modefinancement = "CPF & Fonds Propres"
elif (str(diction['modefinancement']).lower() == "autre"):
modefinancement = "Fonds Autre"
else:
modefinancement = str(diction['modefinancement'])
opco = ""
if ("opco" in diction.keys()):
opco = diction['opco']
# Creation du dictionnaire d'information à utiliser pour la creation du doc
convention_dictionnary_data = {}
new_diction = {}
new_diction['token'] = diction['token']
new_diction['list_stagiaire_id'] = []
new_diction['list_session_id'] = [ObjectId(str(diction['session_id']))]
new_diction['list_class_id'] = []
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = []
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
if (local_status is False):
return local_status, local_retval
if( local_retval and 'company_data' in local_retval.keys() ):
my_company_data = local_retval['company_data']
# This data can come from database query
body = {
"params":{"nom": str(diction['nom']),
@ -1437,6 +1499,9 @@ def Notification_partner_Pre_incription_mail(diction):
"ville": str(local_ville),
"email": str(diction['email']),
"session_ondemande": str(session_ondemande),
"company_data": my_company_data,
"modefinancement": modefinancement,
"opco": opco,
},
}
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))

View File

@ -700,10 +700,65 @@ def Get_Ent_Student_Session_Sequence_List(diction):
if ("unite_enseignement_planif_id" not in user.keys()):
user['unite_enseignement_planif_id'] = ""
"""
Recuperer les ressource associées (materiel et humaine)
"""
tab_ressource_humaine = []
tab_ressource_materiel = []
for local_affectation in MYSY_GV.dbname['session_formation_sequence_affectation'].find(
{'sequence_session_id': str(New_retVal['_id']),
'partner_owner_recid':str(apprenant_data['partner_owner_recid'])}):
related_target_collection_id_nom = ""
related_target_collection_object = ""
# Si l'affectation a un 'related_target_collection_id', alors cela veut dire qu'il faut aller chercheer
# la cible de cette affection.
if ("related_target_collection_id" in local_affectation.keys() and "related_target_collection" in local_affectation.keys()):
if (local_affectation["related_target_collection_id"] and local_affectation[
"related_target_collection"]):
# Si l'affectation concerne une ressource_humaine
if (local_affectation["related_target_collection"] == "ressource_humaine"):
affectation_target_data = MYSY_GV.dbname[
local_affectation["related_target_collection"]].find_one(
{"_id": ObjectId(str(local_affectation["related_target_collection_id"])),
'partner_recid': str(apprenant_data['partner_owner_recid']),
'valide': '1', 'locked': "0"})
if (affectation_target_data is not None):
related_target_collection_id_nom = affectation_target_data["nom"] + " " + \
affectation_target_data["prenom"]
related_target_collection_object = "Ressource Humaine"
tab_ressource_humaine.append(related_target_collection_id_nom)
elif (local_affectation["related_target_collection"] == "ressource_materielle"):
# Si l'affectation concerne une ressource_materielle
affectation_target_data = MYSY_GV.dbname[
local_affectation["related_target_collection"]].find_one(
{"_id": ObjectId(str(local_affectation["related_target_collection_id"])),
'partner_recid': str(apprenant_data['partner_owner_recid']),
'valide': '1'})
if (affectation_target_data is not None):
related_target_collection_id_nom = affectation_target_data["nom"]
related_target_collection_object = "Ressource Materielle"
tab_ressource_materiel.append(related_target_collection_id_nom)
user['tab_ressource_humaine'] = tab_ressource_humaine
user['tab_ressource_materiel'] = tab_ressource_materiel
RetObject.append(mycommon.JSONEncoder().encode(user))
"""
On recuperer les évaluation de l'etudiant
"""
if ("inscription_id" in diction.keys() and diction['inscription_id'] and
"session_id" in diction.keys() and diction['session_id']):
inscription_data = MYSY_GV.dbname['inscription'].find_one({'session_id':str(diction['session_id']),

View File

@ -62,8 +62,8 @@ def Add_Groupe_Inscrit(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'code', 'nom', 'description', 'type_groupe_code', 'class_id', 'session_id',
'color']
field_list = ['token', 'code', 'nom', 'description', 'class_id', 'session_id',
'color', 'groupe_inscription_type_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -75,7 +75,7 @@ def Add_Groupe_Inscrit(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'code', 'type_groupe_code', 'class_id', 'session_id']
field_list_obligatoire = ['token', 'code', 'groupe_inscription_type_id', 'class_id', 'session_id']
for val in field_list_obligatoire:
if val not in diction:
@ -135,17 +135,17 @@ def Add_Groupe_Inscrit(diction):
return False, " L'identifiant de la session/classe est invalide valide "
"""
Verifier que la type_groupe exist et est valide
"""
is_type_groupe_code_count = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'code': str(diction['type_groupe_code']),
'valide': '1',
'partner_owner_recid':'default'})
Verifier la validité du groupe_inscription_type_id
"""
groupe_inscription_type_id_count = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'_id': ObjectId(str(diction['groupe_inscription_type_id'])),
'valide': '1', 'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
if (is_type_groupe_code_count != 1):
if (groupe_inscription_type_id_count != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le type de groupe est invalide valide ")
return False, " Le type de groupe est invalide valide "
str(inspect.stack()[0][3]) + " L'identifiant du type de groupe est invalide ")
return False, " L'identifiant du type de groupe est invalide "
new_data = diction
del diction['token']
@ -189,8 +189,8 @@ def Update_Groupe_Inscrit(diction):
"""
Verification des input acceptés
"""
field_list = ['token', '_id', 'code', 'nom', 'description', 'type_groupe_code', 'class_id', 'session_id',
'color']
field_list = ['token', '_id', 'code', 'nom', 'description', 'class_id', 'session_id',
'color', 'groupe_inscription_type_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -202,7 +202,7 @@ def Update_Groupe_Inscrit(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', '_id',]
field_list_obligatoire = ['token', '_id', 'groupe_inscription_type_id']
for val in field_list_obligatoire:
if val not in diction:
@ -237,12 +237,18 @@ def Update_Groupe_Inscrit(diction):
return False, " L'identifiant du groupe est invalide "
qry = {'code':str(diction['code']),
'valide':'1',
'partner_owner_recid':str(my_partner['recid']),
'_id': {'$ne': ObjectId(str(diction['_id']))},
"""
Verifier la validité du groupe_inscription_type_id
"""
groupe_inscription_type_id_count = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'_id': ObjectId(str(diction['groupe_inscription_type_id'])),
'valide': '1', 'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
}
if (groupe_inscription_type_id_count != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du type de groupe est invalide ")
return False, " L'identifiant du type de groupe est invalide "
#print(" ### qry = ", qry)
@ -290,22 +296,6 @@ def Update_Groupe_Inscrit(diction):
return False, " L'identifiant de la session/classe est invalide valide "
"""
Verifier que la type_groupe exist et est valide
"""
if ("type_groupe_code" in diction.keys()):
is_type_groupe_code_count = MYSY_GV.dbname['groupe_inscription_type'].count_documents(
{'code': str(diction['type_groupe_code']),
'valide': '1',
'partner_owner_recid':'default'})
if (is_type_groupe_code_count != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le type de groupe est invalide valide ")
return False, " Le type de groupe est invalide valide "
local_id = str(diction['_id'])
@ -1415,8 +1405,7 @@ def Get_Type_Groupe_Apprenant(diction):
data_cle['valide'] = "1"
data_cle['locked'] = "0"
data_cle['partner_owner_recid'] = str(my_partner['recid'])
RetObject = []
val_tmp = 0

View File

@ -183,8 +183,8 @@ def Add_Message_To_Internal_Mail(tab_files, diction):
'partner_owner_recid':str(my_partner['recid'])})
if(login_count != 1 ):
mycommon.myprint("L'utilisateur destinataire de l'email est invalide ")
return False, "L'utilisateur destinataire de l'email est invalide"
mycommon.myprint("L'utilisateur destinataire de l'email n'est pas enregistré sur la plateforme => Add_Message_To_Internal_Mail")
return False, "L'utilisateur destinataire de l'email n'est pas enregistré sur la plateforme => Add_Message_To_Internal_Mail"
# Sauvegarde des fichiers joints depuis le front

69
main.py
View File

@ -118,6 +118,7 @@ import stage_mgt as stage_mgt
import Type_apprenant_mgt as Type_apprenant_mgt
import Finance_mode_mgt as Finance_mode_mgt
import Categorie_apprenant as Categorie_apprenant
import Type_groupe_inscrit_mgt as Type_groupe_inscrit_mgt
import base_document_automatic_setup as base_document_automatic_setup
@ -17671,6 +17672,74 @@ def Get_Given_Categorie_Apprenant():
"""
API pour ajouter un type de groupe d'inscrit
"""
@app.route('/myclass/api/Add_Type_Groupe_Inscrit/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_Type_Groupe_Inscrit():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_Type_Groupe_Inscrit payload = ",payload)
status, retval = Type_groupe_inscrit_mgt.Add_Type_Groupe_Inscrit(payload)
return jsonify(status=status, message=retval)
"""
API pour mettre a jour un type de groupe d'inscrit
"""
@app.route('/myclass/api/Update_Type_Groupe_Inscrit/', methods=['POST','GET'])
@crossdomain(origin='*')
def Update_Type_Groupe_Inscrit():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Update_Type_Groupe_Inscrit payload = ",payload)
status, retval = Type_groupe_inscrit_mgt.Update_Type_Groupe_Inscrit(payload)
return jsonify(status=status, message=retval)
"""
API pour supprimer un type de groupe d'inscrit
"""
@app.route('/myclass/api/Delete_Type_Groupe_Inscrit/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Type_Groupe_Inscrit():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Type_Groupe_Inscrit payload = ",payload)
status, retval = Type_groupe_inscrit_mgt.Delete_Type_Groupe_Inscrit(payload)
return jsonify(status=status, message=retval)
"""
API pour recuperer la liste des types de groupe d'inscrit d'un partenaire
"""
@app.route('/myclass/api/Get_List_Type_Groupe_Inscrit/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Type_Groupe_Inscrit():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Type_Groupe_Inscrit payload = ",payload)
status, retval = Type_groupe_inscrit_mgt.Get_List_Type_Groupe_Inscrit(payload)
return jsonify(status=status, message=retval)
"""
API pour recuperer les données d'un type de groupe d'inscrit
"""
@app.route('/myclass/api/Get_Given_Type_Groupe_Inscrit/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Given_Type_Groupe_Inscrit():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Given_Type_Groupe_Inscrit payload = ",payload)
status, retval = Type_groupe_inscrit_mgt.Get_Given_Type_Groupe_Inscrit(payload)
return jsonify(status=status, message=retval)
if __name__ == '__main__':
print(" debut api")

View File

@ -245,10 +245,10 @@ def Add_Partner_Document(diction):
if ("corps_mail" in diction.keys()):
if diction['corps_mail']:
corps_mail = diction['corps_mail']
if (len(str(corps_mail)) > 10000):
if (len(str(corps_mail)) > 15000):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Le champ 'corps_mail' fait plus de 10000 caractères ")
3]) + " - Le champ 'corps_mail' fait plus de 10000 caractères "+ str(len(str(corps_mail))) )
return False, " - Le champ 'corps_mail' fait plus de 10000 caractères "
data['corps_mail'] = corps_mail
@ -480,10 +480,10 @@ def Update_Partner_Document(diction):
if ("corps_mail" in diction.keys()):
if diction['corps_mail']:
corps_mail = diction['corps_mail']
if (len(str(corps_mail)) > 10000):
if (len(str(corps_mail)) > 15000):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Le champ 'corps_mail' fait plus de 10000 caractères ")
3]) + " - Le champ 'corps_mail' fait plus de 10000 caractères "+ str(len(str(corps_mail))) )
return False, " - Le champ 'corps_mail' fait plus de 10000 caractères "
data_update['corps_mail'] = corps_mail
@ -730,7 +730,7 @@ def Update_Partner_Document_Super_Admin(diction):
if ("corps_mail" in diction.keys()):
if diction['corps_mail']:
corps_mail = diction['corps_mail']
if (len(str(corps_mail)) > 10000):
if (len(str(corps_mail)) > 15000):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Le champ 'corps_mail' fait plus de 10000 caractères ")

View File

@ -3881,15 +3881,16 @@ def GerneratePDF_Partner_Invoice(diction):
return local_status, local_retval
convention_dictionnary_data = local_retval
company_data = {
"params": convention_dictionnary_data,
}
convention_dictionnary_data['order_header'] = Order_header_data
convention_dictionnary_data['order_lines'] = Order_header_lines_data
convention_dictionnary_data['invoice_paiement_data'] = invoice_paiement_data
convention_dictionnary_data['invoice_aquite'] = invoice_aquite
company_data = {
"params": convention_dictionnary_data,
}
# read css file
css_file = "./css_document/elyos_css.css"
from xhtml2pdf.default import DEFAULT_CSS
@ -3901,9 +3902,9 @@ def GerneratePDF_Partner_Invoice(diction):
#sourceHtml = contenu_doc_Template.render(params_order_header=Order_header_data, params_order_lines=Order_header_lines_data, params=company_data['params'])
#print(" ### company_data = ", company_data)
sourceHtml = contenu_doc_Template.render(params=company_data['params'])
orig_file_name = "Partner_Invoice_"+str(Order_header_data['invoice_header_ref_interne'])+".pdf"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) +"/"+ str(orig_file_name)
@ -4480,20 +4481,16 @@ def Send_Partner_Invoice_By_Email(tab_files, Folder, diction):
company_name = local_retval['company_data']['societe_nom']
convention_dictionnary_data = local_retval
company_data = {
"params": convention_dictionnary_data,
}
body = {
"params": convention_dictionnary_data,
}
convention_dictionnary_data['order_header'] = Order_header_data
convention_dictionnary_data['order_lines'] = Order_header_lines_data
convention_dictionnary_data['invoice_paiement_data'] = invoice_paiement_data
convention_dictionnary_data['invoice_aquite'] = invoice_aquite
body = {
"params": convention_dictionnary_data,
}
#print(" ############ convention_dictionnary_data = ", convention_dictionnary_data)
# Recuperation de la version PDF de la facture déjà enregistrée

View File

@ -6078,7 +6078,7 @@ def GerneratePDF_Partner_Order(diction):
"params": convention_dictionnary_data,
}
print(" ### bodybody = ", body)
#rint(" ### bodybody = ", body)
contenu_doc_Template = jinja2.Template(str(partner_document_CONF_ORDER_data['contenu_doc']))

View File

@ -3677,6 +3677,41 @@ def GetAttendeeDetail_perSession(diction):
local_modefinancement = local_Insc_retval['modefinancement']
my_retrun_dict['modefinancement'] = local_modefinancement
###
modefinancement_code = ""
modefinancement_id = ""
if ("modefinancement_id" in local_Insc_retval.keys() and local_Insc_retval['modefinancement_id']):
modefinancement_data = MYSY_GV.dbname['financement_mode'].find_one(
{'_id': ObjectId(str(local_Insc_retval['modefinancement_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if( modefinancement_data and "code" in modefinancement_data.keys()):
modefinancement_code = str(modefinancement_data['code'])
modefinancement_id = str(modefinancement_data['_id'])
my_retrun_dict['modefinancement_code'] = modefinancement_code
my_retrun_dict['modefinancement_id'] = modefinancement_id
type_apprenant_code = ""
type_apprenant_id = ""
if ("type_apprenant_id" in local_Insc_retval.keys() and local_Insc_retval['type_apprenant_id']):
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'_id': ObjectId(str(local_Insc_retval['type_apprenant_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(local_Insc_retval['partner_owner_recid'])})
if (type_apprenant_data and "code" in type_apprenant_data.keys()):
type_apprenant_code = str(type_apprenant_data['code'])
type_apprenant_id = str(type_apprenant_data['_id'])
my_retrun_dict['type_apprenant_code'] = type_apprenant_code
my_retrun_dict['type_apprenant_id'] = type_apprenant_id
###
local_opco = ""
if ("opco" in local_Insc_retval.keys()):
local_opco = local_Insc_retval['opco']
@ -5661,6 +5696,12 @@ Mais ca permet d'envoir un systeme pleinement operationnel des l'activation du c
- Configuration des formulaire (positionnement, à chaud, froid, enseignant, etc
- Initialisation des séquence - mysy_sequence
- Initialisation des type_apprenant
- Initialisation des financement_mode
- Initialisation des type_groupe_inscrit
"""
def Configure_Partner_Init_Setup_No_Token(diction):
@ -5706,12 +5747,10 @@ def Configure_Partner_Init_Setup_No_Token(diction):
""""
1 - Configuration des documents
"""
liste_document_ref_interne = ['CONF_PRE_INSCRIPTION', 'CONF_INSCRIPTION', 'REFUS_INSCRIPTION', 'ANNULE_INSCRIPTION', 'EVAL_FORMATION', 'EMARGEMENT_FORMATION', 'TABLEAU EMARGEMENT', 'EMPLOYEE_CREDENTIALS',
'EMARGEMENT', 'CONVOCATION_STAGIAIRE', 'CONVOCATION_STAGIAIRE', 'EMPLOYEE_CREDENTIALS_FOR_LMS', 'CONVENTION_STAGIAIRE', 'CONVENTION_STAGIAIRE', 'CONVENTION_STAGIAIRE',
'CONVENTION_STAGIAIRE', 'ATTESTATION_FORMATION', 'E_DOCUMENT_SIGNATURE_REQUEST', 'E_DOCUMENT_SIGNED', 'E_DOCUMENT_SIGNATURE_CODE', 'QUESTION_POSITIONNEMENT', 'PARTICIPANT_LIST_UPDATE',
'CLASS_INFO_REQUEST', 'QUOTATION_REMINDER_LEVEL_1', 'PART_ORDER', 'PART_ORDER', 'PART_INVOICE', 'PART_INVOICE', 'EVAL_AUTRE', 'EVAL_RESSOURCE_HUMAINE', 'EVALUATION_MODEL_PDF', 'BPF_MODEL',
'EVALUATION_CONVOCATION', 'EVALUATION_CONVOCATION', 'CRM_OPPORTUNITE_CHANGE_NOTIF', 'SURVEY_RESPONSE_NOTIF', 'STUDENT_CREDENTIALS_FOR_ENT', 'CLASS_INFO_REQUEST_WITH_QUOTATION',
'PARTNER_PRE_INSCRIPTION_NOTIF', 'SENDEMAIL_MODELE']
liste_document_ref_interne = ['CONF_PRE_INSCRIPTION', 'CONF_INSCRIPTION', 'REFUS_INSCRIPTION', 'ANNULE_INSCRIPTION', 'EVAL_FORMATION', 'EMARGEMENT_FORMATION',
'TABLEAU EMARGEMENT', 'EMPLOYEE_CREDENTIALS', 'EMARGEMENT', 'CONVOCATION_STAGIAIRE', 'CONVOCATION_STAGIAIRE', 'EMPLOYEE_CREDENTIALS_FOR_LMS',
'FACTURATION_SESSION', 'CONVENTION_STAGIAIRE', 'CONVENTION_STAGIAIRE', 'CONVENTION_STAGIAIRE', 'CONVENTION_STAGIAIRE', 'ATTESTATION_FORMATION', 'E_DOCUMENT_SIGNATURE_REQUEST', 'E_DOCUMENT_SIGNED', 'E_DOCUMENT_SIGNATURE_CODE', 'QUESTION_POSITIONNEMENT', 'PARTICIPANT_LIST_UPDATE', 'CLASS_INFO_REQUEST', 'QUOTATION_REMINDER_LEVEL_1', 'PART_ORDER', 'PART_ORDER', 'PART_INVOICE', 'PART_INVOICE', 'EVAL_AUTRE', 'EVAL_RESSOURCE_HUMAINE', 'EVALUATION_MODEL_PDF', 'BPF_MODEL', 'EVALUATION_CONVOCATION', 'EVALUATION_CONVOCATION', 'CRM_OPPORTUNITE_CHANGE_NOTIF', 'SURVEY_RESPONSE_NOTIF', 'STUDENT_CREDENTIALS_FOR_ENT', 'CLASS_INFO_REQUEST_WITH_QUOTATION', 'PARTNER_PRE_INSCRIPTION_NOTIF', 'SPECIFIC_SURVEY', 'INSCRIT_BULLETIN_NOTE', 'CONSEIL_CLASS_PV', 'QUALIOPI_AUTOMATIC_DOCUMENT_SENDING', 'SPECIFIC_SURVEY_CLIENT', 'SPECIFIC_SURVEY_EMPLOYEE', 'NOTIF_EMAIL_ELYOS', 'JURY_CONVOCATION_MEMBRE', 'JURY_CONVOCATION_MEMBRE', 'JURY_CONVOCATION_APPRENANT', 'JURY_CONVOCATION_APPRENANT', 'ADMISSION_JURY_CONVOCATION_CANDIDAT', 'ADMISSION_JURY_CONVOCATION_CANDIDAT', 'ADMISSION_RELANCE_DOCUMENT',
'STAGE_CONVENTION', 'STAGE_CONVENTION', 'EVAL_STAGE_ENTREPRISE', 'EVALUATION_STAGE_ENTREPRISE_MODEL_PDF']
"""
@ -7891,7 +7930,7 @@ def Ent_Student_Store_files(diction):
tab_apprenant_with_account_ids = []
tab_inscription_with_account_ids = []
print("### str(diction['tab_inscrit_ids']) = ", diction['tab_inscrit_ids'])
#print("### str(diction['tab_inscrit_ids']) = ", diction['tab_inscrit_ids'])
"""
Recuperer la liste des inscrits qui ont un compte
@ -7904,6 +7943,9 @@ def Ent_Student_Store_files(diction):
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1, 'apprenant_id':1,
'session_id':1, 'class_id':1})
#print(" ## inscrit_data 00 = ", inscrit_data)
if( "session_id" in inscrit_data and inscrit_data['session_id']):
tab_session_id.append(inscrit_data['session_id'])
@ -7913,19 +7955,14 @@ def Ent_Student_Store_files(diction):
if( inscrit_data and 'apprenant_id' in inscrit_data.keys() ):
valide_apprenant_account = MYSY_GV.dbname['user_account'].count_documents({'apprenant_id':str(inscrit_data['apprenant_id']),
'active':'1',
'type':'student'})
if( valide_apprenant_account == 1):
tab_apprenant_with_account_ids.append(str(inscrit_data['apprenant_id']))
tab_inscription_with_account_ids.append(str(val))
tab_apprenant_with_account_ids.append(str(inscrit_data['apprenant_id']))
tab_inscription_with_account_ids.append(str(val))
#print(" tab_inscription_with_account_ids ID = ", tab_inscription_with_account_ids)
for inscrit_id in tab_inscription_with_account_ids :
#print(" APRENANT ID = ", inscrit_id)
for file_name in diction['tab_file_name']:
#print(" ## file_nale = ", file_name)

View File

@ -1920,6 +1920,8 @@ def Get_List_Ressource_Humaine_with_filter(diction):
"""
Recherche sans filter - no_filter
Si 'type_rh' == 2, alors on veut aller cherchez Toutes les RH + autre RH
"""
def Get_List_Ressource_Humaine_no_filter(diction):
try:
@ -1981,9 +1983,11 @@ def Get_List_Ressource_Humaine_no_filter(diction):
find_qry = None
if( "type_rh" in diction.keys()):
if( "type_rh" in diction.keys() and diction['type_rh'] != '2'):
find_qry = {'partner_recid': str(my_partner['recid']), 'valide':'1', 'locked':'0',
'type_rh':diction['type_rh']}
elif( "type_rh" in diction.keys() and diction['type_rh'] == '2'):
find_qry = {'partner_recid': str(my_partner['recid']), 'valide':'1', 'locked':'0'}
else:
find_qry = {'partner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0',
'type_rh':{'$nin':['1']}}
@ -7165,7 +7169,7 @@ def Add_RH_List_Insc_Tutore(diction):
if( diction['role'] not in MYSY_GV.TUTORAT_ROLE):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le role de totorat est invalide ")
3]) + " Le role de totorat est invalide "+str(diction['role'])+" not in "+ str(MYSY_GV.TUTORAT_ROLE))
return False, " Le role de totorat est invalide",
"""

View File

@ -570,39 +570,59 @@ def Get_X_Best_Class_On_Given_period(diction):
def test_return():
try:
tab_return = []
"""
for my_partner in MYSY_GV.dbname['partnair_account'].find({'is_partner_admin_account':'1', 'active':'1'}):
delete = MYSY_GV.dbname['courrier_template'].delete_many({'partner_owner_recid':str(my_partner['recid'])})
print(" Suppression de "+str(delete.deleted_count)+" documents ")
tab_return.append(" Suppression de "+str(delete.deleted_count)+" documents ")
liste_document_ref_interne = ['CONF_PRE_INSCRIPTION', 'CONF_INSCRIPTION', 'REFUS_INSCRIPTION',
'ANNULE_INSCRIPTION', 'EVAL_FORMATION', 'EMARGEMENT_FORMATION',
'TABLEAU EMARGEMENT', 'EMPLOYEE_CREDENTIALS', 'EMARGEMENT',
'CONVOCATION_STAGIAIRE', 'CONVOCATION_STAGIAIRE',
'EMPLOYEE_CREDENTIALS_FOR_LMS',
'FACTURATION_SESSION', 'CONVENTION_STAGIAIRE', 'CONVENTION_STAGIAIRE',
'CONVENTION_STAGIAIRE', 'CONVENTION_STAGIAIRE', 'ATTESTATION_FORMATION',
'E_DOCUMENT_SIGNATURE_REQUEST', 'E_DOCUMENT_SIGNED',
'E_DOCUMENT_SIGNATURE_CODE', 'QUESTION_POSITIONNEMENT',
'PARTICIPANT_LIST_UPDATE', 'CLASS_INFO_REQUEST', 'QUOTATION_REMINDER_LEVEL_1',
'PART_ORDER', 'PART_ORDER', 'PART_INVOICE', 'PART_INVOICE', 'EVAL_AUTRE',
'EVAL_RESSOURCE_HUMAINE', 'EVALUATION_MODEL_PDF', 'BPF_MODEL',
'EVALUATION_CONVOCATION', 'EVALUATION_CONVOCATION',
'CRM_OPPORTUNITE_CHANGE_NOTIF', 'SURVEY_RESPONSE_NOTIF',
'STUDENT_CREDENTIALS_FOR_ENT', 'CLASS_INFO_REQUEST_WITH_QUOTATION',
'PARTNER_PRE_INSCRIPTION_NOTIF', 'SPECIFIC_SURVEY', 'INSCRIT_BULLETIN_NOTE',
'CONSEIL_CLASS_PV', 'QUALIOPI_AUTOMATIC_DOCUMENT_SENDING',
'SPECIFIC_SURVEY_CLIENT', 'SPECIFIC_SURVEY_EMPLOYEE', 'NOTIF_EMAIL_ELYOS',
'JURY_CONVOCATION_MEMBRE', 'JURY_CONVOCATION_MEMBRE',
'JURY_CONVOCATION_APPRENANT', 'JURY_CONVOCATION_APPRENANT',
'ADMISSION_JURY_CONVOCATION_CANDIDAT', 'ADMISSION_JURY_CONVOCATION_CANDIDAT',
'ADMISSION_RELANCE_DOCUMENT',
'STAGE_CONVENTION', 'STAGE_CONVENTION', 'EVAL_STAGE_ENTREPRISE',
'EVALUATION_STAGE_ENTREPRISE_MODEL_PDF']
insertObject = []
nb_val ={'nb_formation':'2'}
tmp_val0 = {}
tmp_val1 = {}
tmp_val2 = {}
tmp_val3 = {}
tmp_val4 = {}
cpt = 0
for my_courrier_data in MYSY_GV.dbname['courrier_template'].find(
{"ref_interne": {"$in": liste_document_ref_interne},
'partner_owner_recid': 'default', 'valide': '1',
'locked': '0'}, ):
new_courrier = my_courrier_data
new_courrier['update_date'] = str(datetime.now())
new_courrier['update_by'] = str(my_partner['_id'])
new_courrier['partner_owner_recid'] = str(my_partner['recid'])
new_courrier['original_courrier_template_id'] = str(my_courrier_data['_id'])
if ("_id" in new_courrier.keys()):
del new_courrier['_id']
tmp_val0['categories'] = "01/02/22, 02/02/22, 03/02/22, 04/02/22, 05/02/22, 06/02/22"
tmp_val1 = {'name': 'formation 1', 'Date_view': '2022-09-11', 'count':'2'}
tmp_val2 = {'name': 'formation 1', 'Date_view': '2022-09-10', 'count': '23'}
tmp_val3 = {'name': 'formation 1', 'Date_view': '2022-09-05', 'count': '9'}
MYSY_GV.dbname['courrier_template'].insert_one(new_courrier)
cpt = cpt + 1
tmp_val4 = {'name': 'formation 2', 'Date_view': '2022-09-11', 'count': '3'}
tmp_val5 = {'name': 'formation 2', 'Date_view': '2022-09-10', 'count': '4'}
tmp_val6 = {'name': 'formation 3', 'Date_view': '2022-09-05', 'count': '6'}
#insertObject.append(JSONEncoder().encode(nb_val))
insertObject.append(JSONEncoder().encode(tmp_val0))
insertObject.append(JSONEncoder().encode(tmp_val1))
insertObject.append(JSONEncoder().encode(tmp_val2))
insertObject.append(JSONEncoder().encode(tmp_val3))
insertObject.append(JSONEncoder().encode(tmp_val4))
insertObject.append(JSONEncoder().encode(tmp_val5))
insertObject.append(JSONEncoder().encode(tmp_val6))
return True, insertObject
print(" Traitement de "+str(cpt)+" courriers pour "+str(my_partner['nom'])+" - "+str(my_partner['email']))
tab_return.append(" Traitement de "+str(cpt)+" courriers pour "+str(my_partner['nom'])+" - "+str(my_partner['email']))
"""
return True, tab_return
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()