26/06/26 - 18h

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-06-26 18:18:37 +02:00
parent 7e6b1a73b9
commit f9e34db291
13 changed files with 10709 additions and 100 deletions

View File

@ -4,25 +4,20 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="14/06/2026 - 12h">
<change afterPath="$PROJECT_DIR$/Bulletin_Note_mgt.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/tools_cherif/send_sms_ovh.py" afterDir="false" />
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/06/26 - 22h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Env_Data.py" beforeDir="false" afterPath="$PROJECT_DIR$/Env_Data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.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$/session_admission_fi.py" beforeDir="false" afterPath="$PROJECT_DIR$/session_admission_fi.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools_cherif/send_sms_ovh.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/send_sms_ovh.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -466,7 +461,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="599" />
<option name="localTasksCounter" value="600" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -508,7 +503,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="07/05/2026 - 17h" />
<MESSAGE value="08/05/2026 - 17h" />
<MESSAGE value="09/05/2025 - 20h30" />
<MESSAGE value="10/05/2026 - 12h30" />
@ -533,6 +527,7 @@
<MESSAGE value="06/06/2026 - 21h" />
<MESSAGE value="08/06/2026 - 21h" />
<MESSAGE value="14/06/2026 - 12h" />
<option name="LAST_COMMIT_MESSAGE" value="14/06/2026 - 12h" />
<MESSAGE value="21/06/26 - 22h" />
<option name="LAST_COMMIT_MESSAGE" value="21/06/26 - 22h" />
</component>
</project>

View File

