04/07/23 - 10h
parent
84d84675ae
commit
f832eef3e6
|
@ -2,9 +2,27 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="13/06/23 - 21h21">
|
||||
<change afterPath="$PROJECT_DIR$/appel_offre.py" afterDir="false" />
|
||||
<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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/articles_avis.py" beforeDir="false" afterPath="$PROJECT_DIR$/articles_avis.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/business_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/business_prices.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" 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$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" 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$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/product_service.py" beforeDir="false" afterPath="$PROJECT_DIR$/product_service.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/statistics.py" beforeDir="false" afterPath="$PROJECT_DIR$/statistics.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_message_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_message_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
2816
Log/log_file.log
2816
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -340,7 +340,7 @@ def GetSessionFormation(diction):
|
|||
|
||||
|
||||
"""
|
||||
Cette fonction recupere la liste de toutes les sessions de formation actives et valide
|
||||
Cette fonction recupere la liste de toutes les sessions de formation actives et valides
|
||||
d'une formation données ET les sessions "on demande"
|
||||
"""
|
||||
def GetActiveSessionFormation_List(diction):
|
||||
|
@ -514,6 +514,13 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
3]) + " Le code de la formation est vide : Impossible d'importer la liste des sessions ")
|
||||
return False, "Le code de la formation est vide. Impossible d'importer la liste des sessions"
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
return False, " La session de connexion n'est pas valide"
|
||||
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(my_token)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
"""
|
||||
Ce fichier permet de gérer tout ce qui est lié
|
||||
a un appel d'offre.
|
||||
|
||||
Pour memo appel d'offre est le moyen par le quel une société va soliciter des
|
||||
organismes de formation pour repondre à un besoin de formation
|
||||
"""
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
import csv
|
||||
import pandas as pd
|
||||
from pymongo import ReturnDocument
|
||||
import GlobalVariable as MYSY_GV
|
||||
from math import isnan
|
||||
import GlobalVariable as MYSY_GV
|
||||
import ela_index_bdd_classes as eibdd
|
||||
import email_mgt as email
|
||||
|
||||
def Add_Appel_Offre(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'nom', 'prenom', 'email', 'tel_mobile', 'date_naissance', 'adr_rue', 'adr_ville',
|
||||
'adr_code_postal', 'adr_pays']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'nom', 'prenom', 'email', 'tel_mobile', ]
|
||||
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
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(token)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ")
|
||||
return False, " Vous n'etes pas autorisé à utiliser cette API "
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_recid(partner_recid)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire. "
|
||||
|
||||
"""
|
||||
Recuperation des données fournies en entrée
|
||||
"""
|
||||
data = {}
|
||||
data['partner_recid'] = diction['partner_recid']
|
||||
nom = ""
|
||||
if ("nom" in diction.keys()):
|
||||
if diction['nom']:
|
||||
nom = diction['nom']
|
||||
data['nom'] = diction['nom']
|
||||
|
||||
return True, " L'appel d'ofre a été correctement créé"
|
||||
|
||||
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 d'ajouter l'appel d'offre "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'un appel d'offre
|
||||
"""
|
||||
def Update_Appel_Offre(diction):
|
||||
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'nom', 'prenom', 'email', 'tel_mobile', 'date_naissance', 'adr_rue', 'adr_ville',
|
||||
'adr_code_postal', 'adr_pays']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '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
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(token)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ")
|
||||
return False, " Vous n'etes pas autorisé à utiliser cette API "
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_recid(partner_recid)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire. "
|
||||
|
||||
"""
|
||||
Recuperation des données fournies en entrée
|
||||
"""
|
||||
|
||||
data = {}
|
||||
|
||||
nom = ""
|
||||
if ("nom" in diction.keys()):
|
||||
nom = diction['nom']
|
||||
data['nom'] = diction['nom']
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
date_cle = {}
|
||||
date_cle['email'] = str(email)
|
||||
date_cle['partner_recid'] = str(partner_recid)
|
||||
date_cle['valide'] = "1"
|
||||
date_cle['locked'] = "0"
|
||||
|
||||
inserted_id = ""
|
||||
result = MYSY_GV.dbname['candidat'].find_one_and_update(
|
||||
date_cle,
|
||||
{"$set": data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
if (not result.acknowledged):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour l'appel d'offre: " + str(email))
|
||||
return False, " Impossible de mettre à jour l'appel d'offre: " + str(email) + " "
|
||||
|
||||
return True, " L'appel d'offre a été correctement mise à jour"
|
||||
|
||||
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 d'ajouter le candidat "
|
|
@ -276,7 +276,7 @@ def add_articles_avis(diction):
|
|||
retval = mycommon.check_token_validity("", str(diction['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
@ -496,8 +496,8 @@ def recherche_articles_avis(diction):
|
|||
retval = mycommon.check_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(token)
|
||||
|
|
|
@ -411,7 +411,7 @@ def get_cust_prices_by_partner(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les factures"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -486,7 +486,7 @@ def get_linked_customer_to_partner(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les factures"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -568,7 +568,7 @@ def get_cust_specific_prices_by_partner(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les factures"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
|
71
class_mgt.py
71
class_mgt.py
|
@ -94,7 +94,7 @@ def add_class(diction):
|
|||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "Les informations d'identification ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
@ -118,13 +118,6 @@ def add_class(diction):
|
|||
inspect.stack()[0][3]) + " - Impossible de recuperer le pack et le nombre de formation du partenaire")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
||||
|
||||
if( mycommon.tryInt(part_nb_active_training) >= mycommon.tryInt(part_pack_nb_training_auto) ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - Vous avez atteint le nombre maximum de formation autorisé")
|
||||
return False, " Vous avez atteint le nombre maximum de formation autorisé ("+str(part_pack_nb_training_auto)+"" \
|
||||
"). La formation '"+str(diction['external_code'])+"' n'a pas été enregistrée"
|
||||
|
||||
mydata['partner_owner_recid'] = user_recid
|
||||
|
||||
class_internal_url = ""
|
||||
|
@ -153,6 +146,29 @@ def add_class(diction):
|
|||
class_internal_url = str(exist_class['internal_url'])
|
||||
|
||||
else :
|
||||
# On est dans le cas ou la formation N'existe PAS, donc on fait un controle par rappart au nombre dans le pack.
|
||||
"""
|
||||
/!\ : Pour le controle du nombre de formation acheté Versus Ajout d'une nouvelle formation
|
||||
l'utilisateur peut mettre à jour la formation autant de fois qu'il souhaite, *
|
||||
MAIS il ne peut pas ajouter une formation s'il a atteint le nombre autororisé
|
||||
|
||||
Algo :
|
||||
1 - verifier si la formation à ajouter/mettre à jour existe en base,
|
||||
- Si elle n'existe pas, alors c'est un ajout, donc controle.
|
||||
- Si la formation existe deja, alors pas de controle
|
||||
|
||||
"""
|
||||
|
||||
# Verification si la formation existe en en base
|
||||
|
||||
if (mycommon.tryInt(part_nb_active_training) >= mycommon.tryInt(part_pack_nb_training_auto)):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - Impossible d'ajouter la formation "+str(diction['title'])+" - Vous avez atteint le nombre maximum de formation autorisé")
|
||||
return False, " - Impossible d'ajouter la formation "+str(diction['title'])+" Vous avez atteint le nombre maximum de formation autorisé (" + str(
|
||||
part_pack_nb_training_auto) + "" \
|
||||
"). La formation '" + str(
|
||||
diction['external_code']) + "' n'a pas été enregistrée"
|
||||
|
||||
status, class_internal_url = mycommon.CreateInternalUrl(diction['title'])
|
||||
|
||||
mydata['internal_url'] = class_internal_url
|
||||
|
@ -1704,7 +1720,7 @@ def get_class(diction):
|
|||
retval = mycommon.check_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint( str(inspect.stack()[0][3])+" - Le token n'est pas valide")
|
||||
mycommon.myprint( str(inspect.stack()[0][3])+" - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -1718,8 +1734,8 @@ def get_class(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_parnter_recid_from_token(my_token)
|
||||
|
@ -2162,7 +2178,7 @@ def get_partner_class(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint( str(inspect.stack()[0][3])+" - Le token n'est pas valide")
|
||||
mycommon.myprint( str(inspect.stack()[0][3])+" - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -2323,7 +2339,7 @@ def find_partner_class_like(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -2486,7 +2502,7 @@ def get_partner_class_external_code(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -2676,27 +2692,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
str(inspect.stack()[0][3]) + " - Impossible de recuperer le token du partenaire")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
||||
part_status, part_pack, part_pack_nb_training_auto = mycommon.Partner_Get_pack_nbTraining(user_recid)
|
||||
if (part_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - Impossible de recuperer le pack et le nombre de formations du partenaire")
|
||||
return False, "Votre pack / abonnement ne permet pas de créer les formations. Verifiez votre abonnement "
|
||||
|
||||
"""
|
||||
Recuperation du nombre de formations actif de ce partner
|
||||
"""
|
||||
part_status2, part_nb_active_training = mycommon.Get_partner_nb_active_training(user_recid)
|
||||
if (part_status2 is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - Impossible de recuperer le pack et le nombre de formations du partenaire")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
||||
new_nb_active = mycommon.tryInt(part_nb_active_training) + total_rows
|
||||
if ( new_nb_active > mycommon.tryInt(part_pack_nb_training_auto) ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - Vous avez atteint le nombre maximum de formation autorisé")
|
||||
return False, " Vous avez atteint le nombre maximum de formation autorisé (" + str(
|
||||
new_nb_active) + "). "
|
||||
|
||||
|
||||
x = range(0, total_rows)
|
||||
ignored_line = ""
|
||||
|
@ -2754,7 +2750,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
"""
|
||||
Verifier que le domaine est bien dans la liste acceptée
|
||||
"""
|
||||
count_domaine = MYSY_GV.dbname['liste_domaine_metier'].count_documents({'domaine': str(mydata['domaine']), 'valide': '1', 'locked':'0'})
|
||||
count_domaine = MYSY_GV.dbname['liste_domaine_metier'].count_documents({'domaine': str(mydata['domaine']).lower(), 'valide': '1', 'locked':'0'})
|
||||
if (count_domaine <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
|
@ -2828,14 +2824,13 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
Verifier que le metier est bien dans la liste acceptée
|
||||
"""
|
||||
count_domaine = MYSY_GV.dbname['liste_domaine_metier'].count_documents(
|
||||
{'metier': str(metier), 'valide': '1', 'locked': '0'})
|
||||
{'metier': str(metier).lower(), 'valide': '1', 'locked': '0'})
|
||||
if (count_domaine <= 0):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][ 3]) + " - Le metier '" + str(metier) + "' pour la formation à la ligne " + str(n + 2) + " n'est pas autorisé. Verifier la liste des domaines autorisés")
|
||||
return False, " - Le metier '" + str(metier) + "' pour la formation à la ligne " + str( n + 2) + " n'est pas autorisé. Verifier la liste des domaines autorisés"
|
||||
|
||||
|
||||
|
||||
mydata['metier'] = metier
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
,index,mots,occurence,moyenne,id_formation,source_field
|
||||
0,0,bdd,1,0.33,MYSY_Demo_001,keyword
|
||||
1,1,sql,1,0.33,MYSY_Demo_001,keyword
|
||||
2,2,relationnel,1,0.33,MYSY_Demo_001,keyword
|
||||
0,0,donne,1,0.33,MYSY_Demo_001,title
|
||||
1,1,base,1,0.33,MYSY_Demo_001,title
|
||||
2,2,gestion,1,0.33,MYSY_Demo_001,title
|
||||
|
|
|
|
@ -74,7 +74,7 @@ def get_invoice_by_customer(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les factures"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -190,7 +190,7 @@ def add_payement_mode(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "Impossible d'ajouter le mode de payement"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -392,7 +392,7 @@ def get_payement_mode(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les mode de payement"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -509,7 +509,7 @@ def createOrder(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de créer la facture", False
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -1198,7 +1198,7 @@ def GetCustomerInvoice(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
mots occurence moyenne id_formation source_field
|
||||
0 bdd 1 0.33 MYSY_Demo_001 keyword
|
||||
1 sql 1 0.33 MYSY_Demo_001 keyword
|
||||
2 relationnel 1 0.33 MYSY_Demo_001 keyword
|
||||
mots occurence moyenne id_formation source_field
|
||||
0 donne 1 0.33 MYSY_Demo_001 title
|
||||
1 base 1 0.33 MYSY_Demo_001 title
|
||||
2 gestion 1 0.33 MYSY_Demo_001 title
|
|
@ -88,7 +88,7 @@ def get_user_objectif(diction):
|
|||
retval = mycommon.check_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les objectifs de l'utilisateur"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -1183,8 +1183,8 @@ def change_uer_email(diction):
|
|||
retval = mycommon.check_token_validity("", token_value)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint("Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint("La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
|
||||
# Recuperation du recid du user
|
||||
|
@ -1277,8 +1277,8 @@ def send_mail_delete_user(diction):
|
|||
|
||||
if retval is False:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Le token n'est pas valide ")
|
||||
return False, "Le token n'est pas valide"
|
||||
str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide ")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid du user
|
||||
user_recid = mycommon.get_user_recid_from_token(token_value)
|
||||
|
@ -1653,8 +1653,8 @@ def get_user_recherche_history(diction):
|
|||
retval = mycommon.check_token_validity("", token_value)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid du user
|
||||
user_recid = mycommon.get_user_recid_from_token(token_value)
|
||||
|
@ -1759,7 +1759,7 @@ def InitUserPasswd(diction):
|
|||
if( mysecrete == ""):
|
||||
coll_name = MYSY_GV.dbname['user_account']
|
||||
|
||||
#print(" myquery ="+str(myquery))
|
||||
print(" myquery ="+str(myquery))
|
||||
|
||||
tmp = coll_name.count_documents(myquery)
|
||||
if (tmp <= 0):
|
||||
|
@ -1822,7 +1822,7 @@ def InitUserPasswd(diction):
|
|||
|
||||
coll_name = MYSY_GV.dbname['partnair_account']
|
||||
|
||||
# print(" myquery ="+str(myquery))
|
||||
print(" #### myquery partenaire ="+str(myquery))
|
||||
|
||||
tmp = coll_name.count_documents(myquery)
|
||||
if (tmp <= 0):
|
||||
|
@ -1869,11 +1869,6 @@ def InitUserPasswd(diction):
|
|||
return True, "La demande de reinitiation à été prise en compte"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
except Exception as e:
|
||||
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))
|
||||
|
@ -1930,7 +1925,7 @@ def IsUserTokenValide(diction):
|
|||
tmp = coll_name_token.count_documents(myquery)
|
||||
if (tmp <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Aucun resultat trouvé pour " + str(myquery))
|
||||
return False, "Le token n'est pas valide"
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
elif( myaccounttype == "2"):
|
||||
# Il s'agit d'un compte pro (partenaire)
|
||||
|
@ -1942,7 +1937,7 @@ def IsUserTokenValide(diction):
|
|||
tmp = coll_name_token.count_documents(myquery)
|
||||
if (tmp <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Aucun resultat trouvé pour " + str(myquery))
|
||||
return False, "Le token n'est pas valide"
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
|
||||
return True, "Le token est valdie"
|
||||
|
|
43
email_mgt.py
43
email_mgt.py
|
@ -2017,7 +2017,7 @@ def ManualSendInvoiceEmailRIB(diction):
|
|||
|
||||
|
||||
"""
|
||||
Creation manuelle d'une facture avec RIB pour Port Cities
|
||||
Creation manuelle d'une facture avec RIB pour Port Cities - perso
|
||||
"""
|
||||
def ManualSendInvoiceEmailRIB_PortCities(diction):
|
||||
try:
|
||||
|
@ -2043,34 +2043,29 @@ def ManualSendInvoiceEmailRIB_PortCities(diction):
|
|||
# JINJA2
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/MySy_Invoice_RIB_PortCities_tpl.html"
|
||||
TEMPLATE_FILE = "Template/MySy_Invoice_RIB_PortCities_Perso_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
body = {
|
||||
"params": {"order_id": "ST-230405001",
|
||||
"date_order": ": 11/04/2023",
|
||||
"total_ht": "13 750",
|
||||
"tva": "2 750",
|
||||
"total_ttc": "16 500",
|
||||
"client_name": "Freelance Informatique",
|
||||
"client_address": "34 rue Laffitte",
|
||||
"client_zip_ville": "75009 Paris",
|
||||
"params": {"order_id": "0010G",
|
||||
"date_order": ": 01/06/2023",
|
||||
"total_ht": "14 400",
|
||||
"tva": "2 880",
|
||||
"total_ttc": "17 280",
|
||||
"client_name": "Port Cities France SAS",
|
||||
"client_address": "180 Av. du Prado",
|
||||
"client_zip_ville": "13008 Marseille",
|
||||
"client_pays": "France",
|
||||
"packs": "Chef de projet Odoo - Sur site",
|
||||
"packs": "Chef de projet Odoo ",
|
||||
"detail_packs": "Avignon - Siège CAPL ",
|
||||
"qty": "14 jrs",
|
||||
"unit_price": "750 €",
|
||||
"montant": "10 500 €",
|
||||
"qty": "18 jrs",
|
||||
"unit_price": "800 €",
|
||||
"montant": "14 400 €",
|
||||
|
||||
"packs2": "Chef de projet Odoo - A distance",
|
||||
"detail_packs2": "Roissy en brie - Siège MTT ",
|
||||
"qty2": "5 jrs",
|
||||
"unit_price2": "650 €",
|
||||
"montant2": "3 200 €",
|
||||
|
||||
"invoice_id": "FACT_230600031",
|
||||
"invoice_date": "01/06/2023",
|
||||
"due_date": "01/06/2023",
|
||||
"orign_order": "Contrat ST-230405001",
|
||||
"invoice_id": "FACT_230700032",
|
||||
"invoice_date": "01/07/2023",
|
||||
"due_date": "01/07/2023",
|
||||
"orign_order": "Contrat N°0010G",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2095,7 +2090,7 @@ def ManualSendInvoiceEmailRIB_PortCities(diction):
|
|||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
#TEMPLATE_FILE = "Template/MySy_Invoice_RIB_tpl.html"
|
||||
TEMPLATE_FILE = "Template/invoice_RIB_PortCities_tpl.html"
|
||||
TEMPLATE_FILE = "Template/invoice_RIB_PortCities_perso_tpl.html"
|
||||
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
|
|
|
@ -102,7 +102,7 @@ def Create_MySy_LMS_User(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de créer le compte LMS", False
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -464,7 +464,7 @@ def Update_Passwd_MySy_LMS_User(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de mettre à jour le compte LMS", False
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -945,7 +945,7 @@ def Update_Pack_MySy_LMS_User(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de mettre à jour le compte LMS", False
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -1155,7 +1155,7 @@ def Check_MySy_LMS_Account(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de créer le compte LMS"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
@ -1381,8 +1381,8 @@ def Get_Active_Ftions_Mysy_and_Lms(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, False, False, str(inspect.stack()[0][3]) + " - Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, False, False, str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(my_token)
|
||||
|
@ -1494,8 +1494,8 @@ def Add_User_To_LMS_Class(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, str(inspect.stack()[0][3]) + " - Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(my_token)
|
||||
|
@ -1647,8 +1647,8 @@ def Remove_User_From_LMS_Class(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, str(inspect.stack()[0][3]) + " - Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(my_token)
|
||||
|
@ -1771,7 +1771,7 @@ def Create_MySy_LMS_Apprenant(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de créer le compte LMS", False
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
|
4
main.py
4
main.py
|
@ -1053,7 +1053,7 @@ Pour le partenaire, en plud du mail, passwd, il faut fournir le token qui est "s
|
|||
def partner_login():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### payload = ",payload)
|
||||
print(" ### partner_login payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = pa.partner_login(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
@ -1145,7 +1145,7 @@ depuis le front office'''
|
|||
def InitUserPasswd():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### payload = ", payload)
|
||||
print(" ### InitUserPasswd payload = ", payload)
|
||||
status, result = eua.InitUserPasswd(payload)
|
||||
return jsonify(status=status, message=result)
|
||||
|
||||
|
|
124
partners.py
124
partners.py
|
@ -584,7 +584,7 @@ def update_partner_account(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False :
|
||||
return False, " Le token n'est pas valide"
|
||||
return False, " La session de connexion n'est pas valide"
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(str(my_token))
|
||||
|
@ -896,7 +896,7 @@ def get_partner_account(diction):
|
|||
retval = mycommon.check_partner_token_validity(email_value, token_value )
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les informations"
|
||||
|
||||
|
||||
|
@ -996,19 +996,99 @@ def partner_login(diction):
|
|||
mydata={}
|
||||
|
||||
# recuperation des paramettre
|
||||
email = ""
|
||||
if ("email" in diction.keys()):
|
||||
if diction['email']:
|
||||
email = diction['email']
|
||||
mydata['email'] = diction['email']
|
||||
|
||||
|
||||
pwd = ""
|
||||
if ("pwd" in diction.keys()):
|
||||
if diction['pwd']:
|
||||
pwd = diction['pwd']
|
||||
|
||||
# Verifier la taille des infos saisies. Pour le login et pass, la longeur max autorisée est 100 caractère
|
||||
if (len(str(email)) > 100 or len(str(pwd)) > 100):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Les informations de login et/ou mot de passe sont incorrectes")
|
||||
return False, " Les informations de login et/ou mot de passe sont incorrectes."
|
||||
|
||||
# Verifier la taille des infos saisies. Pour le login et pass, la longeur max autorisée est 100 caractère
|
||||
if (len(str(email)) <= 0 or len(str(pwd)) <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Les informations de login et/ou mot de passe sont incorrectes")
|
||||
return False, " Les informations de login et/ou mot de passe sont incorrectes."
|
||||
|
||||
|
||||
"""
|
||||
Verifier si le compte ne serait pas verrouillé
|
||||
"""
|
||||
|
||||
tmp_count_verrou = MYSY_GV.dbname['partnair_account'].count_documents({'email':email, 'pwd':pwd, 'locked':'1', 'active': '1'})
|
||||
if (tmp_count_verrou > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Ce compte " + str(email) + " est actuellement verrouillé")
|
||||
return False, " Ce compte " + str(email) + " est actuellement verrouillé."
|
||||
|
||||
# Verification si ce user existe (controle : login et passwd)
|
||||
tmp_count = MYSY_GV.dbname['partnair_account'].count_documents({'email':email, 'pwd':pwd, 'locked':'0', 'active': '1'})
|
||||
|
||||
if (tmp_count != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Login et/ou mot de passe invalide " + str( email) + " ")
|
||||
return False, " Login et/ou mot de passe invalide, merci de verifier votre saisie. "
|
||||
|
||||
|
||||
# Recuperation des données du partenaire qui se connecte
|
||||
my_partner = MYSY_GV.dbname['partnair_account'].find_one(
|
||||
{'email': email, 'pwd': pwd, 'locked': '0', 'active': '1'})
|
||||
|
||||
partner_recid = my_partner['recid']
|
||||
|
||||
# A ce niveau le login et passe sont ok.
|
||||
# il faut donc créer le token et renvoyer le token.
|
||||
my_token = mycommon.create_token_urlsafe()
|
||||
|
||||
# 1 - Vu le login et passe sont valident, alors on va aller desactier un eventuel token qui existerait
|
||||
local_now = str(datetime.now())
|
||||
local_result = MYSY_GV.dbname['partner_token'].update_many(
|
||||
{"recid": partner_recid, 'valide': '1'},
|
||||
{
|
||||
"$set": {"valide": '0', 'end_date': str(datetime.now()), 'date_update': str(datetime.now())}
|
||||
})
|
||||
|
||||
# Enregistrement du nouveau token
|
||||
tokenfield = {}
|
||||
tokenfield['email'] = email
|
||||
tokenfield['recid'] = partner_recid
|
||||
tokenfield['date_update'] = str(datetime.now())
|
||||
tokenfield['valide'] = '1'
|
||||
tokenfield['locked'] = '0'
|
||||
tokenfield['start_date'] = str(datetime.now())
|
||||
tokenfield['token'] = str(my_token)
|
||||
|
||||
'''
|
||||
Insertion du nouveau token
|
||||
'''
|
||||
ret_val = MYSY_GV.dbname['partner_token'].insert_one(tokenfield, )
|
||||
|
||||
if (not ret_val.inserted_id):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Impossible de finaliser la creation du token du partner")
|
||||
return False, "Impossible de se connecter, merci de contacter le support technique (1)"
|
||||
|
||||
|
||||
|
||||
now = str(datetime.now())
|
||||
|
||||
"""
|
||||
Mise à jour du compte du partenaie
|
||||
avec les info de last connexion et de token
|
||||
"""
|
||||
partner_update_data = {}
|
||||
partner_update_data['lastconnexion'] = str(datetime.now())
|
||||
partner_update_data['token'] = str(my_token)
|
||||
|
||||
|
||||
mydata['valide'] = "1"
|
||||
mydata['date_update'] = now
|
||||
|
||||
|
@ -1017,38 +1097,24 @@ def partner_login(diction):
|
|||
# Verification que les informations sont juste
|
||||
coll_name = MYSY_GV.dbname['partnair_account']
|
||||
ret_val = coll_name.find_one_and_update({'email': str(email), 'pwd': str(pwd), 'active': '1', 'locked':'0'},
|
||||
{"$set": {'lastconnexion':str(now)}},
|
||||
{"$set":partner_update_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
if ret_val and ret_val['_id']:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Connexion partnair "+email+" : OK, Date : "+ str(now)+" , _id = " + str(ret_val['_id']))
|
||||
# Vu que les credentials sont ok, alors enregistrement de la connexion dans la table "partner token"
|
||||
if ("_id" not in ret_val.keys()):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de recuperer les données de l'utilisateur (2)")
|
||||
return False, " Impossible de recuperer les données de l'utilisateur (2) "
|
||||
|
||||
#print(" GRRRRRRRRRRRRRRRRRRR "+str(ret_val))
|
||||
partner_key_secrete_key = str(ret_val['token'])
|
||||
mydata['recid'] = str(ret_val['recid'])
|
||||
mydata['token'] = str(ret_val['token'])
|
||||
token_collection = MYSY_GV.dbname['partner_token']
|
||||
return_data = {}
|
||||
return_data['token'] = str(my_token)
|
||||
|
||||
ret_val2 = token_collection.find_one_and_update({'recid': str(mydata['recid']), 'valide': '1', 'locked':'0'},
|
||||
{"$set": mydata},
|
||||
upsert=True,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
print(" ### token partner = ", str(my_token))
|
||||
|
||||
if ret_val2 and ret_val2['_id']:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Connexion partener_token : OK , _id = " + str(ret_val2['_id']))
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible d'enregistrer le token du partenaire dans partener_token ")
|
||||
return False, " Impossible de se connecter. Une erreur technique est survenue. Merci de contacter votre administrateur"
|
||||
RetObject = []
|
||||
RetObject.append(JSONEncoder().encode(return_data))
|
||||
|
||||
|
||||
return True, partner_key_secrete_key
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Les identifiants fournis (login et/ou mot de passe) sont incorrects")
|
||||
return False, " Les identifiants fournis (login et/ou mot de passe) sont incorrects"
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
|
@ -1115,8 +1181,8 @@ def UpgradetoPro(diction):
|
|||
retval = mycommon.check_token_validity("", token)
|
||||
|
||||
if retval is False :
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(token)
|
||||
|
|
|
@ -204,7 +204,7 @@ def check_token_validity(email="", token=""):
|
|||
print(" check_token_validity token == "+str(token))
|
||||
tmp_count = coll_token.count_documents({ 'token': str(token), 'valide': '1'})
|
||||
if (tmp_count <= 0):
|
||||
myprint( str(inspect.stack()[0][3]) +" Le token n'est pas valide")
|
||||
myprint( str(inspect.stack()[0][3]) +" La session de connexion n'est pas valide")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
@ -256,14 +256,14 @@ donc la table partner_token
|
|||
def check_partner_token_validity(email="", token=""):
|
||||
try :
|
||||
|
||||
#print(" check_partner_token_validity : Token = "+token)
|
||||
print(" check_partner_token_validity : Token = "+token)
|
||||
coll_token = MYSY_GV.dbname['partner_token']
|
||||
tmp_count = coll_token.count_documents({ 'token': str(token), 'locked':'0', 'valide': '1'})
|
||||
|
||||
#tmp_count = coll_token.find({ 'token': str(token), 'locked':'0', 'valide': '1'}).count()
|
||||
|
||||
if (tmp_count <= 0):
|
||||
myprint("Le token du partenaire n'est pas valide")
|
||||
myprint("La session de connexion n'est pas valide")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -1451,7 +1451,7 @@ def recordImage(file=None, Folder=None, diction=None):
|
|||
retval = check_user_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid de la personne
|
||||
|
@ -1578,7 +1578,7 @@ def recordClassImage(file=None, Folder=None, diction=None):
|
|||
retval = check_user_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
|
||||
|
@ -1693,7 +1693,7 @@ def getRecodedImage(diction=None):
|
|||
retval = check_user_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide ")
|
||||
myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide ")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
'''
|
||||
|
||||
|
@ -1791,7 +1791,7 @@ def getRecodedClassImage(diction=None):
|
|||
retval = check_user_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
|
||||
|
@ -1886,7 +1886,7 @@ def DeleteRecodedClassImage(diction=None):
|
|||
retval = check_user_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "Impossible de supprimer le logo de la formation"
|
||||
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ def get_product_service(diction):
|
|||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer les factures"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
|
|
@ -170,7 +170,7 @@ def GetStat_class_view(diction):
|
|||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
@ -356,7 +356,7 @@ def GetStat_class_view_topX(diction):
|
|||
retval = mycommon.check_partner_token_validity("", str(my_token))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
@ -699,7 +699,7 @@ def GetStat_class_by_internal_url(diction):
|
|||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
|
|
@ -747,7 +747,7 @@ def stop_strip_subscription(diction):
|
|||
retval = mycommon.check_partner_token_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "Les informations d'identification ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
@ -863,7 +863,7 @@ def strip_update_subscription_qty(diction):
|
|||
retval = mycommon.check_partner_token_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "Les informations d'identification ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
@ -1042,7 +1042,7 @@ def strip_update_subscription_plan(diction):
|
|||
retval = mycommon.check_partner_token_validity("", str(mytoken))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "Les informations d'identification ne sont pas valident"
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
|
|
|
@ -80,7 +80,7 @@ def add_user_message(diction):
|
|||
retval = mycommon.check_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "Impossible d'ajouter le message"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
|
|
14
wrapper.py
14
wrapper.py
|
@ -210,8 +210,8 @@ def get_all_class(diction):
|
|||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_parnter_recid_from_token(token)
|
||||
|
@ -558,8 +558,8 @@ def recherche_text_simple(diction):
|
|||
retval = mycommon.check_token_validity("", token)
|
||||
|
||||
if retval is False :
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(token)
|
||||
|
@ -572,8 +572,8 @@ def recherche_text_simple(diction):
|
|||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, "Le token n'est pas valide"
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La session de connexion n'est pas valide")
|
||||
return False, "La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_parnter_recid_from_token(token)
|
||||
|
@ -1437,7 +1437,7 @@ def get_stored_recherche(diction):
|
|||
retval = mycommon.check_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - La session de connexion n'est pas valide")
|
||||
return False, " Impossible de recuperer l'historique de recherche"
|
||||
|
||||
# Recuperation du recid du user
|
||||
|
|
Loading…
Reference in New Issue