parent
f8431d5cf9
commit
bf4fbe0c50
|
|
@ -4,16 +4,16 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/11/2025 - 22h30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="16/11/25 - 16h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/BPF.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/BPF.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Data/Convocation_43598_97971_20250610_104314_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.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$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/module_editique.py" beforeDir="false" afterPath="$PROJECT_DIR$/module_editique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_alert_messages.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_alert_messages.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -456,7 +456,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="513" />
|
||||
<option name="localTasksCounter" value="514" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -498,7 +498,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="qsdssdd" />
|
||||
<MESSAGE value="ss" />
|
||||
<MESSAGE value="ssss" />
|
||||
<MESSAGE value="03/07/2025 - 19h30" />
|
||||
|
|
@ -523,6 +522,7 @@
|
|||
<MESSAGE value="12/11/2025 - 22h30" />
|
||||
<MESSAGE value="13/11/2025 - 22h30" />
|
||||
<MESSAGE value="15/11/2025 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="15/11/2025 - 22h30" />
|
||||
<MESSAGE value="16/11/25 - 16h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="16/11/25 - 16h30" />
|
||||
</component>
|
||||
</project>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -882,7 +882,7 @@ EMAIL_MAX_PJ = 5
|
|||
"""
|
||||
La clé API de OpenAI
|
||||
"""
|
||||
OPENAI_KEY = "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"
|
||||
OPENAI_KEY = "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"
|
||||
|
||||
"""
|
||||
Variable interne pour le traitement
|
||||
|
|
|
|||
5345
Log/log_file.log
5345
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -6184,6 +6184,203 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
|
|||
return False, " Impossible d'envoyer les conventions par email "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Envoi des convention email en mode TEST
|
||||
"""
|
||||
def Test_Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction):
|
||||
try:
|
||||
|
||||
field_list_obligatoire = ['token', 'session_id', 'courrier_template_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 la liste des arguments ")
|
||||
return False, " La valeur '" + val + "' n'est pas presente dans la liste des arguments"
|
||||
|
||||
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 promotion 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 promotion est invalide ")
|
||||
return False, " L'identifiant de La promotion est invalide "
|
||||
|
||||
my_inscription_ids = ""
|
||||
if ("tab_ids" in diction.keys()):
|
||||
if diction['tab_ids']:
|
||||
my_inscription_ids = diction['tab_ids']
|
||||
|
||||
tab_my_inscription_Object_ids = []
|
||||
|
||||
tab_my_inscription_ids = str(my_inscription_ids).split(",")
|
||||
for my_inscription_id in tab_my_inscription_ids:
|
||||
tab_my_inscription_Object_ids.append(ObjectId(str(my_inscription_id)))
|
||||
|
||||
|
||||
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans La promotion pour le client
|
||||
liste_client_rattachement_id = MYSY_GV.dbname['inscription'].distinct("client_rattachement_id",
|
||||
{'session_id':str(diction['session_id']),
|
||||
'_id': {
|
||||
'$in': tab_my_inscription_Object_ids},
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"client_rattachement_id": { '$ne': ''}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
print(" ### la liste des liste_client_rattachement_id = ", liste_client_rattachement_id)
|
||||
|
||||
|
||||
# Sauvegarde des fichiers joints depuis le front
|
||||
tab_saved_file_full_path = []
|
||||
for file in tab_files:
|
||||
status, saved_file_full_path = mycommon.Upload_Save_PDF_IMG_File(file, Folder)
|
||||
if (status is False):
|
||||
mycommon.myprint("Impossible de récupérer correctement le fichier à importer")
|
||||
return False, "Impossible de récupérer correctement le fichier à importer"
|
||||
|
||||
tab_saved_file_full_path.append(saved_file_full_path)
|
||||
|
||||
print(" #### tab_saved_file_full_path = ", tab_saved_file_full_path)
|
||||
|
||||
# Recupération des données du modèle de document
|
||||
is_convention_by_client = "0"
|
||||
courrier_template_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'])}
|
||||
)
|
||||
|
||||
if( courrier_template_data and "edit_by_client" in courrier_template_data.keys() and courrier_template_data['edit_by_client'] == "1"):
|
||||
is_convention_by_client = "1"
|
||||
|
||||
if( str(is_convention_by_client) == "1" ):
|
||||
# Envoie des conventions pour les inscrits AVEC client_id (conventions d'entreprise)
|
||||
for single_client in liste_client_rattachement_id :
|
||||
print(" Traintement du client_id = ", single_client)
|
||||
|
||||
# Recuperation des contacts de communication du client
|
||||
local_diction = {}
|
||||
local_diction['token'] = diction['token']
|
||||
local_diction['_id'] = str(single_client)
|
||||
|
||||
#print(" ##### local_diction = ", local_diction)
|
||||
local_status, partner_client_contact_communication = partner_client.Get_Partner_Client_Communication_Contact(local_diction)
|
||||
|
||||
|
||||
if (local_status is False):
|
||||
mycommon.myprint(" Impossible de récupérer les contacts de communication du client ")
|
||||
return False, " Impossible de récupérer les contacts de communication du client "
|
||||
|
||||
#print(" ### partner_client_contact_communication = ", partner_client_contact_communication)
|
||||
tab_local_email_production = []
|
||||
for tmp in partner_client_contact_communication:
|
||||
tmp_JSON = ast.literal_eval(tmp)
|
||||
if ("email" in tmp_JSON.keys()):
|
||||
tab_local_email_production.append(str(tmp_JSON["email"]))
|
||||
|
||||
list_local_email_production = ",".join(tab_local_email_production)
|
||||
|
||||
new_diction_client = {}
|
||||
new_diction_client['partner_client_id'] = single_client
|
||||
new_diction_client['token'] = diction['token']
|
||||
new_diction_client['courrier_template_id'] = diction['courrier_template_id']
|
||||
new_diction_client['email_test'] = diction['email_test']
|
||||
new_diction_client['email_production'] = str(list_local_email_production)
|
||||
new_diction_client['session_id'] = diction['session_id']
|
||||
new_diction_client['request_digital_signature'] = ""
|
||||
if( "request_digital_signature" in diction.keys() ):
|
||||
new_diction_client['request_digital_signature'] = diction['request_digital_signature']
|
||||
|
||||
|
||||
#print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
|
||||
local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_saved_file_full_path, Folder, new_diction_client)
|
||||
|
||||
if( local_status is False):
|
||||
mycommon.myprint(" WARNING : impossible d'envoyer la convention au client : "+str( single_client))
|
||||
|
||||
elif (str(is_convention_by_client) == "0"):
|
||||
liste_inscription_no_client = MYSY_GV.dbname['inscription'].find(
|
||||
{"$or": [{'session_id': str(diction['session_id']),
|
||||
'_id': {'$in': tab_my_inscription_Object_ids},
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
"client_rattachement_id": ''
|
||||
},
|
||||
{'session_id': str(diction['session_id']),
|
||||
'_id': {'$in': tab_my_inscription_Object_ids},
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'client_rattachement_id': {'$exists': False}
|
||||
}]
|
||||
}
|
||||
)
|
||||
# Envoie des conventions pour les inscrits SANS client_id (conventions individuelles)
|
||||
print(" ### is_convention_by_client ==== 0 : ")
|
||||
print(" ### LIST traitement de l'inscrit : ", liste_inscription_no_client)
|
||||
|
||||
|
||||
for single_inscrit_no_client in liste_inscription_no_client :
|
||||
#print(" ### traitement de l'inscrit : ",single_inscrit_no_client )
|
||||
#field_list_obligatoire = [ 'token', 'inscription_id', 'courrier_template_id', 'email_test', 'email_production' ]
|
||||
new_diction_no_client = {}
|
||||
new_diction_no_client['token'] = str(diction['token'])
|
||||
new_diction_no_client['inscription_id'] = str(single_inscrit_no_client['_id'])
|
||||
new_diction_no_client['courrier_template_id'] = diction['courrier_template_id']
|
||||
|
||||
new_diction_no_client['session_id'] = diction['session_id']
|
||||
new_diction_no_client['email_test'] = diction['email_test']
|
||||
new_diction_no_client['email_production'] = diction['email_production']
|
||||
new_diction_no_client['request_digital_signature'] = ""
|
||||
if ("request_digital_signature" in diction.keys()):
|
||||
new_diction_no_client['request_digital_signature'] = diction['request_digital_signature']
|
||||
|
||||
print(" ##### new_diction_no_client = ", new_diction_no_client)
|
||||
local_status, local_retval = Inscription_mgt.Sent_Convention_Stagiaire_By_Email(tab_saved_file_full_path, Folder, new_diction_no_client)
|
||||
|
||||
if (local_status is False):
|
||||
mycommon.myprint(" WARNING impossible d'envoyer la convention a l'apprenant : " + str(single_inscrit_no_client['_id']) )
|
||||
|
||||
else:
|
||||
return False, " Vous devez definir si la convention est individuelle ou par client"
|
||||
|
||||
# Traitement de l'eventuel fichier joint
|
||||
tab_files_to_attache_to_mail = []
|
||||
|
||||
|
||||
|
||||
return True, " Les conventions ont été correctement envoyées par email"
|
||||
|
||||
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 "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
La meme que la précedente mais pour un groupe d'inscrit
|
||||
Important : : Les convention entreprise se font par CLIENT.
|
||||
|
|
@ -8618,6 +8815,146 @@ def Prepare_and_Send_Convocation_From_Session_By_Email(tab_files, Folder, dictio
|
|||
return False, " Impossible d'envoyer les conventions par email "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Fonction d'envoi des convocation en mode test
|
||||
"""
|
||||
|
||||
def Test_Prepare_and_Send_Convocation_From_Session_By_Email(tab_files, Folder, diction):
|
||||
try:
|
||||
|
||||
field_list_obligatoire = ['token', 'session_id', 'courrier_template_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 la liste des arguments ")
|
||||
return False, " La valeur '" + val + "' n'est pas presente dans la liste des arguments"
|
||||
|
||||
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 promotion 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 promotion est invalide ")
|
||||
return False, " L'identifiant de La promotion est invalide "
|
||||
|
||||
my_inscription_ids = ""
|
||||
if ("tab_ids" in diction.keys()):
|
||||
if diction['tab_ids']:
|
||||
my_inscription_ids = diction['tab_ids']
|
||||
|
||||
tab_my_inscription_Object_ids = []
|
||||
|
||||
tab_my_inscription_ids = str(my_inscription_ids).split(",")
|
||||
for my_inscription_id in tab_my_inscription_ids:
|
||||
tab_my_inscription_Object_ids.append(ObjectId(str(my_inscription_id)))
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans La promotion pour le client
|
||||
liste_participants = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'_id': {'$in': tab_my_inscription_Object_ids},
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
#print(" ### la liste des liste_participants = ", liste_participants)
|
||||
|
||||
|
||||
# Sauvegarde des fichiers joints depuis le front
|
||||
tab_saved_file_full_path = []
|
||||
for file in tab_files:
|
||||
status, saved_file_full_path = mycommon.Upload_Save_PDF_IMG_File(file, Folder)
|
||||
if (status is False):
|
||||
mycommon.myprint("Impossible de récupérer correctement le fichier à importer")
|
||||
return False, "Impossible de récupérer correctement le fichier à importer"
|
||||
|
||||
tab_saved_file_full_path.append(saved_file_full_path)
|
||||
|
||||
#print(" #### tab_saved_file_full_path = ", tab_saved_file_full_path)
|
||||
|
||||
# Recupération des données du modèle de document
|
||||
is_convention_by_client = "0"
|
||||
courrier_template_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'])}
|
||||
)
|
||||
|
||||
if( courrier_template_data and "edit_by_client" in courrier_template_data.keys() and courrier_template_data['edit_by_client'] == "1"):
|
||||
is_convention_by_client = "1"
|
||||
|
||||
|
||||
if (str(is_convention_by_client) == "0"):
|
||||
liste_inscription = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'_id': {'$in': tab_my_inscription_Object_ids},
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}
|
||||
)
|
||||
|
||||
#print(" ### LIST liste_inscription: ", liste_inscription)
|
||||
|
||||
|
||||
for single_inscrit in liste_inscription :
|
||||
#print(" ### convocation traitement de l'inscrit : ",single_inscrit )
|
||||
#field_list_obligatoire = [ 'token', 'inscription_id', 'courrier_template_id', 'email_test', 'email_production' ]
|
||||
new_diction_no_client = {}
|
||||
new_diction_no_client['token'] = str(diction['token'])
|
||||
new_diction_no_client['inscription_id'] = str(single_inscrit['_id'])
|
||||
new_diction_no_client['courrier_template_id'] = diction['courrier_template_id']
|
||||
|
||||
new_diction_no_client['session_id'] = diction['session_id']
|
||||
new_diction_no_client['email_test'] = diction['email_test']
|
||||
new_diction_no_client['email_production'] = diction['email_production']
|
||||
|
||||
#print(" ##### new_diction_no_client = ", new_diction_no_client)
|
||||
local_status, local_retval = Sent_Convocation_Stagiaire_By_Email(tab_saved_file_full_path, Folder, new_diction_no_client)
|
||||
|
||||
if (local_status is False):
|
||||
mycommon.myprint(" WARNING impossible d'envoyer la convocation a l'apprenant : " + str(single_inscrit['_id']) )
|
||||
|
||||
|
||||
# Traitement de l'eventuel fichier joint
|
||||
tab_files_to_attache_to_mail = []
|
||||
|
||||
"""
|
||||
25/01/2024 : pour loger une action dans la collection ==> courrier_template_tracking_history
|
||||
"""
|
||||
"""local_status, local_retval = module_editique.Editic_Log_History_Action(my_partner, courrier_template_data,
|
||||
str(diction['session_id']), "inscription", str(single_inscrit['_id']))"""
|
||||
|
||||
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(
|
||||
my_partner, "CONVOCATION_STAGIAIRE", str(diction['session_id']), 'inscription',
|
||||
str(single_inscrit['_id']),
|
||||
str(str(courrier_template_data['_id'])))
|
||||
|
||||
|
||||
return True, " Les convocations ont été correctement envoyées par email"
|
||||
|
||||
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 "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
La meme que la précedentes, a la difference qu'on envoie les convocation
|
||||
pour une liste d'inscrits bien précise.
|
||||
|
|
@ -8666,7 +9003,8 @@ def Prepare_and_Send_Convocation_From_Session_For_Selected_Inscrit_By_Email(tab_
|
|||
|
||||
tab_my_inscription_ids = str(my_inscription_ids).split(",")
|
||||
for my_inscription_id in tab_my_inscription_ids:
|
||||
tab_my_inscription_Object_ids.append(ObjectId(str(my_inscription_id)))
|
||||
if(my_inscription_id ):
|
||||
tab_my_inscription_Object_ids.append(ObjectId(str(my_inscription_id)))
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans La promotion pour le client
|
||||
liste_participants = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2567,7 +2567,7 @@ def LMS_Credential_Sending_mail(diction):
|
|||
queue_mail_diction['tab_email_bcc'] = tab_email_bcc
|
||||
queue_mail_diction['email_sujet'] = sujetHtml
|
||||
queue_mail_diction['email_to'] = str(diction['email'])
|
||||
queue_mail_diction['message'] = diction['initial_message']
|
||||
queue_mail_diction['message'] = str(sourceHtml)
|
||||
|
||||
queue_mail_diction['smtp_account_password'] = local_SMTP_COUNT_password
|
||||
queue_mail_diction['smtp_account_smtpsrv'] = local_SMTP_COUNT_smtpsrv
|
||||
|
|
@ -2578,7 +2578,7 @@ def LMS_Credential_Sending_mail(diction):
|
|||
if ("tab_saved_file_full_path" in diction.keys()):
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = diction['tab_saved_file_full_path']
|
||||
else:
|
||||
queue_mail_diction = []
|
||||
queue_mail_diction['tab_files_to_attache_to_mail'] = []
|
||||
|
||||
internal_mail_diction = {}
|
||||
for tmp in queue_mail_diction.keys():
|
||||
|
|
|
|||
|
|
@ -277,7 +277,6 @@ def Update_Ent_Alert_Message(diction):
|
|||
return False, " Impossible de mettre à jour le message "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des message d'alerte ENT d'un partenaire
|
||||
"""
|
||||
|
|
@ -345,6 +344,146 @@ def Get_List_Ent_Alert_Message(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 de récupérer la liste des message "
|
||||
return False, " Impossible de récupérer la liste des messages "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de supprimer une liste de message
|
||||
"""
|
||||
def Delete_Ent_Alert_Message(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'tab_ids']
|
||||
|
||||
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', 'tab_ids',]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
tab_message_ids = ""
|
||||
if ("tab_ids" in diction.keys()):
|
||||
if diction['tab_ids']:
|
||||
tab_message_ids = diction['tab_ids']
|
||||
|
||||
tab_message_Object_ids = []
|
||||
|
||||
tab_my_message_ids = str(tab_message_ids).split(",")
|
||||
for message_id in tab_my_message_ids:
|
||||
if( message_id ):
|
||||
tab_message_Object_ids.append(ObjectId(str(message_id)))
|
||||
|
||||
"""
|
||||
Suppression des données dans la collection
|
||||
"""
|
||||
delete_row = MYSY_GV.dbname['ent_alert_message'].delete_many(
|
||||
{'_id': {'$in': tab_message_Object_ids},
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
return True, " (" + str(delete_row.deleted_count) + " message(s) supprimé(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 de supprimer les messages "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données d'un message
|
||||
"""
|
||||
def Get_Given_Ent_Alert_Message(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
print(" ## my_partner = ",my_partner)
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['partner_owner_recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['_id'] = ObjectId(str(diction['_id']))
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['ent_alert_message'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer les données du message "
|
||||
|
|
|
|||
90
main.py
90
main.py
|
|
@ -2665,6 +2665,27 @@ def Prepare_and_Send_Convention_From_Session_By_Email():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API : pour préparer et envoyer les convention en partant d'une session EN MODE TEST
|
||||
"""
|
||||
@app.route('/myclass/api/Test_Prepare_and_Send_Convention_From_Session_By_Email/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Test_Prepare_and_Send_Convention_From_Session_By_Email():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Test_Prepare_and_Send_Convention_From_Session_By_Email : payload = ",str(payload))
|
||||
|
||||
file = []
|
||||
if request.method == 'POST':
|
||||
# Create variable for uploaded file
|
||||
tab_files = []
|
||||
for tmp in request.files.getlist("File"):
|
||||
tab_files.append(tmp)
|
||||
|
||||
status, retval = SF.Test_Prepare_and_Send_Convention_From_Session_By_Email(tab_files, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API : pour préparer et envoyer les convention en partant d'une session MAIS
|
||||
|
|
@ -7437,6 +7458,22 @@ def Delete_Stored_Downloaded_File():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API de suppression d'un fichier stocké
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Stored_Downloaded_File_from_Ids/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Stored_Downloaded_File_from_Ids():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Stored_Downloaded_File_from_Ids : payload = ",payload)
|
||||
status, retval = attached_file_mgt.Delete_Stored_Downloaded_File_from_Ids(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API d'enregistrement
|
||||
d'une pièce jointe
|
||||
|
|
@ -7950,7 +7987,7 @@ API qui supprime une sequence à une session de formation en masse
|
|||
def Delete_Given_Session_Sequence_Mass():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Given_Session_Sequence_Mass payload = ",payload)
|
||||
print(" ### Delete_Given_Session_Sequence_Mass payload = ",)
|
||||
status, retval = Session_Formation_Sequence.Delete_Given_Session_Sequence_Mass(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
|
@ -9150,6 +9187,29 @@ def Prepare_and_Send_Convocation_From_Session_By_Email():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API : pour préprer et envoyer les convocations en partant d'une session en MODE TESTTTTT
|
||||
"""
|
||||
@app.route('/myclass/api/Test_Prepare_and_Send_Convocation_From_Session_By_Email/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Test_Prepare_and_Send_Convocation_From_Session_By_Email():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Test_Prepare_and_Send_Convocation_From_Session_By_Email : payload = ",str(payload))
|
||||
|
||||
file = []
|
||||
if request.method == 'POST':
|
||||
# Create variable for uploaded file
|
||||
tab_files = []
|
||||
for tmp in request.files.getlist("File"):
|
||||
tab_files.append(tmp)
|
||||
|
||||
status, retval = SF.Test_Prepare_and_Send_Convocation_From_Session_By_Email(tab_files, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API : pour préprer et envoyer les convocations en partant d'une session avec une liste d'inscrits bien definie
|
||||
"""
|
||||
|
|
@ -14641,6 +14701,34 @@ def Get_List_Ent_Alert_Message():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer les données d'une message d'alerte
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Ent_Alert_Message/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Ent_Alert_Message():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Ent_Alert_Message payload = ",payload)
|
||||
status, retval = ent_alert_messages.Get_Given_Ent_Alert_Message(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer une liste de messages d'alerte
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Ent_Alert_Message/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Ent_Alert_Message():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Ent_Alert_Message payload = ",payload)
|
||||
status, retval = ent_alert_messages.Delete_Ent_Alert_Message(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue