01/09/22 - 16h
parent
ed6b224f47
commit
943a4b5fc8
|
@ -760,17 +760,26 @@ def convertHtmlToPdf(diction):
|
||||||
# close output file
|
# close output file
|
||||||
resultFile.close()
|
resultFile.close()
|
||||||
|
|
||||||
# On deplace la facture vers le serveur ftp
|
|
||||||
os.rename(outputFilename, MYSY_GV.INVOICE_DIRECTORY+outputFilename)
|
|
||||||
|
|
||||||
print(" debut envoie de la factureeee "+diction['invoice_id'])
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) +" debut envoie de la factureeee "+diction['invoice_id'])
|
||||||
|
|
||||||
email.SendInvoiceEmail(str(diction['invoice_email']), diction )
|
email.SendInvoiceEmail(str(diction['invoice_email']), diction )
|
||||||
|
|
||||||
|
# On deplace la facture vers le serveur ftp
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " deplacement de la facture vers " + str(MYSY_GV.INVOICE_DIRECTORY) + str(
|
||||||
|
outputFilename))
|
||||||
|
|
||||||
|
os.rename(outputFilename, MYSY_GV.INVOICE_DIRECTORY + outputFilename)
|
||||||
|
|
||||||
|
|
||||||
# return True on success and False on errors
|
# return True on success and False on errors
|
||||||
print(pisaStatus.err, type(pisaStatus.err))
|
print(pisaStatus.err, type(pisaStatus.err))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Exception when calling SMTPApi->send_transac_email: %s\n" % e)
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) +"Exception when calling SMTPApi->send_transac_email: %s\n" % e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
12
main.py
12
main.py
|
@ -1330,6 +1330,18 @@ def PrintAndSendInvoices():
|
||||||
return jsonify(status=status, message=message)
|
return jsonify(status=status, message=message)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette API imprime et envoie les factures aux clients
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/PutClassNote/', methods=['GET','POST'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def PutClassNote():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = request.form.to_dict()
|
||||||
|
print(" ### payload = ", str(payload))
|
||||||
|
status, message = mycommon.PutClassNote()
|
||||||
|
return jsonify(status=status, message=message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -369,7 +369,7 @@ def levenshtein(mot1,mot2):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
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))
|
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
|
|
||||||
|
@ -592,7 +592,7 @@ def RunSearchAPI(search_text=None, external_code_prefixe=None):
|
||||||
"api_key": "596cb9a468f8292fcefa6f297444db9c12478685d8734b52efdf8aa53c54fd55"
|
"api_key": "596cb9a468f8292fcefa6f297444db9c12478685d8734b52efdf8aa53c54fd55"
|
||||||
}
|
}
|
||||||
|
|
||||||
mycommon.myprint("######## PARAM RunSearchAPI = "+str(params))
|
myprint("######## PARAM RunSearchAPI = "+str(params))
|
||||||
|
|
||||||
'''
|
'''
|
||||||
return false prematuré pour eviter de consommer les credits de l'API
|
return false prematuré pour eviter de consommer les credits de l'API
|
||||||
|
@ -606,7 +606,7 @@ def RunSearchAPI(search_text=None, external_code_prefixe=None):
|
||||||
|
|
||||||
my_collection = MYSY_GV.YTUBES_dbname['mysyserpapi']
|
my_collection = MYSY_GV.YTUBES_dbname['mysyserpapi']
|
||||||
|
|
||||||
#mycommon.myprint("resutlat 1 organic_results ")
|
#myprint("resutlat 1 organic_results ")
|
||||||
cmpt = 0
|
cmpt = 0
|
||||||
for val in organic_results:
|
for val in organic_results:
|
||||||
cmpt = cmpt +1
|
cmpt = cmpt +1
|
||||||
|
@ -651,15 +651,15 @@ def RunSearchAPI(search_text=None, external_code_prefixe=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
if ret_val and ret_val['_id']:
|
if ret_val and ret_val['_id']:
|
||||||
mycommon.myprint(" Le document de la recherche étendu a bien été ajouté = " + str(ret_val['_id']))
|
myprint(" Le document de la recherche étendu a bien été ajouté = " + str(ret_val['_id']))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
mycommon.myprint(" WARNING : Impossible d'ajouter le document de la recherche étentue " + str(mydata['url']))
|
myprint(" WARNING : Impossible d'ajouter le document de la recherche étentue " + str(mydata['url']))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
mycommon.myprint(str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
myprint(str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ def GetMasculinSingulier(word=None):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
mycommon.myprint(str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
myprint(str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, ""
|
return False, ""
|
||||||
|
|
||||||
|
|
||||||
|
@ -971,7 +971,7 @@ def Migration_internal_url():
|
||||||
user = retVal
|
user = retVal
|
||||||
|
|
||||||
my_internal_url = str(user['title'])
|
my_internal_url = str(user['title'])
|
||||||
local_status, my_internal_url = mycommon.local_Remove_Ponct_Special_Caractere(my_internal_url)
|
local_status, my_internal_url = local_Remove_Ponct_Special_Caractere(my_internal_url)
|
||||||
my_internal_url = unidecode(my_internal_url.lower())
|
my_internal_url = unidecode(my_internal_url.lower())
|
||||||
my_internal_url = my_internal_url.replace(" ", "-")
|
my_internal_url = my_internal_url.replace(" ", "-")
|
||||||
my_internal_url = my_internal_url.replace("/", "-")
|
my_internal_url = my_internal_url.replace("/", "-")
|
||||||
|
@ -1031,7 +1031,7 @@ def GetMotFromElaIndex(diction):
|
||||||
incom_keys = diction.keys()
|
incom_keys = diction.keys()
|
||||||
for val in incom_keys:
|
for val in incom_keys:
|
||||||
if val not in field_list:
|
if val not in field_list:
|
||||||
mycommon.myprint(str(inspect.stack()[0][
|
myprint(str(inspect.stack()[0][
|
||||||
3]) + " - Le champ '" + val + "' n'existe pas, Creation formation annulée")
|
3]) + " - Le champ '" + val + "' n'existe pas, Creation formation annulée")
|
||||||
return False, []
|
return False, []
|
||||||
|
|
||||||
|
@ -1043,7 +1043,7 @@ def GetMotFromElaIndex(diction):
|
||||||
|
|
||||||
for val in field_list_obligatoire:
|
for val in field_list_obligatoire:
|
||||||
if val not in diction:
|
if val not in diction:
|
||||||
mycommon.myprint(
|
myprint(
|
||||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||||
return False, []
|
return False, []
|
||||||
|
|
||||||
|
@ -1238,7 +1238,7 @@ def recordImage(file=None, Folder=None, diction=None):
|
||||||
'''
|
'''
|
||||||
for val in incom_keys:
|
for val in incom_keys:
|
||||||
if str(val).lower() not in str(field_list).lower():
|
if str(val).lower() not in str(field_list).lower():
|
||||||
mycommon.myprint(
|
myprint(
|
||||||
str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas accepté dans cette API")
|
str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas accepté dans cette API")
|
||||||
return False, " Impossible de se connecter"
|
return False, " Impossible de se connecter"
|
||||||
|
|
||||||
|
@ -1249,7 +1249,7 @@ def recordImage(file=None, Folder=None, diction=None):
|
||||||
field_list_obligatoire = ['token', 'type']
|
field_list_obligatoire = ['token', 'type']
|
||||||
for val in field_list_obligatoire:
|
for val in field_list_obligatoire:
|
||||||
if str(val).lower() not in diction:
|
if str(val).lower() not in diction:
|
||||||
mycommon.myprint(
|
myprint(
|
||||||
str(inspect.stack()[0][3]) + " La valeur '" + val + "' n'est pas presente dans liste des champs")
|
str(inspect.stack()[0][3]) + " La valeur '" + val + "' n'est pas presente dans liste des champs")
|
||||||
return False, "Impossible de se connecter"
|
return False, "Impossible de se connecter"
|
||||||
|
|
||||||
|
@ -1275,20 +1275,20 @@ def recordImage(file=None, Folder=None, diction=None):
|
||||||
retval = check_user_validity("", str(mytoken))
|
retval = check_user_validity("", str(mytoken))
|
||||||
|
|
||||||
if retval is False:
|
if retval is False:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||||
return False, "L'email ou le token ne sont pas valident"
|
return False, "L'email ou le token ne sont pas valident"
|
||||||
|
|
||||||
# Recuperation du recid de la personne
|
# Recuperation du recid de la personne
|
||||||
if( mytype == "user"):
|
if( mytype == "user"):
|
||||||
user_recid = get_user_recid_from_token(str(mytoken))
|
user_recid = get_user_recid_from_token(str(mytoken))
|
||||||
if user_recid is False:
|
if user_recid is False:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du user")
|
myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du user")
|
||||||
return False, " Les informations d'identification sont incorrectes"
|
return False, " Les informations d'identification sont incorrectes"
|
||||||
|
|
||||||
elif( mytype == "partner"):
|
elif( mytype == "partner"):
|
||||||
user_recid = get_parnter_recid_from_token(str(mytoken))
|
user_recid = get_parnter_recid_from_token(str(mytoken))
|
||||||
if user_recid is False:
|
if user_recid is False:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du partner")
|
myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du partner")
|
||||||
return False, " Les informations d'identification sont incorrectes"
|
return False, " Les informations d'identification sont incorrectes"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1296,7 +1296,7 @@ def recordImage(file=None, Folder=None, diction=None):
|
||||||
myuserrecid = user_recid
|
myuserrecid = user_recid
|
||||||
|
|
||||||
|
|
||||||
status, saved_file = mycommon.Upload_Save_IMG_File(file, Folder)
|
status, saved_file = Upload_Save_IMG_File(file, Folder)
|
||||||
if (status == False):
|
if (status == False):
|
||||||
return False, "Impossible d'inserer les formation en masse "
|
return False, "Impossible d'inserer les formation en masse "
|
||||||
|
|
||||||
|
@ -1330,10 +1330,10 @@ def recordImage(file=None, Folder=None, diction=None):
|
||||||
|
|
||||||
|
|
||||||
if ret_val and ret_val['_id']:
|
if ret_val and ret_val['_id']:
|
||||||
mycommon.myprint(" L'image a bien ete enregistrée. ")
|
myprint(" L'image a bien ete enregistrée. ")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
mycommon.myprint(" IMPOSSIBLE D'ENREGISTRER L'IMAGE")
|
myprint(" IMPOSSIBLE D'ENREGISTRER L'IMAGE")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -1362,7 +1362,7 @@ def getRecodedImage(diction=None):
|
||||||
'''
|
'''
|
||||||
for val in incom_keys:
|
for val in incom_keys:
|
||||||
if str(val).lower() not in str(field_list).lower():
|
if str(val).lower() not in str(field_list).lower():
|
||||||
mycommon.myprint(
|
myprint(
|
||||||
str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas accepté dans cette API")
|
str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas accepté dans cette API")
|
||||||
return False, " Impossible de se connecter"
|
return False, " Impossible de se connecter"
|
||||||
|
|
||||||
|
@ -1373,7 +1373,7 @@ def getRecodedImage(diction=None):
|
||||||
field_list_obligatoire = ['token','type']
|
field_list_obligatoire = ['token','type']
|
||||||
for val in field_list_obligatoire:
|
for val in field_list_obligatoire:
|
||||||
if str(val).lower() not in diction:
|
if str(val).lower() not in diction:
|
||||||
mycommon.myprint(
|
myprint(
|
||||||
str(inspect.stack()[0][3]) + " La valeur '" + val + "' n'est pas presente dans liste des champs")
|
str(inspect.stack()[0][3]) + " La valeur '" + val + "' n'est pas presente dans liste des champs")
|
||||||
return False, "Impossible de se connecter"
|
return False, "Impossible de se connecter"
|
||||||
|
|
||||||
|
@ -1396,20 +1396,20 @@ def getRecodedImage(diction=None):
|
||||||
retval = check_user_validity("", str(mytoken))
|
retval = check_user_validity("", str(mytoken))
|
||||||
|
|
||||||
if retval is False:
|
if retval is False:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||||
return False, "L'email ou le token ne sont pas valident"
|
return False, "L'email ou le token ne sont pas valident"
|
||||||
|
|
||||||
# Recuperation du recid de la personne
|
# Recuperation du recid de la personne
|
||||||
if( mytype == "user"):
|
if( mytype == "user"):
|
||||||
user_recid = get_user_recid_from_token(str(mytoken))
|
user_recid = get_user_recid_from_token(str(mytoken))
|
||||||
if user_recid is False:
|
if user_recid is False:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du user")
|
myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du user")
|
||||||
return False, " Les informations d'identification sont incorrectes"
|
return False, " Les informations d'identification sont incorrectes"
|
||||||
|
|
||||||
elif (mytype == "partner"):
|
elif (mytype == "partner"):
|
||||||
user_recid = get_parnter_recid_from_token(str(mytoken))
|
user_recid = get_parnter_recid_from_token(str(mytoken))
|
||||||
if user_recid is False:
|
if user_recid is False:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du user")
|
myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du user")
|
||||||
return False, " Les informations d'identification sont incorrectes"
|
return False, " Les informations d'identification sont incorrectes"
|
||||||
|
|
||||||
myuserrecid = user_recid
|
myuserrecid = user_recid
|
||||||
|
@ -1529,7 +1529,7 @@ def UpdateMetier():
|
||||||
|
|
||||||
|
|
||||||
if ( (ret_val2 is False) or (ret_val2['_id'] is False) ):
|
if ( (ret_val2 is False) or (ret_val2['_id'] is False) ):
|
||||||
mycommon.myprint("Impossible de mettre à jour la formation _id =" + str(x['class_id']) )
|
myprint("Impossible de mettre à jour la formation _id =" + str(x['class_id']) )
|
||||||
return False
|
return False
|
||||||
i = i+1
|
i = i+1
|
||||||
|
|
||||||
|
@ -1667,3 +1667,32 @@ def fillSuggestionCollection():
|
||||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
return False,
|
return False,
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette fonction attribut des notes
|
||||||
|
"""
|
||||||
|
def PutClassNote():
|
||||||
|
try:
|
||||||
|
coll_name = MYSY_GV.dbname['myclass']
|
||||||
|
i = 2
|
||||||
|
for retVal in coll_name.find({}):
|
||||||
|
user = retVal
|
||||||
|
if( i == 5 ):
|
||||||
|
i = 2
|
||||||
|
|
||||||
|
i = i+0.5
|
||||||
|
|
||||||
|
result = coll_name.update_many(
|
||||||
|
{'_id':ObjectId(str(user['_id']))},
|
||||||
|
{
|
||||||
|
"$set": {"note": str(i)}
|
||||||
|
})
|
||||||
|
'''print("raw:", result.raw_result)
|
||||||
|
print("acknowledged:", result.acknowledged)
|
||||||
|
print("matched_count:", result.matched_count)'''
|
||||||
|
|
||||||
|
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, "KO"
|
||||||
|
|
Loading…
Reference in New Issue