03/02/2024 - 21h
parent
d596575de6
commit
6bd21df4c5
|
@ -1,13 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="02/02/2024 - 17h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="02/02/2024 - 23h">
|
||||
<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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.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$/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$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -77,13 +83,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00161" summary="04/12/2023 - 21h">
|
||||
<created>1701722884012</created>
|
||||
<option name="number" value="00161" />
|
||||
<option name="presentableId" value="LOCAL-00161" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1701722884013</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00162" summary="05/12/2023 - 21h">
|
||||
<created>1701809248688</created>
|
||||
<option name="number" value="00162" />
|
||||
|
@ -420,7 +419,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1706890019272</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="210" />
|
||||
<task id="LOCAL-00210" summary="02/02/2024 - 23h">
|
||||
<created>1706911273733</created>
|
||||
<option name="number" value="00210" />
|
||||
<option name="presentableId" value="LOCAL-00210" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1706911273735</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="211" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -435,7 +441,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="31/12/2023- 18h" />
|
||||
<MESSAGE value="01/01/2024- 18h" />
|
||||
<MESSAGE value="03/01/2024 - 17h30" />
|
||||
<MESSAGE value="04/01/2024 - 22h30" />
|
||||
|
@ -460,6 +465,7 @@
|
|||
<MESSAGE value="31/01/2024 - 16h" />
|
||||
<MESSAGE value="31/01/2024 - 20h" />
|
||||
<MESSAGE value="02/02/2024 - 17h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="02/02/2024 - 17h" />
|
||||
<MESSAGE value="02/02/2024 - 23h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="02/02/2024 - 23h" />
|
||||
</component>
|
||||
</project>
|
|
@ -203,7 +203,7 @@ def AddStagiairetoClass(diction):
|
|||
mydata['class_internal_url'] = str(tmp_val['class_internal_url']).strip()
|
||||
|
||||
|
||||
civilite = ""
|
||||
civilite = "Neutre"
|
||||
if ("civilite" in diction.keys()):
|
||||
if diction['civilite']:
|
||||
civilite = str(diction['civilite']).strip()
|
||||
|
|
1984
Log/log_file.log
1984
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -2406,7 +2406,7 @@ def Controle_Add_Update_SessionFormation_mass(saved_file=None, Folder=None, dict
|
|||
formateur_email = ""
|
||||
formateur_id = ""
|
||||
if ("formateur_email" in df.keys()):
|
||||
if (str(df['formateur_email'].values[n])):
|
||||
if (str(df['formateur_email'].values[n]) and str(df['formateur_email'].values[n]) != ""):
|
||||
|
||||
formateur_email = str(df['formateur_email'].values[n]).strip()
|
||||
if (mycommon.isEmailValide(formateur_email) is False):
|
||||
|
@ -2418,28 +2418,28 @@ def Controle_Add_Update_SessionFormation_mass(saved_file=None, Folder=None, dict
|
|||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide."
|
||||
|
||||
is_formateur_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
if (is_formateur_email_ok <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2).")
|
||||
return False, " L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2)."
|
||||
is_formateur_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
if (is_formateur_email_ok <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2).")
|
||||
return False, " L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2)."
|
||||
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one({'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one({'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
|
||||
formateur_id = str(formateur_data['_id'])
|
||||
formateur_id = str(formateur_data['_id'])
|
||||
|
||||
mydata['formateur_id'] = formateur_id
|
||||
|
||||
|
@ -2871,7 +2871,7 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
formateur_email = ""
|
||||
formateur_id = ""
|
||||
if ("formateur_email" in df.keys()):
|
||||
if (str(df['formateur_email'].values[n])):
|
||||
if (str(df['formateur_email'].values[n]) and str(df['formateur_email'].values[n]) != ""):
|
||||
|
||||
formateur_email = str(df['formateur_email'].values[n]).strip()
|
||||
if (mycommon.isEmailValide(formateur_email) is False):
|
||||
|
@ -2883,28 +2883,28 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide."
|
||||
|
||||
is_formateur_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
if (is_formateur_email_ok <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2).")
|
||||
return False, " L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2)."
|
||||
is_formateur_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
if (is_formateur_email_ok <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2).")
|
||||
return False, " L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2)."
|
||||
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one({'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one({'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
|
||||
formateur_id = str(formateur_data['_id'])
|
||||
formateur_id = str(formateur_data['_id'])
|
||||
|
||||
mydata['formateur_id'] = formateur_id
|
||||
|
||||
|
@ -3421,7 +3421,7 @@ def Controle_Add_Update_SessionFormation_mass_for_many_class(saved_file=None, Fo
|
|||
formateur_email = ""
|
||||
formateur_id = ""
|
||||
if ("formateur_email" in df.keys()):
|
||||
if (str(df['formateur_email'].values[n])):
|
||||
if (str(df['formateur_email'].values[n]) and str(df['formateur_email'].values[n]) != ""):
|
||||
|
||||
formateur_email = str(df['formateur_email'].values[n]).strip()
|
||||
if (mycommon.isEmailValide(formateur_email) is False):
|
||||
|
@ -3433,28 +3433,28 @@ def Controle_Add_Update_SessionFormation_mass_for_many_class(saved_file=None, Fo
|
|||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide."
|
||||
|
||||
is_formateur_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
if (is_formateur_email_ok <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2).")
|
||||
return False, " L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2)."
|
||||
is_formateur_email_ok = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
if (is_formateur_email_ok <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2).")
|
||||
return False, " L'email du formateur '" + str(
|
||||
formateur_email) + "' pour la formation à la ligne " + str(
|
||||
n + 2) + " n'est pas valide (2)."
|
||||
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one({'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
formateur_data = MYSY_GV.dbname['ressource_humaine'].find_one({'email': formateur_email,
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(
|
||||
partner_recid)})
|
||||
|
||||
formateur_id = str(formateur_data['_id'])
|
||||
formateur_id = str(formateur_data['_id'])
|
||||
|
||||
mydata['formateur_id'] = formateur_id
|
||||
|
||||
|
|
16
class_mgt.py
16
class_mgt.py
|
@ -296,18 +296,24 @@ def add_class(diction):
|
|||
|
||||
|
||||
|
||||
metier = ""
|
||||
if ("metier" in diction.keys()):
|
||||
if diction['metier']:
|
||||
mydata['metier'] = diction['metier']
|
||||
metier = diction['metier']
|
||||
mydata['metier'] = metier
|
||||
|
||||
|
||||
myprki = ""
|
||||
if ("pourqui" in diction.keys()):
|
||||
if diction['pourqui']:
|
||||
mydata['pourqui'] = diction['pourqui']
|
||||
myprki = diction['pourqui']
|
||||
mydata['pourqui'] = myprki
|
||||
|
||||
mysupport = ""
|
||||
if ("support" in diction.keys()):
|
||||
if diction['support']:
|
||||
mydata['support'] = str(diction['support']).lower().strip()
|
||||
mysupport = str(diction['support']).lower().strip()
|
||||
mydata['support'] = mysupport
|
||||
|
||||
if ("img_banner_detail_class" in diction.keys()):
|
||||
if diction['img_banner_detail_class']:
|
||||
|
@ -387,9 +393,11 @@ def add_class(diction):
|
|||
return False, " La formation "+str(mydata['external_code'])+" a plus de "+ str(MYSY_GV.MAX_KEYWORD)+" mots clés"
|
||||
|
||||
|
||||
domaine = ""
|
||||
if ("domaine" in diction.keys()):
|
||||
if diction['domaine']:
|
||||
mydata['domaine'] = diction['domaine']
|
||||
domaine = diction['domaine']
|
||||
mydata['domaine'] = domaine
|
||||
|
||||
# Traitement de l'url imag
|
||||
if ("img_url" in diction.keys()):
|
||||
|
|
|
@ -2223,3 +2223,177 @@ def Employee_Credential_Sending_mail(diction):
|
|||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction un mail à un EMPLOYE pour lui notifier
|
||||
de l'ouverture de ses acces à la plateforme E-Learning
|
||||
"""
|
||||
def Employee_Acces_LMS_Sending_mail(diction):
|
||||
try:
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['nom', 'prenom', 'email', 'mysy_url', 'partner_owner_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")
|
||||
|
||||
print("debut envoi mail de test ")
|
||||
|
||||
# on rentre les renseignements pris sur le site du fournisseur
|
||||
|
||||
# msg = MIMEMultipart("alternative")
|
||||
|
||||
|
||||
# JINJA2
|
||||
# This data can come from database query
|
||||
body = {}
|
||||
|
||||
body = {
|
||||
|
||||
"params": {"nom": str(diction['nom']),
|
||||
"prenom": str(diction['prenom']),
|
||||
"email": str(diction['email']),
|
||||
"mysy_url": str(diction['mysy_url']),
|
||||
},
|
||||
}
|
||||
|
||||
#------------------
|
||||
partner_document_EMPLOYEE_CREDENTIALS_data_qry = {'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'valide': '1', 'locked': '0', 'ref_interne': 'EMPLOYEE_CREDENTIALS_FOR_LMS'}
|
||||
|
||||
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)
|
||||
|
||||
|
||||
if (partner_document_EMPLOYEE_CREDENTIALS_data is None):
|
||||
# Il n'existe pas de personnalisation de la preinscription pour ce partenaire, on va aller récupérer la presinscription pa defaut
|
||||
partner_document_EMPLOYEE_CREDENTIALS_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'partner_owner_recid': 'default',
|
||||
'valide': '1', 'locked': '0', 'ref_interne': 'EMPLOYEE_CREDENTIALS_FOR_LMS'})
|
||||
|
||||
if (partner_document_EMPLOYEE_CREDENTIALS_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "-Impossible d'envoyer l'email de notification des accès. Aucun document parametré ")
|
||||
return False, " Impossible d'envoyer l'email de notification des accès. Aucun document parametré "
|
||||
|
||||
if ("contenu_doc" not in partner_document_EMPLOYEE_CREDENTIALS_data or len(
|
||||
str(partner_document_EMPLOYEE_CREDENTIALS_data['contenu_doc'])) <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " -Impossible d'envoyer l'email de notification des accès. Le parametrage du document est invalide")
|
||||
return False, " Impossible d'envoyer l'email de notification des accès. Le parametrage du document est invalide "
|
||||
|
||||
EMPLOYEE_CREDENTIALS_contenu_doc_Template = jinja2.Template(
|
||||
str(partner_document_EMPLOYEE_CREDENTIALS_data['contenu_doc']))
|
||||
|
||||
sourceHtml = EMPLOYEE_CREDENTIALS_contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
# print(" ### PRE_INSCRIPTION_contenu_doc = ",str(sourceHtml))
|
||||
|
||||
"""
|
||||
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']),
|
||||
'config_name': 'partner_smtp',
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (partner_own_smtp and "config_value" in partner_own_smtp.keys()):
|
||||
partner_own_smtp_value = partner_own_smtp['config_value']
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
partner_SMTP_COUNT_password = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_user_pwd',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_smtpsrv = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_server',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_user = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_user',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_From_User = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_count_from_name',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_port = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(diction['partner_owner_recid']),
|
||||
'config_name': 'smtp_count_port',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
msg = EmailMessage()
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
# msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = partner_document_EMPLOYEE_CREDENTIALS_data['sujet']
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
||||
# -----------------
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(partner_SMTP_COUNT_user, partner_SMTP_COUNT_password)
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email EMPLOYEE_CREDENTIALS_FOR_LMS envoyé " + str(val))
|
||||
|
||||
else:
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
msg = EmailMessage()
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
#msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = partner_document_EMPLOYEE_CREDENTIALS_data['sujet']
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
||||
#-----------------
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email EMPLOYEE_CREDENTIALS_FOR_LMS envoyé " + str(val))
|
||||
|
||||
|
||||
return True, " Email d'identification de connexion au E-Learnning envoyé "
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification de connexion au E-Learning "
|
||||
|
|
16
main.py
16
main.py
|
@ -3072,6 +3072,22 @@ def Delete_And_Load_DB_Collection_partnair_account_to_DB_Collection_For_Demo_Env
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API de migration de collection (a supprimer)
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_And_Load_DB_Collection_courrier_template_From_rec_to_Demo_Env/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_And_Load_DB_Collection_courrier_template_From_rec_to_Demo_Env():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_And_Load_DB_Collection_courrier_template_From_rec_to_Demo_Env : payload = ", payload)
|
||||
localStatus, message = tools_cherif.Delete_And_Load_DB_Collection_courrier_template_From_rec_to_Demo_Env()
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API créer un user LMS Mysy, c'est a dire un user chamilo
|
||||
"""
|
||||
|
|
|
@ -802,7 +802,7 @@ def Get_Partner_List_Partner_Client(diction):
|
|||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['partner_client'].find(data_cle):
|
||||
for retval in MYSY_GV.dbname['partner_client'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
|
|
@ -567,7 +567,12 @@ def Get_Given_Partner_Invoice_Lines(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if( "domaine" in retval['myclass_collection'][0].keys() ):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -745,7 +750,12 @@ def Get_Given_Partner_Invoice_Lines_From_Invoice_ref_interne(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if ("domaine" in retval['myclass_collection'][0].keys()):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -1256,7 +1266,12 @@ def Get_Given_Line_Of_Partner_Invoice_Lines(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if ("domaine" in retval['myclass_collection'][0].keys()):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -1488,7 +1503,12 @@ def GerneratePDF_Partner_Invoice(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if ("domaine" in retval['myclass_collection'][0].keys()):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -1756,7 +1776,12 @@ def Send_Partner_Invoice_By_Email(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if ("domaine" in retval['myclass_collection'][0].keys()):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
|
|
@ -3085,7 +3085,12 @@ def Get_Given_Partner_Order_Lines(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if( "domaine" in retval['myclass_collection'][0].keys() ):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -3261,7 +3266,12 @@ def Get_Given_Partner_Order_Lines_From_order_ref_interne(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if ("domaine" in retval['myclass_collection'][0].keys()):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -3855,7 +3865,13 @@ def Get_Given_Line_Of_Partner_Order_Lines(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if ("domaine" in retval['myclass_collection'][0].keys()):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -4317,7 +4333,12 @@ def GerneratePDF_Partner_Order(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if( "domaine" in retval['myclass_collection'][0].keys() ):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
@ -4566,7 +4587,12 @@ def Send_Partner_Order_By_Email(diction):
|
|||
|
||||
user['title'] = retval['myclass_collection'][0]['title']
|
||||
user['order_line_formation_external_code'] = retval['myclass_collection'][0]['external_code']
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
|
||||
if ("domaine" in retval['myclass_collection'][0].keys()):
|
||||
user['domaine'] = retval['myclass_collection'][0]['domaine']
|
||||
else:
|
||||
user['domaine'] = ""
|
||||
|
||||
user['duration'] = retval['myclass_collection'][0]['duration']
|
||||
user['duration_unit'] = retval['myclass_collection'][0]['duration_unit']
|
||||
|
||||
|
|
|
@ -4636,7 +4636,7 @@ def HR_Create_LMS_Trainer_Account(diction):
|
|||
'lms_virtualhost_id': str(my_partner['lms_virtualhost_id']),
|
||||
}
|
||||
|
||||
print(" #### qry meee = ", qry)
|
||||
#print(" #### qry meee = ", qry)
|
||||
MYSY_GV.dbname['partnair_account'].update_one({'_id':ObjectId(str(is_rh_data['account_partner_id'])),
|
||||
'active':'1',
|
||||
'recid':str(my_partner['recid'])},
|
||||
|
@ -4651,8 +4651,22 @@ def HR_Create_LMS_Trainer_Account(diction):
|
|||
})
|
||||
|
||||
|
||||
"""
|
||||
A présent les acces au LMS sont crées,
|
||||
on va envoyer un email de notification à la personne
|
||||
"""
|
||||
data_for_mail = {}
|
||||
data_for_mail['nom'] = is_rh_data['nom']
|
||||
data_for_mail['prenom'] = is_rh_data['prenom']
|
||||
data_for_mail['email'] = is_rh_data['email']
|
||||
data_for_mail['mysy_url'] = str(MYSY_GV.CLIENT_URL_BASE)
|
||||
|
||||
return True, " Les acceès ont été créée dans le LMS"
|
||||
data_for_mail['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
email_inscription_mgt.Employee_Acces_LMS_Sending_mail(data_for_mail)
|
||||
|
||||
return True, " Les accès ont été créée dans le LMS. Un email de notification envoyé à l'utilisateur"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
|
@ -1503,3 +1503,57 @@ def Delete_And_Load_DB_Collection_partnair_account_to_DB_Collection_For_Demo_Env
|
|||
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 de Delete_And_Load_DB_Collection_MyClass_to_DB_Collection_For_Demo_Env"
|
||||
|
||||
|
||||
"""
|
||||
Migration des collections de la base de recette vers la base de demo
|
||||
- courrier_template
|
||||
- courrier_template_type_document
|
||||
|
||||
pour les valeur default
|
||||
"""
|
||||
|
||||
def Delete_And_Load_DB_Collection_courrier_template_From_rec_to_Demo_Env():
|
||||
try:
|
||||
|
||||
# REC_base_config_dashbord
|
||||
CONNECTION_STRING = "mongodb://localhost:27017"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
|
||||
REC_dbname = client['cherifdb_rec']
|
||||
DEM_dbname = client['cherifdb_demo']
|
||||
|
||||
"""
|
||||
Ici les collections avec les filtres pr chaque collection
|
||||
"""
|
||||
qry_rec = {'partner_owner_recid': 'default'}
|
||||
|
||||
## On vide les table d'abord dans l'environnement cible
|
||||
for tmp in REC_dbname['courrier_template'].find(qry_rec):
|
||||
del tmp['_id']
|
||||
print(" tmp = ", tmp)
|
||||
|
||||
ret_val = DEM_dbname['courrier_template'].insert_one(tmp)
|
||||
|
||||
|
||||
if (ret_val is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - errreur sur transfert de ")
|
||||
|
||||
## On vide les table d'abord dans l'environnement cible
|
||||
for tmp in REC_dbname['courrier_template_type_document'].find(qry_rec):
|
||||
del tmp['_id']
|
||||
print(" tmp = ", tmp)
|
||||
|
||||
ret_val = DEM_dbname['courrier_template_type_document'].insert_one(tmp)
|
||||
|
||||
if (ret_val is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - errreur sur transfert de ")
|
||||
|
||||
|
||||
return True, "OK"
|
||||
|
||||
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 de Delete_And_Load_DB_Collection_courrier_template_From_rec_to_Demo_Env"
|
||||
|
||||
|
|
Loading…
Reference in New Issue