08/06/2025 - 16h30

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2025-06-09 19:39:56 +02:00
parent 31e23691f3
commit 80c5590d1b
14 changed files with 12935 additions and 6122 deletions

View File

@ -4,19 +4,21 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="07/06/2025 - 21h30">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="08/06/2025 - 16h30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_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$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_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$/formulaire_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/formulaire_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/user_session.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_session.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -458,7 +460,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="472" />
<option name="localTasksCounter" value="473" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -500,7 +502,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="10/03/2025 - 13h" />
<MESSAGE value="29/03/2025 - 9h" />
<MESSAGE value="29/03/2025 - 21h" />
<MESSAGE value="25/04/2025 - 15h" />
@ -525,6 +526,7 @@
<MESSAGE value="06/06/2025 - 20h" />
<MESSAGE value="qsd" />
<MESSAGE value="07/06/2025 - 21h30" />
<option name="LAST_COMMIT_MESSAGE" value="07/06/2025 - 21h30" />
<MESSAGE value="08/06/2025 - 16h30" />
<option name="LAST_COMMIT_MESSAGE" value="08/06/2025 - 16h30" />
</component>
</project>

View File

@ -759,7 +759,6 @@ def AddStagiairetoClass(diction):
Vu que c'est une inscription validée du premier cout, alors on va lancer les opération de validation
"""
local_diction = {}
local_diction['token'] = str(mytoken)
local_diction['email'] = str(diction['email'])
@ -6509,9 +6508,7 @@ def AcceptAttendeeInscription(diction):
Mettre à jour la collection "inscription" en ajoutant local_participant_lms_id et et le mot de passe
et la date d'expiration du compte LMS
"""
print(" ### Mise à jour 'inscription' pour inscription_line_id = ", str(diction['inscription_id']),
" local_participant_lms_id = ", local_participant_lms_id, " str(new_diction['password'] ",
str(new_diction['password']), " lms_account_expiration_date = ",local_lms_access_end_date_formated )
local_ret_val = MYSY_GV.dbname['inscription'].find_one_and_update(
{'_id': ObjectId(str(diction['inscription_id'])), 'partner_owner_recid':str(my_partner['recid'])},
{"$set": {'lms_user_id': str(local_participant_lms_id),
@ -11075,7 +11072,7 @@ def Download_Convention_Stagiaire_PDF_By_Partner_client(diction):
# Creation du dictionnaire d'information à utiliser pour la creation du doc
print(" ### convention_dictionnary_data = ")
#print(" ### convention_dictionnary_data = ")
#json_object = ast.literal_eval(convention_dictionnary_data)
@ -13480,7 +13477,7 @@ def Create_Emargement_Send_Email_From_Inscription(diction):
Recuperation du modèle de courrier pour la demande d'emargement
"""
local_diction = {}
local_diction['ref_interne'] = "EMARGEMENT_REQUEST_EMAIL"
local_diction['ref_interne'] = "EMARGEMENT_FORMATION"
local_diction['type_doc'] = "email"
local_diction['partner_owner_recid'] = str(my_partner['recid'])

View File

@ -2934,7 +2934,7 @@ def Cron_Send_Emargement_By_Date_By_Email_for_not_sent(Folder, 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"
return False, " La valeur '" + val + "' n'est pas presente dans la liste des arguments", "0"
my_token = ""
if ("token" in diction.keys()):
@ -2943,7 +2943,7 @@ def Cron_Send_Emargement_By_Date_By_Email_for_not_sent(Folder, diction):
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
return local_status, my_partner, "0"
# Verifier que la session est valide
is_session_valide = MYSY_GV.dbname['session_formation'].count_documents(
@ -2955,7 +2955,7 @@ def Cron_Send_Emargement_By_Date_By_Email_for_not_sent(Folder, diction):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de la session est invalide ")
return False, " L'identifiant de la session est invalide "
return False, " L'identifiant de la session est invalide ", "0"
"""
/!\ Cas particulier des émargements
@ -2994,11 +2994,11 @@ def Cron_Send_Emargement_By_Date_By_Email_for_not_sent(Folder, diction):
if (is_warning_message == "1"):
return True, str(warning_message)
return True, str(warning_message), str(len(tab_emargement_ids))
return True, "Les demandes d'émargement envoyées par emails", str(len(tab_emargement_ids))
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible d'envoyer les demandes d'émargement "
return False, " Impossible d'envoyer les demandes d'émargement ", "0"

File diff suppressed because it is too large Load Diff

View File

@ -104,22 +104,24 @@ def Add_Update_SessionFormation(diction):
user_scope_class_id_ObjectId = []
query_class_scope = {}
if ("scope" in my_partner.keys() and "class_id" in my_partner['scope'].keys() and len(my_partner['scope']['class_id']) > 0):
for tmp in my_partner['scope']['class_id']:
user_scope_class_id_ObjectId.append(ObjectId(str(tmp)))
query_class_scope = {'_id': { '$in': user_scope_class_id_ObjectId} }
"""
Verifier la validité de la formation
"""
is_class_valide = MYSY_GV.dbname['myclass'].count_documents({'internal_url':str(diction['class_internal_url']),
is_class_valide = MYSY_GV.dbname['myclass'].count_documents({'$and': [{'internal_url':str(diction['class_internal_url']),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0',
'_id': {
'$in': user_scope_class_id_ObjectId}
}
'locked':'0'},
query_class_scope]}
)
if( is_class_valide != 1 ):
@ -153,12 +155,19 @@ def Add_Update_SessionFormation(diction):
class_internal_url = ""
class_id = ""
if ("class_internal_url" in diction.keys()):
mydata['class_internal_url'] = diction['class_internal_url']
mydata['class_id'] = str(is_class_data['_id'])
class_id = str(is_class_data['_id'])
query_key['class_id'] = str(is_class_data['_id'])
# Aller recuperer le class_id
Class_data = MYSY_GV.dbname['myclass'].find_one({"internal_url":str(diction['class_internal_url']), 'valide':'1',
'partner_owner_recid':str(my_partner['recid'])}, {'_id':1})
if( Class_data and '_id' in Class_data.keys() ):
mydata['class_id'] = str(Class_data['_id'])
class_id = str(Class_data['_id'])
#query_key['class_id'] = str(is_class_data['_id'])
class_source = ""
if ("source" in diction.keys()):
@ -585,6 +594,7 @@ def Add_Update_SessionFormation(diction):
return True, " La promotion de formation à bien été mise à jour"
print(" ### GRRR str(session_id) = ", str(session_id))
if (len(str(session_id)) <= 0):
# La promotion n'existe pas, on fait une simple creation
@ -605,6 +615,8 @@ def Add_Update_SessionFormation(diction):
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])}
print(" #### qry_automatic_setup == ", qry_automatic_setup)
for base_document_automatic_setup_for_partner in MYSY_GV.dbname['base_document_automatic_setup'].find(qry_automatic_setup):
new_local_data = base_document_automatic_setup_for_partner
new_local_data['statut'] = "0"
@ -613,7 +625,7 @@ def Add_Update_SessionFormation(diction):
mydata['automatic_traitement'].append(new_local_data)
#print(" ### mydata ICIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII = ", mydata)
print(" ### mydata ICIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII = ", mydata)
coll_name = MYSY_GV.dbname['session_formation']
ret_val = coll_name.insert_one(mydata)
@ -634,7 +646,7 @@ def Add_Update_SessionFormation(diction):
'valide':'1',
'locked':'0',
'related_collection':'myclass',
'related_collection_id':str(is_class_data['_id'])}):
'related_collection_id':str(class_id)}):
del financial_data['_id']
financial_data['related_collection'] = "session_formation"
financial_data['related_collection_id'] = str(session_formtion_inserted_id)

