27/07/23 - 23h
parent
b14bf52d2a
commit
220951b7c2
|
@ -3,12 +3,10 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="26/07/23 - 23h">
|
||||
<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$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/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" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.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" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
1477
Log/log_file.log
1477
Log/log_file.log
File diff suppressed because it is too large
Load Diff
16
main.py
16
main.py
|
@ -3258,11 +3258,19 @@ Creation en mass des clients d'un partner
|
|||
@app.route('/myclass/api/Add_Partner_Client_mass/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Partner_Client_mass():
|
||||
# On recupere le corps (payload) de la requete
|
||||
|
||||
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Partner_Client_mass : payload = ",payload)
|
||||
localStatus, message = partner_client.Add_Partner_Client_mass(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
print(" ### Add_Partner_Client_mass payload = ",payload)
|
||||
#print(request.files)
|
||||
|
||||
if request.method == 'POST':
|
||||
# Create variable for uploaded file
|
||||
f = request.files['File']
|
||||
localStatus, message = partner_client.Add_Partner_Client_mass(f, app.config['UPLOAD_FOLDER'], payload)
|
||||
#status, retval = cm.add_class_mass(f, app.config['UPLOAD_FOLDER'], payload)
|
||||
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
@ -41,6 +41,9 @@ def Add_Partner_Client(diction):
|
|||
'invoice_tva', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays'
|
||||
]
|
||||
|
||||
print(" diction = ", diction)
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
|
@ -175,7 +178,7 @@ def Add_Partner_Client(diction):
|
|||
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 "
|
||||
return False, " - L'adresse email "+str(email)+" n'est pas valide "
|
||||
|
||||
|
||||
telephone = ""
|
||||
|
@ -200,14 +203,14 @@ def Add_Partner_Client(diction):
|
|||
invoice_email = ""
|
||||
if ("invoice_email" in diction.keys()):
|
||||
if diction['invoice_email']:
|
||||
email = diction['invoice_email']
|
||||
invoice_email = diction['invoice_email']
|
||||
data['invoice_email'] = diction['invoice_email']
|
||||
if (mycommon.isEmailValide(invoice_email) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - L'adresse email de facturation " + str(invoice_email) + " n'est pas valide")
|
||||
3]) + " - L'adresse email de facturation '" + str(invoice_email) + "' n'est pas valide")
|
||||
|
||||
return False, " - L'adresse email de facturation " + str(invoice_email) + " n'est pas valide "
|
||||
return False, " - L'adresse email de facturation '" + str(invoice_email) + "' n'est pas valide "
|
||||
|
||||
invoice_nom = ""
|
||||
if ("invoice_nom" in diction.keys()):
|
||||
|
@ -958,10 +961,10 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
|||
mydata = {}
|
||||
mydata['nom'] = str(df['nom'].values[n])
|
||||
mydata['email'] = str(df['email'].values[n])
|
||||
mydata['adresse'] = str(df['adresse'].values[n])
|
||||
mydata['code_postal'] = str(df['code_postal'].values[n])
|
||||
mydata['ville'] = str(df['ville'].values[n])
|
||||
mydata['pays'] = str(df['pays'].values[n])
|
||||
mydata['adr_adresse'] = str(df['adresse'].values[n])
|
||||
mydata['adr_code_postal'] = str(df['code_postal'].values[n])
|
||||
mydata['adr_ville'] = str(df['ville'].values[n])
|
||||
mydata['adr_pays'] = str(df['pays'].values[n])
|
||||
mydata['telephone'] = str(df['telephone'].values[n])
|
||||
mydata['token'] = str(my_token)
|
||||
|
||||
|
@ -1043,7 +1046,7 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
|||
status, retval = Add_Partner_Client( clean_dict)
|
||||
|
||||
if (status is False):
|
||||
warning_msg = warning_msg + " Line "+str(n)+" : "+str(retval)
|
||||
warning_msg = warning_msg + " Line "+str(n+1)+" : "+str(retval)
|
||||
nb_warning_msg = nb_warning_msg + 1
|
||||
|
||||
|
||||
|
|
|
@ -3091,7 +3091,7 @@ Cette fonction verifie si une chaine de caractère est un email valide
|
|||
"""
|
||||
def isEmailValide(email):
|
||||
try:
|
||||
pat = "^[a-zA-Z0-9-_]+@[a-zA-Z0-9]+\.[a-z]{1,3}$"
|
||||
pat = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
|
||||
if re.match(pat, email):
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in New Issue