master
cherif 2024-09-30 12:47:34 +02:00
parent e830586352
commit 3236117ff7
5 changed files with 8860 additions and 2 deletions

View File

@ -4,6 +4,8 @@
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="25/09/2024 - 15h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/ela_factures_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_factures_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" />
</list>
<option name="SHOW_DIALOG" value="false" />

File diff suppressed because it is too large Load Diff

View File

@ -338,7 +338,7 @@ def add_payement_mode(diction):
return_document=ReturnDocument.AFTER
)
if (ret_val['_id'] is False):
if (ret_val is None or ret_val['_id'] is False):
mycommon.myprint(
str(inspect.stack()[0][3]) + " : Impossible de mettre à jour (ispending':'1') le compte partenaire")
return False, "Impossible d'ajouter le mode de payement"

14
main.py
View File

@ -11187,6 +11187,20 @@ def Get_List_Type_Cours():
return jsonify(status=status, message=retval)
"""
API pour ajouter / mettre à jour une adresse email a la newsletter
"""
@app.route('/myclass/api/Add_Update_Email_To_Newsletter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_Update_Email_To_Newsletter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_Update_Email_To_Newsletter payload = ",payload)
status, retval = mycommon.Add_Update_Email_To_Newsletter(payload)
return jsonify(status=status, message=retval)
if __name__ == '__main__':
print(" debut api")

View File

@ -6763,4 +6763,74 @@ def Get_Config_Conversion_Heures(locl_partner_owner_recid):
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la conversion des heure "
return False, " Impossible de récupérer la conversion des heure "
"""
Newsletter ajout email
Cette fonction permet d'ajouter une adresse email dans liste des newsletter
"""
def Add_Update_Email_To_Newsletter(diction):
try:
diction = strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['email', ]
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
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 = ['email', ]
for val in field_list_obligatoire:
if val not in diction:
myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Les informations fournies sont incorrectes"
if (isEmailValide(str(diction['email'])) is False):
myprint(
str(inspect.stack()[0][3]) + " L'adresse email " + str(diction['email']) + " n'est pas valide")
return False, " L'adresse email " + str(diction['email']) + " n'est pas valide "
new_data = {}
new_data['email'] = str(diction['email']).strip()
new_data['date_update'] = str(datetime.now())
new_data['date_created'] = str(datetime.now())
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['update_by'] = ""
new_data['created_by'] = ""
ret_val = MYSY_GV.dbname['newsletter_email'].find_one_and_update(
{'email': str(diction['email']).strip(), },
{"$set": new_data},
upsert=True,
return_document=ReturnDocument.AFTER
)
if (ret_val is None or ret_val['_id'] is False):
myprint(
str(inspect.stack()[0][3]) + " : Impossible de mettre à jour (ispending':'1') le compte partenaire")
return False, "Impossible d'ajouter le mode de payement"
return True, "Merci, votre adresse email a bien été ajoutée"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible d'ajouter l'adresse email à la newsletter"