@ -833,7 +833,7 @@ PARTNER_BASE_CONFIG_NAME = ['tva', 'smtp_server', 'smtp_user', 'smtp_user_pwd',
'preinscription_notification_email', 'inscription_notification_email','nb_heure_par_jour',
'nb_heure_par_mois', 'nb_heure_par_annee', 'nb_heure_par_semaine',
'annulation_inscription_notification_email', 'partner_devise',
'sequence_code_couleur', 'absence_recever_mail']
'sequence_code_couleur', 'absence_recever_mail', 'send_sms']
"""
@ -855,9 +855,9 @@ ALLOWED_AGENDA_RELATED_COLLECTION = ['ressource_humaine', 'ressource_materielle'
'apprenant', 'jury']
"""
Les types de location pour une session (intra ou extra ou autre)
Les types de location pour une session (inter, intra ou autre)
"""
TRAINING_LOCATION_TYPE = ['intra', 'extra', 'autre', '']
TRAINING_LOCATION_TYPE = ['inter', 'intra', 'autre', '']
"""
@ -1287,10 +1287,14 @@ Gestion Ressource humaine : Type RH
type_rh = 1 ==> Autre RH (ex : parent d'eleves, etc)
"""
## Application name : EYSY02
"""
Config OVH pour l'envoi des SMS
"""
OVH_ENDPOINT="ovh-eu"
OVH_APPLICATION_KEY="16ef9f92d1580d15"
OVH_APPLICATION_SECRET="ec7e66e0f27f5494038c14fcb11d105a"
OVH_CONSUMER_KEY="0268191866b32cce8ea012136ce94ddd"
OVH_APPLICATION_KEY="f6bfba1b35684556"
OVH_APPLICATION_SECRET="ebb362779fc7f4ab18019cd3da75d5cd"
OVH_CONSUMER_KEY="0712f5a9e7255894f48bdf0aa7d97cae"
OVH_SMS_SERVICE_NAME="sms-bc2043990-1"
OVH_SMS_SENDER="EYSY"
OVH_SMS_SENDER="EYSY"
SMS_MESSAGE_MAX_LENGTH = 155

View File

@ -107,7 +107,7 @@ def AddStagiairetoClass(diction):
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['nom', 'prenom', 'email', 'telephone', 'modefinancement',
field_list_obligatoire = ['nom', 'prenom', 'email', 'telephone',
'class_internal_url', 'session_id', ]
for val in field_list_obligatoire:
@ -1230,7 +1230,7 @@ def AddStagiairetoClass_from_marketplace(diction):
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['nom', 'prenom', 'email', 'telephone', 'modefinancement',
field_list_obligatoire = ['nom', 'prenom', 'email', 'telephone',
'class_internal_url', 'session_id', ]
for val in field_list_obligatoire:
@ -4301,7 +4301,7 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
return False, " Entete du fichier csv. La Colonne '" + val + "' n'est pas acceptée"
# Verification des champs obligatoires dans le fichier
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'modefinancement', 'status', 'prix']
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'status', 'prix']
for val in field_list_obligatoire_file:
if val not in df.columns:
@ -4419,7 +4419,11 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
if (str(df['type_apprenant_code'].values[n])):
type_apprenant_code = str(df['type_apprenant_code'].values[n])
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'code': type_apprenant_code,
{
'code': {
'$regex': f'^{re.escape(type_apprenant_code)}$',
'$options': 'i'
},
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
@ -4736,7 +4740,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
return False, " Entete du fichier csv. La Colonne '" + val + "' n'est pas acceptée"
# Verification des champs obligatoires dans le fichier
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'modefinancement', 'status', 'prix']
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'status', 'prix']
for val in field_list_obligatoire_file:
if val not in df.columns:
@ -4840,7 +4844,11 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
if (str(df['type_apprenant_code'].values[n])):
type_apprenant_code = str(df['type_apprenant_code'].values[n])
type_apprenant_data = MYSY_GV.dbname['type_apprenant'].find_one(
{'code': type_apprenant_code,
{
'code': {
'$regex': f'^{re.escape(type_apprenant_code)}$',
'$options': 'i'
},
'valide': '1',
'locked': '0',
'partner_owner_recid': str(partner_recid)})
@ -5164,7 +5172,8 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
field_list = ['formation_code_externe', 'code_session', 'prenom', 'nom', 'employeur',
'telephone', 'email', 'modefinancement', 'opco', 'status', 'prix', 'adresse', 'code_postal',
'ville', 'pays', 'client_rattachement_email', 'client_rattachement_nom','facture_client_rattachement_email',
'facture_client_rattachement_nom', 'civilite', 'type_apprenant', 'date_naissance']
'facture_client_rattachement_nom', 'civilite', 'type_apprenant', 'date_naissance',
'mode_financement_code', 'type_apprenant_code']
# Controle du nombre de lignes dans le fichier.
@ -5184,7 +5193,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
# Verification des champs obligatoires dans le fichier
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'modefinancement', 'status', 'prix']
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'status', 'prix']
for val in field_list_obligatoire_file:
if val not in df.columns:
@ -5620,7 +5629,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
'telephone', 'email', 'modefinancement', 'opco', 'status', 'prix', 'adresse', 'code_postal',
'ville', 'pays', 'client_rattachement_email', 'client_rattachement_nom',
'facture_client_rattachement_email', 'facture_client_rattachement_nom', 'civilite', 'type_apprenant',
'date_naissance']
'date_naissance', 'mode_financement_code', 'type_apprenant_code']
# Controle du nombre de lignes dans le fichier.
@ -5641,7 +5650,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
# Verification des champs obligatoires dans le fichier
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'modefinancement', 'status', 'prix']
field_list_obligatoire_file = ['prenom', 'nom', 'email', 'status', 'prix']
for val in field_list_obligatoire_file:
if val not in df.columns:
@ -10518,22 +10527,32 @@ def Get_Statgaire_List_Partner_with_filter(diction):
sub_filt_client_nom = {}
Lists_partner_client_id = []
if ("client_nom" in diction.keys()):
sub_filt_client_nom = {'nom': {'$regex': str(diction['client_nom']), "$options": "i"},
'partner_owner_recid': str(partner_recid), 'valide': '1', 'locked': '0'}
sub_filt_client_nom = {"$or": [
{'raison_sociale': {'$regex': mycommon.regex_replace_cartere(str(diction['client_nom'])), "$options": "i"}, },
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['client_nom'])), "$options": "i"}, 'partner_owner_recid': str(partner_recid), 'valide': '1', 'locked': '0'},
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['client_nom'])), "$options": "i"}, 'partner_owner_recid': str(partner_recid), 'valide': '1', 'locked': '0'},
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['client_nom'])), "$options": "i"}, 'partner_owner_recid': str(partner_recid), 'valide': '1', 'locked': '0'},
]}
# Recuperation des '_id' des clients dont le nom match en regexp
# print(" ### sub_filt_client_nom = ", sub_filt_client_nom)
print(" ### sub_filt_client_nom = ", sub_filt_client_nom)
for List_Client_Data in MYSY_GV.dbname['partner_client'].find(sub_filt_client_nom, {'_id': 1}):
Lists_partner_client_id.append(str(List_Client_Data['_id']))
filt_client_nom = {'client_rattachement_id': {'$in': Lists_partner_client_id, }}
# print(' ### filt_client_nom = ', filt_client_nom)
print(' ### filt_client_nom = ', filt_client_nom)
# ----
query = [{'$match': {
'$and': [filt_archive, filt_class_internal_url, filt_session_code, qry_gle,
query = [{'$match':
{
'$and': [filt_archive, filt_class_internal_url, filt_session_code, qry_gle, filt_client_nom,
filt_client_rattachement_id,
filt_session_id, filt_invoiced, {'partner_owner_recid': str(partner_recid), 'valide': '1'}]}},
{'$sort': {'_id': -1}},
{'$lookup':
{
@ -10584,7 +10603,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
], 'as': 'apprenant_collection'}}
]
#print("#### Get_Statgaire_List_Partner_with_filter laa 01 : query = ", query)
print("#### Get_Statgaire_List_Partner_with_filter laa 01 : query = ", query)
RetObject = []
cpt = 0
for retVal in MYSY_GV.dbname['inscription'].aggregate(query):

File diff suppressed because one or more lines are too long

View File

@ -287,7 +287,7 @@ def Add_Update_SessionFormation(diction):
mydata['nb_participant'] = "1"
if ("prix_session" in diction.keys()):
mydata['prix_session'] = diction['prix_session']
mydata['prix_session'] = str(mycommon.tryFloat(str(diction['prix_session'])))
if ("price_by" in diction.keys()):
if( str(diction['price_by']) not in MYSY_GV.TRAINING_PRICE):
@ -1137,6 +1137,8 @@ def GetSessionFormation(diction):
#print(" ##### retval sess = " + str(retval))
user = {}
user = retval
user['id'] = str(nb_val)
nb_val = nb_val + 1
title = ""
@ -1234,6 +1236,9 @@ def GetSessionFormation(diction):
user['nb_valide_inscription_entreprise'] = str(tmp_count)
if ("location_type" in user.keys() and user['location_type'] == "extra"):
user['location_type'] = "inter"
"""
Regarder si cette inscriptiona des inscriptions (validées) d'individuelle
"""
@ -2011,6 +2016,9 @@ def GetAllValideSessionPartner_List_Without_Scope_Action(diction):
val['_id'] = retVal['_id']
val['code_session'] = retVal['code_session']
if ("location_type" in retVal.keys() and retVal['location_type'] == "extra"):
val['location_type'] = "inter"
if( "session_etape" in retVal.keys()):
val['session_etape'] = retVal['session_etape']
else:
@ -2247,6 +2255,10 @@ def GetAllValideSessionPartner_List(diction):
val['_id'] = retVal['_id']
val['code_session'] = retVal['code_session']
if ("location_type" in retVal.keys() and retVal['location_type'] == "extra"):
val['location_type'] = "inter"
if ("session_etape" in retVal.keys()):
val['session_etape'] = retVal['session_etape']
else:
@ -2731,6 +2743,10 @@ def GetAllValideSessionPartner_List_filter_like(diction):
val['class_id'] = str(retVal['myclass_collection'][0]['_id'])
val['code_session'] = retVal['code_session']
if ("location_type" in retVal.keys() and retVal['location_type'] == "extra"):
val['location_type'] = "inter"
if ("titre" in retVal.keys()):
val['titre'] = retVal['titre']
else:
@ -3162,6 +3178,10 @@ def GetAllValideSessionPartner_List_no_filter(diction):
val['class_id'] = str(retVal['myclass_collection']['_id'])
val['code_session'] = retVal['code_session']
if ("location_type" in retVal.keys() and retVal['location_type'] == "extra"):
val['location_type'] = "inter"
if ("titre" in retVal.keys()):
val['titre'] = retVal['titre']
else:
@ -5233,7 +5253,7 @@ def Controle_Add_Update_SessionFormation_mass_for_many_class(saved_file=None, Fo
if (type_session):
local_type_session = type_session
print(" ### local_type_session = ", local_type_session)
#print(" ### local_type_session = ", local_type_session)
if (local_type_session not in MYSY_GV.TYPE_SESSION):
mycommon.myprint(

View File

@ -1693,6 +1693,10 @@ def Evaluation_training_confirmation_mail(diction):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demo.mysy-training.com/Display-Detail-formation/" + str(diction['internal_url'])+"/"+str(diction['token_eval'])
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://formation.mysy-training.com/Display-Detail-formation/" + str(
diction['internal_url']) + "/" + str(diction['token_eval'])
print(" ### Adresse = "+str(diction['adresse']) )
print(" #### my_url = ", my_url)
@ -2774,6 +2778,23 @@ def Employee_Credential_Sending_mail(diction):
# JINJA2
# This data can come from database query
body = {}
new_diction = {}
new_diction['token'] = diction['token']
new_diction['list_stagiaire_id'] = []
new_diction['list_session_id'] = []
new_diction['list_class_id'] = []
new_diction['list_client_id'] = []
new_diction['list_apprenant_id'] = []
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
if (local_status is False):
return local_status, local_retval
company_data = {}
if ("company_data" in local_retval.keys()):
company_data = local_retval['company_data']
body = {
@ -2783,6 +2804,7 @@ def Employee_Credential_Sending_mail(diction):
"login": str(diction['login']),
"pwd": str(diction['pwd']),
"mysy_url": str(diction['mysy_url']),
"company_data":company_data
},
}
@ -2790,7 +2812,7 @@ def Employee_Credential_Sending_mail(diction):
partner_document_EMPLOYEE_CREDENTIALS_data_qry = {'partner_owner_recid': str(diction['partner_owner_recid']),
'valide': '1', 'locked': '0', 'ref_interne': 'EMPLOYEE_CREDENTIALS'}
print(" ### partner_document_EMPLOYEE_CREDENTIALS_data_qry = ", partner_document_EMPLOYEE_CREDENTIALS_data_qry)
#print(" ### partner_document_EMPLOYEE_CREDENTIALS_data_qry = ", partner_document_EMPLOYEE_CREDENTIALS_data_qry)
partner_document_EMPLOYEE_CREDENTIALS_data = MYSY_GV.dbname['courrier_template'].find_one(partner_document_EMPLOYEE_CREDENTIALS_data_qry)
@ -2821,8 +2843,8 @@ def Employee_Credential_Sending_mail(diction):
# print(" ### PRE_INSCRIPTION_contenu_doc = ",str(sourceHtml))
"""
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
"""
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
"""
partner_own_smtp_value = "0"
partner_own_smtp = MYSY_GV.dbname['base_partner_setup'].find_one(
{'partner_owner_recid': str(diction['partner_owner_recid']),

View File

@ -81,6 +81,9 @@ def send_user_account_mail_old(message, account_mail):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://formationapimysy.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
my_url = "https://demoapi.xceliahub.com/myclass/api/valide_user_account/" + str(message)
@ -135,6 +138,10 @@ def send_user_thks_mail_old(message, account_mail):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://formationapimysy.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
my_url = "https://demoapi.xceliahub.com/myclass/api/valide_user_account/" + str(message)
@ -172,6 +179,9 @@ def send_partner_account_mail_old(message, account_mail):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_partnair_account/"+str(message)
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://formationapimysy.mysy-training.com/myclass/api/valide_partnair_account/"+str(message)
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
my_url = "https://demoapi.xceliahub.com/myclass/api/valide_partnair_account/"+str(message)
@ -1196,6 +1206,9 @@ def send_user_account_mail(message, account_mail):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://formationapimysy.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
my_url = "https://demoapi.xceliahub.com/myclass/api/valide_user_account/" + str(message)
@ -1269,6 +1282,10 @@ def send_partner_account_mail(message, account_mail):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_partnair_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://formationapimysy.mysy-training.com/myclass/api/valide_partnair_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
my_url = "https://demoapi.xceliahub.com/myclass/api/valide_partnair_account/" + str(message)
@ -1439,8 +1456,11 @@ def send_user_thks_mail(message, account_mail):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
my_url = "https://demoapi.xceliahub.com/myclass/api/valide_user_account/" + str(message)
my_url = "https://formationapimysy.xceliahub.com/myclass/api/valide_user_account/" + str(message)
"""
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=16, params={ "user_name": str(account_mail),},
@ -1509,6 +1529,11 @@ def send_user_init_pwd_mail(token, account_mail, type_account):
elif (MYSY_GV.MYSY_ENV == "DEM"):
my_url = "https://demo.mysy-training.com/ResetUserPwd/" + str(token) + "/" + str(type_account)
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
my_url = "https://formationapimysy.mysy-training.com/ResetUserPwd/" + str(token) + "/" + str(type_account)
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
my_url = "https://demo.xceliahub.com/ResetUserPwd/" + str(token) + "/" + str(type_account)
@ -2178,6 +2203,11 @@ def SendEmargementMail( diction):
elif (MYSY_GV.MYSY_ENV == "DEM"):
myurl = "https://demoapi.mysy-training.com/myclass/api/UserEmargementValidation/" + str(val_emarge['_id']) + "/1"
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
myurl = "https://formationapimysy.mysy-training.com/myclass/api/UserEmargementValidation/" + str(val_emarge['_id']) + "/1"
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
myurl = "https://demoapi.xceliahub.com/myclass/api/UserEmargementValidation/" + str(val_emarge['_id']) + "/1"
@ -3029,24 +3059,24 @@ def ManualSendInvoiceEmailRIB_CIC_TECHFIRM_IS_OUEST(diction):
body = {
"params": {"order_id": "N/A",
"date_order": ": 13/05/2026",
"periode":"26/05/2026 au 31/05/2026",
"total_ht": "1 600",
"tva": "320",
"total_ttc": "1 920",
"periode":"01/06/2026 au 30/06/2026",
"total_ht": "8 800",
"tva": "1 760",
"total_ttc": "10 560",
"client_name": "TECHFIRM IS OUEST",
"client_address": "Chez HQ Ravezies, CS 80112, 32 allée de Boutaut",
"client_zip_ville": "33000 Bordeaux,",
"client_pays": "France",
"packs": "Prestation de service ",
"detail_packs": "Direction de projets IT / MOE du Ministère de l'Agriculture, de l'Agro-alimentaire et de la Souveraineté Alimentaire",
"qty": "4 jours",
"qty": "22 jours",
"unit_price": "400 €",
"montant": "1 600 €",
"montant": "8 800 €",
"invoice_id": "FACT_20260525",
"invoice_date": "31/05/2026",
"due_date": "15/06/2026",
"invoice_id": "FACT_20260626",
"invoice_date": "30/06/2026",
"due_date": "15/07/2026",
"orign_order": "N/A",
}
}
@ -3080,7 +3110,7 @@ def ManualSendInvoiceEmailRIB_CIC_TECHFIRM_IS_OUEST(diction):
#print(" ### body 22 = ", body)
sourceHtml = template.render(json_data=body["params"])
orig_file_name = "invoice_FACT_20260525.pdf"
orig_file_name = "invoice_FACT_20260626.pdf"
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
# open output file for writing (truncated binary)

35
main.py
View File

@ -397,6 +397,9 @@ def valide_user_account(value):
elif (MYSY_GV.MYSY_ENV == "REC"):
url = 'https://dev.mysy-training.com/mysy-account-activated/'
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
url = 'https://formation.mysy-training.com/mysy-account-activated/'
elif (MYSY_GV.MYSY_ENV == "DEM"):
url = 'https://demo.mysy-training.com/mysy-account-activated/'
@ -413,6 +416,9 @@ def valide_user_account(value):
elif (MYSY_GV.MYSY_ENV == "REC"):
url = 'https://dev.mysy-training.com/'
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
url = 'https://formation.mysy-training.com/'
elif (MYSY_GV.MYSY_ENV == "DEM"):
url = 'https://demo.mysy-training.com/'
@ -905,6 +911,9 @@ def valide_partnair_account(value):
elif (MYSY_GV.MYSY_ENV == "REC"):
url = 'https://dev.mysy-training.com/PartnerLogin1/'
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
url = 'https://formation.mysy-training.com/PartnerLogin1/'
elif (MYSY_GV.MYSY_ENV == "DEM"):
url = 'https://demo.mysy-training.com/PartnerLogin1/'
@ -921,6 +930,9 @@ def valide_partnair_account(value):
elif (MYSY_GV.MYSY_ENV == "DEM"):
url = 'https://demo.mysy-training.com/'
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
url = 'https://formation.mysy-training.com/'
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
url = 'https://demo.xceliahub.com/'
@ -3295,6 +3307,9 @@ def UserEmargementValidation(value, session):
elif (MYSY_GV.MYSY_ENV == "DEM"):
url = 'https://demo.mysy-training.com/Emargement/'
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
url = 'https://formation.mysy-training.com/Emargement/'
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
url = 'https://demo.xceliahub.com/Emargement/'
@ -3310,6 +3325,10 @@ def UserEmargementValidation(value, session):
elif (MYSY_GV.MYSY_ENV == "DEM"):
url = 'https://demo.mysy-training.com/erreur'
elif (MYSY_GV.MYSY_ENV == "FORMATION"):
url = 'https://formation.mysy-training.com/erreur'
elif (MYSY_GV.MYSY_ENV == "XCELIA_DEM"):
url = 'https://demo.xceliahub.com/erreur'
@ -17698,6 +17717,22 @@ def get_FI_base_authorized_type_evaluation():
"""
API pour envoyer des message SMS via OVH
"""
@app.route('/myclass/api/EySy_OVH_Send_Sms/', methods=['POST','GET'])
@crossdomain(origin='*')
def EySy_OVH_Send_Sms():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### EySy_OVH_Send_Sms payload = ",payload)
status, retval = mycommon.EySy_OVH_Send_Sms(payload)
return jsonify(status=status, message=retval)
"""
API qui permet d'ajouter le stage d'un etudiant

View File

@ -295,7 +295,7 @@ def Add_Partner_Client(diction):
if ("telephone" in diction.keys()):
if diction['telephone']:
telephone = diction['telephone']
data['telephone'] = telephone
data['telephone'] = str(mycommon.normalize_phone_for_sms_France(telephone))
website = ""
@ -425,7 +425,7 @@ def Add_Partner_Client(diction):
if ("invoice_telephone" in diction.keys()):
if diction['invoice_telephone']:
invoice_telephone = diction['invoice_telephone']
data['invoice_telephone'] = invoice_telephone
data['invoice_telephone'] = str(mycommon.normalize_phone_for_sms_France(invoice_telephone))
list_adress = []
line = 0
@ -495,7 +495,7 @@ def Add_Partner_Client(diction):
if ("invoice_telephone" not in diction.keys()):
if ("telephone" in diction.keys()):
invoice_telephone = diction['telephone']
data['invoice_telephone'] = str(invoice_telephone)
data['invoice_telephone'] = str(mycommon.normalize_phone_for_sms_France(invoice_telephone))
@ -571,13 +571,13 @@ def Add_Partner_Client(diction):
new_contact_diction['fonction'] = ""
if ("contact_mobile" in diction.keys()):
new_contact_diction['telephone_mobile'] = diction['contact_mobile']
new_contact_diction['telephone_mobile'] = str(mycommon.normalize_phone_for_sms_France(diction['contact_mobile']))
else:
new_contact_diction['telephone_mobile'] = ""
if ("contact_phone" in diction.keys()):
new_contact_diction['telephone'] = diction['contact_phone']
new_contact_diction['telephone'] = str(mycommon.normalize_phone_for_sms_France(diction['contact_phone']))
else:
new_contact_diction['telephone'] = ""
@ -635,7 +635,7 @@ def Add_Partner_Client(diction):
new_contact_diction['telephone_mobile'] = ""
if ("telephone" in diction.keys()):
new_contact_diction['telephone'] = diction['telephone']
new_contact_diction['telephone'] = str(mycommon.normalize_phone_for_sms_France(diction['telephone'] ))
else:
new_contact_diction['telephone'] = ""
@ -928,7 +928,7 @@ def Add_Partner_Prospect(diction):
if ("telephone" in diction.keys()):
if diction['telephone']:
telephone = diction['telephone']
data['telephone'] = telephone
data['telephone'] = str(mycommon.normalize_phone_for_sms_France( telephone ))
website = ""
@ -1151,7 +1151,7 @@ def Update_Partner_Client_Contact(diction):
telephone = ""
if ("telephone" in diction.keys()):
telephone = diction['telephone']
data_update["address.$[elem].telephone"] = telephone
data_update["address.$[elem].telephone"] = str(mycommon.normalize_phone_for_sms_France(telephone ))
"""print(" #### data_update = ", data_update)
@ -1452,7 +1452,7 @@ def Update_Partner_Client(diction):
telephone = ""
if ("telephone" in diction.keys()):
telephone = diction['telephone']
data_update['telephone'] = diction['telephone']
data_update['telephone'] = str(mycommon.normalize_phone_for_sms_France(diction['telephone'] ))
email = ""
if ("email" in diction.keys()):
@ -1521,7 +1521,7 @@ def Update_Partner_Client(diction):
invoice_telephone = ""
if ("invoice_telephone" in diction.keys()):
invoice_telephone = diction['invoice_telephone']
data_update['invoice_telephone'] = diction['invoice_telephone']
data_update['invoice_telephone'] = str(mycommon.normalize_phone_for_sms_France(diction['invoice_telephone'] ))
invoice_pays = ""
if ("invoice_pays" in diction.keys()):
@ -2387,7 +2387,7 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
'contact_fonction', 'contact_mobile', 'contact_phone', 'contact_adresse', 'contact_code_postal',
'contact_ville',
'contact_pays', 'contact_siret', 'contact_tva',
'is_fournisseur', 'is_client', 'is_financeur', 'client_type_code']
'is_fournisseur', 'is_client', 'is_financeur', 'client_type_code', 'responsable_compte_email']
# Controle du nombre de lignes dans le fichier.
@ -2539,6 +2539,48 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
partner_groupe_client_id = str(is_valide_partner_groupe_client_data['_id'])
mydata['partner_groupe_client_id'] = partner_groupe_client_id
# Verifier que l'adresse email du responsable de compte est valide
responsable_compte_email = ""
responsable_compte_id = ""
if ("responsable_compte_email" in df.keys()):
if (str(df['responsable_compte_email'].values[n]) and str(df['responsable_compte_email'].values[n]) != ""):
responsable_compte_email = str(df['responsable_compte_email'].values[n]).strip()
if (mycommon.isEmailValide(responsable_compte_email) is False):
mycommon.myprint(str(
inspect.stack()[0][3]) + " - L'email du responsable de compte '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide.")
return False, " L'email du responsable de compte '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide."
is_responsable_compte_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
{'email': responsable_compte_email,
'valide': '1',
'locked': '0',
'partner_recid': my_partner['recid']})
if (is_responsable_compte_email_ok <= 0):
mycommon.myprint(str(
inspect.stack()[0][3]) + " - L'email du responsable de compte '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide (2).")
return False, " L'email du formateur '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide (2)."
responsable_compte_data = MYSY_GV.dbname['ressource_humaine'].find_one({'email': responsable_compte_email,
'valide': '1',
'locked': '0',
'partner_recid': my_partner['recid']})
responsable_compte_id = str(responsable_compte_data['_id'])
mydata['responsable_compte_id'] = responsable_compte_id
# type de client : client_type_code
client_type_id = ""
if ("client_type_code" in df.keys()):
@ -2604,7 +2646,7 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
contact_email = ""
if ("contact_email" in df.keys()):
if ("contact_email" in df.keys() and str(df['contact_email'].values[n]).strip()):
if (str(df['contact_email'].values[n])):
contact_email = str(df['contact_email'].values[n])
mydata['contact_email'] = contact_email
@ -2619,7 +2661,7 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
contact_email = ""
if ("contact_email" in df.keys()):
if ("contact_email" in df.keys() and str(df['contact_email'].values[n])):
if (str(df['contact_email'].values[n])):
contact_email = str(df['contact_email'].values[n])
mydata['contact_email'] = contact_email
@ -2768,7 +2810,7 @@ def Controle_Add_Partner_Client_mass(saved_file=None, Folder=None, diction=None)
'contact_civilite', 'contact_nom', 'contact_prenom', 'contact_email', 'is_contact_communication',
'contact_fonction','contact_mobile', 'contact_phone', 'contact_adresse', 'contact_code_postal', 'contact_ville',
'contact_pays', 'contact_siret', 'contact_tva',
'is_fournisseur', 'is_client', 'is_financeur', 'client_type_code']
'is_fournisseur', 'is_client', 'is_financeur', 'client_type_code', 'responsable_compte_email']
# Controle du nombre de lignes dans le fichier.
@ -2830,7 +2872,7 @@ def Controle_Add_Partner_Client_mass(saved_file=None, Folder=None, diction=None)
# Contoler contact_email
if ("contact_email" in df.keys()):
if ("contact_email" in df.keys() and str(df['contact_email'].values[n]).strip() ):
contact_email = str(df['contact_email'].values[n]).strip()
if (mycommon.isEmailValide(contact_email) is False):
mycommon.myprint(
@ -2919,6 +2961,37 @@ def Controle_Add_Partner_Client_mass(saved_file=None, Folder=None, diction=None)
return False, "Le champ 'is_financeur' pour la ligne " + str(
n + 2) + " est invalide. Les valeurs acceptées '0', '1', ou '[vide]'"
# Verifier que l'adresse email du responsable de compte est valide
if ("responsable_compte_email" in df.keys()):
if (str(df['responsable_compte_email'].values[n]) and str(
df['responsable_compte_email'].values[n]) != ""):
responsable_compte_email = str(df['responsable_compte_email'].values[n]).strip()
if (mycommon.isEmailValide(responsable_compte_email) is False):
mycommon.myprint(str(
inspect.stack()[0][3]) + " - L'email du responsable de compte '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide.")
return False, " L'email du responsable de compte '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide."
is_responsable_compte_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
{'email': responsable_compte_email,
'valide': '1',
'locked': '0',
'partner_recid': my_partner['recid']})
if (is_responsable_compte_email_ok <= 0):
mycommon.myprint(str(
inspect.stack()[0][3]) + " - L'email du responsable de compte '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide (2).")
return False, " L'email du formateur '" + str(
responsable_compte_email) + "' pour la ligne " + str(
n + 2) + " n'est pas valide (2)."
# Controle des conditions de paiement : partner_groupe_client_code

View File

@ -6370,6 +6370,22 @@ def Update_Partner_Draft_Invoice(diction):
return False, " - Le champ 'Commentaire' fait plus de 500 caractères ", False
data['invoice_header_comment'] = diction['invoice_header_comment']
invoice_date_work = datetime.today().strftime("%d/%m/%Y")
invoice_date = invoice_date_work
if ("invoice_date" in diction.keys()):
if diction['invoice_date']:
invoice_date = str(diction['invoice_date']).strip()
local_status = mycommon.CheckisDate(invoice_date)
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de facture n'est pas au format 'jj/mm/aaaa' ")
return False, " La date de facture n'est pas au format 'jj/mm/aaaa' "
data['invoice_date'] = str(invoice_date)
invoice_date_str = str(invoice_date)
print(" ### invoice_date_str = ", invoice_date_str)
order_header_lieu_formation = ""
if ("order_header_lieu_formation" in diction.keys()):
if diction['order_header_lieu_formation']:
@ -6382,6 +6398,8 @@ def Update_Partner_Draft_Invoice(diction):
return False, " - Le champ 'Lieu de formation' fait plus de 1000 caractères ", False
data['order_header_lieu_formation'] = diction['order_header_lieu_formation']
order_header_condition_paiement_id = ""
if ("order_header_condition_paiement_id" in diction.keys() and diction['order_header_condition_paiement_id']):
is_valide_condition_paiement_id = MYSY_GV.dbname['base_partner_paiement_condition'].count_documents(
@ -6410,21 +6428,22 @@ def Update_Partner_Draft_Invoice(diction):
nb_jour_int = mycommon.tryInt(str(paiement_condition_data['nb_jour']))
today = datetime.today()
date_echance = datetime.today()
date_echance_old = datetime.today()
date_echance = datetime.strptime(invoice_date_str, "%d/%m/%Y")
if (str(paiement_condition_data['depart']) == "mois"):
days_in_month = lambda dt: monthrange(dt.year, dt.month)[1]
first_day_next_month = today.replace(day=1) + timedelta(days_in_month(today))
first_day_next_month = date_echance.replace(day=1) + timedelta(days_in_month(today))
date_echance = first_day_next_month + timedelta(days=nb_jour_int)
if (str(paiement_condition_data['depart']) == "facture"):
date_echance = today + timedelta(days=nb_jour_int)
date_echance = date_echance + timedelta(days=nb_jour_int)
date_echance = date_echance.strftime("%d/%m/%Y")
data['invoice_date_echeance'] = str(date_echance)
order_header_condition_paiement_code = ""
if ("order_header_condition_paiement_code" in diction.keys()):
if diction['order_header_condition_paiement_code']:
@ -7617,12 +7636,8 @@ def Confirm_Partner_Invoice_Header_And_Lines(diction):
'valide': '1', 'locked': '0', 'status': '0',
'_id': ObjectId(str(invoice_header_id))})
"""
Important : : A present que tous les controles sont ok, on va proceder à la creation dans les table.
"""
# Récuperation de la sequence de l'objet "partner_invoice_header" dans la collection : "mysy_sequence"
@ -7655,8 +7670,12 @@ def Confirm_Partner_Invoice_Header_And_Lines(diction):
### 1 - Mise à jour de l'entete
# Recuperation des champs
now = str(datetime.now())
invoice_date_time = str(datetime.now().strftime("%d/%m/%Y"))
if( "invoice_date" in my_order_data_previous_information.keys()):
invoice_date_time = str(my_order_data_previous_information['invoice_date'])
data = {}
invoice_ref_interne = retval_sequence_invoice['prefixe'] + str(current_seq_value)
data['invoice_header_ref_interne'] = invoice_ref_interne

View File

@ -35,7 +35,7 @@ from unidecode import unidecode
import GlobalVariable as MYSY_GV
from serpapi import GoogleSearch
import re
import ovh
import attached_file_mgt
import email_mgt as email_mgt
import random
@ -869,7 +869,10 @@ def IsFloat(val):
try:
val = str(val).replace(",",".")
myfloat = round(float(val), 2)
return True, myfloat
myfloat_2 = int(myfloat) if myfloat == int(myfloat) else myfloat
return True, myfloat_2
except ValueError:
return False, 0
@ -8979,3 +8982,106 @@ def get_FI_base_authorized_type_evaluation(diction=None):
return False, " Impossible de récupérer la liste des type d'évaluation autorisés"
def normalize_phone_for_sms_France(phone: str, default_country_code: str = "+33") -> str:
"""
Normalise un numéro de téléphone pour OVH SMS.
Exemple France :
06 12 34 56 78 -> +33612345678
0033612345678 -> +33612345678
+33 6 12... -> +33612345678
"""
if not phone:
return ""
# Supprime espaces, points, tirets, parenthèses
phone = str(phone).strip()
phone = re.sub(r"[^\d+]", "", phone)
# 0033... -> +33...
if phone.startswith("00"):
phone = "+" + phone[2:]
# Déjà au format international
if phone.startswith("+"):
return phone
# Numéro français local : 06... ou 07...
if phone.startswith("0"):
return default_country_code + phone[1:]
# Cas : 612345678 sans le 0
if default_country_code == "+33" and len(phone) == 9 and phone[0] in ["6", "7"]:
return "+33" + phone
# Sinon, on ajoute l'indicatif par défaut
return default_country_code + phone
"""
Fonction d'envoi d'un message SMS"""
def EySy_OVH_Send_Sms(diction):
try:
diction = strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['phone_number', 'message']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
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 = ['phone_number', 'message']
for val in field_list_obligatoire:
if val not in diction:
myprint(
str(inspect.stack()[0][
3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
return False, " Les informations fournies sont incorrectes",
phone_number = normalize_phone_for_sms_France(str(diction['phone_number']))
message = str(diction['message'])
if(len(message) > MYSY_GV.SMS_MESSAGE_MAX_LENGTH):
message = str(message)[0:MYSY_GV.SMS_MESSAGE_MAX_LENGTH]
client = ovh.Client(
endpoint=MYSY_GV.OVH_ENDPOINT,
application_key=MYSY_GV.OVH_APPLICATION_KEY,
application_secret=MYSY_GV.OVH_APPLICATION_SECRET,
consumer_key=MYSY_GV.OVH_CONSUMER_KEY,
)
service_name = MYSY_GV.OVH_SMS_SERVICE_NAME
sender = MYSY_GV.OVH_SMS_SENDER
response = client.post(
f"/sms/{service_name}/jobs",
charset="UTF-8",
coding="7bit",
message=message,
noStopClause=False,
priority="high",
receivers=[phone_number],
sender=sender,
senderForResponse=False,
validityPeriod=2880
)
return True, "Le message SMS a bien été envoyé"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible d'envoyer le message SMS OVH"

View File

@ -358,7 +358,12 @@ def Add_Ressource_Humaine(diction):
'adr_ville', 'adr_pays', 'profil', 'telephone_mobile', 'linkedin',
'facebook', 'twitter', 'prenom', 'fonction', 'civilite', 'superieur_hierarchie_id', 'ismanager',
'groupe_prix_achat_id', 'prix_achat', 'type_contrat', 'gategorie', 'date_naissance', 'competence',
'diffusion_mail', 'type_rh'
'diffusion_mail', 'type_rh',
'is_handicap', 'is_droit_image', 'is_rgpd', 'nationalite', 'situation_famille', 'naissance_lieu',
'naissance_departement',
'naissance_pays', 'num_secu', 'identite_type', 'piece_identite_num', 'nom_fille',
'profession', 'siret'
]
incom_keys = diction.keys()
@ -428,7 +433,7 @@ def Add_Ressource_Humaine(diction):
prenom = diction['prenom']
data['prenom'] = prenom
date_naissance = ""
date_naissance = "01/01/1900"
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
@ -607,6 +612,75 @@ def Add_Ressource_Humaine(diction):
data['email'] = email
if ("is_handicap" in diction.keys() and str(diction['is_handicap']) not in ['0', '1', '']):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'is_handicap' est invalide ")
return False, " Le champ 'is_handicap' est invalide "
is_handicap = ""
if ("is_handicap" in diction.keys()):
if diction['is_handicap']:
is_handicap = str(diction['is_handicap']).strip()
data['is_handicap'] = is_handicap
if ("is_droit_image" in diction.keys() and str(diction['is_droit_image']) not in ['0', '1', '']):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'is_droit_image' est invalide ")
return False, " Le champ 'is_droit_image' est invalide "
is_droit_image = ""
if ("is_droit_image" in diction.keys()):
if diction['is_droit_image']:
is_droit_image = str(diction['is_droit_image']).strip()
data['is_droit_image'] = is_droit_image
if ("situation_famille" in diction.keys() and str(diction['situation_famille']) not in MYSY_GV.SITUATION_FAMILLE):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'situation_famille' est invalide ")
return False, " Le champ 'situation_famille' est invalide "
situation_famille = ""
if ("situation_famille" in diction.keys()):
if diction['situation_famille']:
situation_famille = str(diction['situation_famille']).strip()
data['situation_famille'] = situation_famille
if ("identite_type" in diction.keys() and str(diction['identite_type']) not in MYSY_GV.PICE_IDENTITE_TYPE):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'identite_type' est invalide ")
return False, " Le champ 'identite_type' est invalide "
identite_type = ""
if ("identite_type" in diction.keys()):
if diction['identite_type']:
identite_type = str(diction['identite_type']).strip()
data['identite_type'] = identite_type
nom_fille = ""
if ("nom_fille" in diction.keys()):
if diction['nom_fille']:
nom_fille = str(diction['nom_fille']).strip()
data['nom_fille'] = nom_fille
profession = ""
if ("profession" in diction.keys()):
if diction['profession']:
profession = str(diction['profession']).strip()
data['profession'] = profession
siret = ""
if ("siret" in diction.keys()):
if diction['siret']:
siret = str(diction['siret']).strip()
data['siret'] = siret
telephone = ""
if ("telephone" in diction.keys()):
if diction['telephone']:
@ -749,7 +823,12 @@ def Update_Ressource_Humaine(diction):
'adr_ville', 'adr_pays', 'profil', 'telephone_mobile', 'linkedin',
'facebook', 'twitter', '_id', 'prenom', 'fonction', 'civilite',
'superieur_hierarchie_id', 'ismanager', 'groupe_prix_achat_id', 'prix_achat', 'type_contrat',
'gategorie', 'date_naissance', 'competence', 'diffusion_mail']
'gategorie', 'date_naissance', 'competence', 'diffusion_mail',
'is_handicap', 'is_droit_image', 'is_rgpd', 'nationalite', 'situation_famille', 'naissance_lieu',
'naissance_departement', 'naissance_pays', 'num_secu', 'identite_type', 'piece_identite_num', 'nom_fille',
'profession', 'siret'
]
incom_keys = diction.keys()
@ -851,7 +930,7 @@ def Update_Ressource_Humaine(diction):
data_update['civilite'] = civilite
date_naissance = ""
date_naissance = "01/01/1900"
if ("date_naissance" in diction.keys()):
if diction['date_naissance']:
date_naissance = str(diction['date_naissance']).strip()
@ -1063,6 +1142,133 @@ def Update_Ressource_Humaine(diction):
data_update['competence'] = diction['competence']
if ("is_rgpd" in diction.keys() and str(diction['is_rgpd']) not in ['0', '1', '']):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'is_rgpd' est invalide ")
return False, " Le champ 'is_rgpd' est invalide "
is_rgpd = ""
if ("is_rgpd" in diction.keys()):
if diction['is_rgpd']:
is_rgpd = str(diction['is_rgpd']).strip()
data_update['is_rgpd'] = is_rgpd
if ("is_handicap" in diction.keys() and str(diction['is_handicap']) not in ['0', '1', '']):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'is_handicap' est invalide ")
return False, " Le champ 'is_handicap' est invalide "
is_handicap = ""
if ("is_handicap" in diction.keys()):
if diction['is_handicap']:
is_handicap = str(diction['is_handicap']).strip()
data_update['is_handicap'] = is_handicap
if ("is_droit_image" in diction.keys() and str(diction['is_droit_image']) not in ['0', '1', '']):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'is_droit_image' est invalide ")
return False, " Le champ 'is_droit_image' est invalide "
is_droit_image = ""
if ("is_droit_image" in diction.keys()):
if diction['is_droit_image']:
is_droit_image = str(diction['is_droit_image']).strip()
data_update['is_droit_image'] = is_droit_image
if ("situation_famille" in diction.keys() and str(diction['situation_famille']) not in MYSY_GV.SITUATION_FAMILLE):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'situation_famille' est invalide ")
return False, " Le champ 'situation_famille' est invalide "
situation_famille = ""
if ("situation_famille" in diction.keys()):
if diction['situation_famille']:
situation_famille = str(diction['situation_famille']).strip()
data_update['situation_famille'] = situation_famille
if ("identite_type" in diction.keys() and str(diction['identite_type']) not in MYSY_GV.PICE_IDENTITE_TYPE):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'identite_type' est invalide ")
return False, " Le champ 'identite_type' est invalide "
identite_type = ""
if ("identite_type" in diction.keys()):
if diction['identite_type']:
identite_type = str(diction['identite_type']).strip()
data_update['identite_type'] = identite_type
piece_identite_num = ""
if ("piece_identite_num" in diction.keys()):
if diction['piece_identite_num']:
piece_identite_num = str(diction['piece_identite_num']).strip()
data_update['piece_identite_num'] = piece_identite_num
nom_fille = ""
if ("nom_fille" in diction.keys()):
if diction['nom_fille']:
nom_fille = str(diction['nom_fille']).strip()
data_update['nom_fille'] = nom_fille
nationalite = ""
if ("nationalite" in diction.keys()):
if diction['nationalite']:
nationalite = str(diction['nationalite']).strip()
data_update['nationalite'] = nationalite
naissance_lieu = ""
if ("naissance_lieu" in diction.keys()):
if diction['naissance_lieu']:
naissance_lieu = str(diction['naissance_lieu']).strip()
data_update['naissance_lieu'] = naissance_lieu
naissance_departement = ""
if ("naissance_departement" in diction.keys()):
if diction['naissance_departement']:
naissance_departement = str(diction['naissance_departement']).strip()
data_update['naissance_departement'] = naissance_departement
naissance_pays = ""
if ("naissance_pays" in diction.keys()):
if diction['naissance_pays']:
naissance_pays = str(diction['naissance_pays']).strip()
data_update['naissance_pays'] = naissance_pays
num_secu = ""
if ("num_secu" in diction.keys()):
if diction['num_secu']:
num_secu = str(diction['num_secu']).strip()
data_update['num_secu'] = num_secu
piece_identite_num = ""
if ("piece_identite_num" in diction.keys()):
if diction['piece_identite_num']:
piece_identite_num = str(diction['piece_identite_num']).strip()
data_update['piece_identite_num'] = piece_identite_num
profession = ""
if ("profession" in diction.keys()):
if diction['profession']:
profession = str(diction['profession']).strip()
data_update['profession'] = profession
siret = ""
if ("siret" in diction.keys()):
if diction['siret']:
siret = str(diction['siret']).strip()
data_update['siret'] = siret
"""
Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenaire
@ -1560,6 +1766,20 @@ def Get_List_Ressource_Humaine_with_filter(diction):
if ("nom" in diction.keys() and diction['nom']):
filt_nom = {'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom'])), "$options": "i"}}
"""
Filtre général
"""
if ("nom" in diction.keys()):
filt_nom = {"$or": [
{'prenom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
{'telephone_mobile': {'$regex': mycommon.regex_replace_cartere(str(diction['nom']))}},
]}
filt_type_rh = {}
if ("type_rh" in diction.keys() and diction['type_rh']):
filt_type_rh = {'type_rh': str(diction['type_rh'])}
@ -2315,6 +2535,44 @@ def Get_Given_Ressource_Humaine(diction):
if( "date_naissance" not in user.keys() ):
user['date_naissance'] = "01/01/1901"
if ("is_handicap" not in user.keys()):
user['is_handicap'] = "0"
if ("is_droit_image" not in user.keys()):
user['is_droit_image'] = "0"
if ("is_rgpd" not in user.keys()):
user['is_rgpd'] = "0"
if ("nationalite" not in user.keys()):
user['nationalite'] = ""
if ("situation_famille" not in user.keys()):
user['situation_famille'] = ""
if ("naissance_lieu" not in user.keys()):
user['naissance_lieu'] = ""
if ("naissance_departement" not in user.keys()):
user['naissance_departement'] = ""
if ("naissance_pays" not in user.keys()):
user['naissance_pays'] = ""
if ("num_secu" not in user.keys()):
user['num_secu'] = ""
if ("identite_type" not in user.keys()):
user['identite_type'] = ""
if ("piece_identite_num" not in user.keys()):
user['piece_identite_num'] = ""
if ("nom_fille" not in user.keys()):
user['nom_fille'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
#print(" ### RetObject = ", RetObject)
@ -2843,7 +3101,7 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
if ("telephone_mobile" in df.keys()):
if (str(df['telephone_mobile'].values[n])):
telephone_mobile = str(df['telephone_mobile'].values[n])
mydata['telephone_mobile'] = telephone_mobile
mydata['telephone_mobile'] = str(mycommon.normalize_phone_for_sms_France(telephone_mobile))
type_rh = ""
if ("type_rh" in df.keys()):
@ -2853,7 +3111,7 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
mydata['type_rh'] = type_rh
date_naissance = ""
date_naissance = "01/01/1900"
if ("date_naissance" in df.keys()):
if (str(df['date_naissance'].values[n])):
date_naissance = str(df['date_naissance'].values[n])
@ -2872,7 +3130,7 @@ def Add_Ressource_Humaine_mass(file=None, Folder=None, diction=None):
if ("telephone" in df.keys()):
if (str(df['telephone'].values[n])):
telephone = str(df['telephone'].values[n])
mydata['telephone'] = telephone
mydata['telephone'] = str(mycommon.normalize_phone_for_sms_France(telephone))
civilite = ""
if ("civilite" in df.keys()):
@ -3183,7 +3441,7 @@ def Controle_Add_Ressource_Humaine_mass(saved_file=None, Folder=None, diction=No
mydata['civilite'] = str(civilite).lower()
date_naissance = ""
date_naissance = "01/01/1900"
if ("date_naissance" in df.keys()):
if (str(df['date_naissance'].values[n])):
date_naissance = str(df['date_naissance'].values[n])
@ -4111,8 +4369,17 @@ def Add_Update_Employee_Login_Pass(diction):
mydata['pack_service'] = str(my_partner['pack_service'])
mydata['nb_formation'] = str(my_partner['nb_formation'])
mydata['stripe_account_id'] = str(my_partner['stripe_account_id'])
mydata['stripe_paymentmethod_id'] = str(my_partner['stripe_paymentmethod_id'])
mydata['lms_virtualhost_id'] = str(my_partner['lms_virtualhost_id'])
if ("stripe_paymentmethod_id" in my_partner.keys()):
mydata['stripe_paymentmethod_id'] = str(my_partner['stripe_paymentmethod_id'])
else:
mydata['stripe_paymentmethod_id'] = ""
if("lms_virtualhost_id" in my_partner.keys()):
mydata['lms_virtualhost_id'] = str(my_partner['lms_virtualhost_id'])
else:
mydata['lms_virtualhost_id'] = ""
mydata['recid'] = str(my_partner['recid'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
@ -4195,6 +4462,7 @@ def Add_Update_Employee_Login_Pass(diction):
" Impossible de créer ou mettre à jour le compte utilisateur pour " + str(diction['email']))
return False, " Impossible de créer ou mettre à jour le compte utilisateur "
"""
15/02/2024 :
Si l'utilisateur a un deja un accès LMS, il faut aussi mettre à jour le mot de passe dans le LMS
@ -4260,6 +4528,7 @@ def Add_Update_Employee_Login_Pass(diction):
else:
data_for_mail['email_bcc'] = str(result['email'])
data_for_mail['token'] = diction['token']
#print(" #### data_for_mail = ", data_for_mail)
email_inscription_mgt.Employee_Credential_Sending_mail(data_for_mail)
@ -4279,6 +4548,30 @@ def Add_Update_Employee_Login_Pass(diction):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique : " + str(diction['rh_id']))
#print(" ICICI ### count_account = ", count_account)
if (count_account == 0 and "telephone_mobile" in employee_data and employee_data['telephone_mobile']):
# Il faut envoyer le sms de notification de l'ouverture du compte
tronked_email_work = str(email).split("@")
tronked_email_sms = str(email)
if (len(tronked_email_work) == 2):
tronked_email_sms = str(tronked_email_work[0])[0:2] + "xxxx@" + str(tronked_email_work[1])
diction_sms = {}
diction_sms['phone_number'] = str(employee_data['telephone_mobile'])
diction_sms['message'] = "Bonjour, votre compte utilisateur EYSY a été créé. Un email vous a ete envoye a : " + str(
tronked_email_sms) + ". Pensez a verifier vos spams."
status_send_sms, retval_send_sms = mycommon.EySy_OVH_Send_Sms(diction_sms)
if( status_send_sms is False):
mycommon.myprint(
" WARNING : Impossible d'envoyer le sms de notification d'ouverture du compte pour : " + str(diction['rh_id']))
return True, " Les accès ont été créées. Les emails de notification envoyés"
except Exception as e:

View File

@ -17,11 +17,18 @@ def send_sms(phone_number: str, message: str):
message : contenu du SMS
"""
client = ovh.Client(
client_ARCH = ovh.Client(
endpoint="ovh-eu",
application_key="16ef9f92d1580d15",
application_secret="ec7e66e0f27f5494038c14fcb11d105a",
consumer_key="0268191866b32cce8ea012136ce94ddd",
application_key="f6bfba1b35684556",
application_secret="ebb362779fc7f4ab18019cd3da75d5cd",
consumer_key="0712f5a9e7255894f48bdf0aa7d97cae",
)
client = ovh.Client(
endpoint = MYSY_GV.OVH_ENDPOINT,
application_key = MYSY_GV.OVH_APPLICATION_KEY,
application_secret = MYSY_GV.OVH_APPLICATION_SECRET,
consumer_key = MYSY_GV.OVH_CONSUMER_KEY,
)
service_name = MYSY_GV.OVH_SMS_SERVICE_NAME
@ -30,7 +37,7 @@ def send_sms(phone_number: str, message: str):
print('## get/SMS ')
print(client.get("/sms"))
print('============================ ')
response = client.post(
f"/sms/{service_name}/jobs",
@ -67,10 +74,10 @@ def list_sms_services():
"""
client = ovh.Client(
endpoint="ovh-eu",
application_key="16ef9f92d1580d15",
application_secret="ec7e66e0f27f5494038c14fcb11d105a",
consumer_key="0268191866b32cce8ea012136ce94ddd",
endpoint=MYSY_GV.OVH_ENDPOINT,
application_key=MYSY_GV.OVH_APPLICATION_KEY,
application_secret=MYSY_GV.OVH_APPLICATION_SECRET,
consumer_key=MYSY_GV.OVH_CONSUMER_KEY,
)
return client.get("/sms")
@ -78,14 +85,19 @@ def list_sms_services():
def Send_OVH_SMS():
try:
list_sms_services()
#list_sms_services()
print(" DEBUT ENVOI SMSSSS ")
result = send_sms(
phone_number="+33629378286",
message="Bonjour, ceci est un SMS de test envoyé depuis MySy / Elyos."
message = (
"Bonjour, votre compte utilisateur EYSY a ete cree. Un email vous a ete envoye a : aasdxxxx@gmail.fr. Pensez a verifier vos spams."
)
)
print("SMS envoyé avec succès :")
print(result)