04/04/23 - 21h

master
cherif 2023-04-04 21:13:49 +02:00
parent a99f850ecd
commit 2d177fdc74
10 changed files with 5221 additions and 40 deletions

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="30/03/23 - 22h11">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="31/03/23 - 11h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" 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$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -404,7 +413,14 @@
<option name="project" value="LOCAL" />
<updated>1680207124296</updated>
</task>
<option name="localTasksCounter" value="49" />
<task id="LOCAL-00049" summary="31/03/23 - 11h">
<created>1680255185050</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1680255185050</updated>
</task>
<option name="localTasksCounter" value="50" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -419,7 +435,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="25/01/23 - 20h" />
<MESSAGE value="27/01/23 - 15h" />
<MESSAGE value="27/01:23 - 19h" />
<MESSAGE value="30/01/23 - 22h" />
@ -444,6 +459,7 @@
<MESSAGE value="25/03/23 - 12h" />
<MESSAGE value="30/03/23 - 19h30" />
<MESSAGE value="30/03/23 - 22h11" />
<option name="LAST_COMMIT_MESSAGE" value="30/03/23 - 22h11" />
<MESSAGE value="31/03/23 - 11h" />
<option name="LAST_COMMIT_MESSAGE" value="31/03/23 - 11h" />
</component>
</project>

View File

@ -478,7 +478,11 @@ def UpdateStagiairetoClass(diction):
new_diction['email'] = myemail
new_diction['password'] = secrets.token_urlsafe(6)
new_diction['locked'] = "0"
new_diction['username'] = myemail
split_mail_tab = str(myemail).split('@')
new_diction['username'] = split_mail_tab[0]
local_status, local_message, local_participant_lms_id = mys_lms.Create_MySy_LMS_Apprenant(new_diction)
@ -2748,6 +2752,7 @@ def Send_LMS_Credentials_to_particpants(diction):
email_data['pwd'] = lms_pwd
email_data['lms_url'] = MYSY_GV.MYSY_LMS_URL
email_data['course_owner_email'] = my_partner['email']
email_data['partner_recid'] = my_partner['recid']
local_status, local_message = email_session.LMS_Credential_Sending_mail(email_data)
if (local_status is False):

File diff suppressed because one or more lines are too long

View File

@ -2803,7 +2803,8 @@ def add_class_mass(file=None, Folder=None, diction=None):
new_nb_active) + "). "
x = range(0, total_rows)
ignored_line = ""
nb_inserted_line = 0
for n in x:
mydata = {}
@ -2828,12 +2829,23 @@ def add_class_mass(file=None, Folder=None, diction=None):
return False, " Absence de 'domaine' pour la formation à la ligne "+str(n+2)
if ("domaine" not in df.keys()):
if ("description" not in df.keys()):
mycommon.myprint(str(
inspect.stack()[0][
3]) + " - Absence de 'description' pour la formation à la ligne "+str(n+2))
return False, " Absence de 'description' pour la formation à la ligne "+str(n+2)
nb_inserted_line = nb_inserted_line + 1
# Si une ligne n'a aucune information obligatoire, alors on ignore la ligne
if (str(df['external_code'].values[n]) == "nan" or str(df['titre'].values[n]) == "nan"):
mycommon.myprint(str(
inspect.stack()[0][
3]) + " - La ligne " + str(n + 2)+" a été ignorée")
ignored_line = str(n + 2)+" , "+str(ignored_line)
nb_inserted_line = nb_inserted_line - 1
continue
mydata['external_code'] = str(df['external_code'].values[n]).strip()
mydata['title'] = str(df['titre'].values[n]).strip()
@ -2842,6 +2854,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
tmp_desc = mycommon.format_MySy_Text_Tag(tmp_desc)
mydata['description'] = tmp_desc
formateur = ""
if ("formateur" in df.keys()):
if (str(df['formateur'].values[n])):
@ -2880,8 +2893,6 @@ def add_class_mass(file=None, Folder=None, diction=None):
mydata['plus_produit'] = plus_produit
presentiel = "0"
if ("presentiel" in df.keys()):
if (str(df['presentiel'].values[n])):
@ -3073,9 +3084,6 @@ def add_class_mass(file=None, Folder=None, diction=None):
mydata['token'] = diction['token']
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
#print( clean_dict)
@ -3084,9 +3092,12 @@ def add_class_mass(file=None, Folder=None, diction=None):
if( status is False ):
return status, retval
print(str(total_rows)+" formations ont été inserées")
message_ignored_line = ""
if( ignored_line ):
message_ignored_line = " ATTENTION - Les lignes [" + str(ignored_line) + "] ont été ignorées. car les toutes informations obligatoires ne sont pas fournies"
return True, str(total_rows)+" formations ont été inserées / Mises à jour"
return True, str(nb_inserted_line)+" formations ont été inserées / Mises à jour. "+str(message_ignored_line)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()

View File

@ -1,4 +1,2 @@
,index,mots,occurence,moyenne,id_formation,source_field
0,0,praticien,1,0.33,MYSY_Test_AR,title
1,1,aromatherapie,1,0.33,MYSY_Test_AR,title
2,2,integrative,1,0.33,MYSY_Test_AR,title
0,0,qsdqsd,1,1.0,qsdqss,title

1 index mots occurence moyenne id_formation source_field
2 0 0 praticien qsdqsd 1 0.33 1.0 MYSY_Test_AR qsdqss title
1 1 aromatherapie 1 0.33 MYSY_Test_AR title
2 2 integrative 1 0.33 MYSY_Test_AR title

View File

