25/04/2025 - 15h
parent
b9f03b48fa
commit
87fc21b602
|
@ -1,10 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="29/03/2025 - 9h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="29/03/2025 - 21h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.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$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_factures_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_factures_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.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$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_access_right.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_access_right.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -75,13 +94,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00397" summary="18/09/2024 - 21h">
|
||||
<created>1726686298939</created>
|
||||
<option name="number" value="00397" />
|
||||
<option name="presentableId" value="LOCAL-00397" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1726686298939</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00398" summary="19/09/2024 - 20h">
|
||||
<created>1726770477810</created>
|
||||
<option name="number" value="00398" />
|
||||
|
@ -418,7 +430,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1743251536965</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="446" />
|
||||
<task id="LOCAL-00446" summary="29/03/2025 - 21h">
|
||||
<created>1743280368478</created>
|
||||
<option name="number" value="00446" />
|
||||
<option name="presentableId" value="LOCAL-00446" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1743280368479</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="447" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -460,7 +479,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="25/12/2024 - 14h" />
|
||||
<MESSAGE value="25/12/2024 - 22h30" />
|
||||
<MESSAGE value="sdf" />
|
||||
<MESSAGE value="sdfd" />
|
||||
|
@ -485,6 +503,7 @@
|
|||
<MESSAGE value="05/03/2025 - 18h" />
|
||||
<MESSAGE value="10/03/2025 - 13h" />
|
||||
<MESSAGE value="29/03/2025 - 9h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="29/03/2025 - 9h" />
|
||||
<MESSAGE value="29/03/2025 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="29/03/2025 - 21h" />
|
||||
</component>
|
||||
</project>
|
|
@ -55,6 +55,11 @@ Pour un ajout, sont pris en compte :
|
|||
- action_date : Date à la quelle l'action a été faite. La date doit etre au format : d/%m/%Y %H:%M:%S
|
||||
|
||||
/!\ : Il n'y pas d'update. Pour corriger un event, il faut logguer un autre event
|
||||
|
||||
|
||||
/!\ 20/04/25 : on ajoute un champ 'technical_comment' qui permet de logger des detail d'ordre technique qui permet de
|
||||
mieux logger les evenements critiques comme la modification des droits d'acces, les mots de passe, etc
|
||||
|
||||
"""
|
||||
def Add_Historique_Event(diction):
|
||||
try:
|
||||
|
@ -64,7 +69,7 @@ def Add_Historique_Event(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'related_collection', 'related_collection_recid', 'attached_doc_id', 'action_date',
|
||||
'action_description']
|
||||
'action_description', 'technical_comment']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -98,8 +103,6 @@ def Add_Historique_Event(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
# Verifier que l'action_date est bien au format: %d/%m/%Y %H:%M:%S
|
||||
if( mycommon.CheckisDate_Hours_Second(str(diction['action_date'])) is False):
|
||||
mycommon.myprint(
|
||||
|
|
|
@ -230,7 +230,7 @@ MYSY_FTP_PWD = "JvMysedrBsDMy01!+"
|
|||
|
||||
|
||||
if (MYSY_ENV == "DEM"):
|
||||
MYSY_FTP_HOST = "192.168.1.48"
|
||||
MYSY_FTP_HOST = "192.168.1.21"
|
||||
MYSY_FTP_LOGIN = "mysysftpuser"
|
||||
MYSY_FTP_PWD = "JvMysedrBsDMy01!+"
|
||||
|
||||
|
@ -253,16 +253,16 @@ INVOICE_FTP_DIRECTORY = "https://sftp.iexercice.com/mysy_invoices/"
|
|||
|
||||
|
||||
if (MYSY_ENV == "PROD"):
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices/"
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/home/mysy_data/mysy_invoices/"
|
||||
|
||||
elif (MYSY_ENV == "DEV"):
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices_dev/"
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/home/mysy_data/mysy_invoices_dev/"
|
||||
|
||||
elif (MYSY_ENV == "REC"):
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices_rec/"
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/home/mysy_data/mysy_invoices_rec/"
|
||||
|
||||
elif (MYSY_ENV == "DEM"):
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices_demo/"
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/home/mysy_data/mysy_invoices_demo/"
|
||||
|
||||
"""
|
||||
Cette Variable definit le nombre de formation associées à retourner
|
||||
|
@ -307,18 +307,27 @@ if (MYSY_ENV == "DEM"):
|
|||
|
||||
|
||||
if (MYSY_ENV == "DEV"):
|
||||
"""O365_SMTP_COUNT_password = 'GomboyaVince1234+'
|
||||
"""
|
||||
O365_SMTP_COUNT_password = 'GomboyaVince1234+'
|
||||
O365_SMTP_COUNT_smtpsrv = "smtp.office365.com"
|
||||
O365_SMTP_COUNT_user = "cbalde@mysy-training.com"
|
||||
O365_SMTP_COUNT_From_User = "cbalde@mysy-training.com"
|
||||
O365_SMTP_COUNT_port = 587"""
|
||||
|
||||
O365_SMTP_COUNT_port = 587
|
||||
"""
|
||||
"""
|
||||
O365_SMTP_COUNT_password = 'Sod78!526+'
|
||||
O365_SMTP_COUNT_smtpsrv = "smtp.office365.com"
|
||||
O365_SMTP_COUNT_user = "communication@mysytraining.fr"
|
||||
O365_SMTP_COUNT_From_User = "communication@mysytraining.fr"
|
||||
O365_SMTP_COUNT_port = 587
|
||||
"""
|
||||
|
||||
# Tester le relay smtp perso (maison)
|
||||
O365_SMTP_COUNT_password = 'cherif'
|
||||
O365_SMTP_COUNT_smtpsrv = "srvdmz.iexercice.com"
|
||||
O365_SMTP_COUNT_user = "clientmail-vm2"
|
||||
O365_SMTP_COUNT_From_User = "clientmail-vm2@iexercice.com"
|
||||
O365_SMTP_COUNT_port = 587
|
||||
|
||||
|
||||
|
||||
|
@ -500,7 +509,7 @@ elif (MYSY_ENV == "REC"):
|
|||
elif (MYSY_ENV == "DEM"):
|
||||
MYSY_MARIADB_USER = "mysy_mariadb_user"
|
||||
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
|
||||
MYSY_MARIADB_HOST = "192.168.1.48"
|
||||
MYSY_MARIADB_HOST = "192.168.1.21"
|
||||
MYSY_MARIADB_PORT = 3306
|
||||
MYSY_LMS_BDD = "mysy_db_chamilo_rec"
|
||||
MYSY_LMS_URL = "https://demolms.mysy-training.com/"
|
||||
|
|
|
@ -3190,6 +3190,10 @@ Si cette fonction est ok, alors on lance la fonction d'import.
|
|||
|
||||
Elle fera a peu pret les meme controle qui existe dans la fonction d'import actuelle.
|
||||
|
||||
18/04/25 :
|
||||
dans les arguments, 'session_id' sera fourni en option. Si cette dernière est fourni, alors il faudrait
|
||||
obligatoirement s'assurer que le conteu du fichier excel correspond exclusivement a cette session
|
||||
|
||||
"""
|
||||
def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=None):
|
||||
try:
|
||||
|
@ -3202,7 +3206,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['token',]
|
||||
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:
|
||||
|
@ -3238,6 +3242,30 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
|
|||
return False, " Les information de connexion sont incorrectes. Impossible d'importer la liste des participants"
|
||||
|
||||
|
||||
"""
|
||||
Si le champ 'session_id' est fourni, alors il faut s'assurer que l'import ne se fait exclusivement
|
||||
pour la session indiquée
|
||||
"""
|
||||
|
||||
local_session_id = None
|
||||
local_session_id_data = None
|
||||
|
||||
if( "session_id"in diction.keys() and diction['session_id']):
|
||||
local_session_id = diction['session_id']
|
||||
local_session_id_count = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(local_session_id)),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':partner_recid})
|
||||
|
||||
if( local_session_id_count != 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " L'identifiant de la session de formation est invalide ")
|
||||
return False, " L'identifiant de la session de formation est invalide"
|
||||
|
||||
local_session_id_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(local_session_id)),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': partner_recid})
|
||||
|
||||
|
||||
|
||||
status, saved_file = mycommon.Upload_Save_CSV_File(file, Folder)
|
||||
|
@ -3315,6 +3343,19 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
|
|||
"""
|
||||
x = range(0, total_rows)
|
||||
for n in x:
|
||||
|
||||
"""
|
||||
18/04/25 :
|
||||
dans les arguments, 'session_id' sera fourni en option. Si cette dernière est fourni, alors il faudrait
|
||||
obligatoirement s'assurer que le conteu du fichier excel correspond exclusivement a cette session
|
||||
"""
|
||||
if( local_session_id_data and "code_session" in local_session_id_data.keys() ):
|
||||
if( str(local_session_id_data['code_session']).lower() != str(df['code_session'].values[n]).lower() ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Ligne " + str(n + 2) + " : Le code session '"+str(df['code_session'].values[n]) +"' ne correspond pas à la session selectionnée : '"+str(local_session_id_data['code_session'])+"' ")
|
||||
return False, " Ligne " + str(n + 2) + " : Le code session '"+str(df['code_session'].values[n]) +"' ne correspond pas à la session selectionnée : '"+str(local_session_id_data['code_session'])+"' "
|
||||
|
||||
|
||||
mydata = {}
|
||||
class_external_code = str(df['formation_code_externe'].values[n])
|
||||
#mydata['code_session'] = str(df['code_session'].values[n])
|
||||
|
@ -3345,7 +3386,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
|
|||
- partner_owner_recid
|
||||
"""
|
||||
qry = {'external_code':str(class_external_code), 'valide':'1', 'locked':'0', 'partner_owner_recid':str(partner_recid)}
|
||||
print(" ### qry = ", qry)
|
||||
|
||||
myclass_data_count = MYSY_GV.dbname['myclass'].count_documents({'external_code':str(class_external_code), 'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':str(partner_recid)})
|
||||
|
||||
|
@ -3363,7 +3404,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
|
|||
mysession_count_qry = {'class_internal_url': str(myclass_data['internal_url']), 'valide': '1',
|
||||
'partner_owner_recid': str(partner_recid), 'code_session':str(df['code_session'].values[n]) }
|
||||
|
||||
print(" ### mysession_count_qry = ", qry)
|
||||
|
||||
|
||||
mysession_count = MYSY_GV.dbname['session_formation'].count_documents(mysession_count_qry)
|
||||
|
||||
|
@ -3638,7 +3679,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['token',]
|
||||
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:
|
||||
|
|
131
Job_Cron.py
131
Job_Cron.py
|
@ -1190,6 +1190,14 @@ def Cron_Daily_Automatic_Qualiopi_Documents():
|
|||
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')
|
||||
|
||||
|
||||
|
||||
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') = ",
|
||||
|
@ -1203,7 +1211,7 @@ def Cron_Daily_Automatic_Qualiopi_Documents():
|
|||
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')):
|
||||
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][
|
||||
|
@ -1282,37 +1290,45 @@ def Cron_Daily_Automatic_Qualiopi_Documents():
|
|||
|
||||
"""
|
||||
Mettre à jour le document
|
||||
"""
|
||||
|
||||
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 ):
|
||||
print(" #### local_update.matched_count = ", local_update.matched_count)
|
||||
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']))
|
||||
/!\ 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']))
|
||||
|
@ -1321,8 +1337,6 @@ def Cron_Daily_Automatic_Qualiopi_Documents():
|
|||
|
||||
diction_for_notification_email['token'] = str(my_partner['token'])
|
||||
|
||||
print("### diction_for_notification_email == ", diction_for_notification_email)
|
||||
|
||||
local_status, local_retval = Job_Cron_Common.Cron_Qualiopi_Automatic_Traitement_Notification(diction_for_notification_email)
|
||||
|
||||
return True, "OK"
|
||||
|
@ -1415,7 +1429,6 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
|
||||
local_convoc_status, local_convoc_retval = Cron_Session_Convocation_Sending(local_diction_convocation_by_email)
|
||||
|
||||
|
||||
elif ( str(diction['document_ref_intern']) == 'QUESTION_POSITIONNEMENT' ):
|
||||
"""
|
||||
1 - Aller chercher le formulaire (type = questionnaire de positionnement ) par defaut
|
||||
|
@ -1463,7 +1476,6 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
if (local_status_send is False):
|
||||
return local_status_send, local_retval_send
|
||||
|
||||
|
||||
elif ( str(diction['document_ref_intern']) == 'EVAL_FORMATION' ):
|
||||
|
||||
"""
|
||||
|
@ -1615,7 +1627,6 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
if (local_status_init is False):
|
||||
return local_status_init, local_retval_init
|
||||
|
||||
|
||||
elif ( str(diction['document_ref_intern']) == 'ATTESTATION_FORMATION' ):
|
||||
print(" ### Debut Initialisation les attestations de formation ")
|
||||
# 1 Recuperer le modele d'attestation par défaut
|
||||
|
@ -1661,6 +1672,54 @@ def Send_document_from_base_document_automatic_setup(diction):
|
|||
if (local_status_send_attestation is False):
|
||||
return local_status_send_attestation, local_retval_send_attesation
|
||||
|
||||
elif ( str(diction['document_ref_intern']) == 'EMARGEMENT_FORMATION' ):
|
||||
# 1 Recuperer le modele d'attestation par défaut
|
||||
|
||||
local_diction = {}
|
||||
local_diction['ref_interne'] = "EMARGEMENT_FORMATION"
|
||||
local_diction['type_doc'] = "email"
|
||||
local_diction['partner_owner_recid'] = str(diction['partner_owner_recid'])
|
||||
local_diction['default_version'] = "1"
|
||||
|
||||
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(
|
||||
local_diction)
|
||||
if (courrier_data_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible de récuperer le modèle de courrier 'EMARGEMENT_FORMATION', (type : Email) ")
|
||||
return False, " Impossible de récuperer le modèle de courrier 'EMARGEMENT_FORMATION', (type : Email) "
|
||||
|
||||
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le modèle de courrier 'EMARGEMENT_FORMATION', (type : Email) n'est pas correctement configuré ")
|
||||
return False, " Le modèle de courrier 'EMARGEMENT_FORMATION', (type : Email) n'est pas correctement configuré"
|
||||
|
||||
|
||||
init_diction = {}
|
||||
init_diction['token'] = my_partner['token']
|
||||
init_diction['session_id'] = diction['session_id']
|
||||
init_diction['courrier_template_id'] = courrier_data_retval['_id']
|
||||
|
||||
local_status_init, local_retval_init = Job_Cron_Common.Cron_Init_Emargement_By_Date_With_Template(
|
||||
init_diction)
|
||||
|
||||
if (local_status_init is False):
|
||||
return local_status_init, local_retval_init
|
||||
|
||||
init_diction['email_test'] = ""
|
||||
init_diction['email_production'] = ""
|
||||
local_status_send_attestation, local_retval_send_attesation, nb_emargment_traite = Job_Cron_Common.Cron_Send_Emargement_By_Date_By_Email_for_not_sent(
|
||||
MYSY_GV.upload_folder, init_diction)
|
||||
|
||||
if (local_status_send_attestation is False):
|
||||
return local_status_send_attestation, local_retval_send_attesation
|
||||
|
||||
if( nb_emargment_traite == "0"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " WARNING : Aucune demande d'émargement envoyé. Verifier les données ")
|
||||
|
||||
|
||||
return True, "OK Documents "
|
||||
except Exception as e:
|
||||
|
|
|
@ -359,8 +359,6 @@ def Prepare_and_Send_Convocation_From_Session_By_PDF(diction):
|
|||
'target_collection_recid':str(val['_id']),
|
||||
'courrier_template_id':diction['courrier_template_id']}
|
||||
|
||||
print(" ### qry_courrier_template_tracking_history = ", qry_courrier_template_tracking_history)
|
||||
|
||||
is_convocation_already_sent_count = MYSY_GV.dbname['courrier_template_tracking_history'].count_documents(
|
||||
{'partner_owner_recid':str(my_partner['recid']),
|
||||
'courrier_template_tracking_id':str(courrier_template_tracking_data['_id']),
|
||||
|
@ -2078,7 +2076,7 @@ def Cron_Send_Attestation_From_Session_By_Email_for_not_sent(Folder, diction):
|
|||
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'envoyer les conventions par email "
|
||||
return False, " Impossible d'envoyer les attestations par email "
|
||||
|
||||
|
||||
"""
|
||||
|
@ -2731,3 +2729,278 @@ def Cron_Qualiopi_Automatic_Traitement_Notification(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 l'email de notification du traitement automatique"
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
CRON :
|
||||
Initialisation de la liste des emargements pour la paire inscrits / Sequence du jour pour lesquels aucune initialisation n'a pas déja été faite
|
||||
n'a ete faite.
|
||||
|
||||
Important :
|
||||
Dans le cas précis des emargements, on prend en compte le couple Inscrit / Sequence du jour .
|
||||
|
||||
Alog :
|
||||
Le systeme va aller chercher les sequences du jour pour la session de formation
|
||||
|
||||
"""
|
||||
def Cron_Init_Emargement_By_Date_With_Template(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'courrier_template_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', 'courrier_template_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 liste ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# Verifier la valididé du model de courrier
|
||||
is_courrier_valide = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||
{'_id': ObjectId(str(diction['courrier_template_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'default_version': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_courrier_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le modèle de courrier '" + str(
|
||||
diction['courrier_template_id']) + "' n'est pas valide ")
|
||||
return False, " Le modèle de courrier '" + str(diction['courrier_template_id']) + "' n'est pas valide "
|
||||
|
||||
# A présent les inscriptions sont ok, le modele de courrier ok, on peut proceder à l'initialisation des attestations
|
||||
warning_message = " WARNING : "
|
||||
is_warning_message = 0
|
||||
is_courrier_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'_id': ObjectId(str(diction['courrier_template_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
cpt = 0
|
||||
|
||||
"""
|
||||
/!\ Cas particulier des émargements
|
||||
Ici, on va aller chercher les séquences du jour
|
||||
"""
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
|
||||
for session_sequence in MYSY_GV.dbname["session_formation_sequence"].find({"session_id":str(diction["session_id"]),
|
||||
'valide':'1',
|
||||
'locked':'0'}):
|
||||
|
||||
|
||||
if( "sequence_start" in session_sequence.keys() ):
|
||||
date_debut_sequence = str(session_sequence['sequence_start'])[0:10]
|
||||
local_status = mycommon.CheckisDate(date_debut_sequence)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de debut de séquence " + str(
|
||||
date_debut_sequence) + " n'est pas au format 'jj/mm/aaaa' ")
|
||||
return False, " La date de debut de session " + str(
|
||||
date_debut_sequence) + " n'est pas au format 'jj/mm/aaaa' "
|
||||
|
||||
#print(" ### session_sequence cmp de str(todays_date) = ", str(todays_date), " ET str(date_debut_sequence) = ", str(date_debut_sequence) )
|
||||
if( str(todays_date) == str(date_debut_sequence)):
|
||||
|
||||
# Vu qu'il y a une séquence ce jour, on va aller faire le traitement pour chaque inscrit
|
||||
|
||||
for my_inscription in MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])}):
|
||||
|
||||
"""
|
||||
01/03/2025 : Regarder si cet inscrit a déjà une initialisation d'emargement faite pour la meme séquence
|
||||
|
||||
"""
|
||||
is_init_emargement_for_today_date_exist_count = MYSY_GV.dbname['emargement'].count_documents(
|
||||
{'inscription_id':str(my_inscription['_id']),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'session_id':str(diction['session_id']),
|
||||
'date': str(todays_date),
|
||||
'sequence_start': str(session_sequence['sequence_start']),
|
||||
'sequence_end': str(session_sequence['sequence_end']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
|
||||
if( is_init_emargement_for_today_date_exist_count == 0 ):
|
||||
|
||||
# Aucune attestation (ni initialisée, ni envoyé), on peut donc initialiser l'attestation
|
||||
# On fait volontairement un update pour pallier tout eventuel pb.
|
||||
query_key = {}
|
||||
query_key['email'] = my_inscription['email']
|
||||
query_key['session_id'] = my_inscription['session_id']
|
||||
query_key['class_internal_url'] = my_inscription['class_internal_url']
|
||||
|
||||
query_key['date'] = str(todays_date)
|
||||
query_key['sequence_start'] = str(session_sequence['sequence_start'])
|
||||
query_key['sequence_end'] = str(session_sequence['sequence_end'])
|
||||
|
||||
|
||||
new_my_local_data = {}
|
||||
new_my_local_data['inscription_id'] = str(my_inscription['_id'])
|
||||
new_my_local_data['email'] = my_inscription['email']
|
||||
new_my_local_data['nom'] = my_inscription['nom']
|
||||
new_my_local_data['prenom'] = my_inscription['prenom']
|
||||
new_my_local_data['session_id'] = my_inscription['session_id']
|
||||
new_my_local_data['class_internal_url'] = my_inscription['class_internal_url']
|
||||
new_my_local_data['date_update'] = str(datetime.now())
|
||||
new_my_local_data['is_present'] = False
|
||||
new_my_local_data['matin'] = False
|
||||
new_my_local_data['apresmidi'] = False
|
||||
|
||||
new_my_local_data['statut'] = "0"
|
||||
new_my_local_data['date_envoi'] = ""
|
||||
|
||||
new_my_local_data['date_update'] = str(datetime.now())
|
||||
new_my_local_data['update_by'] = str(my_partner['recid'])
|
||||
new_my_local_data['valide'] = "1"
|
||||
new_my_local_data['locked'] = "0"
|
||||
new_my_local_data['date'] = str(todays_date)
|
||||
|
||||
new_my_local_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
ret_val2 = MYSY_GV.dbname['emargement'].find_one_and_update(
|
||||
query_key,
|
||||
{"$set": new_my_local_data},
|
||||
upsert=True,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
if (ret_val2 is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - WARNING : Impossible d'initialiser l'émargement pour l'inscription : "+str(my_inscription['_id'])+" pour la date du "+str(todays_date))
|
||||
warning_message = warning_message +" Impossible d'initialiser émargement pour l'inscription : "+str(my_inscription['_id']) +" pour la date du "+str(todays_date) +" - "
|
||||
is_warning_message = 1
|
||||
else:
|
||||
cpt = cpt +1
|
||||
|
||||
|
||||
if( is_warning_message == 1 ):
|
||||
return True, str(cpt) + " Emargement(s) initialisé(s) : "+str(warning_message)
|
||||
|
||||
return True, str(cpt)+" Emargement(s) initialisé(s) "
|
||||
|
||||
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'initialiser les émargement"
|
||||
|
||||
|
||||
"""
|
||||
CRON :
|
||||
Cette fonction prepare et envoi les demandes d'émargement du JOUR qui n'ont pas déjà été envoyées
|
||||
|
||||
/!\ : On envoie uniquement les demandes d'émargement du jours
|
||||
"""
|
||||
def Cron_Send_Emargement_By_Date_By_Email_for_not_sent(Folder, diction):
|
||||
try:
|
||||
|
||||
field_list_obligatoire = ['token', 'session_id', 'email_test', 'email_production',]
|
||||
|
||||
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 liste ")
|
||||
return False, " La valeur '" + val + "' n'est pas presente dans liste"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_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 la session est valide
|
||||
is_session_valide = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'_id': ObjectId(str(diction['session_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_session_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
|
||||
"""
|
||||
/!\ Cas particulier des émargements
|
||||
Ici, on envoyer uniquement les emargement du jour
|
||||
"""
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
tab_emargement_ids = []
|
||||
|
||||
is_warning_message = "0"
|
||||
warning_message = "Les demandes d'émargement ont été correctement envoyées par emails avec l'attention suivante : "
|
||||
|
||||
|
||||
# Recuperer la liste des emargement à envoyer pour le jour = str(todays_date)
|
||||
for emargement_data in MYSY_GV.dbname['emargement'].find({"session_id":str(diction['session_id']),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':"1",
|
||||
"locked":'0',
|
||||
'statut':'0',
|
||||
"date":str(todays_date)
|
||||
}):
|
||||
tab_emargement_ids.append(str(emargement_data['_id']))
|
||||
|
||||
if(len(tab_emargement_ids) > 0 ):
|
||||
tab_emargement_ids_str = ",".join(tab_emargement_ids)
|
||||
local_payload = {}
|
||||
local_payload['token'] = str(diction['token'])
|
||||
local_payload['tab_emargement_ids'] = str(tab_emargement_ids_str)
|
||||
local_payload['session_id'] = str(diction['session_id'])
|
||||
|
||||
|
||||
status, retval = Inscription_mgt.Create_Emargement_Send_Email_From_Inscription(local_payload)
|
||||
|
||||
if( status is False ):
|
||||
warning_message = str(retval)
|
||||
is_warning_message = "1"
|
||||
|
||||
|
||||
if (is_warning_message == "1"):
|
||||
return True, str(warning_message)
|
||||
|
||||
return True, "Les demandes d'émargement envoyées par emails", str(len(tab_emargement_ids))
|
||||
|
||||
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'envoyer les demandes d'émargement "
|
||||
|
|
30140
Log/log_file.log
30140
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -63,7 +63,7 @@ def Add_Update_SessionFormation(diction):
|
|||
'class_internal_url', 'session_status', 'date_debut_inscription', 'date_fin_inscription',
|
||||
'attestation_certif', "distantiel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'session_ondemande', 'source', 'session_id', 'session_etape', 'pays', 'formateur_id',
|
||||
'titre', 'location_type', 'is_bpf', 'site_formation_id', 'price_by']
|
||||
'titre', 'location_type', 'is_bpf', 'site_formation_id', 'price_by', 'mode_animation']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -165,6 +165,17 @@ def Add_Update_SessionFormation(diction):
|
|||
else:
|
||||
mydata['presentiel'] = "0"
|
||||
|
||||
"""
|
||||
Pour le mode d'animation d'une session de formation, on a :
|
||||
0 => Présentiel
|
||||
1 => Distanciel
|
||||
2 => Hybride
|
||||
"""
|
||||
if ("mode_animation" in diction.keys() and diction['mode_animation'] in ['0', '1', '2']):
|
||||
mydata['mode_animation'] = str(diction['mode_animation'])
|
||||
else:
|
||||
mydata['mode_animation'] = "0"
|
||||
|
||||
|
||||
if ("session_ondemande" in diction.keys()):
|
||||
mydata['session_ondemande'] = str(mycommon.tryInt(str(diction['session_ondemande'])))
|
||||
|
@ -526,8 +537,10 @@ 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'] = []
|
||||
|
||||
qry_automatic_setup = {'collection_target':'session_formation',
|
||||
|
@ -543,7 +556,7 @@ def Add_Update_SessionFormation(diction):
|
|||
|
||||
mydata['automatic_traitement'].append(new_local_data)
|
||||
|
||||
#print(" ### mydata = ", mydata)
|
||||
#print(" ### mydata ICIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII = ", mydata)
|
||||
coll_name = MYSY_GV.dbname['session_formation']
|
||||
ret_val = coll_name.insert_one(mydata)
|
||||
|
||||
|
@ -1338,7 +1351,7 @@ def GetActiveSession_Cities_And_Distance_Formation_List(diction):
|
|||
liste_session_cities.append(str(retval['ville']))
|
||||
RetObject.append(mycommon.JSONEncoder().encode(str(retval['ville'])))
|
||||
|
||||
elif( "distantiel" in retval.keys() and str(retval['distantiel']) == "1"):
|
||||
elif( "mode_animation" in retval.keys() and str(retval['mode_animation']) == "1"):
|
||||
if ( "A Distance" not in liste_session_cities):
|
||||
liste_session_cities.append("A Distance")
|
||||
RetObject.append(mycommon.JSONEncoder().encode("A Distance"))
|
||||
|
@ -1529,6 +1542,11 @@ def GetAllValideSessionPartner_List(diction):
|
|||
val['date_fin_inscription'] = retVal['date_fin_inscription'][0:10]
|
||||
|
||||
val['distantiel'] = retVal['distantiel']
|
||||
if( "mode_animation" in retVal.keys() ):
|
||||
val['mode_animation'] = retVal['mode_animation']
|
||||
else:
|
||||
val['mode_animation'] = "0"
|
||||
|
||||
|
||||
site_formation_id = ""
|
||||
site_formation_code = ""
|
||||
|
@ -1892,6 +1910,11 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("mode_animation" in retVal.keys()):
|
||||
val['mode_animation'] = retVal['mode_animation']
|
||||
else:
|
||||
val['mode_animation'] = "0"
|
||||
|
||||
site_formation_id = ""
|
||||
site_formation_code = ""
|
||||
if ("site_formation_id" in retVal.keys() and retVal['site_formation_id']):
|
||||
|
@ -2238,6 +2261,11 @@ def GetAllValideSessionPartner_List_no_filter(diction):
|
|||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("mode_animation" in retVal.keys()):
|
||||
val['mode_animation'] = retVal['mode_animation']
|
||||
else:
|
||||
val['mode_animation'] = "0"
|
||||
|
||||
|
||||
if ("formateur_id" in retVal.keys() and retVal['formateur_id']):
|
||||
val['formateur_id'] = retVal['formateur_id']
|
||||
|
@ -2506,7 +2534,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
'''
|
||||
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville', 'pays',
|
||||
'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation', 'formateur',
|
||||
'code_session', "distanciel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'code_session', "distanciel", "presentiel", "mode_animation", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'session_ondemande', 'session_etape', 'formation_code_externe', 'formateur_email', 'titre', 'location_type', 'is_bpf']
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
|
@ -2742,6 +2770,20 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
|
||||
mydata['presentiel'] = presentiel
|
||||
|
||||
mode_animation = ""
|
||||
if ("mode_animation" in df.keys()):
|
||||
if (str(df['mode_animation'].values[n])):
|
||||
mode_animation = str(df['mode_animation'].values[n]).strip()
|
||||
mode_animation = str(mycommon.tryInt(mode_animation))
|
||||
if (mode_animation != "1" and mode_animation != "0" and mode_animation != "2"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte.")
|
||||
return False, " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte. Les valeurs acceptées sont '0', '1', ou '2' ou vide"
|
||||
|
||||
mydata['mode_animation'] = mode_animation
|
||||
|
||||
#mydata['code_postal'] = str(df['code_postal'].values[n]).strip()
|
||||
|
||||
local_ville = ""
|
||||
|
@ -2966,7 +3008,7 @@ def Controle_Add_Update_SessionFormation_mass(saved_file=None, Folder=None, dict
|
|||
'''
|
||||
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville', 'pays',
|
||||
'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation',
|
||||
'code_session', "distanciel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'code_session', "distanciel", "presentiel", "mode_animation", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'session_ondemande', 'session_etape', 'formation_code_externe','formateur_email', 'titre', 'location_type', 'is_bpf']
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
|
@ -3264,6 +3306,23 @@ def Controle_Add_Update_SessionFormation_mass(saved_file=None, Folder=None, dict
|
|||
|
||||
mydata['presentiel'] = presentiel
|
||||
|
||||
mydata['presentiel'] = presentiel
|
||||
|
||||
mode_animation = ""
|
||||
if ("mode_animation" in df.keys()):
|
||||
if (str(df['mode_animation'].values[n])):
|
||||
mode_animation = str(df['mode_animation'].values[n]).strip()
|
||||
mode_animation = str(mycommon.tryInt(mode_animation))
|
||||
if (mode_animation != "1" and mode_animation != "0" and mode_animation != "2"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte.")
|
||||
return False, " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte. Les valeurs acceptées sont '0', '1', ou '2' ou vide"
|
||||
|
||||
mydata['mode_animation'] = mode_animation
|
||||
|
||||
|
||||
# mydata['code_postal'] = str(df['code_postal'].values[n]).strip()
|
||||
|
||||
local_ville = ""
|
||||
|
@ -3389,6 +3448,7 @@ import des sessions de formation en masse
|
|||
pour plusieurs formation.
|
||||
|
||||
Cela veut dire qu'on fourni 'external_code' pour chaque ligne du fichier excel, mais on ne fourni pas de 'internal_url'
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
@ -3401,7 +3461,7 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['token', ]
|
||||
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:
|
||||
|
@ -3451,6 +3511,27 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
# print(" Lecture du fichier : "+saved_file)
|
||||
nb_line = 0
|
||||
|
||||
exclusive_session_id = ""
|
||||
exclusive_session_id_data = None
|
||||
|
||||
if( "session_id" in diction.keys() and diction['session_id']):
|
||||
exclusive_session_id = str(diction['session_id'])
|
||||
exclusive_session_id_count = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(exclusive_session_id)),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(partner_recid)})
|
||||
|
||||
if(exclusive_session_id_count != "1" ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
|
||||
exclusive_session_id_data = MYSY_GV.dbname['session_formation'].find_one(
|
||||
{'_id': ObjectId(str(exclusive_session_id)),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(partner_recid)})
|
||||
|
||||
|
||||
|
||||
""""
|
||||
update du 31/08/23 : Controle de l'integrité du fichier avant import
|
||||
"""
|
||||
|
@ -3475,7 +3556,7 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
'''
|
||||
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville', 'pays',
|
||||
'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation',
|
||||
'code_session', "distanciel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'code_session', "distanciel", "presentiel", "mode_animation", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'session_ondemande', 'session_etape', 'formation_code_externe', 'formateur_email', 'titre', 'location_type', 'is_bpf']
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
|
@ -3525,6 +3606,9 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
nb_inserted_line = nb_inserted_line - 1
|
||||
continue
|
||||
|
||||
|
||||
|
||||
|
||||
mydata['date_debut'] = str(df['date_debut'].values[n]).strip().split(" ")[0]
|
||||
local_status = mycommon.CheckisDate(mydata['date_debut'])
|
||||
if (local_status is False):
|
||||
|
@ -3764,6 +3848,22 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
|
||||
mydata['presentiel'] = presentiel
|
||||
|
||||
mydata['presentiel'] = presentiel
|
||||
|
||||
mode_animation = ""
|
||||
if ("mode_animation" in df.keys()):
|
||||
if (str(df['mode_animation'].values[n])):
|
||||
mode_animation = str(df['mode_animation'].values[n]).strip()
|
||||
mode_animation = str(mycommon.tryInt(mode_animation))
|
||||
if (mode_animation != "1" and mode_animation != "0" and mode_animation != "2"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte.")
|
||||
return False, " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte. Les valeurs acceptées sont '0', '1', ou '2' ou vide"
|
||||
|
||||
mydata['mode_animation'] = mode_animation
|
||||
|
||||
# mydata['code_postal'] = str(df['code_postal'].values[n]).strip()
|
||||
|
||||
local_ville = ""
|
||||
|
@ -3981,7 +4081,7 @@ def Controle_Add_Update_SessionFormation_mass_for_many_class(saved_file=None, Fo
|
|||
'''
|
||||
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville', 'pays',
|
||||
'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation',
|
||||
'code_session', "distanciel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'code_session', "distanciel", "presentiel", "mode_animation", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'session_ondemande', 'session_etape', 'formation_code_externe', 'formateur_email', 'titre', 'location_type', 'is_bpf']
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
|
@ -4273,6 +4373,22 @@ def Controle_Add_Update_SessionFormation_mass_for_many_class(saved_file=None, Fo
|
|||
|
||||
mydata['presentiel'] = presentiel
|
||||
|
||||
mydata['presentiel'] = presentiel
|
||||
|
||||
mode_animation = ""
|
||||
if ("mode_animation" in df.keys()):
|
||||
if (str(df['mode_animation'].values[n])):
|
||||
mode_animation = str(df['mode_animation'].values[n]).strip()
|
||||
mode_animation = str(mycommon.tryInt(mode_animation))
|
||||
if (mode_animation != "1" and mode_animation != "0" and mode_animation != "2"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte.")
|
||||
return False, " Le champ 'mode_animation' de la ligne " + str(
|
||||
n + 2) + " est incorrecte. Les valeurs acceptées sont '0', '1', ou '2' ou vide"
|
||||
|
||||
mydata['mode_animation'] = mode_animation
|
||||
|
||||
# mydata['code_postal'] = str(df['code_postal'].values[n]).strip()
|
||||
|
||||
local_ville = ""
|
||||
|
@ -4654,7 +4770,7 @@ Cette fonction verifier des données correspondent à une session :
|
|||
def Is_Corresponding_SessionFormation(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token', 'class_url', 'date_debut','date_fin', 'distantiel', 'ville' ]
|
||||
field_list = ['token', 'class_url', 'date_debut','date_fin', 'distantiel', 'mode_animation', 'ville' ]
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
@ -4665,7 +4781,7 @@ def Is_Corresponding_SessionFormation(diction):
|
|||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'class_url', 'date_debut','date_fin', 'distantiel', 'ville' ]
|
||||
field_list_obligatoire = ['token', 'class_url', 'date_debut','date_fin', 'distantiel', 'mode_animation', 'ville' ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
|
@ -4729,7 +4845,7 @@ def Is_Corresponding_SessionFormation(diction):
|
|||
nb_val = 0
|
||||
for retval in coll_session.aggregate(myquery):
|
||||
#print(" ##### Is_Corresponding_SessionFormation retval a controle = " + str(retval))
|
||||
if (retval['distantiel'] == diction['distantiel'] and str(retval['date_debut'][0:10]) == diction[
|
||||
if (retval['mode_animation'] == diction['mode_animation'] and str(retval['date_debut'][0:10]) == diction[
|
||||
'date_debut']
|
||||
and str(retval['date_fin'][0:10]) == diction['date_fin'] and retval['ville'] == diction['ville']):
|
||||
user = {}
|
||||
|
@ -14108,7 +14224,7 @@ def Add_SessionFormation_From_Quotation_Line(diction):
|
|||
field_list = ['token', 'date_debut', 'date_fin', 'nb_participant', 'adresse',
|
||||
'code_postal', 'ville', 'code_session',
|
||||
'class_id', 'session_status', 'date_debut_inscription', 'date_fin_inscription',
|
||||
'attestation_certif', "distantiel", "presentiel", "prix_session", 'contenu_ftion',
|
||||
'attestation_certif', "distantiel", "presentiel", "mode_animation", "prix_session", 'contenu_ftion',
|
||||
'lms_class_code',
|
||||
'session_ondemande', 'source', 'session_etape', 'pays', 'formateur_id',
|
||||
'titre', 'location_type', 'is_bpf', 'site_formation_id', 'price_by',
|
||||
|
@ -14211,6 +14327,9 @@ def Add_SessionFormation_From_Quotation_Line(diction):
|
|||
mydata['presentiel'] = "0"
|
||||
mydata['is_bpf'] = "0"
|
||||
|
||||
mydata['mode_animation'] = "0"
|
||||
|
||||
|
||||
mydata['date_debut_inscription'] = str(mydata['date_debut'])
|
||||
mydata['date_fin_inscription'] = str(mydata['date_fin'])
|
||||
|
||||
|
@ -14422,7 +14541,7 @@ def Update_SessionFormation_Doc_Automatic_Setup(diction):
|
|||
return False, " Le status (actif/inactif) est invalide "
|
||||
|
||||
action_target_date = diction['action_target_date']
|
||||
if (action_target_date not in ['start_session', 'end_session']):
|
||||
if (action_target_date not in ['start_session', 'end_session', 'every_session_sequence_day']):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " La valeur du champ 'action_target_date' est invalide ")
|
||||
|
@ -14628,23 +14747,53 @@ def Get_Given_SessionFormation_List_Automatic_Traitement_From(diction):
|
|||
# On log une erreur, et on continue le traitement dans la boucle.
|
||||
continue
|
||||
|
||||
my_delta = ""
|
||||
new_data = automatic_traitement_data
|
||||
if (automatic_traitement_data['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"))
|
||||
|
||||
my_delta = local_session_target_date_added_nb_jour_action - datetime.strptime(
|
||||
str(todays_date).strip(), '%d/%m/%Y')
|
||||
|
||||
new_data['delta_day'] = str(my_delta.days)
|
||||
|
||||
|
||||
elif (automatic_traitement_data['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"))
|
||||
|
||||
my_delta = local_session_target_date_added_nb_jour_action - datetime.strptime(str(todays_date).strip(), '%d/%m/%Y')
|
||||
my_delta = local_session_target_date_added_nb_jour_action - datetime.strptime(str(todays_date).strip(), '%d/%m/%Y')
|
||||
|
||||
new_data['delta_day'] = str(my_delta.days)
|
||||
|
||||
|
||||
elif (automatic_traitement_data['action_target_date'] == "every_session_sequence_day"):
|
||||
|
||||
local_session_target_date_added_nb_jour_action = local_session_start_date
|
||||
local_session_target_date_added_nb_jour_action_formated = str(local_session_target_date_added_nb_jour_action.strftime("%d/%m/%Y"))
|
||||
|
||||
my_delta = local_session_target_date_added_nb_jour_action - datetime.strptime(str(todays_date).strip(), '%d/%m/%Y')
|
||||
|
||||
if( local_session_start_date <= datetime.strptime( str(todays_date).strip(), '%d/%m/%Y') <= local_session_end_date):
|
||||
new_data['delta_day'] = "0"
|
||||
|
||||
elif ( datetime.strptime( str(todays_date).strip(), '%d/%m/%Y') < local_session_start_date ):
|
||||
# /!\ Pr calculer le my_delta, on prend tjours par rapport au début de session, toujours toujours, car c'est à ce moment que le cron devrait tourner la 1ere fois
|
||||
my_delta = local_session_start_date - datetime.strptime( str(todays_date).strip(), '%d/%m/%Y')
|
||||
new_data['delta_day'] = str(my_delta.days)
|
||||
|
||||
elif (datetime.strptime( str(todays_date).strip(), '%d/%m/%Y') > local_session_end_date ):
|
||||
# /!\ Pr calculer le my_delta, on prend tjours par rapport au début de session, toujours toujours, car c'est à ce moment que le cron devrait tourner la 1ere fois
|
||||
my_delta = local_session_start_date - datetime.strptime( str(todays_date).strip(), '%d/%m/%Y')
|
||||
new_data['delta_day'] = str(my_delta.days)
|
||||
|
||||
|
||||
new_data = automatic_traitement_data
|
||||
new_data['delta_day'] = str(my_delta.days)
|
||||
tab_local_automatic_traitement.append(new_data)
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(tab_local_automatic_traitement))
|
||||
|
@ -14655,3 +14804,7 @@ def Get_Given_SessionFormation_List_Automatic_Traitement_From(diction):
|
|||
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 session de formation"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recuperer """
|
|
@ -1279,7 +1279,7 @@ def Create_Automatic_Sequence(diction):
|
|||
|
||||
cpt = cpt + 1
|
||||
|
||||
return True, str(nb_sequence) + " séquence(s) automatiquement créée(s) "
|
||||
return True, str(nb_sequence) + " séquence(s) automatiquement créée(s) ", str(nb_sequence)
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -1642,13 +1642,15 @@ def Get_Session_Sequence_List(diction):
|
|||
return local_status, my_partner
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
val_tmp = 0
|
||||
nb_sequence = 0
|
||||
for New_retVal in MYSY_GV.dbname['session_formation_sequence'].find({'session_id':str(diction['session_id']),
|
||||
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}):
|
||||
|
||||
user = New_retVal
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
nb_sequence = nb_sequence + 1
|
||||
|
||||
if( "grp_apprenant_id" not in user.keys() ):
|
||||
user['grp_apprenant_id'] = ""
|
||||
|
@ -1684,7 +1686,7 @@ def Get_Session_Sequence_List(diction):
|
|||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
return True, RetObject, nb_sequence
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -3402,7 +3404,7 @@ def Create_Automatic_Sequence_From_Week_Model(diction):
|
|||
cpt = cpt + 1
|
||||
|
||||
|
||||
return True, str(nb_sequence) + " séquence(s) automatiquement créée(s) "
|
||||
return True, str(nb_sequence) + " séquence(s) automatiquement créée(s) ", str(nb_sequence)
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -3749,7 +3751,7 @@ def Create_Automatic_Sequence_From_Month_Model(diction):
|
|||
cpt = cpt + 1
|
||||
|
||||
|
||||
return True, str(nb_sequence) + " séquence(s) automatiquement créée(s) "
|
||||
return True, str(nb_sequence) + " séquence(s) automatiquement créée(s) ", str(nb_sequence)
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
58
agenda.py
58
agenda.py
|
@ -180,6 +180,24 @@ def Add_Update_Agenda_Event(diction):
|
|||
{'$set':mydata}
|
||||
)
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
/!\ ici on le fait pour l'objet concerné par l'agenda
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = str(diction['related_collection'])
|
||||
history_event_dict['related_collection_recid'] = str(diction['related_collection_recid'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Mise à jour entrée Agenda Titre : '" + str(
|
||||
diction['event_title']) + "', Debut : '" + str(diction['event_start']) + "', Fin : '" + str(
|
||||
diction['event_end']) + "' "
|
||||
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'entrée Agenda: " + str(diction['_id']))
|
||||
|
||||
return True, " L'événement a été mis à jour"
|
||||
|
||||
else:
|
||||
|
@ -196,8 +214,23 @@ def Add_Update_Agenda_Event(diction):
|
|||
|
||||
insert = MYSY_GV.dbname['agenda'].insert_one(mydata)
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
/!\ ici on le fait pour l'objet concerné par l'agenda
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = str(diction['related_collection'])
|
||||
history_event_dict['related_collection_recid'] = str(diction['related_collection_recid'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Creation entrée Agenda Titre : '"+str(diction['event_title'])+"', Debut : '"+str(diction['event_start'])+"', Fin : '"+str(diction['event_end'])+"' "
|
||||
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'entrée Agenda: " + str(diction['_id']))
|
||||
|
||||
return True, " L'événement a été ajouté"
|
||||
return True, " L'événement a été ajouté"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -772,6 +805,12 @@ def Delete_Agenda_Event(diction):
|
|||
'locked':'0'})
|
||||
|
||||
if( is_event_exist > 0 ):
|
||||
|
||||
is_event_exist_data = MYSY_GV.dbname['agenda'].find_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
# L'eventement existe est valide, on autorise la suppression
|
||||
update = MYSY_GV.dbname['agenda'].delete_one({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
|
@ -780,6 +819,23 @@ def Delete_Agenda_Event(diction):
|
|||
|
||||
)
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
/!\ ici on le fait pour l'objet concerné par l'agenda
|
||||
"""
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = str(is_event_exist_data['related_collection'])
|
||||
history_event_dict['related_collection_recid'] = str(is_event_exist_data['related_collection_recid'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Suppression entrée Agenda Titre : '" + str(
|
||||
is_event_exist_data['event_title']) + "', Debut : '"+str(is_event_exist_data['event_start'])+"', Fin : '"+str(is_event_exist_data['event_end'])+"' "
|
||||
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'entrée Agenda: " + str(diction['_id']))
|
||||
|
||||
return True, " L'événement a été supprimé"
|
||||
|
||||
else:
|
||||
|
|
45
class_mgt.py
45
class_mgt.py
|
@ -59,7 +59,7 @@ def add_class(diction):
|
|||
'programme', 'prerequis', 'note', 'cpf', 'certif', 'class_inscription_url', 'pourqui',
|
||||
'support', 'img_banner_detail_class', 'source', 'lms_class_code', 'formateur_id',
|
||||
'class_level', 'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'class_id',
|
||||
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite', 'recyclage_alert']
|
||||
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -71,7 +71,7 @@ def add_class(diction):
|
|||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['external_code', 'title', 'description', 'distantiel', 'presentiel', 'token']
|
||||
field_list_obligatoire = ['external_code', 'title', 'description', 'token']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -431,6 +431,10 @@ def add_class(diction):
|
|||
if diction['plus_produit']:
|
||||
mydata['plus_produit'] = diction['plus_produit']
|
||||
|
||||
if ("contenu_attestation" in diction.keys()):
|
||||
if diction['contenu_attestation']:
|
||||
mydata['contenu_attestation'] = diction['contenu_attestation']
|
||||
|
||||
if ("institut_formation" in diction.keys()):
|
||||
if diction['institut_formation']:
|
||||
mydata['institut_formation'] = diction['institut_formation']
|
||||
|
@ -467,6 +471,10 @@ def add_class(diction):
|
|||
if diction['plus_produit']:
|
||||
mydata['plus_produit'] = diction['plus_produit']
|
||||
|
||||
if ("contenu_attestation" in diction.keys()):
|
||||
if diction['contenu_attestation']:
|
||||
mydata['contenu_attestation'] = diction['contenu_attestation']
|
||||
|
||||
local_mots_cle = ""
|
||||
if ("mots_cle" in diction.keys()):
|
||||
if diction['mots_cle']:
|
||||
|
@ -782,7 +790,7 @@ def update_class(diction):
|
|||
'cpf', 'certif', 'class_inscription_url','pourqui', 'support', 'img_banner_detail_class',
|
||||
'duration_unit', 'source', 'lms_class_code', 'formateur_id', 'class_level','methode_pedagogique',
|
||||
'condition_handicape', 'suivi_eval', 'class_id', 'version', 'categorie', 'recyclage_delai',
|
||||
'recyclage_periodicite', 'recyclage_alert']
|
||||
'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -1104,6 +1112,11 @@ def update_class(diction):
|
|||
mydata['plus_produit'] = diction['plus_produit']
|
||||
|
||||
|
||||
if ("contenu_attestation" in diction.keys()):
|
||||
mydata['contenu_attestation'] = diction['contenu_attestation']
|
||||
|
||||
|
||||
|
||||
if ("mots_cle" in diction.keys()):
|
||||
mots_cle = diction['mots_cle']
|
||||
if (mots_cle.endswith(';')):
|
||||
|
@ -3953,7 +3966,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
'objectif', 'programme', 'prerequis', 'formateur', 'note', 'cpf', 'certif',
|
||||
'class_inscription_url', 'pourqui', 'support', 'img_banner_detail_class', 'formateur_email',
|
||||
'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'version', 'categorie', 'recyclage_delai',
|
||||
'recyclage_periodicite' 'recyclage_alert']
|
||||
'recyclage_periodicite' 'recyclage_alert', 'contenu_attestation']
|
||||
|
||||
total_rows = len(df)
|
||||
|
||||
|
@ -4103,6 +4116,14 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
|
||||
mydata['plus_produit'] = plus_produit
|
||||
|
||||
contenu_attestation = ""
|
||||
if ("contenu_attestation" in df.keys()):
|
||||
if (str(df['contenu_attestation'].values[n])):
|
||||
contenu_attestation = str(df['contenu_attestation'].values[n]).strip()
|
||||
contenu_attestation = mycommon.format_MySy_Text_Tag(contenu_attestation)
|
||||
|
||||
mydata['contenu_attestation'] = contenu_attestation
|
||||
|
||||
|
||||
presentiel = "0"
|
||||
if ("presentiel" in df.keys()):
|
||||
|
@ -4495,7 +4516,7 @@ def Controle_add_class_mass(saved_file=None, Folder=None, diction=None):
|
|||
'objectif', 'programme', 'prerequis', 'formateur', 'note', 'cpf', 'certif',
|
||||
'class_inscription_url', 'pourqui', 'support', 'img_banner_detail_class', 'formateur_email' ,'methode_pedagogique',
|
||||
'condition_handicape', 'suivi_eval', 'version', 'categorie', 'recyclage_delai',
|
||||
'recyclage_periodicite', 'recyclage_alert']
|
||||
'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation']
|
||||
|
||||
total_rows = len(df)
|
||||
|
||||
|
@ -4755,6 +4776,16 @@ def Controle_add_class_mass(saved_file=None, Folder=None, diction=None):
|
|||
|
||||
mydata['plus_produit'] = plus_produit
|
||||
|
||||
contenu_attestation = ""
|
||||
if ("contenu_attestation" in df.keys()):
|
||||
if (str(df['contenu_attestation'].values[n])):
|
||||
contenu_attestation = str(df['contenu_attestation'].values[n]).strip()
|
||||
contenu_attestation = mycommon.format_MySy_Text_Tag(contenu_attestation)
|
||||
|
||||
mydata['contenu_attestation'] = contenu_attestation
|
||||
|
||||
|
||||
|
||||
presentiel = "0"
|
||||
if ("presentiel" in df.keys()):
|
||||
if (str(df['presentiel'].values[n])):
|
||||
|
@ -6428,13 +6459,13 @@ def Export_Class_To_Excel_From_from_List_Id(diction):
|
|||
"duration", "duration_unit", "institut_formation", "metier", "mots_cle",
|
||||
"note",
|
||||
"plus_produit", "pourqui", "prerequis", "price", "programme", "published", "support",
|
||||
"presentiel", "distantiel", "formateur_nom", "formateur_prenom" ]
|
||||
"presentiel", "distantiel", "formateur_nom", "formateur_prenom" , "contenu_attestation"]
|
||||
|
||||
|
||||
tab_exported_fields = ["external_code", "certif", "cpf", "title", "description", "objectif", "domaine",
|
||||
"duration", "duration_unit", "institut_formation", "metier", "mots_cle",
|
||||
"note",
|
||||
"plus_produit", "pourqui", "prerequis", "price", "programme", "published", "support",]
|
||||
"plus_produit", "pourqui", "prerequis", "price", "programme", "published", "support", "contenu_attestation"]
|
||||
|
||||
|
||||
# Create a workbook and add a worksheet.
|
||||
|
|
|
@ -462,8 +462,13 @@ Ensuite un job va tourner (frequence à definir) pour traiter tous les client
|
|||
dont : "send_pre_invoice_data" = 1 et "date_time_pre_invoice_created" <= now() - 5 min.
|
||||
Ainsi on laisse 5 minutes à strype pour bien se mettre à jour
|
||||
|
||||
|
||||
"""
|
||||
"""
|
||||
14/04/2025 : desormais les pack ne sont pas liés au nombre de formation
|
||||
Donc pour eviter des blocages coté LMS sur le nombre de formation,
|
||||
on va TOUJOURS forcer le nombre de formation à 999
|
||||
"""
|
||||
|
||||
def createOrder(diction):
|
||||
try:
|
||||
order_id = ""
|
||||
|
@ -545,10 +550,11 @@ def createOrder(diction):
|
|||
if diction['nb_product']:
|
||||
nb_line = mycommon.tryInt(diction['nb_product'])
|
||||
|
||||
|
||||
periodicite = "mois"
|
||||
if ("periodicite" in diction.keys()):
|
||||
if diction['periodicite']:
|
||||
new_data['periodicite'] = diction['periodicite']
|
||||
periodicite = diction['periodicite']
|
||||
|
||||
if ("end_date" in diction.keys()):
|
||||
if diction['end_date']:
|
||||
|
@ -589,7 +595,13 @@ def createOrder(diction):
|
|||
new_data_item['code'] = line_dict['code']
|
||||
new_data_item['prix'] = line_dict['prix']
|
||||
new_data_item['qty'] = line_dict['qty']
|
||||
nb_formation = line_dict['qty']
|
||||
"""
|
||||
14/04/2025 : desormais les pack ne sont pas liés au nombre de formation
|
||||
Donc pour eviter des blocages coté LMS sur le nombre de formation,
|
||||
on va TJRS FORCER la valeur de nb_formation à 999
|
||||
"""
|
||||
|
||||
nb_formation = "999"
|
||||
new_data_item['pack_products'] = line_dict['pack_products']
|
||||
|
||||
new_data_item['amount'] = str(montant_line)
|
||||
|
@ -862,6 +874,7 @@ def createOrder(diction):
|
|||
{'recid': str(user_recid), },
|
||||
{"$set": {'pack_service':str(mypack),
|
||||
'nb_formation':str(nb_formation),
|
||||
'abonnement_periodicite': str(periodicite),
|
||||
'end_date_abonnement':''}},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
|
|
|
@ -561,6 +561,8 @@ def add_user_account(diction):
|
|||
# Verification que cette adresse email n'existe pas. On doit aussi verifier que cette adresse
|
||||
# n'est pas utiliser comme compte partner.
|
||||
|
||||
print(" QRY check partner exist = ", {'email': str(myuser['email']), 'active':'1'})
|
||||
|
||||
tmp = coll_name.count_documents({'email': str(myuser['email']), 'active':'1'})
|
||||
if( tmp > 0 ):
|
||||
mycommon.myprint("l'adresse email '"+str(myuser['email'])+"' existe deja, impossible de créer le compte ")
|
||||
|
|
|
@ -339,6 +339,8 @@ def Create_MySy_LMS_User(diction):
|
|||
new_dicton['mysy_pack'] = my_partner['pack_service']
|
||||
new_dicton['mysy_nb_formation'] = my_partner['nb_formation']
|
||||
|
||||
|
||||
|
||||
local_status, local_message, local_value = Update_Pack_MySy_LMS_User(new_dicton)
|
||||
if( local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - WARNING : impossible de créer les varible MySy dans le LMS")
|
||||
|
@ -1267,6 +1269,12 @@ def Check_MySy_LMS_Account(diction):
|
|||
DONC LE CONTROLE EST A FAIRE BIEN EN AMONT
|
||||
|
||||
"""
|
||||
"""
|
||||
14/04/2025 : desormais les pack ne sont pas liés au nombre de formation
|
||||
Donc pour eviter des blocages coté LMS sur le nombre de formation,
|
||||
le nombre de formations est tjours = 999
|
||||
"""
|
||||
|
||||
# Reactivation du compte utilisateur
|
||||
new_diction = {}
|
||||
new_diction['password'] = my_partner['pwd']
|
||||
|
|
41
main.py
41
main.py
|
@ -104,6 +104,9 @@ import type_cours as type_cours
|
|||
import tools_cherif.freemobile_send_sms as freemobile_send_sms
|
||||
import tools_cherif.mysy_openai_file as mysy_openai_file
|
||||
|
||||
import MySy_Monitoring.check_is_mysy_site_up as MySy_Monitoring_Website
|
||||
import MySy_Monitoring.programme_monit_python_disk_and_service as MySy_Monitoring_Server
|
||||
|
||||
import MySy_IA.mysy_ia as mysy_ia
|
||||
|
||||
app = Flask(__name__)
|
||||
|
@ -486,7 +489,7 @@ def get_partner_class_external_code():
|
|||
def update_class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### update_class payload = ",payload)
|
||||
print(" ### update_class payload = (trop long cherif) ")
|
||||
status, retval, class_id = cm.update_class(payload)
|
||||
|
||||
|
||||
|
@ -7480,8 +7483,8 @@ def Get_Session_Sequence_List():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Session_Sequence_List payload = ",payload)
|
||||
status, retval = Session_Formation_Sequence.Get_Session_Sequence_List(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
status, retval, nb_sequence = Session_Formation_Sequence.Get_Session_Sequence_List(payload)
|
||||
return jsonify(status=status, message=retval, nb_sequence=nb_sequence)
|
||||
|
||||
|
||||
"""
|
||||
|
@ -7662,8 +7665,8 @@ def Create_Automatic_Sequence():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Create_Automatic_Sequence payload = ",payload)
|
||||
status, retval = Session_Formation_Sequence.Create_Automatic_Sequence(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
status, retval , nb_sequence = Session_Formation_Sequence.Create_Automatic_Sequence(payload)
|
||||
return jsonify(status=status, message=retval, nb_sequence=nb_sequence)
|
||||
|
||||
|
||||
|
||||
|
@ -9907,8 +9910,8 @@ def Create_Automatic_Sequence_From_Week_Model():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Create_Automatic_Sequence_From_Week_Model payload = ",payload)
|
||||
status, retval = Session_Formation_Sequence.Create_Automatic_Sequence_From_Week_Model(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
status, retval, nb_sequence = Session_Formation_Sequence.Create_Automatic_Sequence_From_Week_Model(payload)
|
||||
return jsonify(status=status, message=retval, nb_sequence=nb_sequence)
|
||||
|
||||
|
||||
"""
|
||||
|
@ -9920,8 +9923,8 @@ def Create_Automatic_Sequence_From_Month_Model():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Create_Automatic_Sequence_From_Month_Model payload = ",payload)
|
||||
status, retval = Session_Formation_Sequence.Create_Automatic_Sequence_From_Month_Model(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
status, retval, nb_sequence = Session_Formation_Sequence.Create_Automatic_Sequence_From_Month_Model(payload)
|
||||
return jsonify(status=status, message=retval, nb_sequence=nb_sequence)
|
||||
|
||||
|
||||
|
||||
|
@ -11267,7 +11270,7 @@ API qui permet d'envoyer des emails generés depuis le front pour les contact co
|
|||
def Prepare_and_Send_Email_From_Front():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Prepare_and_Send_Email_From_Front payload = ",payload)
|
||||
print(" ### Prepare_and_Send_Email_From_Front payload (trop long cherif) = ")
|
||||
file = []
|
||||
tab_files = []
|
||||
if request.method == 'POST':
|
||||
|
@ -11591,7 +11594,7 @@ partenaire
|
|||
def Add_Update_Partner_Catalog_Pub_Config():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
#print(" ### Add_Update_Partner_Catalog_Pub_Config payload = ",payload)
|
||||
print(" ### Add_Update_Partner_Catalog_Pub_Config payload (trop long) = ")
|
||||
status, retval = base_partner_catalog_config.Add_Update_Partner_Catalog_Pub_Config(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
@ -12027,6 +12030,16 @@ def Delete_Nicole_Account(token, user_email):
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
Test des fonctions de monitoring des serveurs
|
||||
"""
|
||||
@app.route('/myclass/api/Monitoring_check_if_site_is_up/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Monitoring_check_if_site_is_up():
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### Monitoring_check_if_site_is_up payload = ", payload)
|
||||
localStatus, message= MySy_Monitoring_Website.check_if_site_is_up(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -12050,8 +12063,8 @@ if __name__ == '__main__':
|
|||
"""
|
||||
/!\ Dasactivé en dev pour pas consommer de ressource pr rien.
|
||||
"""
|
||||
|
||||
""" scheduler = BackgroundScheduler()
|
||||
"""
|
||||
scheduler = BackgroundScheduler()
|
||||
# Create the job
|
||||
scheduler.add_job(func=Flask_Cron_Strip_Get_Customer_Abonnement_Data, trigger="interval", minutes=3)
|
||||
scheduler.add_job(func=Internal_Global_MySy_Cron_Traitement, trigger="interval", minutes=1)
|
||||
|
@ -12063,8 +12076,8 @@ if __name__ == '__main__':
|
|||
|
||||
# /!\ IMPORTANT /!\ : Shut down the scheduler when exiting the app
|
||||
atexit.register(lambda: scheduler.shutdown())
|
||||
"""
|
||||
|
||||
"""
|
||||
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_DEV, debug=True, threaded=True)
|
||||
# Create the background scheduler
|
||||
|
||||
|
|
|
@ -1874,32 +1874,34 @@ def Get_List_Participant_To_Evaluation(diction):
|
|||
inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(retval['inscription_id']))},
|
||||
{'_id':1, 'apprenant_id':1})
|
||||
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id':ObjectId(str(inscription_data['apprenant_id']))},
|
||||
{'_id':1, 'nom':1, 'prenom':1, 'email':1})
|
||||
if( inscription_data and "apprenant_id" in inscription_data.keys() ):
|
||||
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id':ObjectId(str(inscription_data['apprenant_id']))},
|
||||
{'_id':1, 'nom':1, 'prenom':1, 'email':1})
|
||||
|
||||
|
||||
nom_apprenant = apprenant_data['nom']
|
||||
prenom_apprenant = apprenant_data['prenom']
|
||||
email_apprenant = apprenant_data['email']
|
||||
nom_apprenant = apprenant_data['nom']
|
||||
prenom_apprenant = apprenant_data['prenom']
|
||||
email_apprenant = apprenant_data['email']
|
||||
|
||||
user['nom'] = nom_apprenant
|
||||
user['prenom'] = prenom_apprenant
|
||||
user['email'] = email_apprenant
|
||||
user['id'] = str(nb_val)
|
||||
if( "note" not in retval.keys() ):
|
||||
user['note'] = "-1"
|
||||
user['nom'] = nom_apprenant
|
||||
user['prenom'] = prenom_apprenant
|
||||
user['email'] = email_apprenant
|
||||
user['id'] = str(nb_val)
|
||||
if( "note" not in retval.keys() ):
|
||||
user['note'] = "-1"
|
||||
|
||||
|
||||
if( "convocation_send_date" not in user.keys() ):
|
||||
user['convocation_send_date'] = ""
|
||||
if( "convocation_send_date" not in user.keys() ):
|
||||
user['convocation_send_date'] = ""
|
||||
|
||||
if ("convocation_send_type" not in user.keys()):
|
||||
user['convocation_send_type'] = ""
|
||||
if ("convocation_send_type" not in user.keys()):
|
||||
user['convocation_send_type'] = ""
|
||||
|
||||
|
||||
nb_val = nb_val + 1
|
||||
nb_val = nb_val + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
|
30
partners.py
30
partners.py
|
@ -183,7 +183,11 @@ def add_partner_account(diction):
|
|||
mydata['locked'] = '0'
|
||||
mydata['ispending'] = "0"
|
||||
|
||||
print(str(datetime.now()) + " webservice : diction = "+str(mydata))
|
||||
# 12/04/205 :
|
||||
mydata['firstconnexion'] = '1'
|
||||
mydata['is_partner_admin_account'] = '1'
|
||||
|
||||
#print(str(datetime.now()) + " webservice : diction = "+str(mydata))
|
||||
coll_name = MYSY_GV.dbname['partnair_account']
|
||||
coll_name_user_account = MYSY_GV.dbname['user_account']
|
||||
|
||||
|
@ -204,6 +208,7 @@ def add_partner_account(diction):
|
|||
return False, "l'adresse email '" + str(
|
||||
mydata['email']) + "' est deja utilisée, impossible de créer le compte partenaire "
|
||||
|
||||
print(" ### create compt mydata = ", mydata)
|
||||
|
||||
ret_val = coll_name.insert_one(mydata)
|
||||
mail.send_partner_account_mail(ret_val.inserted_id, str(mydata['email']))
|
||||
|
@ -418,7 +423,9 @@ def update_partner_pwd(diction):
|
|||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
|
||||
print(" ### update_partner_pwd ", mydata)
|
||||
#print(" ### QRY for update_partner_pwd ", {'_id':ObjectId(str(my_partner['_id'])), 'locked': '0', 'active': '1', 'pwd':mypwd})
|
||||
|
||||
#print(" ### update_partner_pwd ", mydata)
|
||||
|
||||
|
||||
coll_name = MYSY_GV.dbname['partnair_account']
|
||||
|
@ -1144,14 +1151,9 @@ def get_partner_account(diction):
|
|||
|
||||
#print(" #### parters RECID = "+str(partnere_recid))
|
||||
|
||||
is_first_connexion = True
|
||||
|
||||
RetObject = []
|
||||
for retVal in coll_name.find({'_id': ObjectId(str(parnter_account_id)), 'active':'1', 'locked':'0'}):
|
||||
#mycommon.myprint (str(retVal))
|
||||
if ("firstconnexion" in retVal.keys()):
|
||||
if retVal['firstconnexion'] and str(retVal['firstconnexion'] == "0"):
|
||||
is_first_connexion = False
|
||||
|
||||
user = retVal
|
||||
|
||||
|
@ -1170,6 +1172,11 @@ def get_partner_account(diction):
|
|||
mysy_lms_user_id = retVal['mysy_lms_user_id']
|
||||
user['mysy_lms_user_id'] = mysy_lms_user_id
|
||||
|
||||
abonnement_periodicite = ""
|
||||
if ("abonnement_periodicite" in retVal.keys()):
|
||||
abonnement_periodicite = retVal['abonnement_periodicite']
|
||||
user['abonnement_periodicite'] = abonnement_periodicite
|
||||
|
||||
|
||||
"""
|
||||
05/09/2024 : Recuperer le nombre d'activité en retard pour la personne connectée
|
||||
|
@ -1224,16 +1231,11 @@ def get_partner_account(diction):
|
|||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
|
||||
"""
|
||||
Si la première connexion, alors on met la Le champ avec la valeur firstconnexion = 0
|
||||
"""
|
||||
|
||||
my_new_data = {}
|
||||
now = str(datetime.now())
|
||||
my_new_data = {'firstconnexion':'0', 'lastconnexion':now}
|
||||
|
||||
if( is_first_connexion is True):
|
||||
my_new_data = {'firstconnexion':'0', 'lastconnexion':now}
|
||||
else:
|
||||
my_new_data = {'lastconnexion': now}
|
||||
|
||||
ret_val = coll_name.find_one_and_update({'_id': ObjectId(str(parnter_account_id)), 'active':'1', 'locked':'0'},
|
||||
{"$set": my_new_data},
|
||||
|
|
|
@ -5525,8 +5525,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
|
|||
"""
|
||||
cpt = 0
|
||||
for my_courrier_data in MYSY_GV.dbname['base_document_automatic_setup'].find(
|
||||
{
|
||||
'partner_owner_recid': 'default', 'valide': '1',
|
||||
{'partner_owner_recid': 'default', 'valide': '1',
|
||||
'locked': '0'}, ):
|
||||
new_courrier_for_automation = my_courrier_data
|
||||
new_courrier_for_automation['actif'] = "0"
|
||||
|
|
|
@ -672,6 +672,20 @@ def Add_Ressource_Humaine(diction):
|
|||
" Impossible de créer la ressource ")
|
||||
return False, " Impossible de créer la ressource "
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(inserted_id)
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Création "
|
||||
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 la ressource humaine (email): " + str(diction['email']))
|
||||
|
||||
return True, " La ressource a été correctement créée"
|
||||
|
||||
|
@ -1040,6 +1054,21 @@ def Update_Ressource_Humaine(diction):
|
|||
" Impossible de mettre à jour les information : email = " + str(diction['email']))
|
||||
return False, " Impossible de mettre à jour les informations "
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Mise à jour "
|
||||
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 : " + str(diction['_id']))
|
||||
|
||||
return True, " Les données a été correctement mises à jour"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -1119,6 +1148,10 @@ def Delete_Ressource_Humaine(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Cet employé est invalide")
|
||||
return False, str(inspect.stack()[0][3]) + " -Cet employé est invalide "
|
||||
|
||||
existe_employee_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_recid': str(my_partner['recid']), })
|
||||
|
||||
"""
|
||||
Suppression des eventuels affectation de cet employé
|
||||
"""
|
||||
|
@ -1143,7 +1176,21 @@ def Delete_Ressource_Humaine(diction):
|
|||
'is_partner_admin_account': '0',
|
||||
'partner_recid': str(my_partner['recid']),})
|
||||
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Suppression du materiel Nom = " + str(
|
||||
existe_employee_data['nom']) + " Prenom = "+str(existe_employee_data['prenom'])+" , Email = " + str(existe_employee_data['email'])
|
||||
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 : " + str(diction['_id']))
|
||||
|
||||
return True, " L'employé a été correctement supprimé "
|
||||
|
||||
|
@ -2093,6 +2140,21 @@ def Update_Ressource_Humaine_Image(file_img=None, Folder=None, diction=None):
|
|||
if( local_status is False):
|
||||
return local_status, local_message
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Modification de l'image "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, "L'image a été correctement enregistrée"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -3178,6 +3240,23 @@ def Add_Affectation_Ressource_Humaine_Poste(diction):
|
|||
if( inserted_data is None):
|
||||
return False," Impossible d'affecter l'employé au poste (2)"
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Affectation de la ressource humaine du " + str(date_du) + " au " + str(
|
||||
date_au) + ". Poste : " + str(diction['poste']) + " . Cible " + str(
|
||||
related_target_collection) + " ==> " + str(related_target_collection_id)
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
|
||||
return True, "L'affectation de l'employé a été correctement faite."
|
||||
|
||||
|
@ -3344,7 +3423,20 @@ def Update_Affectation_Ressource_Humaine_Poste(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour cette affectation (3)")
|
||||
return False, " Impossible de mettre à jour cette affectation (3) "
|
||||
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Modification affectation de la ressource humaine "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, "L'affectation de l'employé a été correctement mise à jour."
|
||||
|
||||
|
@ -3439,7 +3531,20 @@ def Delete_Affectation_Ressource_Humaine_Poste(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de supprimer à jour cette affectation (3)")
|
||||
return False, " Impossible de supprimer cette affectation (3) "
|
||||
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Suppression affectation de la ressource humaine "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, "L'affectation de l'employé a été correctement supprimée."
|
||||
|
||||
|
@ -3789,7 +3894,7 @@ def Add_Update_Employee_Login_Pass(diction):
|
|||
|
||||
|
||||
qry_key = {'email':str(email), 'partner_owner_recid':str(my_partner['recid'])}
|
||||
print(" #### qry key 012 = ", qry_key)
|
||||
#print(" #### qry key 012 = ", qry_key)
|
||||
|
||||
inserted_id = ""
|
||||
result = MYSY_GV.dbname['partnair_account'].find_one_and_update(
|
||||
|
@ -3808,8 +3913,8 @@ def Add_Update_Employee_Login_Pass(diction):
|
|||
Si l'utilisateur a un deja un accès LMS, il faut aussi mettre à jour le mot de passe dans le LMS
|
||||
|
||||
"""
|
||||
print(" ### result = ", result)
|
||||
print(" ### my_partner = ", my_partner)
|
||||
#print(" ### result = ", result)
|
||||
#print(" ### my_partner = ", my_partner)
|
||||
if( "mysy_lms_user_id" in result.keys() and len(str(result['mysy_lms_user_id'])) > 1 and 'token' in result.keys()
|
||||
and "partner_owner_recid" in result.keys() and str(result['partner_owner_recid']) == str(my_partner['recid']) ):
|
||||
# ce compte a deja un acces LMS, il faut mettre à jour le mot de passe.
|
||||
|
@ -3872,6 +3977,21 @@ def Add_Update_Employee_Login_Pass(diction):
|
|||
|
||||
email_inscription_mgt.Employee_Credential_Sending_mail(data_for_mail)
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['ressource_humaine_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Creation / Mise à jour du compte utilisateur "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, " Les accès ont été créées. Les emails de notification envoyés"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -4119,6 +4239,22 @@ def Add_Employee_Contrat(diction):
|
|||
" Impossible de créer le contrat (1) ")
|
||||
return False, " Impossible de créer le contrat (1) "
|
||||
|
||||
"""
|
||||
# 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'] = str(token)
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Creation du contrat de la ressource humaine. \
|
||||
Detail contrat : type_contrat = " + str(diction['type_contrat']) + ", Debut = " + str(
|
||||
diction['date_debut']) + ", Fin " + str(diction['date_fin'])
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, " Le contrat été correctement créé "
|
||||
|
||||
|
@ -4358,6 +4494,24 @@ def Update_Employee_Contrat(diction):
|
|||
{'$set': new_data}
|
||||
)
|
||||
|
||||
"""
|
||||
# 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'] = str(token)
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Mise à jour du contrat de la ressource humaine.\
|
||||
Detail contrat : type_contrat = " + str(diction['type_contrat']) + ", Debut = " + str(
|
||||
diction['date_debut']) + ", Fin " + str(diction['date_fin'])+", Id = "+str(local_id)
|
||||
|
||||
|
||||
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 : " + str(local_id))
|
||||
|
||||
|
||||
return True, " Le contrat été correctement mis à jour "
|
||||
|
@ -4379,7 +4533,7 @@ def Delete_Employee_Contrat(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id']
|
||||
field_list = ['token', '_id', 'rh_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -4391,7 +4545,7 @@ def Delete_Employee_Contrat(diction):
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id']
|
||||
field_list_obligatoire = ['token', '_id', 'rh_id']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -4424,12 +4578,34 @@ def Delete_Employee_Contrat(diction):
|
|||
str(inspect.stack()[0][3]) + " L'identifiant du contrat est invalide ")
|
||||
return False, " L'identifiant du contrat est invalide "
|
||||
|
||||
is_contrat_valide_data = MYSY_GV.dbname['ressource_humaine_contrat'].find_one(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
delete_retval = MYSY_GV.dbname['ressource_humaine_contrat'].delete_one(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Suppression du contrat de la ressource humaine. \
|
||||
Detail contrat : type_contrat = "+str(is_contrat_valide_data['type_contrat'])+", Debut = "+str(is_contrat_valide_data['type_contrat'])+", Fin "+str(is_contrat_valide_data['date_fin'])
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, " Le contrat été correctement supprimé "
|
||||
|
||||
|
@ -4610,7 +4786,7 @@ def Get_List_Employee_Contrat(diction):
|
|||
|
||||
|
||||
"""
|
||||
Cett fonction permet de recuperer les types de contrat
|
||||
Cette fonction permet de recuperer les types de contrat
|
||||
"""
|
||||
def Get_Type_Contrat_List(diction):
|
||||
try:
|
||||
|
@ -4846,6 +5022,21 @@ def HR_Create_LMS_Trainer_Account(diction):
|
|||
|
||||
email_inscription_mgt.Employee_Acces_LMS_Sending_mail(data_for_mail)
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = "Creation / mise à jour du compte enseignant LMS "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, " Les accès ont été créée dans le LMS. Un email de notification envoyé à l'utilisateur"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -4910,6 +5101,21 @@ def Lock_partner_account_From_Rh_Id(diction):
|
|||
|
||||
local_status, local_retval = partners.Lock_partner_account(new_data)
|
||||
|
||||
if( local_status is True ):
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Verrouillage du compte utilisateur "
|
||||
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 : " + str(diction['rh_id']))
|
||||
return local_status, local_retval
|
||||
|
||||
|
||||
|
@ -4975,6 +5181,22 @@ def Unlock_partner_account_From_Rh_Id(diction):
|
|||
|
||||
local_status, local_retval = partners.UnLock_partner_account(new_data)
|
||||
|
||||
if( local_status is True ):
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Reactivation du compte utilisateur "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return local_status, local_retval
|
||||
|
||||
|
||||
|
@ -5066,6 +5288,21 @@ def Add_Update_RH_Competence(diction):
|
|||
|
||||
)
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Mise à jour des compétences "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, " La compétence a été mise à jour"
|
||||
|
||||
|
||||
|
@ -5101,6 +5338,20 @@ def Add_Update_RH_Competence(diction):
|
|||
|
||||
)
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Creation d'une nouvelle compétence "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, " La compétence a été ajoutée"
|
||||
|
||||
|
@ -5180,6 +5431,20 @@ def Delete_RH_Competence(diction):
|
|||
|
||||
{'$pull': {'list_competence': {"_id": str(diction['competence_id'])}}}
|
||||
)
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rh_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Suppression d'une competence "
|
||||
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 : " + str(diction['rh_id']))
|
||||
|
||||
return True, " La compétence a été supprimée"
|
||||
|
||||
|
|
|
@ -336,6 +336,20 @@ def Add_Ressource_Materielle(diction):
|
|||
" Impossible de créer le materiel (2) ")
|
||||
return False, " Impossible de créer le materiel (2) "
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_materielle"
|
||||
history_event_dict['related_collection_recid'] = str(inserted_id)
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Création "
|
||||
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 la ressource materielle (ref_interne): " + str(diction['ref_interne']))
|
||||
|
||||
return True, " Le materiel a été correctement créé"
|
||||
|
||||
|
@ -658,6 +672,22 @@ def Update_Ressource_Materielle(diction):
|
|||
" Impossible de mettre à jour le materiel : email = ")
|
||||
return False, " Impossible de mettre à jour le materiel "
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_materielle"
|
||||
history_event_dict['related_collection_recid'] = str(diction['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Mise à jour "
|
||||
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 : " + str(diction['_id']) )
|
||||
|
||||
|
||||
return True, " Le materiel a été correctement mis à jour"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -735,6 +765,9 @@ def Delete_Ressource_Materielle(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Ce materiel est invalide")
|
||||
return False, str(inspect.stack()[0][3]) + " -Cet materiel est invalide "
|
||||
|
||||
existe_materiel_data = MYSY_GV.dbname['ressource_materielle'].find_one(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_recid': str(my_partner['recid']), })
|
||||
"""
|
||||
Suppression des eventuels affectation de ce materiel
|
||||
"""
|
||||
|
@ -752,7 +785,20 @@ def Delete_Ressource_Materielle(diction):
|
|||
MYSY_GV.dbname['ressource_materielle'].delete_many({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_recid': str(my_partner['recid']),})
|
||||
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_materielle"
|
||||
history_event_dict['related_collection_recid'] = str(diction['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Suppression du materiel Nom = "+str(existe_materiel_data['nom'])+", ref_interne = "+str(existe_materiel_data['ref_interne'])
|
||||
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 : " + str(diction['_id']))
|
||||
|
||||
return True, " Le materiel a été correctement supprimé"
|
||||
|
||||
|
@ -1067,6 +1113,21 @@ def Update_Ressource_Materielle_Image(file_img=None, Folder=None, diction=None):
|
|||
if( local_status is False):
|
||||
return local_status, local_message
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_materielle"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rm_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Modification de l'image "
|
||||
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 : " + str(diction['rm_id']))
|
||||
|
||||
return True, "L'image a été correctement enregistrée"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -1134,8 +1195,6 @@ def DeleteImage_Ressource_Materielle(diction=None):
|
|||
|
||||
ret_val = coll_name.delete_one({"recid": image_recid,}, )
|
||||
|
||||
|
||||
|
||||
print(" ### recordClassImage_v2 :L'image a été correctement supprimée ")
|
||||
return True, "L'image a été correctement supprimée"
|
||||
|
||||
|
@ -1500,6 +1559,20 @@ def Add_Affectation_Ressource_Materielle_Poste(diction):
|
|||
if( inserted_data is None):
|
||||
return False," Impossible d'affecter le materiel(2)"
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_materielle"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rm_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Affectation du materiel du "+str(date_du)+" au "+str(date_au)+". Poste : "+str(diction['poste'])+" . Cible "+str(related_target_collection)+" ==> "+str(related_target_collection_id)
|
||||
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 : " + str(diction['rm_id']))
|
||||
|
||||
return True, "L'affectation du materiel a été correctement faite."
|
||||
|
||||
|
@ -1646,7 +1719,7 @@ def Update_Affectation_Ressource_Materielle_Poste(diction):
|
|||
|
||||
# Verifier l'existance de l'affectation
|
||||
affectation_existe_count_qry = {'_id': ObjectId(str(diction['_id'])), 'valide': "1", "locked":"0", 'partner_owner_recid':str(partner_recid)}
|
||||
print(" ### affectation_existe_count_qry = ", affectation_existe_count_qry)
|
||||
#print(" ### affectation_existe_count_qry = ", affectation_existe_count_qry)
|
||||
affectation_existe_count = MYSY_GV.dbname['ressource_materielle_affectation'].count_documents( affectation_existe_count_qry)
|
||||
|
||||
if( affectation_existe_count != 1 ):
|
||||
|
@ -1665,9 +1738,22 @@ def Update_Affectation_Ressource_Materielle_Poste(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour cette affectation (3)")
|
||||
return False, " Impossible de mettre à jour cette affectation (3) "
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_materielle"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rm_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Modification affectation du materiel "
|
||||
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 : " + str(diction['rm_id']))
|
||||
|
||||
|
||||
return True, "L'affectation de l'employé a été correctement mise à jour."
|
||||
return True, "L'affectation du materiel a été correctement mise à jour."
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -1761,6 +1847,20 @@ def Delete_Affectation_Ressource_Materielle_Poste(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de supprimer à jour cette affectation (3)")
|
||||
return False, " Impossible de supprimer cette affectation (3) "
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_materielle"
|
||||
history_event_dict['related_collection_recid'] = str(diction['rm_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = " Suppression affectation du materiel "
|
||||
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 : " + str(diction['rm_id']))
|
||||
|
||||
return True, "L'affectation du materiel a été correctement supprimée."
|
||||
|
||||
|
|
|
@ -661,8 +661,8 @@ def create_subscription(diction):
|
|||
|
||||
abonnement_data['partner_recid'] = local_partner_data['recid']
|
||||
|
||||
print(" ### ret_val apres souscription id = ", str(ret_val))
|
||||
print(" ### ret_val apres subscription = ", str(subscription))
|
||||
#print(" ### ret_val apres souscription id = ", str(ret_val))
|
||||
#print(" ### ret_val apres subscription = ", str(subscription))
|
||||
|
||||
if ('_id' in ret_val.keys()):
|
||||
abonnement_data['stripe_subscription_id'] = str(ret_val['stripe_subscription_id'])
|
||||
|
|
|
@ -82,6 +82,11 @@ def Add_Update_User_Access_Right(diction):
|
|||
str(inspect.stack()[0][3]) + " - L'utilisateur est invalide ")
|
||||
return False, " L'utilisateur est invalide ",
|
||||
|
||||
rh_id_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(diction['user_id'])),
|
||||
'partner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if( is_user_existe_count > 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -160,7 +165,21 @@ def Add_Update_User_Access_Right(diction):
|
|||
" Impossible mettre à jour les droits d'acces du user_id" + str(diction['user_id']))
|
||||
return False, " Impossible mettre à jour les droits d'acces "
|
||||
|
||||
|
||||
"""
|
||||
# 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'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "ressource_humaine"
|
||||
history_event_dict['related_collection_recid'] = str(rh_id_data['_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['technical_comment'] = "Nouveaux droits d'accès = "+ str(tab_access)
|
||||
history_event_dict['action_description'] = " Mise à jour des droits d'accès au système "
|
||||
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 : " + str(rh_id_data['_id']) )
|
||||
|
||||
return True, " Les droits d'accès ont été correctement mis à jour"
|
||||
|
||||
|
|
Loading…
Reference in New Issue