View File

@ -5,6 +5,10 @@ Un apprenant est crée apres la validation d'une inscription ou sans.
"""
import ast
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import xlsxwriter
import jinja2
import pymongo
@ -509,6 +513,19 @@ def Get_Given_Apprenant_Data(diction):
if( "date_naissance" not in user.keys() or str(user['date_naissance']) == ""):
user['date_naissance'] = "01/01/1900"
"""
Aller voir s'il a un compte ENT
"""
has_ent_account = MYSY_GV.dbname['user_account'].count_documents({'apprenant_id':str(val['_id']),
'partner_owner_recid':str(my_partner['recid'])})
if( has_ent_account == 1):
user['is_ent_compte'] = '1'
else:
user['is_ent_compte'] = '0'
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
@ -810,6 +827,20 @@ def Get_List_Partner_Apprenant(diction):
user['client_nom'] = client_nom
"""
Aller voir s'il a un compte ENT
"""
has_ent_account = MYSY_GV.dbname['user_account'].count_documents(
{'apprenant_id': str(val['_id']),
'partner_owner_recid': str(my_partner['recid'])})
if (has_ent_account == 1):
user['is_ent_compte'] = '1'
else:
user['is_ent_compte'] = '0'
if( 'civilite' in val.keys() ):
user['civilite'] = str(val['civilite']).lower()
else:
@ -892,6 +923,28 @@ def Get_Apprenant_List_Partner_with_filter(diction):
if ("date_naissance" not in val.keys() or str(val['date_naissance']) == ""):
val['date_naissance'] = "01/01/1900"
"""
Aller voir s'il a un compte ENT
"""
has_ent_account = MYSY_GV.dbname['user_account'].count_documents(
{'apprenant_id': str(val['_id']),
'partner_owner_recid': str(my_partner['recid'])})
if (has_ent_account == 1):
val['is_ent_compte'] = '1'
else:
val['is_ent_compte'] = '0'
if ('civilite' in retVal.keys()):
val['civilite'] = str(retVal['civilite']).lower()
else:
val['civilite'] = ""
if ("date_naissance" not in retVal.keys() or str(retVal['date_naissance']) == ""):
val['date_naissance'] = "01/01/1900"
RetObject.append(mycommon.JSONEncoder().encode(val))
@ -2750,7 +2803,77 @@ def ENT_Create_Apprenant_Account(diction):
3]) + " L'identifiant de l'apprenant "+str(val)+" est invalide ")
return False, " L'identifiant de l'apprenant "+str(val)+" est invalide "
# Recuperer l'url vers l'espace ENT
local_partner_ent_student_url = ""
config_partner_catalog_data = MYSY_GV.dbname['config_partner_catalog'].find_one(
{'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'}, {'_id': 1, 'partner_ent_student_url': 1})
if (config_partner_catalog_data and "partner_ent_student_url" in config_partner_catalog_data.keys() and
config_partner_catalog_data['partner_ent_student_url']):
local_partner_ent_student_url = config_partner_catalog_data['partner_ent_student_url']
# recuperer le model de document
local_diction = {}
local_diction['ref_interne'] = "STUDENT_CREDENTIALS_FOR_ENT"
local_diction['type_doc'] = "email"
local_diction['partner_owner_recid'] = str(my_partner['recid'])
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(
local_diction)
if (courrier_data_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Impossible de récuperer le modèle de courrier 'STUDENT_CREDENTIALS_FOR_ENT' ")
return False, " Impossible de récuperer le modèle de courrier 'STUDENT_CREDENTIALS_FOR_ENT' "
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier 'STUDENT_CREDENTIALS_FOR_ENT' n'est pas correctement configuré - contenu_doc")
return False, " Le modèle de courrier 'STUDENT_CREDENTIALS_FOR_ENT' n'est pas correctement configuré - contenu_doc"
"""
Envoie des email de notification des apprenants
"""
# Recuperation des donnes SMTP
(local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User,
partner_SMTP_COUNT_port) = mycommon.Get_Partner_SMTP_Param(my_partner['recid'])
if (local_stpm_status is False):
return local_stpm_status, partner_own_smtp_value
smtpserver = None
if (str(partner_own_smtp_value) == "1"):
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
else:
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
cpt_email_envoye = 0
# Creation du dictionnaire d'information à utiliser pour la creation du doc
convention_dictionnary_data = {}
new_diction = {}
new_diction['token'] = my_partner['token']
new_diction['list_stagiaire_id'] = []
new_diction['list_session_id'] = []
new_diction['list_class_id'] = []
new_diction['list_client_id'] = []
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
if (local_status is False):
return local_status, local_retval
convention_dictionnary_data = local_retval
convention_dictionnary_data['url_ent_student'] = local_partner_ent_student_url
"""
A présent tous les apprenants sont valides,
@ -2807,9 +2930,56 @@ def ENT_Create_Apprenant_Account(diction):
return_document=ReturnDocument.AFTER
)
convention_dictionnary_data['civilite'] = local_apprenant_data['civilite']
convention_dictionnary_data['nom'] = local_apprenant_data['nom']
convention_dictionnary_data['prenom'] = local_apprenant_data['prenom']
convention_dictionnary_data['email'] = local_apprenant_data['email']
convention_dictionnary_data['ent_login'] = local_apprenant_data['email']
convention_dictionnary_data['ent_pwd'] = new_account['pwd']
body = {
"params": convention_dictionnary_data,
}
# Traitement du sujet du mail
sujet_mail_Template = jinja2.Template(str(courrier_data_retval['sujet']))
sujetHtml = sujet_mail_Template.render(params=body["params"])
# Traitement du corps du mail
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
contenu_docHtml = contenu_doc_Template.render(params=body["params"])
html_mime = MIMEText(contenu_docHtml, 'html')
# Creation de l'email à enoyer
msg = MIMEMultipart("alternative")
if (str(partner_own_smtp_value) == "1"):
msg.attach(html_mime)
msg['From'] = partner_SMTP_COUNT_From_User
msg['Bcc'] = "contact@mysy-training.com"
msg['Subject'] = sujetHtml
msg['to'] = str(local_apprenant_data['email'])
val = smtpserver.send_message(msg)
print(" Email a envoyé " + str(email))
else:
msg.attach(html_mime)
msg['From'] = partner_SMTP_COUNT_From_User
msg['Bcc'] = "contact@mysy-training.com"
msg['Subject'] = sujetHtml
msg['to'] = str(local_apprenant_data['email'])
val = smtpserver.send_message(msg)
print(" Email a envoyé " + str(email))
nb_compte = nb_compte + 1
print(" NB_email envoyé = ", nb_compte)
smtpserver.close()
return True, str(nb_compte)+" compte(s) ENT créé(s) "
except Exception as e:

