parent
a328428635
commit
ad3fdcc302
|
|
@ -4,15 +4,21 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="02/01/26 - 2">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="04/01/26 - 21h30">
|
||||
<change afterPath="$PROJECT_DIR$/admission_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.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$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_base_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_base_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -455,7 +461,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="523" />
|
||||
<option name="localTasksCounter" value="524" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -497,7 +503,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="sss" />
|
||||
<MESSAGE value="10/10/2025 - 17:30" />
|
||||
<MESSAGE value="12/10/2025 - 17:14 - Elyos V1.2" />
|
||||
<MESSAGE value="14/10/2025 - 23h" />
|
||||
|
|
@ -522,6 +527,7 @@
|
|||
<MESSAGE value="15/12/25 - 13h" />
|
||||
<MESSAGE value="02/01/26 - 13h" />
|
||||
<MESSAGE value="02/01/26 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="02/01/26 - 21h" />
|
||||
<MESSAGE value="04/01/26 - 21h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="04/01/26 - 21h30" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -865,7 +865,7 @@ Statut de facturation d'un session de formation : invoiced_statut
|
|||
|
||||
- Si toutes les inscription associées à une session sont facturée ==> invoiced_statut de la session = 2
|
||||
- Si au moins une inscription associée à une session est facturé ==> invoiced_statut de la session = 1
|
||||
- Si non invoiced_statut de la session =0
|
||||
- Si non invoiced_statut de la session = 0
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1087,3 +1087,11 @@ Tutorat d'un inscrit : Les roles autorisés
|
|||
3 : Autre
|
||||
"""
|
||||
TUTORAT_ROLE = ['0', '1', '2', '3', '']
|
||||
|
||||
|
||||
"""
|
||||
Pour la gestion des relances automatique
|
||||
sur les sessions, voici la liste des config_name à
|
||||
prendre """
|
||||
LIST_RELANCE_CONFIG_NAME = ['relance_auto', 'frequence_relance_auto', 'nb_relance_auto']
|
||||
LIST_RELANCE_RELATED_COLLECTION = ['survey', 'emargement', 'q_position']
|
||||
|
|
|
|||
1302
Inscription_mgt.py
1302
Inscription_mgt.py
File diff suppressed because it is too large
Load Diff
642
Job_Cron.py
642
Job_Cron.py
|
|
@ -2289,7 +2289,7 @@ Cette fonction permet de faire la relance tous les SURVEY (positionnement, evalu
|
|||
|
||||
"""
|
||||
|
||||
def Cron_Survey_Questionnaires_Relance():
|
||||
def Cron_Survey_Questionnaires_Relance_old():
|
||||
try:
|
||||
|
||||
print(" Cron : In function = Cron_Survey_Q_Position_Relance")
|
||||
|
|
@ -2475,14 +2475,428 @@ def Cron_Survey_Questionnaires_Relance():
|
|||
return False, str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)
|
||||
|
||||
|
||||
"""
|
||||
CRON :
|
||||
Cette fonction permet de faire la relance tous des SURVEY de type 'pos' ( UNIQUEMENT LES QUESTIONNAIRES DE POSITIONNEMENT)
|
||||
|
||||
"""
|
||||
|
||||
def Cron_Survey_Questionnaires_Relance_Q_Position():
|
||||
try:
|
||||
|
||||
print(" Cron : In function = Cron_Survey_Q_Position_Relance")
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
todays_date_ISODATE = datetime.strptime(str(todays_date), '%d/%m/%Y')
|
||||
|
||||
|
||||
# Aller chercher tous les questionnaires à relancer
|
||||
|
||||
survey_qery_match = {'$and': [{'survey_type':'pos',
|
||||
'valide': '1',
|
||||
'locked': '0', 'statut': '1', 'type': '1',
|
||||
'date_dernier_relance_auto': {'$exists': True, }
|
||||
}
|
||||
]}
|
||||
|
||||
pipe_qry = ([
|
||||
{'$match': survey_qery_match},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup': {
|
||||
'from': 'session_formation',
|
||||
"let": {'session_id': "$session_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$session_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$project': {'relance_automation': 1, 'code_session': 1, 'date_debut': 1, 'date_fin': 1, }},
|
||||
],
|
||||
'as': 'collection_session_formation'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_session_formation'
|
||||
}
|
||||
])
|
||||
|
||||
print(" ## pipe_qry Cron_Survey_Questionnaires_Relance = ", pipe_qry)
|
||||
for local_questionnaire in MYSY_GV.dbname['survey'].aggregate(pipe_qry):
|
||||
|
||||
if ("collection_session_formation" in local_questionnaire.keys() and "relance_automation" in local_questionnaire[
|
||||
'collection_session_formation'].keys()):
|
||||
print(" ## traitement de local_questionnaire = ", local_questionnaire)
|
||||
"""
|
||||
Pour les related_collection: 'emargement',
|
||||
Aller recuperer les valeurs :
|
||||
- config_name: 'relance_auto',
|
||||
- config_name: 'frequence_relance_auto',
|
||||
- config_name: 'nb_relance_auto',
|
||||
"""
|
||||
config_relance_auto = ""
|
||||
config_frequence_relance_auto = ""
|
||||
config_nb_relance_auto = ""
|
||||
|
||||
tab_relance_automation = local_questionnaire['collection_session_formation']['relance_automation']
|
||||
|
||||
for session_relance_config in tab_relance_automation:
|
||||
if (session_relance_config['related_collection'] == "q_position" and session_relance_config[
|
||||
'config_name'] == "relance_auto"):
|
||||
config_relance_auto = session_relance_config['config_value']
|
||||
|
||||
if (session_relance_config['related_collection'] == "q_position" and session_relance_config[
|
||||
'config_name'] == "frequence_relance_auto"):
|
||||
config_frequence_relance_auto = session_relance_config['config_value']
|
||||
|
||||
if (session_relance_config['related_collection'] == "q_position" and session_relance_config[
|
||||
'config_name'] == "nb_relance_auto"):
|
||||
config_nb_relance_auto = session_relance_config['config_value']
|
||||
|
||||
print(" ### config_relance_auto = ", config_relance_auto)
|
||||
print(" ### config_frequence_relance_auto = ", config_frequence_relance_auto)
|
||||
print(" ### config_nb_relance_auto = ", config_nb_relance_auto)
|
||||
|
||||
|
||||
relance_done = 0
|
||||
|
||||
if ("nb_relance" in local_questionnaire.keys() and local_questionnaire['nb_relance']):
|
||||
relance_done = mycommon.tryInt(str(local_questionnaire['nb_relance']))
|
||||
|
||||
date_derniere_relance_auto = "01/12/2099"
|
||||
if ("date_dernier_relance_auto" in local_questionnaire.keys() and local_questionnaire[
|
||||
'date_dernier_relance_auto']):
|
||||
date_derniere_relance_auto = str(local_questionnaire['date_dernier_relance_auto'])[0:10]
|
||||
|
||||
date_derniere_relance_auto_ISODATE = datetime.strptime(str(date_derniere_relance_auto), '%d/%m/%Y')
|
||||
|
||||
new_relance_date_ISODATE = date_derniere_relance_auto_ISODATE + timedelta(
|
||||
days=float(config_frequence_relance_auto))
|
||||
|
||||
|
||||
|
||||
new_relance_date_no_ISODATE = str(new_relance_date_ISODATE.strftime("%d/%m/%Y"))
|
||||
print(" ### LA PROCHAINE RELANCE EST (new_relance_date_no_ISODATE) ", new_relance_date_no_ISODATE)
|
||||
|
||||
datetime.strptime(str(todays_date), '%d/%m/%Y')
|
||||
|
||||
|
||||
|
||||
if (config_relance_auto == "1" and relance_done <= float(config_frequence_relance_auto) and datetime.strptime(
|
||||
str(todays_date), '%d/%m/%Y') >= datetime.strptime(str(new_relance_date_no_ISODATE).strip(),
|
||||
'%d/%m/%Y')):
|
||||
|
||||
"""
|
||||
On fait le traitement, on envoie le mail
|
||||
1 - recuperation des data
|
||||
"""
|
||||
print(" IL FAUT FAIRE UNE RELANCEEEE pour ", local_questionnaire)
|
||||
|
||||
|
||||
|
||||
local_status, my_partner = mycommon.Get_Connected_User_Partner_Data_From_RecID(
|
||||
str(local_questionnaire['partner_owner_recid']))
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
local_dicton = {}
|
||||
local_dicton['partner_owner_recid'] = str(local_questionnaire['partner_owner_recid'])
|
||||
local_dicton['tab_ids'] = str(local_questionnaire['_id'])
|
||||
local_dicton['token'] = str(my_partner['token'])
|
||||
|
||||
# print(" ### local_dicton = ", local_dicton)
|
||||
|
||||
local_status, local_retval = survey_mgt.Automatic_Send_Survey_TabIds(local_dicton)
|
||||
|
||||
# print(" relance return local_send_remind_status = ", local_status)
|
||||
|
||||
if (local_status is True):
|
||||
|
||||
print(" RELANCE FAIT ET OK ")
|
||||
"""
|
||||
Une fois la relance faite, on met à jour le devis avec les infos suivant :
|
||||
- liste_relance
|
||||
|
||||
"""
|
||||
|
||||
frequence_relance_auto_reached = "0"
|
||||
|
||||
if ("list_relance" in local_questionnaire.keys() and local_questionnaire['list_relance']):
|
||||
local_node = {}
|
||||
local_node['date_relance'] = str(date.today())
|
||||
local_node['mesg_relance'] = str(local_retval)
|
||||
local_questionnaire['list_relance'].append(local_node)
|
||||
|
||||
else:
|
||||
|
||||
local_node = {}
|
||||
local_node['date_relance'] = str(date.today())
|
||||
local_questionnaire['list_relance'] = []
|
||||
local_questionnaire['list_relance'].append(local_node)
|
||||
local_node['mesg_relance'] = str(local_retval)
|
||||
|
||||
nb_relance = str(len(local_questionnaire['list_relance']))
|
||||
|
||||
local_data_update = local_questionnaire
|
||||
|
||||
id_to_update = str(local_data_update['_id'])
|
||||
|
||||
del local_data_update['_id']
|
||||
|
||||
local_data_update['nb_relance'] = str(nb_relance)
|
||||
local_data_update['date_dernier_relance_auto'] = str(todays_date)
|
||||
|
||||
result = MYSY_GV.dbname['survey'].find_one_and_update(
|
||||
{'_id': ObjectId(str(id_to_update)),
|
||||
|
||||
'valide': '1',
|
||||
'locked': '0'},
|
||||
{"$set": local_data_update},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
else:
|
||||
print(" NOOOOOOOO PASSSSSSSSS FAIRE RELANCEEEE ")
|
||||
return True, "Relance Questionnaires 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)
|
||||
|
||||
|
||||
"""
|
||||
CRON :
|
||||
Cette fonction permet de faire la relance tous les SURVEY hors questionnaire de positionnement
|
||||
|
||||
"""
|
||||
|
||||
def Cron_Survey_Questionnaires_Relance_Except_Q_Position():
|
||||
try:
|
||||
|
||||
print(" Cron : In function = Cron_Survey_Q_Position_Relance")
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
todays_date_ISODATE = datetime.strptime(str(todays_date), '%d/%m/%Y')
|
||||
|
||||
# Aller chercher tous les questionnaires à relancer
|
||||
"""
|
||||
08/01/26 - Tous les questionnaire hors questionnaires de positionnement
|
||||
"""
|
||||
LOCAL_FORM_TYPE = ['hot_eval', 'cold_eval', 'human_eval', 'autre_eval', 'client_eval']
|
||||
|
||||
survey_qery_match = {'$and': [{'survey_type': {'$in':LOCAL_FORM_TYPE},
|
||||
'valide': '1',
|
||||
'locked': '0', 'statut': '1', 'type': '1',
|
||||
'date_dernier_relance_auto': {'$exists': True, }
|
||||
}
|
||||
]}
|
||||
|
||||
pipe_qry = ([
|
||||
{'$match': survey_qery_match},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup': {
|
||||
'from': 'session_formation',
|
||||
"let": {'session_id': "$session_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$session_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$project': {'relance_automation': 1, 'code_session': 1, 'date_debut': 1, 'date_fin': 1, }},
|
||||
],
|
||||
'as': 'collection_session_formation'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_session_formation'
|
||||
}
|
||||
])
|
||||
|
||||
print(" ## pipe_qry Cron_Survey_Questionnaires_Relance = ", pipe_qry)
|
||||
for local_questionnaire in MYSY_GV.dbname['survey'].aggregate(pipe_qry):
|
||||
|
||||
if ("collection_session_formation" in local_questionnaire.keys() and "relance_automation" in
|
||||
local_questionnaire[
|
||||
'collection_session_formation'].keys()):
|
||||
print(" ## traitement de local_questionnaire = ", local_questionnaire)
|
||||
"""
|
||||
Pour les related_collection: 'emargement',
|
||||
Aller recuperer les valeurs :
|
||||
- config_name: 'relance_auto',
|
||||
- config_name: 'frequence_relance_auto',
|
||||
- config_name: 'nb_relance_auto',
|
||||
"""
|
||||
config_relance_auto = ""
|
||||
config_frequence_relance_auto = ""
|
||||
config_nb_relance_auto = ""
|
||||
|
||||
tab_relance_automation = local_questionnaire['collection_session_formation']['relance_automation']
|
||||
|
||||
for session_relance_config in tab_relance_automation:
|
||||
if (session_relance_config['related_collection'] == "survey" and session_relance_config[
|
||||
'config_name'] == "relance_auto"):
|
||||
config_relance_auto = session_relance_config['config_value']
|
||||
|
||||
if (session_relance_config['related_collection'] == "survey" and session_relance_config[
|
||||
'config_name'] == "frequence_relance_auto"):
|
||||
config_frequence_relance_auto = session_relance_config['config_value']
|
||||
|
||||
if (session_relance_config['related_collection'] == "survey" and session_relance_config[
|
||||
'config_name'] == "nb_relance_auto"):
|
||||
config_nb_relance_auto = session_relance_config['config_value']
|
||||
|
||||
print(" ### config_relance_auto = ", config_relance_auto)
|
||||
print(" ### config_frequence_relance_auto = ", config_frequence_relance_auto)
|
||||
print(" ### config_nb_relance_auto = ", config_nb_relance_auto)
|
||||
|
||||
relance_done = 0
|
||||
|
||||
if ("nb_relance" in local_questionnaire.keys() and local_questionnaire['nb_relance']):
|
||||
relance_done = mycommon.tryInt(str(local_questionnaire['nb_relance']))
|
||||
|
||||
date_derniere_relance_auto = "01/12/2099"
|
||||
if ("date_dernier_relance_auto" in local_questionnaire.keys() and local_questionnaire[
|
||||
'date_dernier_relance_auto']):
|
||||
date_derniere_relance_auto = str(local_questionnaire['date_dernier_relance_auto'])[0:10]
|
||||
|
||||
date_derniere_relance_auto_ISODATE = datetime.strptime(str(date_derniere_relance_auto), '%d/%m/%Y')
|
||||
|
||||
new_relance_date_ISODATE = date_derniere_relance_auto_ISODATE + timedelta(
|
||||
days=float(config_frequence_relance_auto))
|
||||
|
||||
new_relance_date_no_ISODATE = str(new_relance_date_ISODATE.strftime("%d/%m/%Y"))
|
||||
print(" ### LA PROCHAINE RELANCE EST (new_relance_date_no_ISODATE) ", new_relance_date_no_ISODATE)
|
||||
|
||||
datetime.strptime(str(todays_date), '%d/%m/%Y')
|
||||
|
||||
if (config_relance_auto == "1" and relance_done <= float(
|
||||
config_frequence_relance_auto) and datetime.strptime(
|
||||
str(todays_date), '%d/%m/%Y') >= datetime.strptime(str(new_relance_date_no_ISODATE).strip(),
|
||||
'%d/%m/%Y')):
|
||||
|
||||
"""
|
||||
On fait le traitement, on envoie le mail
|
||||
1 - recuperation des data
|
||||
"""
|
||||
print(" IL FAUT FAIRE UNE RELANCEEEE pour ", local_questionnaire)
|
||||
|
||||
local_status, my_partner = mycommon.Get_Connected_User_Partner_Data_From_RecID(
|
||||
str(local_questionnaire['partner_owner_recid']))
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
local_dicton = {}
|
||||
local_dicton['partner_owner_recid'] = str(local_questionnaire['partner_owner_recid'])
|
||||
local_dicton['tab_ids'] = str(local_questionnaire['_id'])
|
||||
local_dicton['token'] = str(my_partner['token'])
|
||||
|
||||
# print(" ### local_dicton = ", local_dicton)
|
||||
|
||||
local_status, local_retval = survey_mgt.Automatic_Send_Survey_TabIds(local_dicton)
|
||||
|
||||
# print(" relance return local_send_remind_status = ", local_status)
|
||||
|
||||
if (local_status is True):
|
||||
|
||||
print(" RELANCE FAIT ET OK ")
|
||||
"""
|
||||
Une fois la relance faite, on met à jour le devis avec les infos suivant :
|
||||
- liste_relance
|
||||
|
||||
"""
|
||||
|
||||
frequence_relance_auto_reached = "0"
|
||||
|
||||
if ("list_relance" in local_questionnaire.keys() and local_questionnaire['list_relance']):
|
||||
local_node = {}
|
||||
local_node['date_relance'] = str(date.today())
|
||||
local_node['mesg_relance'] = str(local_retval)
|
||||
local_questionnaire['list_relance'].append(local_node)
|
||||
|
||||
else:
|
||||
|
||||
local_node = {}
|
||||
local_node['date_relance'] = str(date.today())
|
||||
local_questionnaire['list_relance'] = []
|
||||
local_questionnaire['list_relance'].append(local_node)
|
||||
local_node['mesg_relance'] = str(local_retval)
|
||||
|
||||
nb_relance = str(len(local_questionnaire['list_relance']))
|
||||
|
||||
local_data_update = local_questionnaire
|
||||
|
||||
id_to_update = str(local_data_update['_id'])
|
||||
|
||||
del local_data_update['_id']
|
||||
|
||||
local_data_update['nb_relance'] = str(nb_relance)
|
||||
local_data_update['date_dernier_relance_auto'] = str(todays_date)
|
||||
|
||||
result = MYSY_GV.dbname['survey'].find_one_and_update(
|
||||
{'_id': ObjectId(str(id_to_update)),
|
||||
|
||||
'valide': '1',
|
||||
'locked': '0'},
|
||||
{"$set": local_data_update},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
else:
|
||||
print(" NOOOOOOOO PASSSSSSSSS FAIRE RELANCEEEE ")
|
||||
return True, "Relance Questionnaires 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)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
CRON :
|
||||
Cette fonction permet de faire la relance toutes demandes EMARGEMENT.
|
||||
|
||||
08/01/26 :
|
||||
Desormais la configuration de le relance est faite sur la session.
|
||||
Donc au d'aller chercher les données dans la collection 'base_partner_setup', on va aller la chercher
|
||||
sur la session, notamment sur 'relance_automation'
|
||||
"""
|
||||
|
||||
def Cron_Emargement_Relance():
|
||||
def Cron_Emargement_Relance_old():
|
||||
try:
|
||||
|
||||
print(" Cron : In function = Cron_Emargement_Relance")
|
||||
|
|
@ -2684,6 +3098,228 @@ def Cron_Emargement_Relance():
|
|||
return False, str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)
|
||||
|
||||
|
||||
def Cron_Emargement_Relance():
|
||||
try:
|
||||
|
||||
print(" Cron : In function = Cron_Emargement_Relance")
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
todays_date_ISODATE = datetime.strptime(str(todays_date), '%d/%m/%Y')
|
||||
|
||||
# Aller chercher tous les emargements à relancer
|
||||
|
||||
emargement_qery_match = {'$and': [{'valide': '1',
|
||||
'locked': '0', 'statut': '1',
|
||||
'date_dernier_relance_auto': {'$exists': True, }
|
||||
}
|
||||
]}
|
||||
|
||||
pipe_qry = ([
|
||||
{'$match': emargement_qery_match},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup': {
|
||||
'from': 'session_formation',
|
||||
"let": {'session_id': "$session_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$session_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$project': {'relance_automation': 1, 'code_session': 1, 'date_debut': 1, 'date_fin': 1, }},
|
||||
],
|
||||
'as': 'collection_session_formation'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_session_formation'
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
print(" ## relance pipe_qry Cron_Emargement_Relance = ", pipe_qry)
|
||||
tab_email_sent = []
|
||||
tab_session_sent = []
|
||||
tab_emargement_qr_safe_token_sent = []
|
||||
send_email_relance = "0"
|
||||
|
||||
for local_emargement in MYSY_GV.dbname['emargement'].aggregate(pipe_qry):
|
||||
|
||||
if( "collection_session_formation" in local_emargement.keys() and "relance_automation" in local_emargement['collection_session_formation'].keys() ):
|
||||
print("### local_emargement a traiter = ", local_emargement)
|
||||
"""
|
||||
Pour les related_collection: 'emargement',
|
||||
Aller recuperer les valeurs :
|
||||
- config_name: 'relance_auto',
|
||||
- config_name: 'frequence_relance_auto',
|
||||
- config_name: 'nb_relance_auto',
|
||||
"""
|
||||
config_relance_auto = ""
|
||||
config_frequence_relance_auto = ""
|
||||
config_nb_relance_auto = ""
|
||||
|
||||
tab_relance_automation = local_emargement['collection_session_formation']['relance_automation']
|
||||
|
||||
for session_relance_config in tab_relance_automation :
|
||||
if( session_relance_config['related_collection'] == "emargement" and session_relance_config['config_name'] == "relance_auto"):
|
||||
config_relance_auto = session_relance_config['config_value']
|
||||
|
||||
if (session_relance_config['related_collection'] == "emargement" and session_relance_config[
|
||||
'config_name'] == "frequence_relance_auto"):
|
||||
config_frequence_relance_auto = session_relance_config['config_value']
|
||||
|
||||
if (session_relance_config['related_collection'] == "emargement" and session_relance_config[
|
||||
'config_name'] == "nb_relance_auto"):
|
||||
config_nb_relance_auto = session_relance_config['config_value']
|
||||
|
||||
|
||||
print(" ### config_relance_auto = ", config_relance_auto)
|
||||
print(" ### config_frequence_relance_auto = ", config_frequence_relance_auto)
|
||||
print(" ### config_nb_relance_auto = ", config_nb_relance_auto)
|
||||
|
||||
relance_done = 0
|
||||
|
||||
if ("nb_relance" in local_emargement.keys() and local_emargement['nb_relance']):
|
||||
relance_done = mycommon.tryInt(str(local_emargement['nb_relance']))
|
||||
|
||||
date_derniere_relance_auto = "01/12/2099"
|
||||
if ("date_dernier_relance_auto" in local_emargement.keys() and local_emargement[
|
||||
'date_dernier_relance_auto']):
|
||||
date_derniere_relance_auto = str(local_emargement['date_dernier_relance_auto'])[0:10]
|
||||
|
||||
date_derniere_relance_auto_ISODATE = datetime.strptime(str(date_derniere_relance_auto), '%d/%m/%Y')
|
||||
|
||||
print(' ## date_derniere_relance_auto_ISODATE = ', date_derniere_relance_auto_ISODATE)
|
||||
|
||||
new_relance_date_ISODATE = date_derniere_relance_auto_ISODATE + timedelta(days=float(config_frequence_relance_auto))
|
||||
|
||||
print(" ### LA frequence_relance_auto ", config_frequence_relance_auto)
|
||||
|
||||
print(" ### LA dernière relance date de ", date_derniere_relance_auto)
|
||||
|
||||
print(" ### LA PROCHAINE RELANCE EST ", new_relance_date_ISODATE)
|
||||
|
||||
new_relance_date_no_ISODATE = str(new_relance_date_ISODATE.strftime("%d/%m/%Y"))
|
||||
# print(" ### LA PROCHAINE RELANCE EST (new_relance_date_no_ISODATE) ", new_relance_date_no_ISODATE)
|
||||
|
||||
datetime.strptime(str(todays_date), '%d/%m/%Y')
|
||||
|
||||
print(" ### relance_done = ", relance_done)
|
||||
print(" ### nb_limite_relance = ", config_nb_relance_auto)
|
||||
|
||||
print(" ### datetime.strptime( str(todays_date), '%d/%m/%Y') = ", datetime.strptime(
|
||||
str(todays_date), '%d/%m/%Y'))
|
||||
|
||||
print(" ### datetime.strptime(str(new_relance_date_no_ISODATE).strip(), '%d/%m/%Y') = ",
|
||||
datetime.strptime(str(new_relance_date_no_ISODATE).strip(),
|
||||
'%d/%m/%Y'))
|
||||
|
||||
if (config_relance_auto == "1" and relance_done <= float(config_nb_relance_auto) and datetime.strptime(
|
||||
str(todays_date), '%d/%m/%Y') >= datetime.strptime(str(new_relance_date_no_ISODATE).strip(),
|
||||
'%d/%m/%Y')):
|
||||
|
||||
"""
|
||||
On fait le traitement, on envoie le mail
|
||||
1 - recuperation des data
|
||||
"""
|
||||
print(" IL FAUT FAIRE UNE RELANCEEEE ")
|
||||
"""
|
||||
Important :
|
||||
L'idée est d'envoyer 1 et 1 seul par couple : email/session
|
||||
En effet si il plusieurs séquence, l'apprenant en cliquant sur le mysyurl,
|
||||
il tombera sur l'affichage de toutes les sequence
|
||||
"""
|
||||
|
||||
if ("session_id" in local_emargement.keys() and local_emargement[
|
||||
'session_id'] in tab_session_sent and
|
||||
"email" in local_emargement.keys() and local_emargement['email'] in tab_email_sent and
|
||||
"emargement_qr_safe_token" in local_emargement.keys() and local_emargement[
|
||||
'emargement_qr_safe_token'] in tab_emargement_qr_safe_token_sent):
|
||||
send_email_relance = "0"
|
||||
else:
|
||||
send_email_relance = "1"
|
||||
tab_session_sent.append(local_emargement['session_id'])
|
||||
tab_email_sent.append(local_emargement['email'])
|
||||
tab_emargement_qr_safe_token_sent.append(local_emargement['emargement_qr_safe_token'])
|
||||
|
||||
local_status, my_partner = mycommon.Get_Connected_User_Partner_Data_From_RecID(
|
||||
str(local_emargement['partner_owner_recid']))
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
local_dicton = {}
|
||||
local_dicton['partner_owner_recid'] = str(local_emargement['partner_owner_recid'])
|
||||
local_dicton['tab_emargement_ids'] = str(local_emargement['_id'])
|
||||
|
||||
# print(" ### local_dicton = ", local_dicton)
|
||||
local_retval = ""
|
||||
if (send_email_relance == "1"):
|
||||
local_status, local_retval = Job_Cron_Common.Cron_Relance_Emargement_By_Email(local_dicton)
|
||||
else:
|
||||
print(" ### UNE RELANCE A DEJA ETE ENVOY2 pour ce apprenant et pour cette session")
|
||||
|
||||
|
||||
frequence_relance_auto_reached = "0"
|
||||
|
||||
if ("list_relance" in local_emargement.keys() and local_emargement['list_relance']):
|
||||
local_node = {}
|
||||
local_node['date_relance'] = str(date.today())
|
||||
local_node['mesg_relance'] = str(local_retval)
|
||||
local_emargement['list_relance'].append(local_node)
|
||||
|
||||
else:
|
||||
|
||||
local_node = {}
|
||||
local_node['date_relance'] = str(date.today())
|
||||
local_emargement['list_relance'] = []
|
||||
local_emargement['list_relance'].append(local_node)
|
||||
local_node['mesg_relance'] = str(local_retval)
|
||||
|
||||
nb_relance = str(len(local_emargement['list_relance']))
|
||||
|
||||
local_data_update = local_emargement
|
||||
|
||||
id_to_update = str(local_data_update['_id'])
|
||||
|
||||
del local_data_update['_id']
|
||||
|
||||
local_data_update['nb_relance'] = str(nb_relance)
|
||||
local_data_update['date_dernier_relance_auto'] = str(todays_date)
|
||||
|
||||
result = MYSY_GV.dbname['emargement'].find_one_and_update(
|
||||
{'_id': ObjectId(str(id_to_update)),
|
||||
|
||||
'valide': '1',
|
||||
'locked': '0'},
|
||||
{"$set": local_data_update},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
else:
|
||||
print(" NOOOOOOOO PASSSSSSSSS FAIRE RELANCEEEE ")
|
||||
|
||||
return True, "Relance Emargement 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)
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet d'envoyer les emails qui sont dans file d'attente
|
||||
|
|
@ -2886,3 +3522,5 @@ def Cron_Send_Mail_Queue_Message_With_Filter(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 d'envoyer les emails "
|
||||
|
||||
|
||||
|
|
|
|||
14397
Log/log_file.log
14397
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -648,8 +648,6 @@ def Add_Update_SessionFormation(diction):
|
|||
21/02/2025
|
||||
Il faut aller chercher la configuration des envois automatic de document.
|
||||
Il faut regarder dans la collection - base_document_automatic_setup -
|
||||
|
||||
|
||||
"""
|
||||
#print(" ## ICIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ")
|
||||
mydata['automatic_traitement'] = []
|
||||
|
|
@ -669,6 +667,26 @@ def Add_Update_SessionFormation(diction):
|
|||
|
||||
mydata['automatic_traitement'].append(new_local_data)
|
||||
|
||||
"""
|
||||
05/01/2026 : on va aussi aller chercher la config des relances automatiques
|
||||
"""
|
||||
mydata['relance_automation'] = []
|
||||
for relance_automation in MYSY_GV.dbname['base_partner_setup'].find({'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'config_name': {
|
||||
'$in': MYSY_GV.LIST_RELANCE_CONFIG_NAME},
|
||||
'related_collection': {
|
||||
'$in': MYSY_GV.LIST_RELANCE_RELATED_COLLECTION}
|
||||
}):
|
||||
new_local_data = relance_automation
|
||||
new_local_data['statut'] = "0"
|
||||
new_local_data['creation_date'] = str(datetime.now())
|
||||
new_local_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
mydata['relance_automation'].append(new_local_data)
|
||||
|
||||
|
||||
|
||||
coll_name = MYSY_GV.dbname['session_formation']
|
||||
ret_val = coll_name.insert_one(mydata)
|
||||
|
|
@ -5755,6 +5773,13 @@ def Duplicate_List_Session_Formation(diction):
|
|||
if( "invoiced_statut" in duplicated_session ):
|
||||
del duplicated_session['invoiced_statut']
|
||||
|
||||
if ("base_document_automatic_setup" in duplicated_session):
|
||||
del duplicated_session['base_document_automatic_setup']
|
||||
|
||||
if ("relance_automation" in duplicated_session):
|
||||
del duplicated_session['relance_automation']
|
||||
|
||||
|
||||
|
||||
duplicated_session['code_session'] = str(session_data['code_session'])+"_dup"
|
||||
duplicated_session['creation_date'] = now
|
||||
|
|
@ -5775,11 +5800,56 @@ def Duplicate_List_Session_Formation(diction):
|
|||
duplicated_session['session_etape'] = str(diction['session_etape'])
|
||||
duplicated_session['formateur_id'] = str(formateur_id)
|
||||
|
||||
"""
|
||||
21/02/2025
|
||||
Il faut aller chercher la configuration des envois automatic de document.
|
||||
Il faut regarder dans la collection - base_document_automatic_setup -
|
||||
"""
|
||||
# print(" ## ICIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ")
|
||||
duplicated_session['automatic_traitement'] = []
|
||||
|
||||
qry_automatic_setup = {'collection_target': 'session_formation',
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
print(" #### qry_automatic_setup == ", qry_automatic_setup)
|
||||
|
||||
for base_document_automatic_setup_for_partner in MYSY_GV.dbname['base_document_automatic_setup'].find(
|
||||
qry_automatic_setup):
|
||||
new_local_data = base_document_automatic_setup_for_partner
|
||||
new_local_data['statut'] = "0"
|
||||
new_local_data['creation_date'] = str(datetime.now())
|
||||
new_local_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
duplicated_session['automatic_traitement'].append(new_local_data)
|
||||
|
||||
"""
|
||||
05/01/2026 : on va aussi aller chercher la config des relances automatiques
|
||||
"""
|
||||
duplicated_session['relance_automation'] = []
|
||||
for relance_automation in MYSY_GV.dbname['base_partner_setup'].find({'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'config_name': {
|
||||
'$in': MYSY_GV.LIST_RELANCE_CONFIG_NAME},
|
||||
'related_collection': {
|
||||
'$in': MYSY_GV.LIST_RELANCE_RELATED_COLLECTION}
|
||||
}):
|
||||
new_local_data = relance_automation
|
||||
new_local_data['statut'] = "0"
|
||||
new_local_data['creation_date'] = str(datetime.now())
|
||||
new_local_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
duplicated_session['relance_automation'].append(new_local_data)
|
||||
|
||||
|
||||
|
||||
local_retval = MYSY_GV.dbname['session_formation'].insert_one(duplicated_session)
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = diction['token']
|
||||
|
|
@ -14865,6 +14935,8 @@ def Invoice_Create_Secure_E_Document(diction):
|
|||
Order_header_lines_data = []
|
||||
for retval in MYSY_GV.dbname['partner_invoice_line'].aggregate(query):
|
||||
if ('myclass_collection' in retval.keys() and len(retval['myclass_collection']) > 0):
|
||||
|
||||
print(" ### retval = ", retval)
|
||||
user = {}
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
|
@ -16678,6 +16750,210 @@ def Update_SessionFormation_Doc_Automatic_Setup(diction):
|
|||
return False, "Impossible mettre à jour La promotion de formation"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de mettre à jour le paramettrage
|
||||
d'envoie automatique des documents d'une session de formation.
|
||||
Par exemple :
|
||||
- Envoyer les convention X avant le début de La promotion de formation
|
||||
|
||||
Important : : Toute mise à jour reinitialise la valeur 'statut' à 0. (sans cele
|
||||
le traitement ne va s'exécuté s'il a déjà ete exécuté 1 fois
|
||||
"""
|
||||
|
||||
|
||||
def Update_SessionFormation_Relance_Automation_Setup(diction):
|
||||
try:
|
||||
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['token', '_id', 'nb_relance', 'frequence_relance', 'relance_auto', 'related_collection',
|
||||
'automation_relance_nb_relance_auto_id', 'automation_relance_frequence_relance_auto_id', 'automation_relance_relance_auto_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, " Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id', 'nb_relance', 'frequence_relance', 'relance_auto', 'related_collection',
|
||||
'automation_relance_nb_relance_auto_id', 'automation_relance_frequence_relance_auto_id',
|
||||
'automation_relance_relance_auto_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"
|
||||
|
||||
mydata = {}
|
||||
query_key = {}
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
|
||||
|
||||
data_for_check_connexion = {'token': my_token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier la valididé de La promotion de formation
|
||||
"""
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (is_valide_session != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - L'identifiant de la session / promotion est invalide ")
|
||||
return False, " L'identifiant de la session / promotion est invalide "
|
||||
|
||||
is_valide_session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
|
||||
print({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
|
||||
'relance_automation._id': ObjectId(str(diction['automation_relance_nb_relance_auto_id']))
|
||||
|
||||
})
|
||||
|
||||
# config_name": 'nb_relance_auto'
|
||||
update = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'relance_automation._id': ObjectId(str(diction['automation_relance_nb_relance_auto_id']))
|
||||
|
||||
},
|
||||
{'$set':
|
||||
{
|
||||
'relance_automation.$[xxx].config_value': str(diction['nb_relance']),
|
||||
'relance_automation.$[xxx].statut': "0",
|
||||
'relance_automation.$[xxx].date_update': str(
|
||||
datetime.now()),
|
||||
'relance_automation.$[xxx].update_by': str(
|
||||
my_partner['_id']),
|
||||
}
|
||||
},
|
||||
upsert=False,
|
||||
array_filters=[
|
||||
|
||||
{"xxx._id": ObjectId(str(diction['automation_relance_nb_relance_auto_id']))},
|
||||
]
|
||||
)
|
||||
print(" ## update 01 = ", update.modified_count)
|
||||
# config_name": 'frequence_relance'
|
||||
print({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'relance_automation._id': ObjectId(str(
|
||||
diction['automation_relance_frequence_relance_auto_id']))
|
||||
|
||||
})
|
||||
update = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'relance_automation._id': ObjectId(str(
|
||||
diction['automation_relance_frequence_relance_auto_id']))
|
||||
|
||||
},
|
||||
{'$set':
|
||||
{
|
||||
'relance_automation.$[xxx].config_value': str(
|
||||
diction['frequence_relance']),
|
||||
'relance_automation.$[xxx].statut': "0",
|
||||
'relance_automation.$[xxx].date_update': str(
|
||||
datetime.now()),
|
||||
'relance_automation.$[xxx].update_by': str(
|
||||
my_partner['_id']),
|
||||
|
||||
}
|
||||
},
|
||||
upsert=False,
|
||||
array_filters=[
|
||||
{"xxx._id": ObjectId(str(diction['automation_relance_frequence_relance_auto_id']))},
|
||||
]
|
||||
)
|
||||
print(" ## update 02 = ", update.modified_count)
|
||||
# config_name": 'relance_auto'
|
||||
print({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'relance_automation._id': ObjectId(str(
|
||||
diction['automation_relance_relance_auto_id']))
|
||||
|
||||
})
|
||||
update = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'relance_automation._id': ObjectId(str(
|
||||
diction['automation_relance_relance_auto_id']))
|
||||
|
||||
},
|
||||
{'$set':
|
||||
{
|
||||
'relance_automation.$[xxx].config_value': str(
|
||||
diction['relance_auto']),
|
||||
'relance_automation.$[xxx].statut': "0",
|
||||
'relance_automation.$[xxx].date_update': str(
|
||||
datetime.now()),
|
||||
'relance_automation.$[xxx].update_by': str(
|
||||
my_partner['_id']),
|
||||
|
||||
}
|
||||
},
|
||||
upsert=False,
|
||||
array_filters=[
|
||||
{"xxx._id": ObjectId(str(diction['automation_relance_relance_auto_id']))},
|
||||
]
|
||||
)
|
||||
print(" ## update 03 = ", update.modified_count)
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = diction['token']
|
||||
history_event_dict['related_collection'] = "session_formation"
|
||||
history_event_dict['related_collection_recid'] = str(diction['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = "Modif. automatisation des relances. " \
|
||||
" Type Doc " + str(diction['related_collection'])
|
||||
|
||||
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, " La promotion de formation à bien été mise à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible mettre à jour La promotion de formation"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation la list des : "automatic_traitement"
|
||||
|
|
@ -16817,6 +17093,7 @@ def Get_Given_SessionFormation_List_Automatic_Traitement_From(diction):
|
|||
|
||||
tab_local_automatic_traitement.append(new_data)
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(tab_local_automatic_traitement))
|
||||
|
||||
return True, RetObject
|
||||
|
|
@ -16827,6 +17104,77 @@ def Get_Given_SessionFormation_List_Automatic_Traitement_From(diction):
|
|||
return False, "Impossible de récupérer La promotion de formation"
|
||||
|
||||
|
||||
"""
|
||||
Recuperation la list des : "relance_automation"
|
||||
d'une session de formation
|
||||
"""
|
||||
|
||||
|
||||
def Get_Given_SessionFormation_List_relance_automation(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, "de récupérer la liste des stagiaires . 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({'token': str(diction['token'])})
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
partner_recid = my_partner['recid']
|
||||
|
||||
session_id = ""
|
||||
if ("session_id" in diction.keys()):
|
||||
if diction['session_id']:
|
||||
session_id = diction['session_id']
|
||||
|
||||
if (str(session_id).strip() == ""):
|
||||
return True, []
|
||||
|
||||
coll_session = MYSY_GV.dbname['session_formation']
|
||||
RetObject = []
|
||||
|
||||
local_session_data = coll_session.find_one(
|
||||
{'_id': ObjectId(str(session_id)), 'partner_owner_recid': str(partner_recid)}, {'relance_automation': 1,
|
||||
'date_debut': 1,
|
||||
'date_fin': 1})
|
||||
|
||||
|
||||
tab_local_relance_automation = []
|
||||
if (local_session_data and "relance_automation" in local_session_data.keys()):
|
||||
RetObject.append(mycommon.JSONEncoder().encode(local_session_data['relance_automation']))
|
||||
|
||||
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de récupérer la liste des relance_automation"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
02/06/2025 : Archivage d'une session
|
||||
"""
|
||||
|
|
@ -17449,3 +17797,8 @@ def Get_List_UE_Given_SessionFormation(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 recuperer la list des UE de la promotion / session "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction retourne la configuration
|
||||
"""
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
"""
|
||||
Ce fichier permet de gerer le processus d'admission a une formation.
|
||||
|
||||
admission_setup ==> definit les critère d'admission et contients les infos comme :
|
||||
- List_document
|
||||
- Etapes
|
||||
- user_criterias :
|
||||
-> age
|
||||
-> niveau d'etude,
|
||||
-> etc
|
||||
|
||||
Un document est defini par :
|
||||
- doc_nom
|
||||
- doc_type
|
||||
- doc_obligatoire (1/0)
|
||||
|
||||
Une étape est defini par :
|
||||
- etape_nom
|
||||
- etape_code
|
||||
- etape_rang
|
||||
"""
|
||||
import ast
|
||||
from zipfile import ZipFile
|
||||
|
||||
import bson
|
||||
import pymongo
|
||||
import xlsxwriter
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime, date
|
||||
|
||||
import partner_client
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
import csv
|
||||
import pandas as pd
|
||||
from pymongo import ReturnDocument
|
||||
import GlobalVariable as MYSY_GV
|
||||
from math import isnan
|
||||
import GlobalVariable as MYSY_GV
|
||||
import ela_index_bdd_classes as eibdd
|
||||
import email_mgt as email
|
||||
import jinja2
|
||||
from flask import send_file
|
||||
from xhtml2pdf import pisa
|
||||
from email.message import EmailMessage
|
||||
from email.mime.text import MIMEText
|
||||
from email import encoders
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
import attached_file_mgt
|
||||
|
||||
def Add_Admission_Setup(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'description', 'comment', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'code',]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
# Verifier que ce code n'existe pas déjà
|
||||
is_existe_admis_setup = MYSY_GV.dbname['admission_setup'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_existe_admis_setup > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Un document avec le code '" + str(diction['code']) + "' existe déjà ")
|
||||
return False, " Un document avec le code '" + str(diction['code']) + "' existe déjà "
|
||||
|
||||
|
||||
|
||||
|
||||
return True, " La document 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 document "
|
||||
99
main.py
99
main.py
|
|
@ -2223,6 +2223,24 @@ def AddStagiairetoClass():
|
|||
localStatus, message= inscription.AddStagiairetoClass(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de gestion des stagiaires à une une formation depuis la markeplace
|
||||
"""
|
||||
@app.route('/myclass/api/AddStagiairetoClass_from_marketplace/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def AddStagiairetoClass_from_marketplace():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### AddStagiairetoClass_from_marketplace : payload = ",payload)
|
||||
localStatus, message= inscription.AddStagiairetoClass_from_marketplace(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de mise à jour d'un stagaire
|
||||
"""
|
||||
|
|
@ -2361,8 +2379,25 @@ def Update_SessionFormation_Doc_Automatic_Setup():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui permet de recuperer la liste des '' d'une session de formation
|
||||
API de mise à jour du paramétrage d'automatisation des relance des documents
|
||||
"""
|
||||
@app.route('/myclass/api/Update_SessionFormation_Relance_Automation_Setup/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_SessionFormation_Relance_Automation_Setup():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_SessionFormation_Relance_Automation_Setup : payload = ",str(payload))
|
||||
localStatus, message= SF.Update_SessionFormation_Relance_Automation_Setup(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui permet de recuperer la liste des 'automatic_traitement' d'une session de formation
|
||||
en partant de l'_id de la session
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_SessionFormation_List_Automatic_Traitement_From/', methods=['POST','GET'])
|
||||
|
|
@ -2375,6 +2410,24 @@ def Get_Given_SessionFormation_List_Automatic_Traitement_From():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui permet de recuperer la liste des 'relance_automation' d'une session de formation
|
||||
en partant de l'_id de la session
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_SessionFormation_List_relance_automation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_SessionFormation_List_relance_automation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_SessionFormation_List_relance_automation : payload = ",str(payload))
|
||||
localStatus, message= SF.Get_Given_SessionFormation_List_relance_automation(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui permet d'archiver une liste de session de formation
|
||||
"""
|
||||
|
|
@ -11089,6 +11142,34 @@ def Cron_Survey_Questionnaires_Relance():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
""""
|
||||
Test cron qui fait les relance des questionnaire POSITIONNEMENT UNIQUEMENT non repondu (position)
|
||||
"""
|
||||
@app.route('/myclass/api/Cron_Survey_Questionnaires_Relance_Q_Position/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Cron_Survey_Questionnaires_Relance_Q_Position():
|
||||
mycommon.myprint(" ### CRONNN Cron_Survey_Questionnaires_Relance_Q_Position : payload = ")
|
||||
print(" ### CRONNN Cron_Survey_Questionnaires_Relance_Q_Position : payload = ")
|
||||
status, retval = Job_Cron.Cron_Survey_Questionnaires_Relance_Q_Position()
|
||||
print(" FIN traitement Cron_Survey_Questionnaires_Relance_Q_Position localStatus = ", status)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
""""
|
||||
Test cron qui fait les relance des questionnaire HORS POSITIONNEMENT
|
||||
LOCAL_FORM_TYPE = ['hot_eval', 'cold_eval', 'human_eval', 'autre_eval', 'client_eval']
|
||||
"""
|
||||
@app.route('/myclass/api/Cron_Survey_Questionnaires_Relance_Except_Q_Position/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Cron_Survey_Questionnaires_Relance_Except_Q_Position():
|
||||
mycommon.myprint(" ### CRONNN Cron_Survey_Questionnaires_Relance_Except_Q_Position : payload = ")
|
||||
print(" ### CRONNN Cron_Survey_Questionnaires_Relance_Except_Q_Position : payload = ")
|
||||
status, retval = Job_Cron.Cron_Survey_Questionnaires_Relance_Except_Q_Position()
|
||||
print(" FIN traitement Cron_Survey_Questionnaires_Relance_Except_Q_Position localStatus = ", status)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
""""
|
||||
Test cron qui fait les relance des emargements non repondu (position, eval, etc)
|
||||
|
|
@ -11104,7 +11185,6 @@ def Cron_Emargement_Relance():
|
|||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un type d'evaluation
|
||||
"""
|
||||
|
|
@ -12068,6 +12148,21 @@ def Get_Inscrit_List_Tuteurs():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des inscrits avec un filtre sur le statut de facturation
|
||||
invoice_status
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Inscrit_By_Invoice_Status_For_List_Session/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Inscrit_By_Invoice_Status_For_List_Session():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Inscrit_By_Invoice_Status_For_List_Session payload = ",payload)
|
||||
status, retval = inscription.Get_Inscrit_By_Invoice_Status_For_List_Session(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -104,9 +104,7 @@ def Add_Update_Partner_Basic_Setup(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
print(" ### str(diction['config_name']) = ", str(diction['config_name']))
|
||||
|
||||
print(" ### MYSY_GV.PARTNER_BASE_CONFIG_NAME = ", str(MYSY_GV.PARTNER_BASE_CONFIG_NAME))
|
||||
|
||||
|
||||
if(str(diction['config_name']) not in MYSY_GV.PARTNER_BASE_CONFIG_NAME):
|
||||
|
|
@ -297,7 +295,7 @@ def Get_List_Partner_Basic_Setup(diction):
|
|||
qry = {'$and': [{'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0',}, filt_related_collection]}
|
||||
sort_tab = [("related_collection", pymongo.ASCENDING ), ("config_name", pymongo.ASCENDING)]
|
||||
|
||||
print(" ### Get_List_Partner_Basic_Setup QRY = ", qry)
|
||||
#print(" ### Get_List_Partner_Basic_Setup QRY = ", qry)
|
||||
for New_retVal in MYSY_GV.dbname['base_partner_setup'].find(qry ).sort(sort_tab):
|
||||
if( str(New_retVal['config_name']) == "smtp_user_pwd"):
|
||||
New_retVal['config_value'] = New_retVal['config_value'][:2]+"...."+str(New_retVal['config_value'])[-2:]
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ def Invoice_Partner_Order(diction):
|
|||
|
||||
#2 - copier les données dans la collection 'facture'
|
||||
"""
|
||||
Important : On va recopier les header et line, telqel.
|
||||
Important : On va recopier les header et line, tel quel.
|
||||
On fera les changements plus tard si besoin
|
||||
"""
|
||||
|
||||
|
|
@ -320,6 +320,17 @@ def Invoice_Partner_Order(diction):
|
|||
new_invoice_data_line['invoice_header_id'] = str(inserted_invoice_id)
|
||||
new_invoice_data_line['update_by'] = str(my_partner['_id'])
|
||||
|
||||
work_tab = []
|
||||
if ("order_line_tab_inscrit_id" in new_invoice_data_line.keys()):
|
||||
for tmp in new_invoice_data_line['order_line_tab_inscrit_id']:
|
||||
if ("_id" in tmp.keys() and tmp['_id']):
|
||||
work_tab.append(ObjectId(str(tmp['_id'])))
|
||||
|
||||
del new_invoice_data_line['order_line_tab_inscrit_id']
|
||||
|
||||
new_invoice_data_line['tab_inscription_ids'] = work_tab
|
||||
|
||||
|
||||
#print(" ### on Va inserer la ligne de factue new_invoice_data_line = ", new_invoice_data_line)
|
||||
|
||||
inserted_line = MYSY_GV.dbname['partner_invoice_line'].insert_one(new_invoice_data_line)
|
||||
|
|
@ -355,51 +366,114 @@ def Invoice_Partner_Order(diction):
|
|||
|
||||
on va créer une table de detail qui reprend le detail des inscription
|
||||
"""
|
||||
partner_invoice_line_data_detail = {}
|
||||
partner_invoice_line_data_detail['order_line_inscription_id'] = ""
|
||||
partner_invoice_line_data_detail['order_line_inscription_type_apprenant'] = str(new_invoice_data_line['order_line_type_apprenant'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_modefinancement'] = ""
|
||||
partner_invoice_line_data_detail['order_line_formation'] = str(new_invoice_data_line['order_line_formation'])
|
||||
|
||||
"""
|
||||
27/07/25 : aller recuperer le 'class_id'
|
||||
09/01/2026 - si on a des inscrits idenifié - new_invoice_data_line['tab_inscription_ids'] = work_tab
|
||||
Alors on va aller recuperer les données de l'inscrits
|
||||
"""
|
||||
local_class_id = ""
|
||||
if( "order_line_formation" in new_invoice_data_line.keys() and new_invoice_data_line['order_line_formation']):
|
||||
class_data = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(new_invoice_data_line['order_line_formation']),
|
||||
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1})
|
||||
if(len(work_tab) > 0 ):
|
||||
for inscrit in work_tab:
|
||||
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(inscrit)), 'partner_owner_recid':my_partner['recid']})
|
||||
partner_invoice_line_data_detail = {}
|
||||
partner_invoice_line_data_detail['order_line_inscription_id'] = str(inscrit_data['_id'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_type_apprenant'] = str( inscrit_data['type_apprenant'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_modefinancement'] = str( inscrit_data['modefinancement'])
|
||||
partner_invoice_line_data_detail['order_line_formation'] = str(new_invoice_data_line['order_line_formation'])
|
||||
|
||||
if( class_data and '_id' in class_data.keys() ):
|
||||
local_class_id = str(class_data['_id'])
|
||||
"""
|
||||
27/07/25 : aller recuperer le 'class_id'
|
||||
"""
|
||||
local_class_id = ""
|
||||
if ("order_line_formation" in new_invoice_data_line.keys() and new_invoice_data_line[
|
||||
'order_line_formation']):
|
||||
class_data = MYSY_GV.dbname['myclass'].find_one(
|
||||
{'internal_url': str(new_invoice_data_line['order_line_formation']),
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'_id': 1})
|
||||
|
||||
partner_invoice_line_data_detail['order_line_class_id'] = local_class_id
|
||||
if (class_data and '_id' in class_data.keys()):
|
||||
local_class_id = str(class_data['_id'])
|
||||
|
||||
partner_invoice_line_data_detail['order_line_class_id'] = local_class_id
|
||||
|
||||
partner_invoice_line_data_detail['order_line_prix_unitaire'] = str(inscrit_data['price'])
|
||||
partner_invoice_line_data_detail['order_line_montant_hors_taxes'] = str( new_invoice_data_line['order_line_montant_hors_taxes'])
|
||||
partner_invoice_line_data_detail['order_line_invoiced_amount'] = str( new_invoice_data_line['order_line_montant_hors_taxes'])
|
||||
partner_invoice_line_data_detail['order_line_qty'] = "1"
|
||||
|
||||
if ("order_line_tab_inscrit_id" in new_invoice_data_line.keys()):
|
||||
del new_invoice_data_line['order_line_tab_inscrit_id']
|
||||
|
||||
partner_invoice_line_data_detail['tab_inscription_ids'] = [ObjectId(str(inscrit_data['_id']))]
|
||||
|
||||
partner_invoice_line_data_detail['order_line_comment'] = ""
|
||||
partner_invoice_line_data_detail['invoice_header_id'] = str(inserted_invoice_id)
|
||||
partner_invoice_line_data_detail['invoice_line_type'] = "facture"
|
||||
partner_invoice_line_data_detail['invoice_header_ref_interne'] = str(invoice_ref_interne)
|
||||
|
||||
order_line_is_include_bpf = ""
|
||||
if ("order_header_inclus_bpf" in order_to_invoice_data.keys()):
|
||||
order_line_is_include_bpf = order_to_invoice_data['order_header_inclus_bpf']
|
||||
partner_invoice_line_data_detail['order_line_is_include_bpf'] = order_line_is_include_bpf
|
||||
|
||||
partner_invoice_line_data_detail['update_by'] = str(my_partner['_id'])
|
||||
partner_invoice_line_data_detail['valide'] = "1"
|
||||
partner_invoice_line_data_detail['locked'] = "0"
|
||||
partner_invoice_line_data_detail['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
print(" #### partner_invoice_line_data = ", partner_invoice_line_data_detail)
|
||||
inserted_detail_invoice_line_id = MYSY_GV.dbname['partner_invoice_line_detail'].insert_one(
|
||||
partner_invoice_line_data_detail).inserted_id
|
||||
|
||||
else:
|
||||
partner_invoice_line_data_detail = {}
|
||||
partner_invoice_line_data_detail['order_line_inscription_id'] = ""
|
||||
partner_invoice_line_data_detail['order_line_inscription_type_apprenant'] = str(new_invoice_data_line['order_line_type_apprenant'])
|
||||
partner_invoice_line_data_detail['order_line_inscription_modefinancement'] = ""
|
||||
partner_invoice_line_data_detail['order_line_formation'] = str(new_invoice_data_line['order_line_formation'])
|
||||
|
||||
"""
|
||||
27/07/25 : aller recuperer le 'class_id'
|
||||
"""
|
||||
local_class_id = ""
|
||||
if( "order_line_formation" in new_invoice_data_line.keys() and new_invoice_data_line['order_line_formation']):
|
||||
class_data = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(new_invoice_data_line['order_line_formation']),
|
||||
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1})
|
||||
|
||||
if( class_data and '_id' in class_data.keys() ):
|
||||
local_class_id = str(class_data['_id'])
|
||||
|
||||
partner_invoice_line_data_detail['order_line_class_id'] = local_class_id
|
||||
|
||||
|
||||
partner_invoice_line_data_detail['order_line_prix_unitaire'] = str(new_invoice_data_line['order_line_prix_unitaire'])
|
||||
partner_invoice_line_data_detail['order_line_montant_hors_taxes'] = str(new_invoice_data_line['order_line_montant_hors_taxes'])
|
||||
partner_invoice_line_data_detail['order_line_invoiced_amount'] = str(new_invoice_data_line['order_line_montant_hors_taxes'])
|
||||
partner_invoice_line_data_detail['order_line_qty'] = str( new_invoice_data_line['order_line_qty'])
|
||||
|
||||
if( "order_line_tab_inscrit_id" in new_invoice_data_line.keys()):
|
||||
del new_invoice_data_line['order_line_tab_inscrit_id']
|
||||
|
||||
partner_invoice_line_data_detail['tab_inscription_ids'] = work_tab
|
||||
|
||||
partner_invoice_line_data_detail['order_line_comment'] = ""
|
||||
partner_invoice_line_data_detail['invoice_header_id'] = str(inserted_invoice_id)
|
||||
partner_invoice_line_data_detail['invoice_line_type'] = "facture"
|
||||
partner_invoice_line_data_detail['invoice_header_ref_interne'] = str(invoice_ref_interne)
|
||||
|
||||
order_line_is_include_bpf = ""
|
||||
if ("order_header_inclus_bpf" in order_to_invoice_data.keys()):
|
||||
order_line_is_include_bpf = order_to_invoice_data['order_header_inclus_bpf']
|
||||
partner_invoice_line_data_detail['order_line_is_include_bpf'] = order_line_is_include_bpf
|
||||
|
||||
partner_invoice_line_data_detail['update_by'] = str(my_partner['_id'])
|
||||
partner_invoice_line_data_detail['valide'] = "1"
|
||||
partner_invoice_line_data_detail['locked'] = "0"
|
||||
partner_invoice_line_data_detail['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
|
||||
partner_invoice_line_data_detail['order_line_prix_unitaire'] = str(new_invoice_data_line['order_line_prix_unitaire'])
|
||||
partner_invoice_line_data_detail['order_line_montant_hors_taxes'] = str(new_invoice_data_line['order_line_montant_hors_taxes'])
|
||||
partner_invoice_line_data_detail['order_line_invoiced_amount'] = str(new_invoice_data_line['order_line_montant_hors_taxes'])
|
||||
partner_invoice_line_data_detail['order_line_qty'] = str( new_invoice_data_line['order_line_qty'])
|
||||
|
||||
|
||||
partner_invoice_line_data_detail['order_line_comment'] = ""
|
||||
partner_invoice_line_data_detail['invoice_header_id'] = str(inserted_invoice_id)
|
||||
partner_invoice_line_data_detail['invoice_line_type'] = "facture"
|
||||
partner_invoice_line_data_detail['invoice_header_ref_interne'] = str(invoice_ref_interne)
|
||||
|
||||
order_line_is_include_bpf = ""
|
||||
if ("order_header_inclus_bpf" in order_to_invoice_data.keys()):
|
||||
order_line_is_include_bpf = order_to_invoice_data['order_header_inclus_bpf']
|
||||
partner_invoice_line_data_detail['order_line_is_include_bpf'] = order_line_is_include_bpf
|
||||
|
||||
partner_invoice_line_data_detail['update_by'] = str(my_partner['_id'])
|
||||
partner_invoice_line_data_detail['valide'] = "1"
|
||||
partner_invoice_line_data_detail['locked'] = "0"
|
||||
partner_invoice_line_data_detail['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
print(" #### partner_invoice_line_data = ", partner_invoice_line_data_detail)
|
||||
inserted_detail_invoice_line_id = MYSY_GV.dbname['partner_invoice_line_detail'].insert_one(
|
||||
partner_invoice_line_data_detail).inserted_id
|
||||
print(" #### partner_invoice_line_data = ", partner_invoice_line_data_detail)
|
||||
inserted_detail_invoice_line_id = MYSY_GV.dbname['partner_invoice_line_detail'].insert_one(
|
||||
partner_invoice_line_data_detail).inserted_id
|
||||
|
||||
|
||||
# 3 - on met à jour les lignes de la commande, pr la mettre à facturé
|
||||
|
|
@ -824,6 +898,7 @@ def Get_Given_Partner_Invoice_Lines(diction):
|
|||
'order_line_inscription_prenom': 1,
|
||||
'order_line_inscription_email': 1,
|
||||
'order_line_inscription_civilite': 1,
|
||||
'tab_inscription_ids': 1,
|
||||
})
|
||||
tab_inscription.append(invoice_inscription_id_data)
|
||||
|
||||
|
|
@ -1192,6 +1267,7 @@ def Get_Given_Partner_Invoice_Lines_From_Invoice_ref_interne(diction):
|
|||
'order_line_inscription_prenom': 1,
|
||||
'order_line_inscription_email': 1,
|
||||
'order_line_inscription_civilite': 1,
|
||||
'tab_inscription_ids': 1,
|
||||
})
|
||||
tab_inscription.append(invoice_inscription_id_data)
|
||||
|
||||
|
|
@ -2674,6 +2750,7 @@ def GerneratePDF_Partner_Invoice(diction):
|
|||
'order_line_inscription_prenom': 1,
|
||||
'order_line_inscription_email': 1,
|
||||
'order_line_inscription_civilite': 1,
|
||||
'tab_inscription_ids': 1,
|
||||
})
|
||||
tab_inscription.append(invoice_inscription_id_data)
|
||||
|
||||
|
|
@ -3229,6 +3306,7 @@ def Send_Partner_Invoice_By_Email(tab_files, Folder, diction):
|
|||
'order_line_inscription_prenom': 1,
|
||||
'order_line_inscription_email': 1,
|
||||
'order_line_inscription_civilite': 1,
|
||||
'tab_inscription_ids': 1,
|
||||
})
|
||||
tab_inscription.append(invoice_inscription_id_data)
|
||||
|
||||
|
|
|
|||
|
|
@ -2405,7 +2405,8 @@ def Add_Update_Partner_Order_Line(diction):
|
|||
'order_line_montant_reduction', 'order_line_id', 'order_header_ref_interne',
|
||||
'order_header_id', 'order_line_status', 'order_line_type', 'order_line_comment',
|
||||
'order_line_montant_hors_taxes', 'order_line_tax_amount', 'order_line_montant_toutes_taxes',
|
||||
'order_line_type_article', 'order_line_taux_taxe', 'order_line_type_apprenant']
|
||||
'order_line_type_article', 'order_line_taux_taxe', 'order_line_type_apprenant', 'tab_inscrit_id',
|
||||
'order_line_tab_inscrit_id', 'order_line_tab_inscrit_id_json']
|
||||
|
||||
|
||||
|
||||
|
|
@ -2571,6 +2572,19 @@ def Add_Update_Partner_Order_Line(diction):
|
|||
order_line_tax = diction['order_line_tax']
|
||||
data['order_line_tax'] = order_line_tax
|
||||
|
||||
tab_inscrit_id = []
|
||||
tab_inscrit_id_work = []
|
||||
if( "order_line_tab_inscrit_id_json" in diction.keys() and diction['order_line_tab_inscrit_id_json']):
|
||||
for inscrit_data in diction['order_line_tab_inscrit_id_json']:
|
||||
tab_inscrit_id.append(inscrit_data)
|
||||
|
||||
elif ("order_line_tab_inscrit_id" in diction.keys() and diction['order_line_tab_inscrit_id']):
|
||||
tab_inscrit_id_JSON = ast.literal_eval(diction['order_line_tab_inscrit_id'])
|
||||
for inscrit_data in tab_inscrit_id_JSON:
|
||||
tab_inscrit_id.append(inscrit_data)
|
||||
|
||||
|
||||
data['order_line_tab_inscrit_id'] = tab_inscrit_id
|
||||
|
||||
order_line_taux_taxe = ""
|
||||
if ("order_line_taux_taxe" in diction.keys()):
|
||||
|
|
@ -3771,6 +3785,12 @@ def Get_Given_Partner_Order_Lines(diction):
|
|||
user['order_line_tax'] = ""
|
||||
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -3939,6 +3959,11 @@ def Get_Given_Partner_Order_Lines(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -4286,6 +4311,11 @@ def Get_Given_Partner_Order_Lines_From_order_ref_interne(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -4993,6 +5023,11 @@ def Get_Given_Line_Of_Partner_Order_Lines(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -5168,6 +5203,12 @@ def Get_Given_Line_Of_Partner_Order_Lines(diction):
|
|||
user['order_line_taux_taxe'] = "20"
|
||||
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -5691,6 +5732,11 @@ def GerneratePDF_Partner_Order(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -5861,6 +5907,11 @@ def GerneratePDF_Partner_Order(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -6213,6 +6264,11 @@ def Gernerate_Stock_PDF_Partner_Order(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -6381,6 +6437,12 @@ def Gernerate_Stock_PDF_Partner_Order(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -6710,6 +6772,12 @@ def Send_Partner_Order_By_Email(tab_files, Folder, diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -6877,6 +6945,11 @@ def Send_Partner_Order_By_Email(tab_files, Folder, diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -7511,6 +7584,11 @@ def Convert_Quotation_to_Order(diction):
|
|||
if (val in New_Order_Line.keys()):
|
||||
del New_Order_Line[val]
|
||||
|
||||
|
||||
if ("order_line_tab_inscrit_id" in New_Order_Line.keys()):
|
||||
New_Order_Line['order_line_tab_inscrit_id_json'] = New_Order_Line["order_line_tab_inscrit_id"]
|
||||
del New_Order_Line["order_line_tab_inscrit_id"]
|
||||
|
||||
print(" ### New_Order_Line = ",New_Order_Line)
|
||||
local_add_line_status, local_add_line_retval = Add_Update_Partner_Order_Line(New_Order_Line)
|
||||
|
||||
|
|
@ -8682,6 +8760,11 @@ def Send_Quotation_Remind_Level1(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
@ -8851,6 +8934,11 @@ def Send_Quotation_Remind_Level1(diction):
|
|||
else:
|
||||
user['order_line_tax'] = ""
|
||||
|
||||
if ("order_line_tab_inscrit_id" in retval.keys()):
|
||||
user['order_line_tab_inscrit_id'] = retval['order_line_tab_inscrit_id']
|
||||
else:
|
||||
user['order_line_tab_inscrit_id'] = ""
|
||||
|
||||
if ("order_line_tax_amount" in retval.keys()):
|
||||
user['order_line_tax_amount'] = retval['order_line_tax_amount']
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -4161,7 +4161,8 @@ def Check_Connexion_And_Return_Partner_Data(diction):
|
|||
return False, " Impossible de verifier la connexion"
|
||||
|
||||
"""
|
||||
Cette fonction retourne les données du partenair rattaché au user connecté
|
||||
Cette fonction retourne les données du partenair rattaché au user connecté.
|
||||
Pour cela on va aller chercher les données liées au compte admin : 'is_partner_admin_account':'1'
|
||||
"""
|
||||
def Get_Connected_User_Partner_Data_From_RecID(user_recid):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -6538,6 +6538,11 @@ def Get_RH_List_Insc_Tutore(diction):
|
|||
else:
|
||||
node_inscrit_totore['include_com'] = "0"
|
||||
|
||||
if ("comment" in insc_tutore_data.keys() ):
|
||||
node_inscrit_totore['comment'] = insc_tutore_data["comment"]
|
||||
else:
|
||||
node_inscrit_totore['comment'] = ""
|
||||
|
||||
if ("role" in insc_tutore_data.keys()):
|
||||
node_inscrit_totore['role'] = insc_tutore_data["role"]
|
||||
tuteur_label = ""
|
||||
|
|
@ -6607,7 +6612,6 @@ def Get_RH_List_Insc_Tutore(diction):
|
|||
node_inscrit_totore['date_naissance'] = inscription_data["date_naissance"]
|
||||
|
||||
|
||||
|
||||
if( "session_id" in inscription_data.keys() and ObjectId.is_valid(inscription_data['session_id']) ):
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(inscription_data['session_id'])),
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
|
|
@ -6669,7 +6673,7 @@ def Get_RH_List_Insc_Tutore(diction):
|
|||
|
||||
"""
|
||||
Cette fonction permet de modifier les données de tutorat.
|
||||
/!\ : on ne peut modiier que le role et include_com
|
||||
/!\ : on ne peut modiier que le role et include_com et comment
|
||||
"""
|
||||
def Update_RH_List_Insc_Tutore(diction):
|
||||
try:
|
||||
|
|
@ -6678,7 +6682,7 @@ def Update_RH_List_Insc_Tutore(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'rh_id', 'role', 'inscription_id', 'include_com']
|
||||
field_list = ['token', 'rh_id', 'role', 'inscription_id', 'include_com', 'comment']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -6690,7 +6694,7 @@ def Update_RH_List_Insc_Tutore(diction):
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'rh_id', 'role', 'inscription_id', 'include_com']
|
||||
field_list_obligatoire = ['token', 'rh_id', 'role', 'inscription_id', 'include_com', 'comment']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
|
|
@ -6766,6 +6770,7 @@ def Update_RH_List_Insc_Tutore(diction):
|
|||
'$set': {
|
||||
'tab_inscription_id.$[xxx].role': diction['role'],
|
||||
'tab_inscription_id.$[xxx].include_com': diction['include_com'],
|
||||
'tab_inscription_id.$[xxx].comment': diction['comment'],
|
||||
'tab_inscription_id.$[xxx].update_by':str(my_partner['_id']),
|
||||
'tab_inscription_id.$[xxx].date_update': str(datetime.now()),
|
||||
|
||||
|
|
@ -6818,7 +6823,7 @@ def Add_RH_List_Insc_Tutore(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'rh_id', 'role', 'inscription_id', 'include_com']
|
||||
field_list = ['token', 'rh_id', 'role', 'inscription_id', 'include_com', 'comment']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -6830,7 +6835,7 @@ def Add_RH_List_Insc_Tutore(diction):
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'rh_id', 'role', 'inscription_id', 'include_com']
|
||||
field_list_obligatoire = ['token', 'rh_id', 'role', 'inscription_id', 'include_com', 'comment']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
|
|
@ -6912,6 +6917,12 @@ def Add_RH_List_Insc_Tutore(diction):
|
|||
new_inscrit_totore['role'] = diction['role']
|
||||
new_inscrit_totore['include_com'] = diction['include_com']
|
||||
|
||||
if( "comment" in diction.keys()):
|
||||
new_inscrit_totore['comment'] = diction['comment']
|
||||
else:
|
||||
new_inscrit_totore['comment'] = ""
|
||||
|
||||
|
||||
new_inscrit_totore['creation_by'] = str(my_partner['_id'])
|
||||
new_inscrit_totore['date_creation'] = str(datetime.now())
|
||||
|
||||
|
|
|
|||
|
|
@ -3560,7 +3560,7 @@ def Automatic_Send_Survey_TabIds(diction):
|
|||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
#print(" ### qry 010101 = ", qry)
|
||||
print(" ### qry 010101 = ", qry)
|
||||
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(local_inscription_id)),
|
||||
'status': '1',
|
||||
|
|
|
|||
Loading…
Reference in New Issue