14/10/2025 - 23h

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2025-10-14 23:14:34 +02:00
parent b8f91d9dfb
commit 21bacab87b
4 changed files with 1754 additions and 23 deletions

View File

@ -4,26 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="10/10/2025 - 17:30">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="12/10/2025 - 17:14 - Elyos V1.2">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.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$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.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$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.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$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/formulaire_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/formulaire_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/jury_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/jury_mgt.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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/temp_direct/qr_code_052.png" beforeDir="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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -466,7 +451,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="498" />
<option name="localTasksCounter" value="499" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -508,7 +493,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="31/05/2025 - 20h" />
<MESSAGE value="02/06/2025 - 20h" />
<MESSAGE value="04/06/2025 - 21h" />
<MESSAGE value="05/06/2025 - 20h" />
@ -533,6 +517,7 @@
<MESSAGE value="10/08/2025 - 10h" />
<MESSAGE value="sss" />
<MESSAGE value="10/10/2025 - 17:30" />
<option name="LAST_COMMIT_MESSAGE" value="10/10/2025 - 17:30" />
<MESSAGE value="12/10/2025 - 17:14 - Elyos V1.2" />
<option name="LAST_COMMIT_MESSAGE" value="12/10/2025 - 17:14 - Elyos V1.2" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,75 @@ import attached_file_mgt
import Inscription_mgt as Inscription_mgt
"""
Cette fonction permet de créer un email à vide, jute pour recuperer un _id
"""
def Create_Empty_Internal_Mail(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', ]
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
mycommon.myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
return False, " Les informations fournies sont incorrectes"
"""
Verification de l'identité et autorisation de l'entité qui
appelle cette API
"""
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
new_data = {}
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['statut'] = "0"
new_data['is_read'] = "0"
new_data['creation_date'] = str(datetime.now())
new_data['creation_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
inserted_id = MYSY_GV.dbname['internal_mail'].insert_one(new_data).inserted_id
if (not inserted_id):
mycommon.myprint(
" Impossible d'ajouter le message dans la collection internal_email (2) ")
return False, " Impossible d'ajouter le message dans la collection internal_email (2) "
return True, str(inserted_id)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, "Impossible d'ajouter le message dans la collection internal_email "
"""
Important :
actuellement le login se fait via la collection 'user_account' ou 'partnair_account'
@ -383,6 +452,7 @@ def Get_List_User_Internal_Mail(diction):
data_cle['locked'] = "0"
data_cle['related_collection_recid'] = str(diction['related_collection_recid'])
print(" ### data_cle = ", data_cle)
RetObject = []
val_tmp = 0
@ -402,6 +472,79 @@ def Get_List_User_Internal_Mail(diction):
return False, " Impossible de récupérer la liste des messages "
"""
Recuperer la liste des message ENVOYES par un user
"""
def Get_List_Internal_Mail_Sent_By_User(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'creation_by']
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', 'creation_by']
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
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['valide'] = "1"
data_cle['locked'] = "0"
data_cle['creation_by'] = str(diction['creation_by'])
print(" ### data_cle = ", data_cle)
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['internal_mail'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la liste des messages "
"""
Cette fonction recupere le nombre d'email non lu pour un user
"""
@ -512,8 +655,8 @@ def Get_Given_Internal_Mail(diction):
RetObject = []
val_tmp = 0
#print(" ### data_cle = ", data_cle)
for retval in MYSY_GV.dbname['internal_mail'].find({'_id':ObjectId(str(diction['internal_mail_id'])), 'valide':'1', 'locked':'1'}):
print(" ### data_cle = ", {'_id':ObjectId(str(diction['internal_mail_id'])), 'valide':'1', 'locked':'0'})
for retval in MYSY_GV.dbname['internal_mail'].find({'_id':ObjectId(str(diction['internal_mail_id'])), 'valide':'1', 'locked':'0'}):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
@ -559,3 +702,111 @@ def Send_List_Internal_Mail(diction):
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de renvoyer les emails "
"""
Cette fonction recupere la liste des emails possible comme destinataire
Il s'agit des emails repertoriés par dans les collection "partnaire_account" et "user_account"
"""
def Get_List_Internal_Destinataire(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
mycommon.myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
return False, " Les informations fournies sont incorrectes",
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token',]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
return False, " Les informations fournies sont incorrectes",
"""
Verification de l'identité et autorisation de l'entité qui
appelle cette API
"""
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['active'] = "1"
data_cle['locked'] = "0"
print(" ### data_cle = ", data_cle)
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['partnair_account'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
user = {}
user['id'] = str(val_tmp)
user['_id'] = str(retval['_id'])
if( "nom" in retval.keys()):
user['nom'] = retval['nom']
else:
user['nom'] = ""
if ("prenom" in retval.keys()):
user['prenom'] = retval['prenom']
else:
user['prenom'] = ""
if ("email" in retval.keys()):
user['email'] = retval['email']
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
for retval in MYSY_GV.dbname['user_account'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
user = {}
user['id'] = str(val_tmp)
user['_id'] = str(retval['_id'])
if( "nom" in retval.keys()):
user['nom'] = retval['nom']
else:
user['nom'] = ""
if ("prenom" in retval.keys()):
user['prenom'] = retval['prenom']
else:
user['prenom'] = ""
if ("email" in retval.keys()):
user['email'] = retval['email']
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la liste adresse email "

48
main.py
View File

@ -14185,6 +14185,23 @@ def Get_Given_Groupe_Client():
"""
API pour créer un email vide pour recuperer l'_id (pour les pièces jointes)
"""
@app.route('/myclass/api/Create_Empty_Internal_Mail/', methods=['POST','GET'])
@crossdomain(origin='*')
def Create_Empty_Internal_Mail():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Create_Empty_Internal_Mail payload = ",payload)
status, retval = internal_email_mgt.Create_Empty_Internal_Mail(payload)
return jsonify(status=status, message=retval)
"""
API pour envoyer un email à un utilisateur du systeme
"""
@ -14238,6 +14255,21 @@ def Get_List_User_Internal_Mail():
return jsonify(status=status, message=retval)
"""
API pour recuperer la liste des emails ENVOYE PAR utilisateur du systeme
"""
@app.route('/myclass/api/Get_List_Internal_Mail_Sent_By_User/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Internal_Mail_Sent_By_User():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Internal_Mail_Sent_By_User payload = ",payload)
status, retval = internal_email_mgt.Get_List_Internal_Mail_Sent_By_User(payload)
return jsonify(status=status, message=retval)
"""
API pour recuperer le nombre d'emails non lu pour un user
"""
@ -14279,6 +14311,22 @@ def Send_List_Internal_Mail():
"""
API pour recuperer la liste des adresse email interne possible comme destinataire
"""
@app.route('/myclass/api/Get_List_Internal_Destinataire/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Internal_Destinataire():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Internal_Destinataire payload = ",payload)
status, retval = internal_email_mgt.Get_List_Internal_Destinataire(payload)
return jsonify(status=status, message=retval)
"""
API pour ajouter un message dans la file d'attente des emails
"""