05/05/23 - 21h
parent
6ea0aa617e
commit
27216cd57b
|
@ -1,10 +1,13 @@
|
|||
<?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="28/04/23 - 21h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="29/04/23 - 21h">
|
||||
<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$/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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -166,7 +169,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1682714699263</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="16" />
|
||||
<task id="LOCAL-00016" summary="29/04/23 - 21h">
|
||||
<created>1682792543419</created>
|
||||
<option name="number" value="00016" />
|
||||
<option name="presentableId" value="LOCAL-00016" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682792543419</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="17" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -194,6 +204,7 @@
|
|||
<MESSAGE value="24/04/23 - 21h" />
|
||||
<MESSAGE value="25/04/23 - 21h" />
|
||||
<MESSAGE value="28/04/23 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="28/04/23 - 21h" />
|
||||
<MESSAGE value="29/04/23 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="29/04/23 - 21h" />
|
||||
</component>
|
||||
</project>
|
|
@ -316,30 +316,38 @@ if (MYSY_ENV == "PROD"):
|
|||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_prod/"
|
||||
LMS_BAS_URL = "mysy-training.fr/"
|
||||
|
||||
|
||||
elif (MYSY_ENV == "DEV"):
|
||||
MYSY_MARIADB_USER = "mysy_mariadb_user"
|
||||
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
|
||||
MYSY_MARIADB_HOST = "192.168.1.21"
|
||||
#MYSY_MARIADB_HOST = "88.170.110.220"
|
||||
MYSY_MARIADB_PORT = 3306
|
||||
MYSY_LMS_BDD = "chamilo_dev2"
|
||||
MYSY_LMS_URL = "https://lms.mysy-training.com/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy/"
|
||||
LMS_BAS_URL = "mysy-training.fr/"
|
||||
|
||||
""" DEV OUTSIDE network
|
||||
elif (MYSY_ENV == "DEV"):
|
||||
""" DEV on localHost
|
||||
elif (MYSY_ENV == "DEV"):
|
||||
MYSY_MARIADB_USER = "mysy_mariadb_user"
|
||||
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
|
||||
MYSY_MARIADB_HOST = "88.170.110.220"
|
||||
MYSY_MARIADB_HOST = "127.0.0.1"
|
||||
MYSY_MARIADB_PORT = 3306
|
||||
MYSY_LMS_BDD = "mysy_db_chamilo_rec"
|
||||
MYSY_LMS_URL = "https://reclms.mysy-training.com/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_rec/"
|
||||
LMS_BAS_URL = "rec.mysy-training.fr/"
|
||||
"""
|
||||
|
||||
MYSY_LMS_BDD = "chamilo"
|
||||
MYSY_LMS_URL = "http://localhost/mysylms/lmsdev/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy/"
|
||||
LMS_BAS_URL = "mysy-training.fr/"
|
||||
|
||||
|
||||
elif (MYSY_ENV == "DEV"):
|
||||
MYSY_MARIADB_USER = "mysy_mariadb_user"
|
||||
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
|
||||
MYSY_MARIADB_HOST = "192.168.1.21"
|
||||
#MYSY_MARIADB_HOST = "88.170.110.220"
|
||||
MYSY_MARIADB_PORT = 3306
|
||||
MYSY_LMS_BDD = "chamilo_dev2"
|
||||
MYSY_LMS_URL = "https://lms.mysy-training.com/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy/"
|
||||
LMS_BAS_URL = "mysy-training.fr/"
|
||||
"""
|
||||
elif (MYSY_ENV == "DEV"):
|
||||
MYSY_MARIADB_USER = "mysy_mariadb_user"
|
||||
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
|
||||
MYSY_MARIADB_HOST = "88.170.110.220"
|
||||
MYSY_MARIADB_PORT = 3306
|
||||
MYSY_LMS_BDD = "chamilo_dev2"
|
||||
MYSY_LMS_URL = "https://lms.mysy-training.com/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy/"
|
||||
LMS_BAS_URL = "mysy-training.fr/"
|
||||
|
||||
|
||||
elif (MYSY_ENV == "REC"):
|
||||
|
@ -350,7 +358,7 @@ elif (MYSY_ENV == "REC"):
|
|||
MYSY_LMS_BDD = "mysy_db_chamilo_rec"
|
||||
MYSY_LMS_URL = "https://reclms.mysy-training.com/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_rec/"
|
||||
LMS_BAS_URL = "rec.mysy-training.fr/"
|
||||
LMS_BAS_URL = "mysy-hosting.fr/"
|
||||
|
||||
|
||||
|
||||
|
|
2851
Log/log_file.log
2851
Log/log_file.log
File diff suppressed because one or more lines are too long
111
email_mgt.py
111
email_mgt.py
|
@ -1940,6 +1940,117 @@ def ManualSendInvoiceEmailRIB(diction):
|
|||
return False, " impossible d'envoyer la facure"
|
||||
|
||||
|
||||
"""
|
||||
Creation manuelle d'une facture avec RIB pour Port Cities
|
||||
"""
|
||||
def ManualSendInvoiceEmailRIB_PortCities(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_PortCities_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
body = {
|
||||
"params": {"order_id": "ST-230405001",
|
||||
"date_order": ": 11/04/2023",
|
||||
"total_ht": "7 750",
|
||||
"tva": "1 550",
|
||||
"total_ttc": "9 300",
|
||||
"client_name": "Freelance Informatique",
|
||||
"client_address": "34 rue Laffitte",
|
||||
"client_zip_ville": "75009 Paris",
|
||||
"client_pays": "France",
|
||||
"packs": "Chef de projet Odoo - Sur site",
|
||||
"detail_packs": "Avignon - Siège CAPL ",
|
||||
"qty": "6 jrs",
|
||||
"unit_price": "750 €",
|
||||
"montant": "4 500 €",
|
||||
|
||||
"packs2": "Chef de projet Odoo - A distance",
|
||||
"detail_packs2": "Roissy en brie - Siège MTT ",
|
||||
"qty2": "5 jrs",
|
||||
"unit_price2": "650 €",
|
||||
"montant2": "3 200 €",
|
||||
|
||||
"invoice_id": "FACT_230500030",
|
||||
"invoice_date": "01/05/2023",
|
||||
"due_date": "01/05/2022",
|
||||
"orign_order": "Contrat ST-230405001",
|
||||
}
|
||||
}
|
||||
|
||||
#print(" ### body 1 = ", body)
|
||||
sourceHtml = template.render(params=body["params"])
|
||||
|
||||
"""msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = "[MySy Training Technology] : Votre facture N° FACT_230500030"
|
||||
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))
|
||||
|
||||
### CREATION DE LA FACTION PDF
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
#TEMPLATE_FILE = "Template/MySy_Invoice_RIB_tpl.html"
|
||||
TEMPLATE_FILE = "Template/invoice_RIB_PortCities_tpl.html"
|
||||
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
|
||||
#print(" ### body 22 = ", body)
|
||||
|
||||
sourceHtml = template.render(json_data=body["params"])
|
||||
orig_file_name = "invoice_FACT_230400030.pdf"
|
||||
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
|
||||
|
||||
# open output file for writing (truncated binary)
|
||||
resultFile = open(outputFilename, "w+b")
|
||||
|
||||
# convert HTML to PDF
|
||||
pisaStatus = pisa.CreatePDF(
|
||||
src=sourceHtml, # the HTML to convert
|
||||
dest=resultFile) # file handle to receive result
|
||||
|
||||
# close output file
|
||||
resultFile.close()
|
||||
|
||||
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"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction envoie un email pour notifier a un partenaire l'arrete d'un abonnement
|
||||
"""
|
||||
|
|
|
@ -28,6 +28,33 @@ import bcrypt
|
|||
from pymongo import ReturnDocument
|
||||
import paramiko
|
||||
|
||||
|
||||
"""
|
||||
Test connexion SQL sur localhost Phpmyadmin
|
||||
"""
|
||||
def test_connexion_php_myadmin():
|
||||
try:
|
||||
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()
|
||||
|
||||
conn.close()
|
||||
return True, " Connexion OK"
|
||||
|
||||
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 se connecter"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction créer un utilisateur (editeur de formation) lms mysy, donc dans chamilo
|
||||
"""
|
||||
|
@ -132,11 +159,18 @@ def Create_MySy_LMS_User(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le nom du partenaire est vide ")
|
||||
return False, str(inspect.stack()[0][3]) + " - Le nom du partenaire est vide "
|
||||
|
||||
nom_partner = mycommon.remove_non_ascii( str(my_partner['nom']) )
|
||||
nom_partner = mycommon.local_Remove_Ponct_Special_Caractere( nom_partner )
|
||||
|
||||
nom_partner = mycommon.remove_non_ascii(str(my_partner['nom']) )
|
||||
|
||||
local_status, nom_partner = mycommon.local_Remove_Ponct_Special_Caractere( nom_partner )
|
||||
if (local_status is False ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le nom du partenaire : local_Remove_Ponct_Special_Caractere ")
|
||||
return False, str(inspect.stack()[0][3]) + " - Le nom du partenaire : local_Remove_Ponct_Special_Caractere "
|
||||
|
||||
suffix_nom_partner = str(nom_partner)[0:3]
|
||||
|
||||
username = str(username)+"_"+str(suffix_nom_partner)
|
||||
|
||||
username = str(str(username)+"_"+str(suffix_nom_partner)).lower()
|
||||
|
||||
registration_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
@ -2176,7 +2210,7 @@ def LMS_Create_VirtualHost(diction):
|
|||
|
||||
print(" #### le prefixe d'url : '"+str(lms_prefixe_url)+"' N'EXISTE PAS. On va créer l'url")
|
||||
registration_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
full_url = str("http://"+str(lms_prefixe_url)+"."+str(MYSY_GV.LMS_BAS_URL)).lower()
|
||||
full_url = str("https://"+str(lms_prefixe_url)+"."+str(MYSY_GV.LMS_BAS_URL)).lower()
|
||||
|
||||
virtualHost_url = full_url
|
||||
my_query = " INSERT INTO access_url (url, description, active, created_by, tms, url_type) "\
|
||||
|
|
32
main.py
32
main.py
|
@ -2073,6 +2073,21 @@ def ManualSendInvoiceEmailRIB():
|
|||
localStatus, message= emails.ManualSendInvoiceEmailRIB(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API d'envoi d'une facture manuelle avec RIB pour port cities
|
||||
"""
|
||||
@app.route('/myclass/api/ManualSendInvoiceEmailRIB_PortCities/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def ManualSendInvoiceEmailRIB_PortCities():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### EmargementMail : payload = ",str(payload))
|
||||
localStatus, message= emails.ManualSendInvoiceEmailRIB_PortCities(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de recuperation au formation CSV de la liste des inscrits à une formation
|
||||
avec les statuts (validé ou pas)
|
||||
|
@ -2907,6 +2922,23 @@ def Lms_Add_BG_File():
|
|||
localStatus, message = mysy_lms.Lms_Add_BG_File(f, app.config['UPLOAD_FOLDER'], payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
"""
|
||||
Test connexion localhost phpmyadmin
|
||||
"""
|
||||
@app.route('/myclass/api/test_connexion_php_myadmin/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def test_connexion_php_myadmin():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### test_connexion_php_myadmin : payload = ",payload)
|
||||
localStatus, message = mysy_lms.test_connexion_php_myadmin()
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
Loading…
Reference in New Issue