View File

@ -540,7 +540,7 @@ def Get_Stored_Downloaded_File_From_Id(diction):
if( not file_name ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Fichier invalide = ", str(file_name))
3]) + " - Fichier invalide = "+ str(file_name))
return False, " Fichier invalide "
@ -555,7 +555,7 @@ def Get_Stored_Downloaded_File_From_Id(diction):
else:
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Fichier invalide (2)= ", str(full_path))
3]) + " Fichier invalide (2)= "+str(full_path))
return False, " Fichier invalide (2) "
@ -1138,7 +1138,10 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
filt_class_external_code, {'partner_owner_recid': str(my_partner['recid']),
'valide':'1'}]}
new_query = ([ {"$addFields": {
"""
09/06/2025 : on a un ob avec le champ :'$creation_date', il n'est pas toujours rempli.
il faudrait trouver le moyen de passer par l'ObjectId, en attendant, je le desactive
new_query = ([ {"$addFields": {
"mysy_download_files_date_creation": {
'$dateFromString': {
'dateString': {"$substr": ["$creation_date", 0, 10]},
@ -1147,10 +1150,12 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
}
}
},
"""
new_query = ([
{'$match': my_query
},
{
'$sort': {'_id':-1, 'mysy_download_files_date_creation': -1}
'$sort': {'_id':-1, }
},
])

View File

@ -6835,17 +6835,16 @@ def Export_Class_To_Excel_From_from_List_Id(diction):
orig_file_name = "Export_Formation_csv_" + str(my_partner['recid']) + "_" + str(ts) + ".xlsx"
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
tab_exported_fields_header = ["external_code", "certif", "cpf", "title", "description", "objectif", "domaine",
"duration", "duration_unit", "institut_formation", "metier", "mots_cle",
"note",
"plus_produit", "pourqui", "prerequis", "price", "programme", "published", "support",
"presentiel", "distantiel", "formateur_nom", "formateur_prenom" , "contenu_attestation"]
tab_exported_fields_header = ["external_code", "certif", "cpf", "title", "description", "objectif", "domaine", "metier", "categorie",
"duration", "duration_unit", "institut_formation", "mots_cle",
"note", "plus_produit", "pourqui", "prerequis", "price", "programme", "published", "support",
"formateur_nom", "formateur_prenom" , "contenu_attestation", "liste_modules"]
tab_exported_fields = ["external_code", "certif", "cpf", "title", "description", "objectif", "domaine",
"duration", "duration_unit", "institut_formation", "metier", "mots_cle",
"note",
"plus_produit", "pourqui", "prerequis", "price", "programme", "published", "support", "contenu_attestation"]
tab_exported_fields = ["external_code", "certif", "cpf", "title", "description", "objectif", "domaine", "metier", "categorie",
"duration", "duration_unit", "institut_formation", "mots_cle",
"note", "plus_produit", "pourqui", "prerequis", "price", "programme", "published", "support",
"formateur_nom", "formateur_prenom" , "contenu_attestation", "liste_modules"]
# Create a workbook and add a worksheet.
@ -6865,7 +6864,56 @@ def Export_Class_To_Excel_From_from_List_Id(diction):
for local_fiels in tab_exported_fields:
answers_record_JSON = ast.literal_eval(str(class_data))
if (str(local_fiels) in answers_record_JSON.keys()):
if( str(local_fiels) == "domaine" and answers_record_JSON[str(local_fiels)]):
no_html = ""
print(" val = ", str(answers_record_JSON[str(local_fiels)]))
domaine_data = MYSY_GV.dbname['class_domaine'].find_one({'_id':ObjectId(str(answers_record_JSON[str(local_fiels)]))}, {'_id':1, 'code':1})
if( domaine_data and 'code' in domaine_data.keys()):
no_html = domaine_data['code']
elif (str(local_fiels) == "metier" and answers_record_JSON[str(local_fiels)]):
no_html = ""
metier_data = MYSY_GV.dbname['class_metier'].find_one(
{'_id': ObjectId(str(answers_record_JSON[str(local_fiels)]))}, {'_id': 1, 'code': 1})
if (metier_data and 'code' in metier_data.keys()):
no_html = metier_data['code']
elif (str(local_fiels) == "categorie" and answers_record_JSON[str(local_fiels)]):
no_html = ""
categorie_data = MYSY_GV.dbname['class_categorie'].find_one(
{'_id': ObjectId(str(answers_record_JSON[str(local_fiels)]))}, {'_id': 1, 'code': 1})
if (categorie_data and 'code' in categorie_data.keys()):
no_html = categorie_data['code']
elif (str(local_fiels) == "liste_modules" and "list_unite_enseignement" in class_data.keys() ):
no_html = ""
tab_module = []
for tmp in class_data['list_unite_enseignement']:
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(tmp['_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'code':1, 'titre':1})
local_code = ""
if( ue_data and 'code' in ue_data.keys() ):
local_code = ue_data['code']
local_titre = ""
if (ue_data and 'titre' in ue_data.keys()):
local_titre = ue_data['titre']
tab_module.append(str(local_code+"-"+local_titre))
no_html = ",".join(tab_module)
elif (str(local_fiels) in answers_record_JSON.keys()):
local_status, local_retval = mycommon.IsFloat(str(answers_record_JSON[str(local_fiels)]).strip())
if( local_status is True ):
no_html = answers_record_JSON[str(local_fiels)]
@ -6874,16 +6922,12 @@ def Export_Class_To_Excel_From_from_List_Id(diction):
else:
no_html = ""
worksheet.write(row, column, no_html)
column += 1
if( "presentiel" in class_data.keys()):
no_html_presentiel = class_data['presentiel']['presentiel']
worksheet.write(row, column, no_html_presentiel)
column += 1
no_html_distantiel = class_data['presentiel']['distantiel']
worksheet.write(row, column, no_html_distantiel)
column += 1
if( "ressource_humaine" in class_data.keys() and len(class_data['ressource_humaine'])> 0 ):
if( "nom" in class_data['ressource_humaine'][0].keys() ):

View File

@ -520,7 +520,7 @@ def Get_Ent_Student_Session_Sequence_List(diction):
if ("unite_enseignement_planif_id" not in user.keys()):
user['unite_enseignement_planif_id'] = ""
print(" ### user = ", user)
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -992,15 +992,9 @@ def Get_Ent_Student_Participant_Notes(diction):
user['type_eval_code'] = ""
user['eval_date_heure_debut'] = str(retval['note_evaluation_collection'][0]['eval_date_heure_debut'])
user['eval_date_heure_fin'] = str(retval['note_evaluation_collection'][0]['eval_date_heure_fin'])
user['nom'] = nom_apprenant
user['prenom'] = prenom_apprenant
user['email'] = email_apprenant

View File

@ -235,6 +235,7 @@ def Add_Update_Question_Formulaire(diction):
return False, " Pour ce type de question, la note maximale doit être supérieure a '1' "
print(" €€€€€€€€€ ")
# si 'question_id', verifier qu'il est valide
if( "question_id" in diction.keys() ):
@ -249,7 +250,6 @@ def Add_Update_Question_Formulaire(diction):
return False, " L'identifiant de la question est invalide "
# On doit faire un update
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['valide'] = "1"
@ -381,6 +381,17 @@ def Add_Update_Question_Formulaire(diction):
else:
new_data['is_statistic'] = "0"
if ("is_alert" in diction.keys() and str(diction['is_alert']).strip() in ['0', '1']):
new_data['is_alert'] = str(diction['is_alert']).strip()
else:
new_data['is_alert'] = "0"
if ("alert_seuil" in diction.keys()):
new_data['alert_seuil'] = str(diction['alert_seuil'])
else:
new_data['alert_seuil'] = ""
tab_list_choix = []
if ("list_choix" in diction.keys() and str(diction['type']) == "qcm"):

View File

@ -1908,9 +1908,6 @@ def Create_MySy_LMS_Apprenant(diction):
cur = conn.cursor()
"""
# retrieving information
cur.execute("SELECT username, email_canonical FROM user WHERE id=?", (2,))

View File

@ -9603,7 +9603,7 @@ API pour enregistrer les resultat d'une enquete
def Record_Survey_Data_No_Token():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Record_Survey_Data_No_Token payload = ",payload)
print(" ### Record_Survey_Data_No_Token payload (trop long cherif) = ")
status, retval = survey_mgt.Record_Survey_Data_No_Token(payload)
return jsonify(status=status, message=retval)

View File

@ -7705,20 +7705,28 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
is_valide_email_in_related_collection = MYSY_GV.dbname[str(related_collection)].count_documents(
{"email": str(email_dest),
'valide': '1',
'session_id':str(diction['session_id']),
local_partner_owner_recid: str(my_partner['recid']),
'_id': {
'$in': list_inscription_id_Objectid},
})
if (is_valide_email_in_related_collection != 1):
if (is_valide_email_in_related_collection <= 0):
myprint(
str(inspect.stack()[0][
3]) + " L'adresse email '" + str(email_dest) + "' existe pas dans le système ")
return False, " L'adresse email '" + str(email_dest) + "'existe pas dans le système "
if (is_valide_email_in_related_collection > 1):
myprint(
str(inspect.stack()[0][
3]) + " L'adresse email '" + str(email_dest) + "' corresponds à plusieur inscription pour la même session ")
return False, " L'adresse email '" + str(email_dest) + "' corresponds à plusieur inscription pour la même session "
is_valide_email_in_related_collection_data = MYSY_GV.dbname[str(related_collection)].find_one(
{"email": str(email_dest),
'valide': '1',
'session_id': str(diction['session_id']),
local_partner_owner_recid: str(my_partner['recid']),
'_id': {
'$in': list_inscription_id_Objectid},
@ -7834,6 +7842,7 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
user_related_collection_data = MYSY_GV.dbname[str(related_collection)].find_one(
{"_id": ObjectId(str(user_id)),
'valide': '1',
'session_id': str(diction['session_id']),
local_partner_owner_recid: str(my_partner['recid'])
}, {'_id': 1, 'email': 1, 'nom': 1, 'prenom': 1})
@ -7872,11 +7881,11 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
3]) + " Impossible de récuperer le modèle de courrier 'ENT_PUSH_DOCUMENT_NOTIF' ")
return False, " Impossible de récuperer le modèle de courrier 'ENT_PUSH_DOCUMENT_NOTIF' "
if ("corps_mail" not in courrier_data_retval.keys() or str(courrier_data_retval['corps_mail']) == ""):
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier 'ENT_PUSH_DOCUMENT_NOTIF' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'ENT_PUSH_DOCUMENT_NOTIF' n'est pas correctement configuré"
3]) + " Le modèle de courrier 'ENT_PUSH_DOCUMENT_NOTIF' n'est pas correctement configuré - contenu_doc")
return False, " Le modèle de courrier 'ENT_PUSH_DOCUMENT_NOTIF' n'est pas correctement configuré - contenu_doc"
@ -7885,9 +7894,9 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
sujetHtml = sujet_mail_Template.render(params=body["params"])
# Traitement du corps du mail
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['corps_mail']))
corp_mailHtml = contenu_doc_Template.render(params=body["params"])
html_mime = MIMEText(corp_mailHtml, 'html')
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
contenu_docHtml = contenu_doc_Template.render(params=body["params"])
html_mime = MIMEText(contenu_docHtml, 'html')
# Creation de l'email à enoyer
msg = MIMEMultipart("alternative")

View File

@ -361,6 +361,11 @@ def Record_Survey_Data_No_Token(diction):
retval_status, retval = Survey_Send_Notification_Sur_Seuil_Alert(local_diction)
if( retval_status is False):
mycommon.myprint(
" WARNINGG : Survey_Send_Notification_Sur_Seuil_Alert "+str(retval))
return True, " Le formulaire a été correctement mis à jour"
@ -436,7 +441,7 @@ def Survey_Send_Notification_Sur_Seuil_Alert(diction):
convention_dictionnary_data = local_retval
print(" ### convention_dictionnary_data =", convention_dictionnary_data)
#print(" ### convention_dictionnary_data =", convention_dictionnary_data)
"""
Recuperation des données du formateur qui est mis sur la session de formation
@ -472,6 +477,7 @@ def Survey_Send_Notification_Sur_Seuil_Alert(diction):
for val in diction['global_response']:
#print(" ### val = ", val)
if("is_alert" in val.keys() and val['is_alert'] == "1" ):
if( val['type'] == "bool" ):
seuil = val['alert_seuil']
@ -481,15 +487,20 @@ def Survey_Send_Notification_Sur_Seuil_Alert(diction):
else:
valeur = "0"
#print(" ### CMP seuil = ", seuil, " ### valeur = ", valeur)
if( seuil == valeur):
#print(" ## DECLENCHEMENT ALERT 01 -- bool")
convention_dictionnary_data['user_question_reponse'] = val
notif_status, notif_retval = Send_Survey_Alert_Notif(convention_dictionnary_data)
elif( val['type'] == "note" ):
seuil = mycommon.tryFloat(val['alert_seuil'])
valeur = mycommon.tryFloat(val['response'])
#print(" ### CMP seuil = ", seuil, " ### valeur = ", valeur)
if( valeur <= seuil):
#print(" ## DECLENCHEMENT ALERT 02 -- note")
convention_dictionnary_data['user_question_reponse'] = val
notif_status, notif_retval = Send_Survey_Alert_Notif(convention_dictionnary_data)
@ -537,11 +548,11 @@ def Send_Survey_Alert_Notif(diction):
return courrier_data_status, courrier_data_retval
if ("corps_mail" not in courrier_data_retval.keys() or str(courrier_data_retval['corps_mail']) == ""):
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier 'SURVEY_RESPONSE_NOTIF' n'est pas correctement configuré - corps_mail ")
return False, " Le modèle de courrier 'SURVEY_RESPONSE_NOTIF' n'est pas correctement configuré - corps_mail "
3]) + " Le modèle de courrier 'SURVEY_RESPONSE_NOTIF' n'est pas correctement configuré - contenu_doc ")
return False, " Le modèle de courrier 'SURVEY_RESPONSE_NOTIF' n'est pas correctement configuré - contenu_doc "
# Recuperation des donnes smtp
@ -565,9 +576,9 @@ def Send_Survey_Alert_Notif(diction):
sujetHtml = sujet_mail_Template.render(params=body["params"])
# Traitement du corps du mail
contenu_corp_mail_Template = jinja2.Template(str(courrier_data_retval['corps_mail']))
sourceHtml_corps_mail = contenu_corp_mail_Template.render(params=body["params"])
html_mime = MIMEText(sourceHtml_corps_mail, 'html')
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
contenu_docHtml_mail = contenu_doc_Template.render(params=body["params"])
html_mime = MIMEText(contenu_docHtml_mail, 'html')
email_to = []