parent
ca7cd37e68
commit
122572d1b3
|
|
@ -4,15 +4,29 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="26/10/2025 - 15h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="29/10/2025 - 22h">
|
||||
<change afterPath="$PROJECT_DIR$/ent_alert_messages.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/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" 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$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.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$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.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$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/domaine_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/domaine_formation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/formulaire_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/formulaire_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/model_planning_sequence_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/model_planning_sequence_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_session.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_session.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -455,7 +469,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="508" />
|
||||
<option name="localTasksCounter" value="509" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -497,7 +511,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="11/06/2025 - 16h30" />
|
||||
<MESSAGE value="19/06/2025 -18h" />
|
||||
<MESSAGE value="20/06/2025 -18h" />
|
||||
<MESSAGE value="ssqsdqsd" />
|
||||
|
|
@ -522,6 +535,7 @@
|
|||
<MESSAGE value="wds" />
|
||||
<MESSAGE value="22/10*2025 - 22h" />
|
||||
<MESSAGE value="26/10/2025 - 15h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="26/10/2025 - 15h" />
|
||||
<MESSAGE value="29/10/2025 - 22h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="29/10/2025 - 22h" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1239,7 +1239,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
|
||||
|
||||
|
||||
print(" ### RetObject BPF = ", RetObject)
|
||||
#print(" ### RetObject BPF = ", RetObject)
|
||||
RetObject = mycommon.JSONEncoder().encode(RetObject)
|
||||
|
||||
return True, RetObject
|
||||
|
|
@ -2462,7 +2462,7 @@ def Prepare_and_Print_BPF_PDF(diction):
|
|||
RetObject['filt_periode_end_date'] = str(filt_periode_end_date)
|
||||
RetObject['bpf_f1_type_apprenant'] = bpf_f1_type_apprenant
|
||||
|
||||
print(" ### RetObject BPF = ", RetObject)
|
||||
#print(" ### RetObject BPF = ", RetObject)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -712,7 +712,9 @@ TRAINING_LOCATION_TYPE = ['intra', 'extra', 'autre', '']
|
|||
"""
|
||||
On definit les entrée scolaires autorisées
|
||||
"""
|
||||
TRAINING_ENTREE_SCOLAIRE = ['2024', '2025', '2026','2027', '2028', '2029', '']
|
||||
TRAINING_ENTREE_SCOLAIRE = ['2024', '2025', '2026','2027', '2028', '2029',
|
||||
'2024/2025','2025/2026','2026/2027', '2027/2028',
|
||||
'2028/2029','']
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -980,3 +982,12 @@ Les type de ressources humaines sont :
|
|||
"""
|
||||
TYPE_RH = ['', '1']
|
||||
|
||||
|
||||
"""
|
||||
Priorité des messages d'alerte sur l'ENT
|
||||
0 ==> 'urgent'
|
||||
1 ==> 'important',
|
||||
2 ==> 'info'
|
||||
|
||||
"""
|
||||
ENT_MESSAGE_PRIORITE = ['0', '1', '2']
|
||||
|
|
@ -1562,7 +1562,7 @@ def GetAllClassStagiaire(diction):
|
|||
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, "Impossible de récupérer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
|
@ -5589,7 +5589,7 @@ def GetListEvaluation_Session(diction):
|
|||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
print(" ### RetObject = ", RetObject)
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -13202,7 +13202,7 @@ def Get_Accepted_Insription_From_Session_id_Reduice_Fields(diction):
|
|||
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, "Impossible de récupérer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
|
@ -13319,7 +13319,7 @@ def Get_Insription_From_Session_id_Reduice_Fields_With_Filter(diction):
|
|||
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, "Impossible de récupérer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
|
|
|||
326
Job_Cron.py
326
Job_Cron.py
|
|
@ -1364,6 +1364,286 @@ def Cron_Daily_Automatic_Qualiopi_Documents():
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)
|
||||
|
||||
"""
|
||||
Cette fonction permet de lancer le traitement automatique pour un partenaire donné (partner_owner_recid)
|
||||
"""
|
||||
|
||||
|
||||
def Cron_Daily_Automatic_Qualiopi_Documents_For_Given_Partner(diction):
|
||||
try:
|
||||
print(" Cron : In function = Cron_Daily_Document_Sending")
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_owner_recid', 'code_session']
|
||||
|
||||
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 = ['partner_owner_recid',]
|
||||
|
||||
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"
|
||||
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
todays_date_ISODATE = datetime.strptime(str(todays_date), '%d/%m/%Y')
|
||||
|
||||
qry_list_session_concerned = {}
|
||||
qry_list_session_concerned['valide'] = "1"
|
||||
qry_list_session_concerned['automatic_traitement.actif'] = "1"
|
||||
qry_list_session_concerned['automatic_traitement.valide'] = "1"
|
||||
|
||||
qry_list_session_concerned['partner_owner_recid'] = str(diction['partner_owner_recid'])
|
||||
|
||||
if( "code_session" in diction.keys() and diction['code_session']):
|
||||
qry_list_session_concerned['code_session'] = str(diction['code_session'])
|
||||
|
||||
# qry_list_session_concerned['automatic_traitement.statut'] = {"$ne": "2"}
|
||||
|
||||
print(" ### qry_list_session_concerned = ", qry_list_session_concerned)
|
||||
|
||||
for my_session in MYSY_GV.dbname['session_formation'].find(qry_list_session_concerned):
|
||||
print(" # Code Session = ", my_session['code_session'])
|
||||
print(" # Date Start Session = ", my_session['date_debut'])
|
||||
print(" # Date End Session = ", my_session['date_fin'])
|
||||
|
||||
# print(" # automatic_traitement = ", my_session['automatic_traitement'])
|
||||
diction_for_notification_email = {}
|
||||
diction_for_notification_email['session_id'] = str(my_session['_id'])
|
||||
diction_for_notification_email['tab_message'] = []
|
||||
diction_for_notification_email['global_status'] = []
|
||||
|
||||
for data_automatic_traitement in my_session['automatic_traitement']:
|
||||
if (data_automatic_traitement["actif"] == "1" and data_automatic_traitement["valide"] == "1" and
|
||||
data_automatic_traitement["statut"] != "2"):
|
||||
|
||||
print(" # Analyse Document = ", str(data_automatic_traitement['nom_document']),
|
||||
" Pour la session_code = ", str(my_session['code_session']), )
|
||||
print(" # Target Date = ", data_automatic_traitement['action_target_date'])
|
||||
print(" # Nb jour action = ", data_automatic_traitement['nb_jour_action'])
|
||||
print(" # Date du jour = ", str(todays_date))
|
||||
|
||||
local_status, nb_jour_action_Int = mycommon.IsInt(
|
||||
str(data_automatic_traitement['nb_jour_action']).strip())
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " CRON WARNING : nb_jour_action_Int n'est pas une valeur entière. Session Formation = ",
|
||||
str(my_session['_id']))
|
||||
# On log une erreur, et on continue le traitement dans la boucle.
|
||||
continue
|
||||
|
||||
local_session_start_date = datetime.strptime(str(my_session['date_debut']).strip(), '%d/%m/%Y')
|
||||
local_session_end_date = datetime.strptime(str(my_session['date_fin']).strip(), '%d/%m/%Y')
|
||||
local_session_target_date_added_nb_jour_action = ""
|
||||
local_session_target_date_added_nb_jour_action_formated = ""
|
||||
|
||||
if (data_automatic_traitement['action_target_date'] == "start_session"):
|
||||
local_session_target_date_added_nb_jour_action = local_session_start_date + timedelta(
|
||||
days=nb_jour_action_Int)
|
||||
local_session_target_date_added_nb_jour_action_formated = str(
|
||||
local_session_target_date_added_nb_jour_action.strftime("%d/%m/%Y"))
|
||||
|
||||
elif (data_automatic_traitement['action_target_date'] == "end_session"):
|
||||
local_session_target_date_added_nb_jour_action = local_session_end_date + timedelta(
|
||||
days=nb_jour_action_Int)
|
||||
local_session_target_date_added_nb_jour_action_formated = str(
|
||||
local_session_target_date_added_nb_jour_action.strftime("%d/%m/%Y"))
|
||||
|
||||
elif (data_automatic_traitement['action_target_date'] == "every_session_sequence_day"):
|
||||
"""
|
||||
Il faut aller voir si on a une sequence en date d'aujoud'hui pour cette session.
|
||||
Si oui, alors on local_session_target_date_added_nb_jour_action = date to day
|
||||
"""
|
||||
local_session_target_date_added_nb_jour_action = datetime.strptime(str(todays_date).strip(),
|
||||
'%d/%m/%Y')
|
||||
|
||||
elif (data_automatic_traitement['action_target_date'] == "preinscription"):
|
||||
"""
|
||||
Il faut aller voir si on a une sequence en date d'aujoud'hui pour cette session.
|
||||
Si oui, alors on local_session_target_date_added_nb_jour_action = date to day
|
||||
"""
|
||||
local_session_target_date_added_nb_jour_action = datetime.strptime(str(todays_date).strip(),
|
||||
'%d/%m/%Y')
|
||||
|
||||
print(" ### CMP 1 local_session_target_date_added_nb_jour_action = ",
|
||||
local_session_target_date_added_nb_jour_action)
|
||||
print(" ### CMP 2 datetime.strptime(str(todays_date).strip(), '%d/%m/%Y') = ",
|
||||
datetime.strptime(str(todays_date).strip(), '%d/%m/%Y'))
|
||||
|
||||
if (data_automatic_traitement['action_target_date'] != "preinscription" and
|
||||
data_automatic_traitement['action_target_date'] != "inscription"):
|
||||
if (data_automatic_traitement['action_target_date'] == "start_session"):
|
||||
print(" ### delta day (start_session) = ",
|
||||
datetime.strptime(str(todays_date).strip(), '%d/%m/%Y') - local_session_start_date)
|
||||
if (data_automatic_traitement['action_target_date'] == "end_session"):
|
||||
print(" ### delta day (end_session) = ",
|
||||
datetime.strptime(str(todays_date).strip(), '%d/%m/%Y') - local_session_end_date)
|
||||
|
||||
if (local_session_target_date_added_nb_jour_action > datetime.strptime(str(todays_date).strip(),
|
||||
'%d/%m/%Y')):
|
||||
print(" ### SUPPPPPP : Action à faire dans le futur ")
|
||||
|
||||
elif (local_session_target_date_added_nb_jour_action < datetime.strptime(
|
||||
str(todays_date).strip(), '%d/%m/%Y')):
|
||||
print(" ### INFFFFFF : Alert il y a un pb sur une action non realiser ")
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " CRON WARNING * Cron_Daily_Document_Sending: Il a un CRON qui ne n'est pas exécuté à la date prévue."
|
||||
" Session Formation = " + str(
|
||||
my_session['_id']) + " Id du CRON courrier_template_type_document_id = " + str(
|
||||
data_automatic_traitement['courrier_template_type_document_id']))
|
||||
|
||||
courrier_template_type_document_data = MYSY_GV.dbname[
|
||||
'courrier_template_type_document'].find_one(
|
||||
{'ref_interne': data_automatic_traitement[
|
||||
'courrier_template_type_document_ref_interne'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
node_notification = {}
|
||||
node_notification['message'] = "Cette tâche n'a pas été exécutée. " \
|
||||
" Date Initialement prévue " + str(
|
||||
local_session_target_date_added_nb_jour_action_formated)
|
||||
node_notification['status'] = "Warning"
|
||||
node_notification['action'] = str(courrier_template_type_document_data['ref_interne'])
|
||||
diction_for_notification_email['tab_message'].append(node_notification)
|
||||
diction_for_notification_email['global_status'].append("warning")
|
||||
|
||||
|
||||
elif (local_session_target_date_added_nb_jour_action == datetime.strptime(
|
||||
str(todays_date).strip(), '%d/%m/%Y')):
|
||||
|
||||
"""
|
||||
Effectuer l'action
|
||||
"""
|
||||
"""
|
||||
Recuperer le type de document concerné
|
||||
"""
|
||||
courrier_template_type_document_data = MYSY_GV.dbname[
|
||||
'courrier_template_type_document'].find_one(
|
||||
{'ref_interne': data_automatic_traitement[
|
||||
'courrier_template_type_document_ref_interne'],
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (
|
||||
courrier_template_type_document_data and 'ref_interne' in courrier_template_type_document_data.keys()):
|
||||
print(" ### Action à faire : Envoyer le document de type ",
|
||||
courrier_template_type_document_data['ref_interne'])
|
||||
else:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " CRON WARNING * Cron_Daily_Document_Sending: Impossible de trouver le type de document concerné "
|
||||
" Session Formation = " + str(
|
||||
my_session['_id']) + " Id du CRON courrier_template_type_document_id = " + str(
|
||||
data_automatic_traitement['courrier_template_type_document_id']))
|
||||
|
||||
continue
|
||||
|
||||
# print(" ### avant action 1 courrier_template_type_document_data = ", courrier_template_type_document_data)
|
||||
# print(" ## data_automatic_traitement = ", data_automatic_traitement)
|
||||
|
||||
local_diction = {}
|
||||
local_diction['session_id'] = str(my_session['_id'])
|
||||
local_diction['document_ref_intern'] = str(
|
||||
courrier_template_type_document_data['ref_interne'])
|
||||
local_diction['partner_owner_recid'] = str(my_session['partner_owner_recid'])
|
||||
local_diction['courrier_template_type_document_ref_interne'] = str(
|
||||
data_automatic_traitement['courrier_template_type_document_ref_interne'])
|
||||
local_diction['courrier_template_type_document_id'] = str(
|
||||
data_automatic_traitement['courrier_template_type_document_id'])
|
||||
|
||||
# print( " ### local_diction for Send_document_from_base_document_automatic_setup = ", local_diction)
|
||||
local_status, local_retval = Send_document_from_base_document_automatic_setup(local_diction)
|
||||
|
||||
node_notification = {}
|
||||
node_notification['message'] = str(courrier_template_type_document_data['ref_interne'])
|
||||
|
||||
local_status_tanslate = ""
|
||||
if (local_status is True):
|
||||
local_status_tanslate = "Ok"
|
||||
else:
|
||||
local_status_tanslate = "Erreur"
|
||||
|
||||
node_notification['status'] = str(local_status_tanslate)
|
||||
node_notification['action'] = str(courrier_template_type_document_data['ref_interne'])
|
||||
diction_for_notification_email['tab_message'].append(node_notification)
|
||||
diction_for_notification_email['global_status'].append(str(local_status).lower())
|
||||
|
||||
"""
|
||||
Mettre à jour le document
|
||||
|
||||
Important : 17/04/25 : Lorsqu'il s'agit d'une action d'emargement avec un targuet = 'every_session_sequence_day', alors
|
||||
on ne desactive l'action que si la date du jous >= a la date de fin de session
|
||||
|
||||
"""
|
||||
if (data_automatic_traitement['action_target_date'] != "every_session_sequence_day" or
|
||||
(data_automatic_traitement['action_target_date'] == "every_session_sequence_day" and
|
||||
local_session_end_date <= datetime.strptime(str(todays_date).strip(),
|
||||
'%d/%m/%Y'))):
|
||||
|
||||
local_update = MYSY_GV.dbname['session_formation'].update_many(
|
||||
{'_id': ObjectId(str(my_session['_id'])),
|
||||
'partner_owner_recid': str(my_session['partner_owner_recid']),
|
||||
'valide': '1',
|
||||
'automatic_traitement.courrier_template_type_document_id': str(
|
||||
data_automatic_traitement['courrier_template_type_document_id'])
|
||||
},
|
||||
{'$set':
|
||||
{
|
||||
'automatic_traitement.$[xxx].actif': "-1",
|
||||
'automatic_traitement.$[xxx].statut': "2",
|
||||
'automatic_traitement.$[xxx].date_traitement_cron': str(datetime.now()),
|
||||
'automatic_traitement.$[xxx].date_update': str(datetime.now()),
|
||||
'automatic_traitement.$[xxx].update_by': "Automatic Cron",
|
||||
}
|
||||
},
|
||||
upsert=False,
|
||||
array_filters=[
|
||||
{"xxx.courrier_template_type_document_id": str(
|
||||
data_automatic_traitement['courrier_template_type_document_id'])}
|
||||
]
|
||||
|
||||
)
|
||||
if (local_update.matched_count < 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " CRON WARNING * Cron_Daily_Document_Sending: La mise à jour du statut (actif = -1) du cron ne s'est "
|
||||
" PAS bien passé : Session Formation = " + str(my_session['_id']) +
|
||||
" Id du CRON courrier_template_type_document_id = " +
|
||||
str(data_automatic_traitement[
|
||||
'courrier_template_type_document_id']))
|
||||
|
||||
local_status, my_partner = mycommon.Get_Connected_User_Partner_Data_From_RecID(
|
||||
str(my_session['partner_owner_recid']))
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
diction_for_notification_email['token'] = str(my_partner['token'])
|
||||
|
||||
local_status, local_retval = Job_Cron_Common.Cron_Qualiopi_Automatic_Traitement_Notification(
|
||||
diction_for_notification_email)
|
||||
|
||||
return True, "OK"
|
||||
|
||||
|
||||
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, str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)
|
||||
|
||||
|
||||
"""
|
||||
|
|
@ -1474,11 +1754,13 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
local_diction_doc['class_id'] = session_class_id
|
||||
local_diction_doc['partner_owner_recid'] = str(diction['partner_owner_recid'])
|
||||
|
||||
#print(" ## Cron_Get_Given_Class_List_Default_Documents_For_Given_Type_Doc local_diction_doc = ", local_diction_doc)
|
||||
local_document_q_position_doc_status, local_document_q_position_doc_retval = Job_Cron_Common.Cron_Get_Given_Class_List_Default_Documents_For_Given_Type_Doc(
|
||||
local_diction_doc)
|
||||
if (local_document_q_position_doc_status):
|
||||
document_q_position = local_document_q_position_doc_retval
|
||||
|
||||
#print(" ## local_document_q_position_doc_retval = ", local_document_q_position_doc_retval)
|
||||
if (document_q_position == ""):
|
||||
|
||||
local_default_form_count = MYSY_GV.dbname['formulaire'].count_documents(
|
||||
|
|
@ -1510,6 +1792,7 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
init_diction['sending_date'] = ""
|
||||
init_diction['related_collection'] = "inscription"
|
||||
|
||||
#print(" ### BEFORE Cron_Init_Survey_Tab_For_Inscrit_Not_Init init_diction = ", init_diction)
|
||||
local_status_init, local_retval_init = Job_Cron_Common.Cron_Init_Survey_Tab_For_Inscrit_Not_Init(init_diction)
|
||||
|
||||
if( local_status_init is False ):
|
||||
|
|
@ -1594,28 +1877,30 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
"""
|
||||
Evaluation du formateur mis que la session de formation, si formateur
|
||||
"""
|
||||
"""
|
||||
Si il ya une evaluation formateur par defaut sur la formation, alors aller la chercher
|
||||
"""
|
||||
document_formateur_eval = ""
|
||||
local_diction_doc = {}
|
||||
local_diction_doc['document_type'] = "EVAL_FORMATION_FORMATEUR"
|
||||
local_diction_doc['class_id'] = session_class_id
|
||||
local_diction_doc['partner_owner_recid'] = str(diction['partner_owner_recid'])
|
||||
# 1 - Verifier s'il y a un formateur valide sur la session
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['session_id']))},
|
||||
{'_id': 1, 'formateur_id': 1})
|
||||
|
||||
local_document_formateur_eval_status, local_document_formateur_eval_retval = Job_Cron_Common.Cron_Get_Given_Class_List_Default_Documents_For_Given_Type_Doc(
|
||||
local_diction_doc)
|
||||
if (local_document_formateur_eval_status):
|
||||
document_formateur_eval = local_document_formateur_eval_retval
|
||||
if (session_data and "formateur_id" in session_data.keys() and session_data['formateur_id']):
|
||||
"""
|
||||
Si il ya une evaluation formateur par defaut sur la formation, alors aller la chercher
|
||||
"""
|
||||
document_formateur_eval = ""
|
||||
local_diction_doc = {}
|
||||
local_diction_doc['document_type'] = "EVAL_FORMATION_FORMATEUR"
|
||||
local_diction_doc['class_id'] = session_class_id
|
||||
local_diction_doc['partner_owner_recid'] = str(diction['partner_owner_recid'])
|
||||
|
||||
if (document_formateur_eval == ""):
|
||||
print(" ### DEBUT Initialiser le questionnaire d'évaluation du formateur mis sur la session ")
|
||||
local_document_formateur_eval_status, local_document_formateur_eval_retval = Job_Cron_Common.Cron_Get_Given_Class_List_Default_Documents_For_Given_Type_Doc(
|
||||
local_diction_doc)
|
||||
if (local_document_formateur_eval_status):
|
||||
document_formateur_eval = local_document_formateur_eval_retval
|
||||
|
||||
#1 - Verifier s'il y a un formateur valide sur la session
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(diction['session_id']))}, {'_id':1, 'formateur_id':1})
|
||||
print(" ### Eval formateur document_formateur_eval = ", document_formateur_eval)
|
||||
|
||||
if (document_formateur_eval == ""):
|
||||
print(" ### DEBUT Initialiser le questionnaire d'évaluation du formateur mis sur la session ")
|
||||
|
||||
if( session_data and "formateur_id" in session_data.keys() and session_data['formateur_id']):
|
||||
# Aller chercher le formulaire par défaut pour l'evaluation des enseignants
|
||||
local_default_form_count = MYSY_GV.dbname['formulaire'].count_documents(
|
||||
{'type': 'human_eval',
|
||||
'valide': '1',
|
||||
|
|
@ -1650,6 +1935,7 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
init_diction['related_collection'] = "ressource_humaine"
|
||||
init_diction['related_collection_id'] = str(session_data['formateur_id'])
|
||||
|
||||
print(' I?IIIII init_diction = ', init_diction)
|
||||
|
||||
local_status_init, local_retval_init = Job_Cron_Common.Cron_Init_Survey_Tab_For_Inscrit_Not_Init(
|
||||
init_diction)
|
||||
|
|
@ -1658,7 +1944,6 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
return local_status_init, local_retval_init
|
||||
|
||||
print(" ### DEBUT Envoyer le questionnaire de Evaluation du formateur ")
|
||||
print(" envoi eval formateur init_diction = ", init_diction)
|
||||
local_status_send, local_retval_send = Job_Cron_Common.Cron_Send_Survey_TabIds(init_diction)
|
||||
|
||||
if (local_status_send is False):
|
||||
|
|
@ -1673,7 +1958,7 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
"""
|
||||
document_cold_eval = ""
|
||||
local_diction_doc = {}
|
||||
local_diction_doc['document_type'] = "EVAL_FORMATION_HOT"
|
||||
local_diction_doc['document_type'] = "EVAL_FORMATION_COLD"
|
||||
local_diction_doc['class_id'] = session_class_id
|
||||
local_diction_doc['partner_owner_recid'] = str(diction['partner_owner_recid'])
|
||||
|
||||
|
|
@ -1721,6 +2006,7 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
init_diction['sending_date'] = str(today_plus_90_jours_string)
|
||||
init_diction['related_collection'] = "inscription"
|
||||
|
||||
|
||||
local_status_init, local_retval_init = Job_Cron_Common.Cron_Init_Survey_Tab_For_Inscrit_Not_Init(
|
||||
init_diction)
|
||||
|
||||
|
|
|
|||
|
|
@ -1158,6 +1158,12 @@ def Cron_Init_Survey_Tab_For_Inscrit_Not_Init(diction):
|
|||
"""
|
||||
|
||||
for local_inscrit in tab_my_inscription_ids_all:
|
||||
|
||||
print(" QRYY is_inscrit_exist_in_survey_count = ", {'partner_owner_recid': str(my_partner['recid']),
|
||||
'session_id': str(diction['session_id']),
|
||||
'survey_type': str(diction['survey_type']),
|
||||
'inscription_id':str(local_inscrit)})
|
||||
|
||||
is_inscrit_exist_in_survey_count = MYSY_GV.dbname['survey'].count_documents(
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'session_id': str(diction['session_id']),
|
||||
|
|
@ -1174,7 +1180,6 @@ def Cron_Init_Survey_Tab_For_Inscrit_Not_Init(diction):
|
|||
{'_id': ObjectId(str(diction['formulaire_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'default': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_form <= 0):
|
||||
|
|
@ -1187,7 +1192,7 @@ def Cron_Init_Survey_Tab_For_Inscrit_Not_Init(diction):
|
|||
Les inscriptions etant toutes valides, on va proceder à
|
||||
1 - la creation de l'enquete
|
||||
"""
|
||||
|
||||
print(" {{{ UUU tab_my_inscription_ids = ", tab_my_inscription_ids)
|
||||
for my_inscription_id in tab_my_inscription_ids:
|
||||
# Recuperation des données de l'inscript
|
||||
|
||||
|
|
@ -1322,11 +1327,6 @@ def Cron_Create_One_Survey_To_Inscrit(diction):
|
|||
"""
|
||||
Recuperer les données de l'inscrit
|
||||
"""
|
||||
print(" qry insc = ", {'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'valide': '1',
|
||||
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
my_inscrit_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'valide': '1',
|
||||
|
|
@ -1553,7 +1553,7 @@ def Cron_Send_Survey_TabIds(diction):
|
|||
'valide': '1', 'locked': '0', 'partner_recid': str(my_partner['recid'])}, {'_id':1, 'nom':1, 'prenom':1, 'email':1, 'civilite':1})
|
||||
|
||||
|
||||
print(" ### local_survey_retval = ",local_survey_retval)
|
||||
#print(" ### local_survey_retval = ",local_survey_retval)
|
||||
courrier_ref_interne = ""
|
||||
if ( "survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "pos"):
|
||||
courrier_ref_interne = "QUESTION_POSITIONNEMENT"
|
||||
|
|
@ -3375,7 +3375,6 @@ def Cron_Get_Given_Class_List_Default_Documents_For_Given_Type_Doc(diction):
|
|||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
#print(" ### Get_Partner_List_Partner_Client data_cle = ", data_cle)
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
|
|
@ -3384,7 +3383,6 @@ def Cron_Get_Given_Class_List_Default_Documents_For_Given_Type_Doc(diction):
|
|||
if( str(diction['document_type']) in retval.keys() ):
|
||||
retval_document_id = retval[str(diction['document_type'])]
|
||||
|
||||
|
||||
return True, retval_document_id
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
12316
Log/log_file.log
12316
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -1096,7 +1096,7 @@ def Get_Given_SessionFormation_From_Id(diction):
|
|||
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é, Creation partenaire annulée")
|
||||
return False, "de récupérer la liste des stagiaires . Toutes les informations fournies ne sont pas valables"
|
||||
return False, "Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
|
|
@ -1106,7 +1106,7 @@ def Get_Given_SessionFormation_From_Id(diction):
|
|||
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, "Impossible de récupérer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
|
@ -5252,7 +5252,7 @@ def Delete_SessionFormation(diction):
|
|||
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, "Impossible de récupérer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
|
@ -5389,7 +5389,7 @@ def Delete_List_SessionFormation(diction):
|
|||
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, "Impossible de récupérer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
|
@ -16298,7 +16298,7 @@ def Get_Given_SessionFormation_List_Automatic_Traitement_From(diction):
|
|||
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, "Impossible de récupérer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
|
@ -16618,3 +16618,430 @@ def unarchive_session(diction):
|
|||
|
||||
return False, " Impossible d'archiver les sessions "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Ajout une UE à une session de formation
|
||||
important : le système va verifier si cette UE est
|
||||
paramettrée sur la formation
|
||||
"""
|
||||
def Add_Update_UE_To_Session(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'ue_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', 'session_id', 'ue_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
|
||||
|
||||
mydata = {}
|
||||
|
||||
mydata = diction
|
||||
del mydata['token']
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
|
||||
# Verifier que UE est valide
|
||||
is_ue_exist_count = MYSY_GV.dbname['unite_enseignement'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'_id':ObjectId(str(diction['ue_id'])),
|
||||
'locked':'0'
|
||||
})
|
||||
if( is_ue_exist_count != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'UE est invalide ")
|
||||
return False, " L'identifiant de l'UE est invalide "
|
||||
|
||||
is_ue_exist_data = MYSY_GV.dbname['unite_enseignement'].find_one(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'_id': ObjectId(str(diction['ue_id'])),
|
||||
'locked': '0'
|
||||
})
|
||||
|
||||
|
||||
|
||||
# Verifier que la session est valide
|
||||
is_session_exist_count = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'_id':ObjectId(str(diction['session_id']))})
|
||||
|
||||
if (is_session_exist_count != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la promotion / session est invalide ")
|
||||
return False, " L'identifiant de la promotion / session est invalide "
|
||||
|
||||
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'_id': ObjectId(str(diction['session_id']))})
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier que l'UE est bien paramettrée sur la formation
|
||||
"""
|
||||
is_ue_in_class_count = MYSY_GV.dbname['myclass'].count_documents({'list_unite_enseignement._id':str(diction['ue_id']),
|
||||
'_id': ObjectId(str(session_data['class_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
})
|
||||
|
||||
if (is_ue_in_class_count != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La configuration de l'UE sur la formation est invalide ")
|
||||
return False, " La configuration de l'UE sur la formation est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Ajouter ou mettre à jour l'UE sur la session
|
||||
"""
|
||||
now = str(datetime.now())
|
||||
|
||||
"""
|
||||
Verifier que le ue_id existe deja pour cette formation, au quel cas c'est un update qu'on fait
|
||||
si non c'est un create
|
||||
"""
|
||||
is_ue_id_existe_class = 0
|
||||
|
||||
is_ue_id_existe_class = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'list_unite_enseignement._id': str(diction['ue_id']),
|
||||
'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid'],
|
||||
'valide': '1',
|
||||
})
|
||||
|
||||
if (is_ue_id_existe_class > 0):
|
||||
update_session_ue = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'list_unite_enseignement._id': str(
|
||||
diction['ue_id'])},
|
||||
{'$set':
|
||||
{
|
||||
|
||||
'list_unite_enseignement.$[xxx].date_update': str(now),
|
||||
'list_unite_enseignement.$[xxx].update_by': str(
|
||||
my_partner['_id']),
|
||||
}
|
||||
},
|
||||
upsert=False,
|
||||
array_filters=[
|
||||
{"xxx._id": str(diction['ue_id'])}
|
||||
]
|
||||
|
||||
)
|
||||
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "session_formation"
|
||||
history_event_dict['related_collection_recid'] = str(session_data['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Mise à jour de l'Unité d'enseignement "+str(is_ue_exist_data['_id'])+", Code UE :"+str(is_ue_exist_data['code'])
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " L'unité d'enseignement a été mise à jour"
|
||||
|
||||
else:
|
||||
# l'UE n'existe pas pour cette session, on fait une creation
|
||||
# Il s'agit de la creation d'une competence
|
||||
new_data = {}
|
||||
new_data['date_update'] = str(now)
|
||||
new_data['valide'] = "1"
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['_id'] = str(diction['ue_id'])
|
||||
|
||||
insert = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
},
|
||||
|
||||
{
|
||||
'$push': {
|
||||
"list_unite_enseignement": {
|
||||
'$each': [new_data]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
)
|
||||
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "session_formation"
|
||||
history_event_dict['related_collection_recid'] = str(session_data['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Ajout de l'Unité d'enseignement " + str(
|
||||
is_ue_exist_data['_id']) + ", Code UE :" + str(is_ue_exist_data['code'])
|
||||
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " L'UE a été correctement ajoutée à la formation "
|
||||
|
||||
|
||||
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 d'ajouter L'UE à la formation "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de supprimer une UE d'une session formation.
|
||||
|
||||
"""
|
||||
def Delete_UE_From_Session(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'ue_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', 'session_id', 'ue_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
|
||||
|
||||
mydata = {}
|
||||
|
||||
mydata = diction
|
||||
del mydata['token']
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
|
||||
# Verifier que UE est valide
|
||||
is_ue_exist_count = MYSY_GV.dbname['unite_enseignement'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'_id':ObjectId(str(diction['ue_id'])),
|
||||
'locked':'0'
|
||||
})
|
||||
if( is_ue_exist_count != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'UE est invalide ")
|
||||
return False, " L'identifiant de l'UE est invalide "
|
||||
|
||||
is_ue_exist_data = MYSY_GV.dbname['unite_enseignement'].find_one(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'_id': ObjectId(str(diction['ue_id'])),
|
||||
'locked': '0'
|
||||
})
|
||||
|
||||
|
||||
# Verifier que la formation est valide
|
||||
is_session_exist_count = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'_id':ObjectId(str(diction['session_id']))})
|
||||
|
||||
if (is_session_exist_count != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la promotion / session de formation est invalide ")
|
||||
return False, " L'identifiant de la promotion / session de formation est invalide "
|
||||
|
||||
|
||||
is_session_exist_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'_id': ObjectId(str(diction['session_id']))})
|
||||
|
||||
if ("list_unite_enseignement" in is_session_exist_data.keys()):
|
||||
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "session_formation"
|
||||
history_event_dict['related_collection_recid'] = str(is_session_exist_data['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Suppression de l'Unité d'enseignement " + str(
|
||||
is_ue_exist_data['_id']) + ", Code UE :" + str(is_ue_exist_data['code'])
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
delete = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'list_unite_enseignement._id': str(diction['ue_id'])},
|
||||
|
||||
{'$pull': {'list_unite_enseignement': {
|
||||
"_id": str(diction['ue_id'])}}}
|
||||
)
|
||||
|
||||
|
||||
|
||||
return True, " L'UE a été correctement supprimée de la promotion / session "
|
||||
|
||||
|
||||
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 L'UE de la promotion / session "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les UE d'une session de formation
|
||||
"""
|
||||
def Get_List_UE_Given_SessionFormation(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token', 'session_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é, Creation partenaire annulée")
|
||||
return False, "Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'session_id', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
}, {'list_unite_enseignement':1})
|
||||
|
||||
print(" ### session_data = ", session_data)
|
||||
if(session_data and "list_unite_enseignement" in session_data.keys()):
|
||||
|
||||
for local_ue in session_data['list_unite_enseignement']:
|
||||
|
||||
|
||||
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(local_ue['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
user = {}
|
||||
user['id'] = str(val_tmp)
|
||||
user['session_id'] = str(diction['session_id'])
|
||||
user['_id'] = str(ue_data['_id'])
|
||||
user['code'] = str(ue_data['code'])
|
||||
user['titre'] = str(ue_data['titre'])
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la list des UE de la promotion / session "
|
||||
|
|
|
|||
|
|
@ -1558,6 +1558,9 @@ def Update_Session_Sequence(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant du groupe est invalide ")
|
||||
return False, " L'identifiant du groupe est invalide "
|
||||
|
||||
elif("grp_apprenant_id" in diction.keys() and diction['grp_apprenant_id'] == ""):
|
||||
update_data['grp_apprenant_id'] = ""
|
||||
|
||||
|
||||
if ("ue_id" in diction.keys() and diction['ue_id']):
|
||||
update_data['ue_id'] = str(diction['ue_id'])
|
||||
|
|
|
|||
|
|
@ -1915,7 +1915,7 @@ def Cacul_UE_Note_Finale_Standard(diction):
|
|||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])}):
|
||||
|
||||
#print(" UEEE : ", is_ue_valide_data['code'])
|
||||
print(" is_ue_valide_data == : ", is_ue_valide_data)
|
||||
|
||||
# Recuperer les données de l'UE dans la formation (ex : credit, seuil de validation, etc)
|
||||
class_ue_data = {}
|
||||
|
|
@ -1996,24 +1996,26 @@ def Cacul_UE_Note_Finale_Standard(diction):
|
|||
|
||||
local_node['ue_id'] = str(is_ue_valide_data['_id'])
|
||||
|
||||
if ("credit" in class_ue_data.keys()):
|
||||
if ("credit" in class_ue_data.keys() and class_ue_data['credit']):
|
||||
local_node['credit'] = str(class_ue_data['credit'])
|
||||
elif ("ects" in is_ue_valide_data.keys()):
|
||||
elif ("ects" in is_ue_valide_data.keys() and is_ue_valide_data['ects']):
|
||||
local_node['credit'] = str(is_ue_valide_data['ects'])
|
||||
else:
|
||||
local_node['credit'] = "0"
|
||||
|
||||
if ("coefficient" in class_ue_data.keys()):
|
||||
if ("coefficient" in class_ue_data.keys() and class_ue_data['coefficient']):
|
||||
local_node['ue_coefficient'] = str(class_ue_data['coefficient'])
|
||||
elif ("coefficient" in is_ue_valide_data.keys()):
|
||||
elif ("coefficient" in is_ue_valide_data.keys() and is_ue_valide_data['coefficient']):
|
||||
local_node['ue_coefficient'] = str(is_ue_valide_data['coefficient'])
|
||||
else:
|
||||
local_node['ue_coefficient'] = "1"
|
||||
|
||||
if ("seuil_validation" in class_ue_data.keys()):
|
||||
if ("seuil_validation" in class_ue_data.keys() and class_ue_data['seuil_validation'] ):
|
||||
local_node['seuil_validation'] = str(class_ue_data['seuil_validation'])
|
||||
elif ("seuil_validation" in is_ue_valide_data.keys()):
|
||||
print(" ## str(class_ue_data['seuil_validation']) = ", str(class_ue_data['seuil_validation']))
|
||||
if ("seuil_validation" in is_ue_valide_data.keys() and is_ue_valide_data['seuil_validation']):
|
||||
local_node['seuil_validation'] = str(is_ue_valide_data['seuil_validation'])
|
||||
print(" ## str(is_ue_valide_data['seuil_validation']) = ", str(is_ue_valide_data['seuil_validation']))
|
||||
else:
|
||||
local_node['seuil_validation'] = "99" # le 99 pour eviter les validation par defaut
|
||||
|
||||
|
|
@ -2089,11 +2091,14 @@ def Cacul_UE_Note_Finale_Standard(diction):
|
|||
note_categorie_status, note_categorie_code = mycommon.Get_Note_Categorie_Code(str(note_finale_ue), my_partner['recid'])
|
||||
local_node['note_categorie'] = str(note_categorie_code)
|
||||
|
||||
#print(" ### note_finale = ", note_finale_ue)
|
||||
print(" ### note_finale = ", note_finale_ue)
|
||||
|
||||
print(" ### local_node['seuil_validation'] = ", local_node['seuil_validation'])
|
||||
|
||||
# Acter si la personne valide l'UE
|
||||
#print(" #### si la personne valide l'UE CMP de float(note_finale_ue) = ", float(note_finale_ue),
|
||||
# " et float(local_node['seuil_validation'] ) = ", float(local_node['seuil_validation']))
|
||||
print(" #### si la personne valide l'UE CMP de float(note_finale_ue) = ", float(note_finale_ue),
|
||||
" et float(local_node['seuil_validation'] ) = ", float(local_node['seuil_validation']))
|
||||
|
||||
if (float(note_finale_ue) >= float(local_node['seuil_validation'])):
|
||||
local_node['ue_validation'] = "1"
|
||||
else:
|
||||
|
|
|
|||
10
class_mgt.py
10
class_mgt.py
|
|
@ -7901,6 +7901,9 @@ def Add_Update_UE_To_Class(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant de l'UE est invalide ")
|
||||
return False, " L'identifiant de l'UE est invalide "
|
||||
|
||||
|
||||
|
||||
|
||||
is_ue_exist_data = MYSY_GV.dbname['unite_enseignement'].find_one(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
|
|
@ -8021,7 +8024,7 @@ def Add_Update_UE_To_Class(diction):
|
|||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " La compétence a été mise à jour"
|
||||
return True, " L'unité d'enseignement a été mise à jour"
|
||||
|
||||
else:
|
||||
# l'UE n'existe pas pour cette formation, on fait une creation
|
||||
|
|
@ -8078,7 +8081,7 @@ def Add_Update_UE_To_Class(diction):
|
|||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " L'UE a été correctement ajoutée à la formation "
|
||||
return True, " L'unité d'enseignement a été correctement ajoutée à la formation "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -8214,7 +8217,7 @@ def Delete_UE_From_Class(diction):
|
|||
|
||||
|
||||
|
||||
return True, " L'UE a été correctement suppimée de la formation "
|
||||
return True, " L'UE a été correctement supprimée de la formation "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -8531,3 +8534,4 @@ def Get_Given_Class_List_Default_Documents_For_Given_Type_Doc(diction):
|
|||
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 documents par défaut"
|
||||
|
||||
|
|
|
|||
121
competence.py
121
competence.py
|
|
@ -53,7 +53,8 @@ def Add_Competence(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'description', 'domaine', 'metier', 'commentaire', 'code' ]
|
||||
field_list = ['token', 'description', 'domaine', 'metier', 'commentaire', 'code',
|
||||
'domaine_competence_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -116,6 +117,24 @@ def Add_Competence(diction):
|
|||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
||||
# Verifier la validité du domaine de compétence
|
||||
print(" ## QRY is_domain_compet_valide = ", {'_id':ObjectId(diction['domaine_competence_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':'default'})
|
||||
if( "domaine_competence_id" in diction.keys() ):
|
||||
is_domain_compet_valide = MYSY_GV.dbname['domaine_competence'].count_documents({'_id':ObjectId(diction['domaine_competence_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':'default'})
|
||||
|
||||
if(is_domain_compet_valide != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du domaine de compétence est invalide ")
|
||||
return False, " L'identifiant du domaine de compétence est invalide "
|
||||
|
||||
mydata['domaine_competence_id'] = str(diction['domaine_competence_id'])
|
||||
|
||||
|
||||
inserted_id = MYSY_GV.dbname['competence_liste'].insert_one(mydata).inserted_id
|
||||
|
|
@ -143,7 +162,8 @@ def Update_Competence(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'description', 'competence_id', 'domaine', 'metier', 'commentaire', 'code' ]
|
||||
field_list = ['token', 'description', 'competence_id', 'domaine', 'metier', 'commentaire', 'code',
|
||||
'domaine_competence_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -212,6 +232,20 @@ def Update_Competence(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant de la compétence est invalide ")
|
||||
return False, " L'identifiant de la compétence est invalide "
|
||||
|
||||
# Verifier la validité du domaine de compétence
|
||||
if ("domaine_competence_id" in diction.keys()):
|
||||
is_domain_compet_valide = MYSY_GV.dbname['domaine_competence'].count_documents(
|
||||
{'_id': diction['domaine_competence_id'],
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': 'default'})
|
||||
|
||||
if (is_domain_compet_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du domaine de compétence est invalide ")
|
||||
return False, " L'identifiant du domaine de compétence est invalide "
|
||||
|
||||
|
||||
mydata = {}
|
||||
mydata = diction
|
||||
|
|
@ -300,13 +334,23 @@ def Get_Competence_no_filter(diction):
|
|||
if( "code" not in user.keys() ):
|
||||
user["code"] = "--"
|
||||
|
||||
domaine_competence_nom = ""
|
||||
if ("domaine" not in user.keys() or user['domaine'] == ""):
|
||||
user["domaine"] = ""
|
||||
else:
|
||||
domaine_compet_data = MYSY_GV.dbname['domaine_competence'].find_one({'_id':ObjectId(str(user['domaine'])),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
if( domaine_compet_data and "nom" in domaine_compet_data.keys() ):
|
||||
domaine_competence_nom = domaine_compet_data['nom']
|
||||
|
||||
user["domaine_competence_nom"] = str(domaine_competence_nom)
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
print(" #### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -379,3 +423,72 @@ def Delete_Given_Competence(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de supprimer la compétence "
|
||||
|
||||
|
||||
"""
|
||||
Recuperarion des domaines de compétences
|
||||
important : cette liste est gérée en dure pour le moment
|
||||
"""
|
||||
def Get_Competence_Domaine(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
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid":"default", 'valide':'1', 'locked':'0'}
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['domaine_competence'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_retVal
|
||||
|
||||
if( "code" not in user.keys() ):
|
||||
user["code"] = "--"
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des domaines de compétences "
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ def Add_Class_Domaine(diction):
|
|||
return False, " Impossible de créer le domaine de formation (2) "
|
||||
|
||||
|
||||
return True, " La domaine a été correctement ajoutée"
|
||||
return True, " Le domaine a été correctement ajouté"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
@ -126,7 +126,7 @@ def Add_Class_Domaine(diction):
|
|||
|
||||
|
||||
"""
|
||||
Mise à jour d'un domainede formation
|
||||
Mise à jour d'un domaine de formation
|
||||
"""
|
||||
|
||||
def Update_Class_domaine(diction):
|
||||
|
|
@ -179,8 +179,8 @@ def Update_Class_domaine(diction):
|
|||
|
||||
if (is_existe_cdtion_paiement < 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de le domaine est invalide ")
|
||||
return False, " L'identifiant de le domaine est invalide "
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du domaine est invalide ")
|
||||
return False, " L'identifiant du domaine est invalide "
|
||||
|
||||
|
||||
# Verifier que code n'est pas pris par un autre domaine
|
||||
|
|
@ -224,7 +224,7 @@ def Update_Class_domaine(diction):
|
|||
" Impossible de mettre à jour le domaine de formation (2) ")
|
||||
return False, " Impossible de mettre à jour le domaine de formation (2) "
|
||||
|
||||
return True, " Le domaine de formation a été correctement mise à jour"
|
||||
return True, " Le domaine de formation a été correctement mis à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
|
|||
20
email_mgt.py
20
email_mgt.py
|
|
@ -2705,24 +2705,24 @@ def ManualSendInvoiceEmailRIB_CIC_BureauVallee(diction):
|
|||
body = {
|
||||
"params": {"order_id": "N/A",
|
||||
"date_order": ": 12/08/2025",
|
||||
"periode":"01/09/2025 au 30/09/2025",
|
||||
"total_ht": "12 530,18",
|
||||
"tva": "2 506,04",
|
||||
"total_ttc": "15 036,22",
|
||||
"periode":"01/10/2025 au 31/10/2025",
|
||||
"total_ht": "12 650",
|
||||
"tva": "2 530",
|
||||
"total_ttc": "15 279",
|
||||
"client_name": "BVD Fr (Bureau Vallée)",
|
||||
"client_address": "25 rue du Gros Caillou",
|
||||
"client_zip_ville": "78340 – Les Clayes-sous-Bois",
|
||||
"client_pays": "France",
|
||||
"packs": "Prestation de service ",
|
||||
"detail_packs": "Accompagnement au déploiement de l'ERP CoQliQo",
|
||||
"qty": "22 jours (-1h)",
|
||||
"qty": "23 jours",
|
||||
"unit_price": "550 €",
|
||||
"montant": "12 021,43 €",
|
||||
"montant": "12 650 €",
|
||||
|
||||
|
||||
"invoice_id": "FACT_20250919",
|
||||
"invoice_date": "30/09/2025",
|
||||
"due_date": "15/10/2025",
|
||||
"invoice_id": "FACT_20251020",
|
||||
"invoice_date": "31/10/2025",
|
||||
"due_date": "15/11/2025",
|
||||
"orign_order": "N/A",
|
||||
}
|
||||
}
|
||||
|
|
@ -2756,7 +2756,7 @@ def ManualSendInvoiceEmailRIB_CIC_BureauVallee(diction):
|
|||
#print(" ### body 22 = ", body)
|
||||
|
||||
sourceHtml = template.render(json_data=body["params"])
|
||||
orig_file_name = "invoice_FACT_20250919.pdf"
|
||||
orig_file_name = "invoice_FACT_20251020.pdf"
|
||||
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
|
||||
|
||||
# open output file for writing (truncated binary)
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ def Add_Message_To_Mail_Queue(tab_files, diction):
|
|||
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
print(" ### mail to store in queue = ", new_data)
|
||||
#print(" ### mail to store in queue = ", new_data)
|
||||
|
||||
inserted_id = MYSY_GV.dbname['mail_queue'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ def GetTableauEmargement(diction):
|
|||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
print(" ### RetObject = ", RetObject)
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,350 @@
|
|||
"""
|
||||
Ce fichier permet de gerer les messages à afficher sur l'ENT une fois un apprenant connecté.
|
||||
Ce sont par exemples les messages d'alerte, d'info, etc.
|
||||
|
||||
Un message est definit par :
|
||||
- code
|
||||
- priorité (Urgent (maximum), Important, Info)
|
||||
- message (1000 caractères max)
|
||||
- debut affichage
|
||||
- fin affichage
|
||||
"""
|
||||
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
|
||||
|
||||
"""
|
||||
Ajout d'un nouveau message
|
||||
Un message est definit par :
|
||||
- code
|
||||
- priorité (Urgent (maximum), Important, Info)
|
||||
- message (1000 caractères max)
|
||||
- debut affichage
|
||||
- fin affichage
|
||||
"""
|
||||
def Add_Ent_Alert_Message(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'priorite', 'message', 'date_debut', 'date_fin']
|
||||
|
||||
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', 'priorite', 'message', 'date_debut', 'date_fin']
|
||||
|
||||
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_alert_message = MYSY_GV.dbname['ent_alert_message'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_existe_alert_message > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Un message avec le code '" + str(diction['code']) + "' existe déjà ")
|
||||
return False, " Un message avec le code '" + str(diction['code']) + "' existe déjà "
|
||||
|
||||
|
||||
local_status = mycommon.CheckisDate(diction['date_debut'])
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "La date debut n'est pas au format jj/mm/aaaa ")
|
||||
|
||||
return False, " La date debut n'est pas au format jj/mm/aaaa "
|
||||
|
||||
|
||||
local_status = mycommon.CheckisDate(diction['date_fin'])
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "La date fin n'est pas au format jj/mm/aaaa ")
|
||||
|
||||
return False, " La date fin n'est pas au format jj/mm/aaaa "
|
||||
|
||||
|
||||
if( diction['priorite'] not in MYSY_GV.ENT_MESSAGE_PRIORITE ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le niveau de priorité est invalide ")
|
||||
|
||||
return False, " Le niveau de priorité est invalide "
|
||||
|
||||
|
||||
new_data = diction
|
||||
del diction['token']
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['ent_alert_message'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer le message d'alerte (2) ")
|
||||
return False, " Impossible de créer le message d'alerte (2) "
|
||||
|
||||
|
||||
return True, " Le message d'alerte 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 message d'alerte "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'un message d'alerte ENT
|
||||
"""
|
||||
|
||||
def Update_Ent_Alert_Message(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'priorite', 'message', 'date_debut', 'date_fin', '_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
|
||||
|
||||
new_data = diction
|
||||
|
||||
# Verifier que la domaine
|
||||
is_existe_cdtion_paiement = MYSY_GV.dbname['ent_alert_message'].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 message est invalide ")
|
||||
return False, " L'identifiant du message est invalide "
|
||||
|
||||
|
||||
# Verifier que code n'est pas pris par un autre domaine
|
||||
is_existe_class_domaine = MYSY_GV.dbname['ent_alert_message'].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]) + " Un message avec le code '" + str(diction['code']) + "' existe déjà ")
|
||||
return False, " Un message avec le code '" + str(diction['code']) + "' existe déjà "
|
||||
|
||||
if( "date_debut" in diction.keys() ):
|
||||
local_status = mycommon.CheckisDate(diction['date_debut'])
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "La date debut n'est pas au format jj/mm/aaaa ")
|
||||
|
||||
return False, " La date debut n'est pas au format jj/mm/aaaa "
|
||||
|
||||
if ("date_fin" in diction.keys()):
|
||||
local_status = mycommon.CheckisDate(diction['date_fin'])
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "La date fin n'est pas au format jj/mm/aaaa ")
|
||||
|
||||
return False, " La date fin n'est pas au format jj/mm/aaaa "
|
||||
|
||||
if ("priorite" in diction.keys()):
|
||||
if (diction['priorite'] not in MYSY_GV.ENT_MESSAGE_PRIORITE):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le niveau de priorité est invalide ")
|
||||
|
||||
return False, " Le niveau de priorité est invalide "
|
||||
|
||||
local_id = str(diction['_id'])
|
||||
|
||||
del diction['token']
|
||||
del diction['_id']
|
||||
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
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['class_domaine'].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 message (2) ")
|
||||
return False, " Impossible de mettre à jour le message (2) "
|
||||
|
||||
return True, " Le message de formation 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 message "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des message d'alerte ENT d'un partenaire
|
||||
"""
|
||||
def Get_List_Ent_Alert_Message(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'existe pas")
|
||||
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
|
||||
|
||||
print(" ## my_partner = ",my_partner)
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['ent_alert_message'].find(data_cle).sort([ ("priorite", pymongo.ASCENDING), ("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des message "
|
||||
|
||||
|
||||
|
|
@ -586,6 +586,8 @@ def Delete_Question_Formulaire(diction):
|
|||
|
||||
"""
|
||||
Fonction pour supprimer un formulaire
|
||||
Important :
|
||||
- Verifier que le formulaire n'est pas utilisée par defaut sur une formation. Collection : myclass_default_document
|
||||
"""
|
||||
def Delete_Formulaire(diction):
|
||||
try:
|
||||
|
|
@ -638,6 +640,31 @@ def Delete_Formulaire(diction):
|
|||
mycommon.myprint(" L'identifiant du formulaire est invalide ")
|
||||
return False, " L'identifiant du formulaire est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que le formualire n'est pas utilisé dans la collection myclass_default_document
|
||||
"""
|
||||
is_myclass_default_document_exist =MYSY_GV.dbname['myclass_default_document'].count_documents({'$or': [
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'QUESTION_POSITIONNEMENT': str(diction['form_id'])}
|
||||
,
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'EVAL_FORMATION_HOT': str(diction['form_id']),
|
||||
},
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'EVAL_FORMATION_COLD': str(diction['form_id']),
|
||||
},
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'EVAL_FORMATION_FORMATEUR': str(diction['form_id']),
|
||||
}
|
||||
]}
|
||||
|
||||
)
|
||||
|
||||
if (is_myclass_default_document_exist > 0):
|
||||
mycommon.myprint(" Ce formulaire est utilisé comme formulaire par défaut sur des formations . Suppression annulée ")
|
||||
return False, " Ce formulaire est utilisé comme formulaire par défaut sur des formations . Suppression annulée "
|
||||
|
||||
qry = {'partner_owner_recid': str(my_partner['recid']),'valide': '1', 'locked': '0', '_id': ObjectId(str(diction['form_id']))}
|
||||
|
||||
delete_formulaire = MYSY_GV.dbname['formulaire'].delete_many(qry)
|
||||
|
|
|
|||
133
main.py
133
main.py
|
|
@ -101,6 +101,7 @@ import ent_student_common as ent_student_common
|
|||
import groupe_client_mgt as groupe_client_mgt
|
||||
import email_queu.email_queu_mgt as email_queu_mgt
|
||||
import internal_email_mgt as internal_email_mgt
|
||||
import ent_alert_messages as ent_alert_messages
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
|
@ -2373,6 +2374,52 @@ def unarchive_session():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour Ajouter une UE à une session de formation
|
||||
important : le système va verifier si cette UE est
|
||||
paramettrée sur la formation
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Update_UE_To_Session/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Update_UE_To_Session():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Update_UE_To_Session : payload = ",str(payload))
|
||||
localStatus, message= SF.Add_Update_UE_To_Session(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer une UE d'une session formation.
|
||||
Important : : Pour rappel, on est en mode nested json sur la collection session de formation
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_UE_From_Session/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_UE_From_Session():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_UE_From_Session : payload = ",str(payload))
|
||||
localStatus, message= SF.Delete_UE_From_Session(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour Recuperer les UE d'une session de formation
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_UE_Given_SessionFormation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_UE_Given_SessionFormation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_UE_Given_SessionFormation : payload = ",str(payload))
|
||||
localStatus, message= SF.Get_List_UE_Given_SessionFormation(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de recuperation de toutes les sessions de formation valides et actives
|
||||
"""
|
||||
|
|
@ -7341,7 +7388,7 @@ API de recuperation de la liste des fichiers attaché à
|
|||
def Get_object_owner_collection_Stored_Files():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_object_owner_collection_Stored_Files : payload = ",payload)
|
||||
print(" ### Get_List_object_owner_collection_Stored_Files : payload = ",)
|
||||
status, retval = attached_file_mgt.Get_List_object_owner_collection_Stored_Files(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
|
@ -7357,7 +7404,7 @@ avec plusieurs filtres
|
|||
def Get_List_object_owner_collection_Stored_Files_With_Filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_object_owner_collection_Stored_Files_With_Filter : payload = ",payload)
|
||||
print(" ### Get_List_object_owner_collection_Stored_Files_With_Filter : payload = ",)
|
||||
status, retval = attached_file_mgt.Get_List_object_owner_collection_Stored_Files_With_Filter(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
|
@ -7373,7 +7420,7 @@ avec plusieurs filtres SANS TOKEN
|
|||
def Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token : payload = ",payload)
|
||||
print(" ### Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token : payload = ",)
|
||||
status, retval = attached_file_mgt.Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
|
@ -9810,6 +9857,24 @@ def Delete_Given_Competence():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste de domaines de compétence
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Competence_Domaine/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Competence_Domaine():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Competence_Domaine payload = ",payload)
|
||||
status, retval = competence.Get_Competence_Domaine(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un formulaire
|
||||
"""
|
||||
|
|
@ -11852,7 +11917,7 @@ a un formateur ou par rapport à une formation
|
|||
def Get_Survey_Stat_Data_For_Given_related_collection_id():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Survey_Stat_Data_For_Given_related_collection_id payload = ",payload)
|
||||
print(" ### Get_Survey_Stat_Data_For_Given_related_collection_id payload = (trop long)")
|
||||
status, retval = survey_mgt.Get_Survey_Stat_Data_For_Given_related_collection_id(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
|
@ -12832,6 +12897,24 @@ def Cron_Daily_Automatic_Qualiopi_Documents():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API de test du cron qui va traiter automatiquement les documents à envoyer pour un partenaire donné (partner_owner_recid)
|
||||
"""
|
||||
@app.route('/myclass/api/Cron_Daily_Automatic_Qualiopi_Documents_For_Given_Partner/', methods=['POST', 'GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Cron_Daily_Automatic_Qualiopi_Documents_For_Given_Partner():
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
mycommon.myprint(" ### CRONNN Cron_Daily_Automatic_Qualiopi_Documents_For_Given_Partner : payload = ")
|
||||
print(" ### CRONNN Cron_Daily_Automatic_Qualiopi_Documents_For_Given_Partner : payload = ", payload)
|
||||
status, retval = Job_Cron.Cron_Daily_Automatic_Qualiopi_Documents_For_Given_Partner(payload)
|
||||
print(" FIN traitement Cron_Daily_Automatic_Qualiopi_Documents_For_Given_Partner localStatus = ", status)
|
||||
return jsonify(status=status, message="OK" )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui permet d'envoyer les emails qui sont dans file d'attente des emails
|
||||
"""
|
||||
|
|
@ -14505,6 +14588,48 @@ def Get_Given_Class_List_Default_Documents_For_Given_Type_Doc():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un message d'alert ENT
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Ent_Alert_Message/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Ent_Alert_Message():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Ent_Alert_Message payload = ",payload)
|
||||
status, retval = ent_alert_messages.Add_Ent_Alert_Message(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour un message d'alert ENT
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Ent_Alert_Message/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Ent_Alert_Message():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Ent_Alert_Message payload = ",payload)
|
||||
status, retval = ent_alert_messages.Update_Ent_Alert_Message(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des messages d'alert ENT d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Ent_Alert_Message/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Ent_Alert_Message():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Ent_Alert_Message payload = ",payload)
|
||||
status, retval = ent_alert_messages.Get_List_Ent_Alert_Message(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ def Get_Given_Sequence_Planning_Model_With_Option(diction):
|
|||
|
||||
new_lines_data.append(new_planning_line_node)
|
||||
|
||||
print(" ### new_lines_data = ", new_lines_data)
|
||||
#print(" ### new_lines_data = ", new_lines_data)
|
||||
|
||||
RetObject = {}
|
||||
RetObject['header_data'] = mycommon.JSONEncoder().encode(header_data)
|
||||
|
|
|
|||
|
|
@ -639,7 +639,7 @@ def Survey_Send_Notification_Sur_Seuil_Alert(diction):
|
|||
"""
|
||||
formateur_data = {}
|
||||
|
||||
if( session_data and "formateur_id" in session_data.keys() ):
|
||||
if( session_data and "formateur_id" in session_data.keys() and session_data['formateur_id']):
|
||||
|
||||
|
||||
formateur_data_tmp = MYSY_GV.dbname["ressource_humaine"].find_one({'_id': ObjectId(str(session_data['formateur_id'])),
|
||||
|
|
@ -1136,6 +1136,7 @@ def Init_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
|
||||
return False, " L'identifiant de l'inscrit est invalide "
|
||||
|
||||
|
||||
server_diction = {}
|
||||
server_diction['token'] = diction['token']
|
||||
server_diction['session_id'] = diction['session_id']
|
||||
|
|
@ -2411,7 +2412,7 @@ def Send_Survey_TabIds(diction):
|
|||
'valide': '1', 'locked': '0', 'partner_recid': str(my_partner['recid'])}, {'_id':1, 'nom':1, 'prenom':1, 'email':1, 'civilite':1})
|
||||
|
||||
|
||||
print(" ### local_survey_retval = ",local_survey_retval)
|
||||
#print(" ### local_survey_retval = ",local_survey_retval)
|
||||
courrier_ref_interne = ""
|
||||
if ( "survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "pos"):
|
||||
courrier_ref_interne = "QUESTION_POSITIONNEMENT"
|
||||
|
|
@ -3251,7 +3252,7 @@ def Get_List_Survey_with_filter(diction):
|
|||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid": str(my_partner['recid']), 'valide': '1', 'locked': '0'}
|
||||
qry = {"partner_owner_recid": str(my_partner['recid']), 'valide': '1', 'locked': '0', 'survey_type':str(diction['formulaire_type'])}
|
||||
query_with_filter = {'$and': [qry, filt_session_id, filt_related_collection, filt_related_collection_id,
|
||||
filt_survey_internal_code]}
|
||||
|
||||
|
|
|
|||
|
|
@ -532,6 +532,7 @@ Suppression d'une UE
|
|||
Si elle n'est pas utilisée
|
||||
|
||||
regles : on ne peut supprimer une UE que si elle n'est pas utilisée dans une formation
|
||||
et pas utilisé dans une évaluation (collection : note_evaluation) ou un conseil de class (collection : jury)
|
||||
|
||||
"""
|
||||
def Delete_Given_Unite_Enseignement(diction):
|
||||
|
|
@ -596,6 +597,34 @@ def Delete_Given_Unite_Enseignement(diction):
|
|||
str(inspect.stack()[0][3]) + " Cette UE est actuellement utilisée dans "+str(is_ue_used_in_class_count)+" formation. Impossible de la supprimer ")
|
||||
return False, " Cette UE est actuellement utilisée dans "+str(is_ue_used_in_class_count)+" formation. Impossible de la supprimer "
|
||||
|
||||
"""
|
||||
Verifier que l'UE n'est pas utilisé dans une évaluation
|
||||
"""
|
||||
is_ue_used_in_eval = MYSY_GV.dbname['note_evaluation'].count_documents({'class_eu_id': str(diction['_id']),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid']})
|
||||
|
||||
if (is_ue_used_in_eval > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + "Cette UE est utilisée dans " + str(
|
||||
is_ue_used_in_eval) + " évaluation(s). Suppression annulée")
|
||||
return False, " Cette UE est utilisée dans " + str(
|
||||
is_ue_used_in_eval) + " évaluation(s). Suppression annulée "
|
||||
|
||||
"""
|
||||
Verifier que l'UE n'est pas utilisé dans un conseil de classe (collection : jury)
|
||||
"""
|
||||
is_ue_used_in_jury = MYSY_GV.dbname['jury'].count_documents({'ue_id': str(diction['_id']),
|
||||
'partner_owner_recid': my_partner[
|
||||
'recid']})
|
||||
|
||||
if (is_ue_used_in_jury > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + "Cette UE est utilisée dans " + str(
|
||||
is_ue_used_in_jury) + " Conseil(s) de classe ou Jury(s). Suppression annulée")
|
||||
return False, " Cette UE est utilisée dans " + str(
|
||||
is_ue_used_in_jury) + " Conseil(s) de classe ou Jury(s). Suppression annulée "
|
||||
|
||||
|
||||
qry = {'_id':ObjectId(str(diction['_id'])), 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue