03/01/2024 - 17h30
parent
44eb3c2e79
commit
8404e94d76
|
@ -1,14 +1,14 @@
|
|||
<?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="31/12/2023- 18h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="01/01/2024- 18h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" 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$/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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/purchase_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/purchase_prices.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>
|
||||
|
@ -80,13 +80,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00136" summary="23/10/2023 - 13h">
|
||||
<created>1698059598790</created>
|
||||
<option name="number" value="00136" />
|
||||
<option name="presentableId" value="LOCAL-00136" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698059598790</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00137" summary="23/10/2023 - 16h">
|
||||
<created>1698067991140</created>
|
||||
<option name="number" value="00137" />
|
||||
|
@ -423,7 +416,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1704042376851</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="185" />
|
||||
<task id="LOCAL-00185" summary="01/01/2024- 18h">
|
||||
<created>1704127826604</created>
|
||||
<option name="number" value="00185" />
|
||||
<option name="presentableId" value="LOCAL-00185" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1704127826605</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="186" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -438,7 +438,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="30/11/2023 - 21h" />
|
||||
<MESSAGE value="01/12/2023 - 23h" />
|
||||
<MESSAGE value="04/12/2023 - 21h" />
|
||||
<MESSAGE value="05/12/2023 - 21h" />
|
||||
|
@ -463,6 +462,7 @@
|
|||
<MESSAGE value="28/12/2023- 19h" />
|
||||
<MESSAGE value="29/12/2023- 12h" />
|
||||
<MESSAGE value="31/12/2023- 18h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="31/12/2023- 18h" />
|
||||
<MESSAGE value="01/01/2024- 18h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="01/01/2024- 18h" />
|
||||
</component>
|
||||
</project>
|
|
@ -15,6 +15,7 @@ Cette variable definit l'environnement de travail
|
|||
"""
|
||||
#MYSY_ENV = "PROD"
|
||||
#MYSY_ENV = "REC"
|
||||
#MYSY_ENV = "DEM"
|
||||
MYSY_ENV = "DEV"
|
||||
|
||||
# Cette variable definit l'url de base du server
|
||||
|
@ -39,6 +40,11 @@ elif (MYSY_ENV == "REC"):
|
|||
dbname = client['cherifdb_rec']
|
||||
CLIENT_URL_BASE = 'https://dev.mysy-training.com/'
|
||||
|
||||
elif (MYSY_ENV == "DEM"):
|
||||
CONNECTION_STRING = "mongodb://localhost:27017/cherifdb_demo"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
dbname = client['cherifdb_demo']
|
||||
CLIENT_URL_BASE = 'https://demo.mysy-training.com/'
|
||||
|
||||
|
||||
|
||||
|
@ -54,6 +60,7 @@ en dev ou en production
|
|||
MYSY_PORT_PROD = 5000
|
||||
MYSY_PORT_DEV = 5001
|
||||
MYSY_PORT_REC = 5001
|
||||
MYSY_PORT_DEM = 5003
|
||||
|
||||
|
||||
|
||||
|
@ -204,6 +211,8 @@ elif (MYSY_ENV == "DEV"):
|
|||
elif (MYSY_ENV == "REC"):
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices_rec/"
|
||||
|
||||
elif (MYSY_ENV == "REC"):
|
||||
INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices_demo/"
|
||||
|
||||
"""
|
||||
Cette Variable definit le nombre de formation associées à retourner
|
||||
|
@ -239,6 +248,13 @@ if (MYSY_ENV == "REC"):
|
|||
O365_SMTP_COUNT_From_User = "support@mysy-training.com"
|
||||
O365_SMTP_COUNT_port = 587
|
||||
|
||||
if (MYSY_ENV == "DEM"):
|
||||
O365_SMTP_COUNT_password = 'Xad47198'
|
||||
O365_SMTP_COUNT_smtpsrv = "smtp.office365.com"
|
||||
O365_SMTP_COUNT_user = "support@mysy-training.com"
|
||||
O365_SMTP_COUNT_From_User = "support@mysy-training.com"
|
||||
O365_SMTP_COUNT_port = 587
|
||||
|
||||
|
||||
if (MYSY_ENV == "DEV"):
|
||||
"""O365_SMTP_COUNT_password = 'GomboyaVince1234+'
|
||||
|
@ -326,6 +342,23 @@ elif (MYSY_ENV == "REC"):
|
|||
STRIPE_CONFIG_KEY_PUB = "pk_test_51LUUfAAbmaEugrFTI25uZBD3IFjbtaL6jUfRV83diDf7nco8worna4NGKhMHbPP71WCwT5EHFRdDNatxPrJWwgZ300kgH5EO4p"
|
||||
STRIPE_CONFIG_API_KEY = "sk_test_51LUUfAAbmaEugrFTrWsfcBWZtbBh9r3HCa2sgeyikG808LjSk3bAdFhV6KxgRZ3vFxooa6RE0c5zBkTuOUrKkyjy00BrsIXAPs"
|
||||
|
||||
elif (MYSY_ENV == "DEM"):
|
||||
STRIPE_GOLD_PRICE_ID = "price_1MT3FmAbmaEugrFTZ5vyJRcZ"
|
||||
STRIPE_GOLD_PRICE_ID_50_OFF = "price_1NEpALAbmaEugrFTCDhlJyo3"
|
||||
STRIPE_GOLD_PRICE_ID_95_OFF = "price_1NFyUEAbmaEugrFT5sRXixeZ"
|
||||
STRIPE_GOLD_PRICE_ID_100_OFF = "price_1NEpeJAbmaEugrFTXT5OFciX"
|
||||
|
||||
STRIPE_STANDARD_PRICE_ID = "price_1MT3FLAbmaEugrFTDgw7MVgb"
|
||||
STRIPE_STANDARD_PRICE_ID_50_OFF = "price_1NEpCOAbmaEugrFTcBnOf89X"
|
||||
STRIPE_STANDARD_PRICE_ID_95_OFF = "price_1NFySwAbmaEugrFTxrQHhFN9"
|
||||
STRIPE_STANDARD_PRICE_ID_100_OFF = "price_1NEpbrAbmaEugrFTgLABbIOF"
|
||||
|
||||
|
||||
STRIPE_TEST_PRICE_ID = "price_1MT3FLAbmaEugrFTDgw7MVgb"
|
||||
STRIPE_CONFIG_KEY_PUB = "pk_test_51LUUfAAbmaEugrFTI25uZBD3IFjbtaL6jUfRV83diDf7nco8worna4NGKhMHbPP71WCwT5EHFRdDNatxPrJWwgZ300kgH5EO4p"
|
||||
STRIPE_CONFIG_API_KEY = "sk_test_51LUUfAAbmaEugrFTrWsfcBWZtbBh9r3HCa2sgeyikG808LjSk3bAdFhV6KxgRZ3vFxooa6RE0c5zBkTuOUrKkyjy00BrsIXAPs"
|
||||
|
||||
|
||||
"""
|
||||
Limite des zones de texte des formation
|
||||
- porgramme
|
||||
|
@ -396,6 +429,17 @@ elif (MYSY_ENV == "REC"):
|
|||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_rec/"
|
||||
LMS_BAS_URL = "mysy-hosting.com/"
|
||||
|
||||
elif (MYSY_ENV == "DEM"):
|
||||
MYSY_MARIADB_USER = "mysy_mariadb_user"
|
||||
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
|
||||
MYSY_MARIADB_HOST = "192.168.1.21"
|
||||
MYSY_MARIADB_PORT = 3306
|
||||
MYSY_LMS_BDD = "mysy_db_chamilo_rec"
|
||||
MYSY_LMS_URL = "https://demolms.mysy-training.com/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_demo/"
|
||||
LMS_BAS_URL = "mysy-hosting.com/"
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
|
2154
Log/log_file.log
2154
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -2339,8 +2339,8 @@ def get_partner_class(diction):
|
|||
for retVal in coll_name.find( {"$and":[ {'valide':'1'},{'locked':'0'},
|
||||
{'partner_owner_recid':user_recid} ,
|
||||
filt_external_code, filt_title, filt_internal_url]},
|
||||
{'programme':0, 'objectif':0, 'indexed':0, 'indexed_desc':0,
|
||||
'indexed_obj':0, 'indexed_title':0, 'description':0}
|
||||
{ 'indexed':0, 'indexed_desc':0,
|
||||
'indexed_obj':0, 'indexed_title':0, }
|
||||
):
|
||||
|
||||
#print(" #### retVal = ", retVal)
|
||||
|
|
|
@ -1142,6 +1142,9 @@ def Evaluation_training_confirmation_mail(diction):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://dev.mysy-training.com/Display-Detail-formation/" + str(diction['internal_url'])+"/"+str(diction['token_eval'])
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demo.mysy-training.com/Display-Detail-formation/" + str(diction['internal_url'])+"/"+str(diction['token_eval'])
|
||||
|
||||
print(" ### Adresse = "+str(diction['adresse']) )
|
||||
print(" #### my_url = ", my_url)
|
||||
|
||||
|
|
18
email_mgt.py
18
email_mgt.py
|
@ -69,6 +69,8 @@ def send_user_account_mail_old(message, account_mail):
|
|||
my_url = "http://localhost:"+str(MYSY_GV.MYSY_PORT_DEV)+"/myclass/api/valide_user_account/"+str(message)
|
||||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://devapimysy.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=15, params={"mysyurl": my_url,
|
||||
|
@ -118,6 +120,8 @@ def send_user_thks_mail_old(message, account_mail):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://devapimysy.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=16, params={ "user_name": str(account_mail),},
|
||||
|
@ -151,6 +155,9 @@ def send_partner_account_mail_old(message, account_mail):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://devapimysy.mysy-training.com/myclass/api/valide_partnair_account/"+str(message)
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_partnair_account/"+str(message)
|
||||
|
||||
|
||||
print(" mail enoye à toaddrs : "+toaddrs)
|
||||
|
||||
|
@ -1170,6 +1177,8 @@ def send_user_account_mail(message, account_mail):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://devapimysy.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
@ -1239,6 +1248,8 @@ def send_partner_account_mail(message, account_mail):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://devapimysy.mysy-training.com/myclass/api/valide_partnair_account/" + str(message)
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_partnair_account/" + str(message)
|
||||
|
||||
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
@ -1404,6 +1415,8 @@ def send_user_thks_mail(message, account_mail):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://devapimysy.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demoapi.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
"""
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=16, params={ "user_name": str(account_mail),},
|
||||
|
@ -1469,6 +1482,9 @@ def send_user_init_pwd_mail(token, account_mail, type_account):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
my_url = "https://dev.mysy-training.com/ResetUserPwd/" + str(token) + "/" + str(type_account)
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
my_url = "https://demo.mysy-training.com/ResetUserPwd/" + str(token) + "/" + str(type_account)
|
||||
|
||||
"""send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=19, params={"mysyurl": my_url,
|
||||
"user_name": str(account_mail),
|
||||
}, to=to, bcc=bcc
|
||||
|
@ -1863,6 +1879,8 @@ def SendEmargementMail( diction):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
myurl = "https://devapimysy.mysy-training.com/myclass/api/UserEmargementValidation/" + str(val_emarge['_id']) + "/1"
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
myurl = "https://demoapi.mysy-training.com/myclass/api/UserEmargementValidation/" + str(val_emarge['_id']) + "/1"
|
||||
|
||||
body = {
|
||||
"params":{"nom": str(val_emarge['nom']),
|
||||
|
|
106
main.py
106
main.py
|
@ -292,6 +292,9 @@ def valide_user_account(value):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
url = 'https://dev.mysy-training.com/mysy-account-activated/'
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
url = 'https://demo.mysy-training.com/mysy-account-activated/'
|
||||
|
||||
else:
|
||||
if (MYSY_GV.MYSY_ENV == "PROD"):
|
||||
url = 'https://www.mysy-training.com/erreur'
|
||||
|
@ -302,6 +305,9 @@ def valide_user_account(value):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
url = 'https://dev.mysy-training.com/erreur'
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
url = 'https://demo.mysy-training.com/erreur'
|
||||
|
||||
return redirect(url)
|
||||
|
||||
|
||||
|
@ -659,6 +665,9 @@ def valide_partnair_account(value):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
url = 'https://dev.mysy-training.com/PartnerLogin1/'
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
url = 'https://demo.mysy-training.com/PartnerLogin1/'
|
||||
|
||||
else:
|
||||
if (MYSY_GV.MYSY_ENV == "PROD"):
|
||||
url = 'https://www.mysy-training.com/erreur'
|
||||
|
@ -666,6 +675,8 @@ def valide_partnair_account(value):
|
|||
url = 'https://www.mysy-training.com/erreur'
|
||||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
url = 'https://dev.mysy-training.com/erreur'
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
url = 'https://demo.mysy-training.com/erreur'
|
||||
|
||||
return redirect(url)
|
||||
|
||||
|
@ -2462,6 +2473,9 @@ def UserEmargementValidation(value, session):
|
|||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
url = 'https://dev.mysy-training.com/Emargement/'
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
url = 'https://demo.mysy-training.com/Emargement/'
|
||||
|
||||
else:
|
||||
if (MYSY_GV.MYSY_ENV == "PROD"):
|
||||
url = 'https://www.mysy-training.com/erreur'
|
||||
|
@ -2471,6 +2485,8 @@ def UserEmargementValidation(value, session):
|
|||
|
||||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
url = 'https://dev.mysy-training.com/erreur'
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
url = 'https://demo.mysy-training.com/erreur'
|
||||
|
||||
return redirect(url)
|
||||
|
||||
|
@ -2958,6 +2974,54 @@ def Get_Personnalisable_Collection():
|
|||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
"""
|
||||
API qui lit depuis la base recette et ecrit dans la base de demo
|
||||
"""
|
||||
"API qui retourne la liste des champs personalisables"
|
||||
@app.route('/myclass/api/Delete_And_Load_DB_Collection_to_DB_Collection_For_Demo_Env/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_And_Load_DB_Collection_to_DB_Collection_For_Demo_Env():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_And_Load_DB_Collection_to_DB_Collection_For_Demo_Env : payload = ", payload)
|
||||
localStatus, message = tools_cherif.Delete_And_Load_DB_Collection_to_DB_Collection_For_Demo_Env()
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
# PROD
|
||||
@app.route('/myclass/api/Delete_And_Load_DB_Collection_to_DB_Collection_For_PROD_Env/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_And_Load_DB_Collection_to_DB_Collection_For_PROD_Env():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_And_Load_DB_Collection_to_DB_Collection_For_PROD_Env : payload = ", payload)
|
||||
localStatus, message = tools_cherif.Delete_And_Load_DB_Collection_to_DB_Collection_For_PROD_Env()
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de migration des formations
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_And_Load_DB_Collection_MyClass_to_DB_Collection_For_Demo_Env/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_And_Load_DB_Collection_MyClass_to_DB_Collection_For_Demo_Env():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_And_Load_DB_Collection_MyClass_to_DB_Collection_For_Demo_Env : payload = ", payload)
|
||||
localStatus, message = tools_cherif.Delete_And_Load_DB_Collection_MyClass_to_DB_Collection_For_Demo_Env()
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
"""
|
||||
API de migration des compte partenaires
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_And_Load_DB_Collection_partnair_account_to_DB_Collection_For_Demo_Env/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_And_Load_DB_Collection_partnair_account_to_DB_Collection_For_Demo_Env():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_And_Load_DB_Collection_partnair_account_to_DB_Collection_For_Demo_Env : payload = ", payload)
|
||||
localStatus, message = tools_cherif.Delete_And_Load_DB_Collection_partnair_account_to_DB_Collection_For_Demo_Env()
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
|
@ -4437,6 +4501,26 @@ def Add_Ressource_Humaine():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
@app.route('/myclass/api/Add_Partner_Admin_Ressource_Humaine_No_Toke/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Partner_Admin_Ressource_Humaine_No_Toke():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Partner_Admin_Ressource_Humaine_No_Toke payload = ",payload)
|
||||
status, retval = ressources_humaines.Add_Partner_Admin_Ressource_Humaine_No_Toke(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
### PRDO DATA MIGRATION
|
||||
@app.route('/myclass/api/PROD_Add_Partner_Admin_Ressource_Humaine_No_Toke/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def PROD_Add_Partner_Admin_Ressource_Humaine_No_Toke():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### PROD_Add_Partner_Admin_Ressource_Humaine_No_Toke payload = ",payload)
|
||||
status, retval = ressources_humaines.PROD_Add_Partner_Admin_Ressource_Humaine_No_Toke(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
"""
|
||||
API qui met a jour une ressource humaine
|
||||
"""
|
||||
|
@ -6902,7 +6986,7 @@ if __name__ == '__main__':
|
|||
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "REC"):
|
||||
mycommon.myprint(" ++++ ENVIRONNEMENT DEVELOPPEMENT ++++")
|
||||
mycommon.myprint(" ++++ ENVIRONNEMENT RECETTE ++++")
|
||||
mycommon.myprint("++ DATABASE " + MYSY_GV.CONNECTION_STRING + " ++")
|
||||
mycommon.myprint("++ DBNAME " + str(MYSY_GV.dbname) + " ++")
|
||||
mycommon.myprint("++ FLASK PORT " + str(MYSY_GV.MYSY_PORT_REC) + " ++")
|
||||
|
@ -6921,6 +7005,26 @@ if __name__ == '__main__':
|
|||
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_REC, debug=True, threaded=True)
|
||||
|
||||
|
||||
elif (MYSY_GV.MYSY_ENV == "DEM"):
|
||||
mycommon.myprint(" ++++ ENVIRONNEMENT DEMONSTRATION ++++")
|
||||
mycommon.myprint("++ DATABASE " + MYSY_GV.CONNECTION_STRING + " ++")
|
||||
mycommon.myprint("++ DBNAME " + str(MYSY_GV.dbname) + " ++")
|
||||
mycommon.myprint("++ FLASK PORT " + str(MYSY_GV.MYSY_PORT_DEM) + " ++")
|
||||
mycommon.myprint("++ LMS_BAS_URL " + str(MYSY_GV.LMS_BAS_URL) + " ++")
|
||||
|
||||
scheduler = BackgroundScheduler()
|
||||
# Create the job
|
||||
scheduler.add_job(func=Flask_Cron_Strip_Get_Customer_Abonnement_Data, trigger="interval", minutes=5)
|
||||
# Start the scheduler
|
||||
scheduler.start()
|
||||
|
||||
# /!\ IMPORTANT /!\ : Shut down the scheduler when exiting the app
|
||||
atexit.register(lambda: scheduler.shutdown())
|
||||
|
||||
|
||||
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_DEM, debug=True, threaded=True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -174,6 +174,152 @@ def Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de créer la compte administrateur du partenaire (2) "
|
||||
|
||||
#### PROD MIGRATION AND DELETE
|
||||
def PROD_Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
|
||||
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
||||
CONNECTION_STRING = "mongodb://localhost:27017"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
PROD_dbname = client['cherifdb']
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_recid', "nom", "email", "comment", 'is_partner_admin_account', 'account_partner_id',
|
||||
'is_partner_admin_account']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = [ "partner_recid", "email", ]
|
||||
|
||||
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, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
partner_recid = ""
|
||||
if ("partner_recid" in diction.keys()):
|
||||
if diction['partner_recid']:
|
||||
partner_recid = diction['partner_recid']
|
||||
|
||||
"""
|
||||
Recuperation des données fournies en entrée
|
||||
"""
|
||||
data = {}
|
||||
data['partner_recid'] = partner_recid
|
||||
|
||||
nom = ""
|
||||
if ("nom" in diction.keys()):
|
||||
if diction['nom']:
|
||||
nom = diction['nom']
|
||||
data['nom'] = diction['nom']
|
||||
|
||||
is_partner_admin_account = "0"
|
||||
if ("is_partner_admin_account" in diction.keys()):
|
||||
if (diction['is_partner_admin_account'] and str(diction['is_partner_admin_account']) in ['0', '1']):
|
||||
is_partner_admin_account = diction['is_partner_admin_account']
|
||||
data['is_partner_admin_account'] = is_partner_admin_account
|
||||
|
||||
|
||||
data['ismanager'] = "0"
|
||||
|
||||
email = ""
|
||||
if ("email" in diction.keys()):
|
||||
if diction['email']:
|
||||
email = diction['email']
|
||||
data['email'] = diction['email']
|
||||
if( mycommon.isEmailValide(email) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - L'adresse email "+str(email)+" n'est pas valide")
|
||||
|
||||
return False, " - - L'adresse email "+str(email)+" n'est pas valide "
|
||||
|
||||
comment = ""
|
||||
if ("comment" in diction.keys()):
|
||||
if diction['comment']:
|
||||
comment = diction['comment']
|
||||
data['comment'] = diction['comment']
|
||||
|
||||
account_partner_id = ""
|
||||
if ("account_partner_id" in diction.keys()):
|
||||
if diction['account_partner_id']:
|
||||
account_partner_id = diction['account_partner_id']
|
||||
data['account_partner_id'] = diction['account_partner_id']
|
||||
|
||||
|
||||
|
||||
data['profil'] = "partner_admin"
|
||||
|
||||
data['valide'] = '1'
|
||||
data['locked'] = '0'
|
||||
data['date_update'] = str(datetime.now())
|
||||
|
||||
|
||||
inserted_id = ""
|
||||
#inserted_id = MYSY_GV.dbname['ressource_humaine'].insert_one(data).inserted_id
|
||||
inserted_id = PROD_dbname["ressource_humaine"].insert_one(data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer la compte adminstrateur du partenaire ")
|
||||
return False, " Impossible de créer la compte adminstrateur du partenaire "
|
||||
|
||||
"""
|
||||
Un fois le compte rh créer, on met à jour la collection partner_account, champ : 'ressource_humaine_id' avec le bon is
|
||||
"""
|
||||
PROD_dbname["partnair_account"].update_one({'recid': str(diction['partner_recid'])},
|
||||
{'$set': {'ressource_humaine_id': str(inserted_id),
|
||||
'is_partner_admin_account':is_partner_admin_account}})
|
||||
|
||||
|
||||
"""
|
||||
Apres la creation de l'employé, il faut ajouter les droit admin au compte
|
||||
"""
|
||||
for retval in MYSY_GV.dbname['application_modules'].find({'valide':'1', 'locked':'0'}):
|
||||
data_to_add = {}
|
||||
data_to_add['partner_owner_recid'] = str(partner_recid)
|
||||
data_to_add['module_name'] = retval['module_name']
|
||||
data_to_add['module'] = retval['module_name']
|
||||
data_to_add['user_id'] = str(inserted_id)
|
||||
data_to_add['read'] = True
|
||||
data_to_add['write'] = True
|
||||
data_to_add['valide'] = "1"
|
||||
data_to_add['locked'] = "0"
|
||||
data_to_add['date_update'] = str(datetime.now())
|
||||
|
||||
|
||||
|
||||
PROD_dbname["user_access_right"].find_one_and_update(
|
||||
{'user_id': str(inserted_id), 'module_name': str(retval['module_name'])},
|
||||
{"$set": data_to_add},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=True,
|
||||
)
|
||||
|
||||
return True, str(inserted_id)
|
||||
|
||||
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 créer la compte administrateur du partenaire (2) "
|
||||
|
||||
####
|
||||
|
||||
def Add_Ressource_Humaine(diction):
|
||||
|
||||
|
|
|
@ -1293,3 +1293,213 @@ def Get_Personnalisable_Collection():
|
|||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste collections personnalisables"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Chargement d'une collection d'une base de données vers une autre base de données
|
||||
"""
|
||||
def Delete_And_Load_DB_Collection_to_DB_Collection_For_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
|
||||
"""
|
||||
collection_with_filter = [
|
||||
{'collection': 'contrat_type', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection':'base_config_dashbord', 'filter':{'partner_owner_recid':'default'}},
|
||||
{'collection': 'base_config_modele_journee', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'base_partner_session_step', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'base_partner_setup', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'class_niveau_formation', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'courrier_template', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'courrier_template_champ_config', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'mysy_sequence', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'application_modules', 'filter': {}},
|
||||
{'collection': 'mysystopwords', 'filter': {}},
|
||||
{'collection': 'pack', 'filter': {}},
|
||||
{'collection': 'products', 'filter': {}},
|
||||
{'collection': 'produit_service', 'filter': {}},
|
||||
{'collection': 'ressource_humaine_profil', 'filter': {}},
|
||||
{'collection': 'search_suggestion_words', 'filter': {}},
|
||||
{'collection': 'ville_commune', 'filter': {}},
|
||||
{'collection': 'word_not_stem', 'filter': {}},
|
||||
{'collection': 'list_mots_fr', 'filter': {}},
|
||||
{'collection': 'list_mots_not_fr', 'filter': {}},
|
||||
{'collection': 'liste_domaine_metier', 'filter': {}},
|
||||
{'collection': 'liste_opco', 'filter': {}},
|
||||
{'collection': 'lms_theme', 'filter': {}},
|
||||
]
|
||||
|
||||
## On vide les table d'abord dans l'environnement cible
|
||||
for tmp in collection_with_filter:
|
||||
collection = tmp['collection']
|
||||
DEM_dbname[str(collection)].delete_many({})
|
||||
|
||||
for tmp in collection_with_filter:
|
||||
collection = tmp['collection']
|
||||
filter = tmp['filter']
|
||||
|
||||
for val in REC_dbname[collection].find(filter):
|
||||
print(" ## val = ", val)
|
||||
del val['_id']
|
||||
print(" ### "+str(collection)+" : "+str(val))
|
||||
DEM_dbname[str(collection)].insert_one(val)
|
||||
|
||||
|
||||
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_to_DB_Collection_For_Demo_Env"
|
||||
|
||||
|
||||
def Delete_And_Load_DB_Collection_to_DB_Collection_For_PROD_Env():
|
||||
try:
|
||||
|
||||
#REC_base_config_dashbord
|
||||
CONNECTION_STRING = "mongodb://localhost:27017"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
REC_dbname = client['cherifdb_rec']
|
||||
PROD_dbname = client['cherifdb']
|
||||
|
||||
"""
|
||||
Ici les collections avec les filtres pr chaque collection
|
||||
"""
|
||||
collection_with_filter = [
|
||||
{'collection': 'contrat_type', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection':'base_config_dashbord', 'filter':{'partner_owner_recid':'default'}},
|
||||
{'collection': 'base_config_modele_journee', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'base_partner_session_step', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'base_partner_setup', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'class_niveau_formation', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'courrier_template', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'courrier_template_champ_config', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'mysy_sequence', 'filter': {'partner_owner_recid': 'default'}},
|
||||
{'collection': 'application_modules', 'filter': {}},
|
||||
|
||||
]
|
||||
|
||||
## On vide les table d'abord dans l'environnement cible
|
||||
for tmp in collection_with_filter:
|
||||
collection = tmp['collection']
|
||||
PROD_dbname[str(collection)].delete_many({})
|
||||
|
||||
for tmp in collection_with_filter:
|
||||
collection = tmp['collection']
|
||||
filter = tmp['filter']
|
||||
|
||||
for val in REC_dbname[collection].find(filter):
|
||||
print(" ## val = ", val)
|
||||
del val['_id']
|
||||
print(" ### "+str(collection)+" : "+str(val))
|
||||
PROD_dbname[str(collection)].insert_one(val)
|
||||
|
||||
|
||||
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_to_DB_Collection_For_Demo_Env"
|
||||
|
||||
"""
|
||||
Recuperation des formations de prod pour les charger dans une base temporaire (myclass_tmp)
|
||||
"""
|
||||
def Delete_And_Load_DB_Collection_MyClass_to_DB_Collection_For_Demo_Env():
|
||||
try:
|
||||
|
||||
#REC_base_config_dashbord
|
||||
CONNECTION_STRING = "mongodb://localhost:27017"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
PROD_dbname = client['cherifdb']
|
||||
REC_dbname = client['cherifdb_rec']
|
||||
DEM_dbname = client['cherifdb_demo']
|
||||
|
||||
"""
|
||||
Ici les collections avec les filtres pr chaque collection
|
||||
"""
|
||||
qry_POD = { 'isalaune':'1', 'valide':'1', 'published':'1', 'locked':'0', 'partner_owner_recid': {'$in':["236bff915d2afe1b50e61885e3ff7a4da5b00138a27f79f975",
|
||||
"5a73e4ef74e50f5ec1952832170377e8c0b573ac4eaf05538f",
|
||||
"462b11d82f53819d1ab00f246bb8235b317221578f992c416b",
|
||||
"1032b68ad0623914036ab22ae086b47787a2946e911b819779",
|
||||
"0e74b36de43dec6e3f2bb7df6b8c3a9ce640585d822db7bb67",
|
||||
"27280fe62d218fe65b0d730bea9af62077838ef8932018fdb6"] } }
|
||||
|
||||
## On vide les table d'abord dans l'environnement cible
|
||||
for tmp in PROD_dbname['myclass'].find(qry_POD):
|
||||
del tmp['_id']
|
||||
print(" tmp = ", tmp)
|
||||
|
||||
ret_val = DEM_dbname['myclass'].find_one_and_update(
|
||||
{'internal_url': str(tmp['internal_url'])},
|
||||
{"$set": tmp},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=True,
|
||||
)
|
||||
|
||||
if (ret_val is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible d'ajouter la formation ")
|
||||
|
||||
|
||||
|
||||
|
||||
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_MyClass_to_DB_Collection_For_Demo_Env"
|
||||
|
||||
"""
|
||||
Migration des compte partner
|
||||
"""
|
||||
|
||||
|
||||
def Delete_And_Load_DB_Collection_partnair_account_to_DB_Collection_For_Demo_Env():
|
||||
try:
|
||||
|
||||
# REC_base_config_dashbord
|
||||
CONNECTION_STRING = "mongodb://localhost:27017"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
PROD_dbname = client['cherifdb']
|
||||
REC_dbname = client['cherifdb_rec']
|
||||
DEM_dbname = client['cherifdb_demo']
|
||||
|
||||
"""
|
||||
Ici les collections avec les filtres pr chaque collection
|
||||
"""
|
||||
qry_POD = {'recid': {'$in': ["236bff915d2afe1b50e61885e3ff7a4da5b00138a27f79f975",
|
||||
"5a73e4ef74e50f5ec1952832170377e8c0b573ac4eaf05538f",
|
||||
"462b11d82f53819d1ab00f246bb8235b317221578f992c416b",
|
||||
"1032b68ad0623914036ab22ae086b47787a2946e911b819779",
|
||||
"0e74b36de43dec6e3f2bb7df6b8c3a9ce640585d822db7bb67",
|
||||
"27280fe62d218fe65b0d730bea9af62077838ef8932018fdb6"]}}
|
||||
|
||||
## On vide les table d'abord dans l'environnement cible
|
||||
for tmp in PROD_dbname['partnair_account'].find(qry_POD):
|
||||
del tmp['_id']
|
||||
print(" tmp = ", tmp)
|
||||
|
||||
ret_val = DEM_dbname['partnair_account'].find_one_and_update(
|
||||
{'recid': str(tmp['recid'])},
|
||||
{"$set": tmp},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=True,
|
||||
)
|
||||
|
||||
if (ret_val is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible d'ajouter le compte partnenare ")
|
||||
|
||||
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_MyClass_to_DB_Collection_For_Demo_Env"
|
||||
|
|
Loading…
Reference in New Issue