@ -1,4 +1,2 @@
mots occurence moyenne id_formation source_field
0 praticien 1 0.33 MYSY_Test_AR title
1 aromatherapie 1 0.33 MYSY_Test_AR title
2 integrative 1 0.33 MYSY_Test_AR title
mots occurence moyenne id_formation source_field
0 qsdqsd 1 1.0 qsdqss title

View File

@ -1160,14 +1160,21 @@ def LMS_Credential_Sending_mail(diction):
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['nom', 'prenom', 'email', 'date_du', 'date_au', 'title', 'login', 'pwd', 'lms_url', 'course_owner_email' ]
field_list_obligatoire = ['nom', 'prenom', 'email', 'date_du', 'date_au', 'title', 'login', 'pwd', 'lms_url', 'course_owner_email', 'partner_recid' ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
return False, "Impossible d'envoyer les information de connexion à la plateforme LMS"
"""
local_status, is_account_exist = mycommon.is_LMS_user_exist(diction)
if( local_status is False or is_account_exist is False):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - Le compte LMS n'est pas valide ")
return False, "Le compte LMS n'est pas valide"
"""
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")

View File

@ -1846,14 +1846,14 @@ def ManualSendInvoiceEmailRIB(diction):
TEMPLATE_FILE = "Template/MySy_Invoice_RIB_tpl.html"
template = templateEnv.get_template(TEMPLATE_FILE)
body = {
"params": {"order_id": "005G",
"date_order": ": 07/03/2023",
"total_ht": "150",
"tva": "0",
"total_ttc": "150",
"client_name": "HIFMI-INSTITUTE",
"client_address": "50 AV PIERRE ET MARIE CURIE",
"client_zip_ville": "93700 DRANCY",
"params": {"order_id": "007G",
"date_order": ": 03/04/2023",
"total_ht": "171",
"tva": "34,2",
"total_ttc": "205,2",
"client_name": "CAP SANTE",
"client_address": "4 Allée des Jacquiers",
"client_zip_ville": "97427 L'Etang Salé",
"client_pays": "France",
"packs": "PACK GOLD ",
"detail_packs": "-- Support téléphonique -- "
@ -1865,13 +1865,13 @@ def ManualSendInvoiceEmailRIB(diction):
"Envoi de 1000 emails markéting / mois --"
"Reporting Dynamique et personnalisé",
"qty": "3",
"unit_price": "50",
"montant": "150",
"invoice_id": "FACT_230300027",
"invoice_date": "07/03/2023",
"due_date": "07/03/2022",
"orign_order": "Contrat 005G",
"qty": "2",
"unit_price": "85.5",
"montant": "171",
"invoice_id": "FACT_230400029",
"invoice_date": "03/04/2023",
"due_date": "03/04/2022",
"orign_order": "Contrat 007G",
}
}
sourceHtml = template.render(params=body["params"])
@ -1917,7 +1917,7 @@ def ManualSendInvoiceEmailRIB(diction):
}
"""
sourceHtml = template.render(json_data=body["params"])
orig_file_name = "invoice_FACT_230200020.pdf"
orig_file_name = "invoice_FACT_230400029.pdf"
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
# open output file for writing (truncated binary)

View File

@ -987,7 +987,8 @@ def Check_MySy_LMS_Account(diction):
new_diction['password'] = my_partner['pwd']
new_diction['locked'] = "0"
new_diction['official_code'] = ""
new_diction['username'] = my_partner['email']
split_mail_tab = str(my_partner['email']).split('@')
new_diction['username'] = split_mail_tab[0]
local_status, local_retval, new_lms_use_id = Create_MySy_LMS_User(new_diction)
@ -1803,7 +1804,8 @@ def LMS_Get_Partner_Data(diction):
"""
lms_pwd_mask = "mSyt"+str(lms_user_id)+str(datetime.now().day)+str(my_partner['pwd'])
day_on_2_digit = '{:02d}'.format(datetime.now().day)
lms_pwd_mask = "mSyt"+str(lms_user_id)+str(day_on_2_digit)+str(my_partner['pwd'])
val_tmp = {}
val_tmp['lms_account'] = lms_account

View File

@ -40,6 +40,7 @@ import jinja2
import ftplib
import pysftp
import html
import mariadb
class JSONEncoder(json.JSONEncoder):
def default(self, o):
@ -2856,3 +2857,49 @@ def CheckSalesOrder(diction):
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de verifier l'existence de la commande "
"""
Cette fonction verifie s'un utilisateur existe vraiment dans le LMS
"""
def is_LMS_user_exist(diction):
try:
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = [ 'login', 'partner_recid']
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 liste ")
return False, "Impossible d'envoyer les information de connexion à la plateforme LMS"
conn = mariadb.connect(
user=MYSY_GV.MYSY_MARIADB_USER,
password=MYSY_GV.MYSY_MARIADB_USER_PASS,
host=MYSY_GV.MYSY_MARIADB_HOST,
port=MYSY_GV.MYSY_MARIADB_PORT,
database=MYSY_GV.MYSY_LMS_BDD
)
cur = conn.cursor()
qry = "SELECT count(*) FROM user WHERE username = '"+str(diction['login'])+"' "
print(" #### qry = ", qry)
query_compte_exist_exec = cur.execute("SELECT count(*) FROM user WHERE username = '"+str(diction['login'])+"' ")
is_exist = False
query_compte_exist_exec = ""
query_compte_exist_exec_val = "0"
for query_compte_exist_exec in cur:
query_compte_exist_exec_val = query_compte_exist_exec[0]
if (int(tryInt(query_compte_exist_exec_val)) > 0):
is_exist = True
conn.commit()
return True, is_exist
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de verifier l'existence du compte utilisateur dans le LMS "