22/11/22 - 11h30
parent
3cc7b9c7cd
commit
7b83b8dd5a
|
@ -3,8 +3,14 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="18/11/22 - 23h30">
|
||||
<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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" 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_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$/opco.py" beforeDir="false" afterPath="$PROJECT_DIR$/opco.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -24,6 +30,7 @@
|
|||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"last_opened_file_path": "C:/Users/cheri/Documents/myclass.com/Siteweb/Production/Ela_back/MySy_Back_Office",
|
||||
|
|
|
@ -226,5 +226,6 @@ O365_SMTP_COUNT_port = 587
|
|||
#O365_SMTP_COUNT_password = 'GomboyaVince1234+'
|
||||
#O365_SMTP_COUNT_smtpsrv = "smtp.office365.com"
|
||||
#O365_SMTP_COUNT_user = "cbalde@mysy-training.com"
|
||||
#O365_SMTP_COUNT_From_User = "cbalde@mysy-training.com"
|
||||
#O365_SMTP_COUNT_port = 587
|
||||
|
||||
|
|
5805
Log/log_file.log
5805
Log/log_file.log
File diff suppressed because one or more lines are too long
44
class_mgt.py
44
class_mgt.py
|
@ -46,7 +46,8 @@ def add_class(diction):
|
|||
field_list = ['external_code', 'title', 'description', 'trainer', 'institut_formation', 'distantiel', 'presentiel',
|
||||
'price', 'url','duration', 'duration_unit', 'token', 'plus_produit', 'mots_cle','domaine',
|
||||
'internal_url', 'zone_diffusion', 'metier', 'date_lieu', 'published', 'img_url', 'objectif',
|
||||
'programme', 'prerequis', 'note', 'cpf', 'certif', 'class_inscription_url']
|
||||
'programme', 'prerequis', 'note', 'cpf', 'certif', 'class_inscription_url', 'pourqui',
|
||||
'support', 'img_banner_detail_class']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -180,6 +181,19 @@ def add_class(diction):
|
|||
mydata['metier'] = diction['metier']
|
||||
|
||||
|
||||
if ("pourqui" in diction.keys()):
|
||||
if diction['pourqui']:
|
||||
mydata['pourqui'] = diction['pourqui']
|
||||
|
||||
if ("support" in diction.keys()):
|
||||
if diction['support']:
|
||||
mydata['support'] = str(diction['support']).lower().strip()
|
||||
|
||||
if ("img_banner_detail_class" in diction.keys()):
|
||||
if diction['img_banner_detail_class']:
|
||||
mydata['img_banner_detail_class'] = diction['img_banner_detail_class']
|
||||
|
||||
|
||||
if ("trainer" in diction.keys()):
|
||||
if diction['trainer']:
|
||||
mydata['trainer'] = diction['trainer']
|
||||
|
@ -323,7 +337,7 @@ def add_class(diction):
|
|||
if diction['date_lieu']:
|
||||
tmp_str2 = str(diction['date_lieu']).lower().replace(",", ";").replace("\r\n", "")
|
||||
|
||||
#print(" ### tmp_str2 = "+str(tmp_str2))
|
||||
print(" ### tmp_str2 = "+str(tmp_str2))
|
||||
|
||||
if (not tmp_str2.endswith(";")):
|
||||
tmp_str2 = tmp_str2 + ";"
|
||||
|
@ -537,7 +551,7 @@ def update_class(diction):
|
|||
'presentiel','price', 'url', 'duration', 'token','plus_produit', 'mots_cle',
|
||||
'domaine', 'internal_code', 'internal_url','zone_diffusion', 'metier',
|
||||
'date_lieu', 'published', 'img_url', 'objectif', 'programme', 'prerequis', 'note',
|
||||
'cpf', 'certif', 'class_inscription_url']
|
||||
'cpf', 'certif', 'class_inscription_url','pourqui', 'support', 'img_banner_detail_class']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -617,6 +631,16 @@ def update_class(diction):
|
|||
if ("cpf" in diction.keys()):
|
||||
mydata['cpf'] = diction['cpf']
|
||||
|
||||
if ("pourqui" in diction.keys()):
|
||||
mydata['pourqui'] = diction['pourqui']
|
||||
|
||||
if ("support" in diction.keys()):
|
||||
mydata['support'] = str(diction['support']).lower().strip()
|
||||
|
||||
if ("img_banner_detail_class" in diction.keys()):
|
||||
mydata['img_banner_detail_class'] = diction['img_banner_detail_class']
|
||||
|
||||
|
||||
if ("certif" in diction.keys()):
|
||||
mydata['certif'] = diction['certif']
|
||||
|
||||
|
@ -2238,7 +2262,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
'distantiel', 'presentiel', 'prix', 'domaine', 'url','duree', 'plus_produit',
|
||||
'mots_cle', 'zone_diffusion', 'metier', 'date_lieu', 'publie', 'img_url',
|
||||
'objectif', 'programme', 'prerequis', 'formateur', 'note', 'cpf', 'certif',
|
||||
'class_inscription_url']
|
||||
'class_inscription_url', 'pourqui', 'support', 'img_banner_detail_class']
|
||||
|
||||
total_rows = len(df)
|
||||
|
||||
|
@ -2328,6 +2352,18 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
if (str(df['prerequis'].values[n])):
|
||||
mydata['prerequis'] = str(df['prerequis'].values[n])
|
||||
|
||||
if ("pourqui" in df.keys()):
|
||||
if (str(df['pourqui'].values[n])):
|
||||
mydata['pourqui'] = str(df['pourqui'].values[n])
|
||||
|
||||
if ("support" in df.keys()):
|
||||
if (str(df['support'].values[n])):
|
||||
mydata['support'] = str(df['support'].values[n])
|
||||
|
||||
if ("img_banner_detail_class" in df.keys()):
|
||||
if (str(df['img_banner_detail_class'].values[n])):
|
||||
mydata['img_banner_detail_class'] = str(df['img_banner_detail_class'].values[n])
|
||||
|
||||
|
||||
'''
|
||||
Verification de l'image
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
,index,mots,occurence,moyenne,id_formation,source_field
|
||||
0,0,formation,1,0.5,POT_191236,title
|
||||
1,1,tuteur,1,0.5,POT_191236,title
|
||||
0,0,base,1,0.25,Edu_10002,title
|
||||
1,1,gestion,1,0.25,Edu_10002,title
|
||||
2,2,donne,1,0.25,Edu_10002,title
|
||||
3,3,sql,1,0.25,Edu_10002,title
|
||||
|
|
|
|
@ -1,3 +1,5 @@
|
|||
mots occurence moyenne id_formation source_field
|
||||
0 formation 1 0.5 POT_191236 title
|
||||
1 tuteur 1 0.5 POT_191236 title
|
||||
mots occurence moyenne id_formation source_field
|
||||
0 base 1 0.25 Edu_10002 title
|
||||
1 gestion 1 0.25 Edu_10002 title
|
||||
2 donne 1 0.25 Edu_10002 title
|
||||
3 sql 1 0.25 Edu_10002 title
|
81
email_mgt.py
81
email_mgt.py
|
@ -1405,7 +1405,7 @@ def send_user_init_pwd_mail(token, account_mail, type_account):
|
|||
# JINJA2
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/MySy_User_account_enabled_tpl.html"
|
||||
TEMPLATE_FILE = "Template/MySy_User_account_change_pwd_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
body = {
|
||||
|
@ -1617,6 +1617,7 @@ def SendInvoiceEmail(account_mail, diction):
|
|||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/MySy_Invoice_tpl.html"
|
||||
print(" ############ TEMPLATE_FILE = "+str(TEMPLATE_FILE))
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
body = {
|
||||
"params": {"order_id": order_id,
|
||||
|
@ -1805,3 +1806,81 @@ def SendEmargementMail( 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 "
|
||||
|
||||
"""
|
||||
Creation manuelle d'une facture avec RIB
|
||||
"""
|
||||
def ManualSendInvoiceEmailRIB(diction):
|
||||
try:
|
||||
'''
|
||||
Verification des données obligatoires
|
||||
'''
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
|
||||
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
|
||||
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
||||
# msg = MIMEMultipart("alternative")
|
||||
msg = EmailMessage()
|
||||
|
||||
# JINJA2
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/MySy_Invoice_RIB_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
body = {
|
||||
"params": {"order_id": "MySy_00wheA",
|
||||
"date_order": ": 01/11/2022",
|
||||
"total_ht": "550",
|
||||
"tva": "110",
|
||||
"total_ttc": "660",
|
||||
"client_name": "POTENTIALS",
|
||||
"client_address": "21 RUE D ABOUKIR",
|
||||
"client_zip_ville": "75002 Paris",
|
||||
"client_pays": "France",
|
||||
"packs": "Gold",
|
||||
"detail_packs": "-- Support téléphonique -- "
|
||||
"Reporting basique -- "
|
||||
"Mots clés par formation -- "
|
||||
"Customisation de l'affichage d'une formation -- "
|
||||
"Préférence/ Diffusion géographique -- "
|
||||
"Publication d'un article -- "
|
||||
"Reporting Dynamique et personnalisé",
|
||||
"qty": "1",
|
||||
"unit_price": "550",
|
||||
"montant": "550",
|
||||
"invoice_id": "FACT_221100019",
|
||||
"invoice_date": "01/11/2022",
|
||||
"due_date": "01/11/2022",
|
||||
"orign_order": "MySy_00wheA",
|
||||
}
|
||||
}
|
||||
sourceHtml = template.render(params=body["params"])
|
||||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = "[MySy Training Technology] : Votre facture N° FACT_221100019"
|
||||
msg['To'] = 'billardman1@gmail.com'
|
||||
|
||||
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 envoyé " + str(val))
|
||||
return True, " facture envoyée"
|
||||
|
||||
|
||||
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 d'envoyer la facure"
|
||||
|
|
14
main.py
14
main.py
|
@ -2020,11 +2020,19 @@ def UserEmargementValidation(value, session):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
url = 'https://dev.mysy-training.com/erreur'
|
||||
|
||||
|
||||
|
||||
return redirect(url)
|
||||
|
||||
|
||||
"""
|
||||
API d'envoi d'une facture manuelle avec RIB
|
||||
"""
|
||||
@app.route('/myclass/api/ManualSendInvoiceEmailRIB/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def ManualSendInvoiceEmailRIB():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### EmargementMail : payload = ",str(payload))
|
||||
localStatus, message= emails.ManualSendInvoiceEmailRIB(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
|
Loading…
Reference in New Issue