diff --git a/class_mgt.py b/class_mgt.py
index 8c27a5a..48c1baa 100644
--- a/class_mgt.py
+++ b/class_mgt.py
@@ -1502,7 +1502,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
print(str(total_rows)+" formations ont été inserées")
- return True, str(total_rows)+" formations ont été inserées"
+ return True, str(total_rows)+" formations ont été inserées / Mises à jour"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
diff --git a/ela_factures_mgt.py b/ela_factures_mgt.py
index dad5c47..86950f7 100644
--- a/ela_factures_mgt.py
+++ b/ela_factures_mgt.py
@@ -393,6 +393,11 @@ def createOrder(diction):
new_data['client_recid'] = user_recid
coll_part_account = MYSY_GV.dbname['partnair_account']
part_account = coll_part_account.find({'recid':user_recid, 'active':'1'})
+ if (part_account.count() <= 0):
+ mycommon.myprint(
+ str(inspect.stack()[0][3]) + "Aucune donnée client, Impossible de créer la commande ")
+ return False, "Aucune donnée client,, Impossible de créer la commande ", None
+
if ("invoice_nom" in part_account[0].keys()):
if part_account[0]['invoice_nom']:
@@ -434,6 +439,10 @@ def createOrder(diction):
# Recuperation ds données de payement
coll_part_payment = MYSY_GV.dbname['payement_mode']
part_account = coll_part_payment.find({'client_recid': user_recid, 'valide': '1'})
+ if( part_account.count() <= 0 ):
+ mycommon.myprint(
+ str(inspect.stack()[0][3]) + "Aucune donnée de payement, Impossible de créer la commande ")
+ return False, "Aucune donnée de payement,, Impossible de créer la commande ", None
if ("type" in part_account[0].keys()):
if part_account[0]['type']:
diff --git a/email_mgt.py b/email_mgt.py
index 5475235..5da2efb 100644
--- a/email_mgt.py
+++ b/email_mgt.py
@@ -711,13 +711,16 @@ def Pro_Account_Token_Pass(account_mail, my_token, my_tmp_pwd):
Pour vous connecter et profiter de nos services, voici vos identifiants :
-
- Votre mot de passe temporaire : {tmp_pwd}
- Nous vous recommandons de changer ce mot de passe apres la première connection.
+
+ Email de connexion : l'email de connexion correspond à l'adresse de cette boite email.
-
+ Votre mot de passe temporaire : {tmp_pwd}
+ Nous vous recommandons de changer ce mot de passe apres la première connection.
+
+
Votre clé secrète : {cle}
-
+
+
url de connexion : https://www.mysy-training.com/PartnerLogin
diff --git a/main.py b/main.py
index b5bbcb9..4beecff 100644
--- a/main.py
+++ b/main.py
@@ -505,7 +505,7 @@ def valide_partnair_account(value):
if (result):
url = 'https://www.mysy-training.com/PartnerLogin0/'
- url = 'http://localhost:3009/PartnerLogin0'
+ #url = 'http://localhost:3009/PartnerLogin0'
else:
url = 'https://www.mysy-training.com/erreur'
diff --git a/partners.py b/partners.py
index 7403774..e5da735 100644
--- a/partners.py
+++ b/partners.py
@@ -574,11 +574,21 @@ La modification ne s'effectue que si le compte n'est pas verrouillé.
'''
def valide_partnair_account(value):
try:
- client = MongoClient(CONNECTION_STRING)
- dbname = client['cherifdb']
+
coll_name = MYSY_GV.dbname['partnair_account']
- tmp = coll_name.find({'_id':ObjectId(str(value))})
+ tmp_count = coll_name.count_documents({'_id':ObjectId(str(value)), 'active':'1'})
+ if (tmp_count > 0):
+ mycommon.myprint(str(inspect.stack()[0][3]) + " - Ce compte a deja été activé")
+ return False, "Ce compte a deja été activé "
+
+
+ tmp = coll_name.find({'_id':ObjectId(str(value)), 'active':'0'})
+
+ if( tmp.count() <= 0 ):
+ mycommon.myprint(str(inspect.stack()[0][3]) + " - il n'y aucun compte à activer")
+ return False, "Impossible de valider ce compte "
+
partner_email = tmp[0]['email']
@@ -927,17 +937,29 @@ def UpgradetoPro(diction):
if x['email']:
new_diction['contact_mail'] = x['email']
- if x['last_name']:
- new_diction['contact_nom'] = x['last_name']
+ if ("last_name" in x.keys()):
+ if x['last_name']:
+ new_diction['contact_nom'] = x['last_name']
- if x['surname']:
- new_diction['contact_prenom'] = x['surname']
+ if ("surname" in x.keys()):
+ if x['surname']:
+ new_diction['contact_prenom'] = x['surname']
- if x['mob_phone']:
- new_diction['contact_tel'] = x['mob_phone']
+ if ("mob_phone" in x.keys()):
+ if x['mob_phone']:
+ new_diction['contact_tel'] = x['mob_phone']
print(" new_diction la = "+str(new_diction))
+ '''
+ Verification que cette adresse email n'hesiste pas deja dans
+ '''
+ check_tmp = coll_user_account.count_documents({'email': str(diction['email'])})
+
+ if (check_tmp < 0):
+ mycommon.myprint(str(inspect.stack()[0][3]) + " - Ce compte partenaire existe deja")
+ return False, "Ce compte partenaire existe deja"
+
status, retval = add_partner_account(new_diction)
if( status ):