parent
55ca9cefeb
commit
e05e0ae097
|
@ -4,10 +4,16 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="ss">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="ssss">
|
||||
<change afterPath="$PROJECT_DIR$/groupe_client_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/domaine_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/domaine_formation_mgt.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$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -450,7 +456,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="485" />
|
||||
<option name="localTasksCounter" value="486" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -492,7 +498,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="07/05/2025 - 20h" />
|
||||
<MESSAGE value="08/05/2025 - 14h" />
|
||||
<MESSAGE value="08/05/2025 - 19" />
|
||||
<MESSAGE value="13/05/2025 - 17h" />
|
||||
|
@ -517,6 +522,7 @@
|
|||
<MESSAGE value="qsd" />
|
||||
<MESSAGE value="qsdssdd" />
|
||||
<MESSAGE value="ss" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ss" />
|
||||
<MESSAGE value="ssss" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ssss" />
|
||||
</component>
|
||||
</project>
|
|
@ -6467,7 +6467,7 @@ def AcceptAttendeeInscription(diction):
|
|||
if( "date_fin" in local_session.keys() ):
|
||||
session_end_date = str(local_session['date_fin']).strip()[0:10]
|
||||
|
||||
""""
|
||||
"""
|
||||
Inscription sur le LMS :
|
||||
Si la formation associée à la session possede un code de formation lms 'lms_class_code'
|
||||
|
||||
|
@ -6475,8 +6475,9 @@ def AcceptAttendeeInscription(diction):
|
|||
Donc l'inscription va generer :
|
||||
1 - La creation du compte LMS participant
|
||||
2 - L'inscription de l'utilisateur à la formation.
|
||||
3 - Envoie par email des accès a l'apprenant
|
||||
|
||||
"""
|
||||
"""
|
||||
return_message = " Inscription validée avec warning : "
|
||||
is_warning_message = 0
|
||||
|
||||
|
@ -6542,6 +6543,27 @@ def AcceptAttendeeInscription(diction):
|
|||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " TOP, l'inscription dans le LMS a ete correctement faite")
|
||||
|
||||
""" Vu que l'inscription est ok, on va envoyer les credentials à l'inscrit
|
||||
si et seulement local_session['lms_account_automatic'] == "1"
|
||||
"""
|
||||
if( local_session and "lms_account_automatic" in local_session.keys() and local_session['lms_account_automatic'] == "1"):
|
||||
local_node_send_credential = {}
|
||||
local_node_send_credential['token'] = diction['token']
|
||||
local_node_send_credential['class_internal_url'] = local_ret_val['class_internal_url']
|
||||
local_node_send_credential['session_id'] = local_ret_val['session_id']
|
||||
local_node_send_credential['email'] = local_ret_val['email']
|
||||
|
||||
print(" ### local_node_send_credential = ", local_node_send_credential)
|
||||
send_credential_status, send_credential_retval = SendInscriptionConfirmation(local_node_send_credential)
|
||||
if( send_credential_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - WARNING : Impossible d'envoyer les accès du compte LMS à l'utilisateur "+str(local_ret_val['email']))
|
||||
return_message = return_message + " -Impossible d'envoyer les accès du compte LMS à l'utilisateur "+str(local_ret_val['email'])+". \n"
|
||||
is_warning_message = 1
|
||||
|
||||
|
||||
|
||||
else:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - WARNING : Impossible de mettre à jour le compte LMS ")
|
||||
|
@ -6887,6 +6909,32 @@ def AcceptAttendeeInscription(diction):
|
|||
upsert=False,
|
||||
)
|
||||
|
||||
|
||||
"""
|
||||
Creation des acces à l'ENT si et seulement si Si l'ent_account_automatic =='1'
|
||||
&& si l'apprenant n'a pas deja de compte
|
||||
"""
|
||||
if (local_session and "ent_account_automatic" in local_session.keys() and local_session[ 'ent_account_automatic'] == "1"):
|
||||
data_key = {}
|
||||
data_key['type'] = 'student'
|
||||
data_key['apprenant_id'] = str(local_apprenant_id)
|
||||
data_key['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
is_user_ent_acces = MYSY_GV.dbname['user_account'].count_documents(data_key)
|
||||
|
||||
if( is_user_ent_acces <= 0 ):
|
||||
local_diction_create_ent_acces = {}
|
||||
local_diction_create_ent_acces['token'] = diction['token']
|
||||
local_diction_create_ent_acces['tab_apprenant_ids'] = str(local_apprenant_id)
|
||||
|
||||
create_ent_acces_status, create_ent_acces_retval = apprenant_mgt.ENT_Create_Apprenant_Account(local_diction_create_ent_acces)
|
||||
if( create_ent_acces_status is False ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " - WARNING : Impossible de créer le compte d'accès à l'espace ENT pour " + str( ret_val2['email']))
|
||||
return_message = return_message + str(
|
||||
" - WARNING : Impossible de créer le compte d'accès à l'espace ENT pour " + str( ret_val2['email']) + " \n")
|
||||
is_warning_message = 1
|
||||
|
||||
"""
|
||||
12/10/2024 - loguer les action dans l'historique général
|
||||
|
||||
|
@ -7994,7 +8042,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
# Recuperation des informations de la session
|
||||
local_qry = {'_id':ObjectId(retVal['session_id']), 'valide':'1'}
|
||||
|
||||
print(" #### local_qry zzz = ", local_qry)
|
||||
#print(" #### local_qry zzz = ", local_qry)
|
||||
|
||||
count_session = MYSY_GV.dbname['session_formation'].count_documents(local_qry)
|
||||
|
||||
|
|
8183
Log/log_file.log
8183
Log/log_file.log
File diff suppressed because it is too large
Load Diff
39
class_mgt.py
39
class_mgt.py
|
@ -60,7 +60,8 @@ def add_class(diction):
|
|||
'support', 'img_banner_detail_class', 'source', 'lms_class_code', 'formateur_id',
|
||||
'class_level', 'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'class_id',
|
||||
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite', 'recyclage_alert',
|
||||
'contenu_attestation', 'note_finale_calculation_rule_id', 'referentiel_padagogique_id']
|
||||
'contenu_attestation', 'note_finale_calculation_rule_id', 'referentiel_padagogique_id',
|
||||
'published_catalog_prive']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -462,13 +463,22 @@ def add_class(diction):
|
|||
mydata['img_banner_detail_class'] = diction['img_banner_detail_class']
|
||||
|
||||
|
||||
if ("published" in diction.keys()):
|
||||
if diction['published']:
|
||||
mydata['published'] = diction['published']
|
||||
if ("published" in diction.keys() and diction['published']):
|
||||
mydata['published'] = diction['published']
|
||||
else:
|
||||
mydata['published'] = "0"
|
||||
|
||||
if ("plus_produit" in diction.keys()):
|
||||
if diction['plus_produit']:
|
||||
mydata['plus_produit'] = diction['plus_produit']
|
||||
|
||||
if ("published_catalog_prive" in diction.keys() and diction['published']):
|
||||
mydata['published_catalog_prive'] = diction['published']
|
||||
else:
|
||||
mydata['published_catalog_prive'] = "0"
|
||||
|
||||
|
||||
if ("plus_produit" in diction.keys() and diction['plus_produit']):
|
||||
mydata['plus_produit'] = diction['plus_produit']
|
||||
else:
|
||||
mydata['plus_produit'] = ""
|
||||
|
||||
if ("contenu_attestation" in diction.keys()):
|
||||
if diction['contenu_attestation']:
|
||||
|
@ -491,9 +501,10 @@ def add_class(diction):
|
|||
|
||||
mydata['presentiel'] = {'presentiel': my_presentiel, 'distantiel': my_distantiel}
|
||||
|
||||
if ("price" in diction.keys()):
|
||||
if diction['price']:
|
||||
mydata['price'] = mycommon.tryFloat(str(diction['price']))
|
||||
if ("price" in diction.keys() and diction['price']):
|
||||
mydata['price'] = mycommon.tryFloat(str(diction['price']))
|
||||
else:
|
||||
mydata['price'] = "0"
|
||||
|
||||
if ("url" in diction.keys()):
|
||||
if diction['url']:
|
||||
|
@ -830,7 +841,7 @@ def update_class(diction):
|
|||
'duration_unit', 'source', 'lms_class_code', 'formateur_id', 'class_level','methode_pedagogique',
|
||||
'condition_handicape', 'suivi_eval', 'class_id', 'version', 'categorie', 'recyclage_delai',
|
||||
'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation',
|
||||
'note_finale_calculation_rule_id', 'referentiel_padagogique_id']
|
||||
'note_finale_calculation_rule_id', 'referentiel_padagogique_id', 'published_catalog_prive']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -992,6 +1003,8 @@ def update_class(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
source = ""
|
||||
if ("source" in diction.keys()):
|
||||
mydata['source'] = diction['source']
|
||||
|
@ -1150,6 +1163,10 @@ def update_class(diction):
|
|||
mydata['published'] = diction['published']
|
||||
|
||||
|
||||
if ("published_catalog_prive" in diction.keys()):
|
||||
mydata['published_catalog_prive'] = diction['published_catalog_prive']
|
||||
|
||||
|
||||
if ("institut_formation" in diction.keys()):
|
||||
mydata['institut_formation'] = diction['institut_formation']
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ def Add_Class_Domaine(diction):
|
|||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
@ -233,7 +233,7 @@ def Update_Class_domaine(diction):
|
|||
|
||||
|
||||
"""
|
||||
Suppression d'un domainede formation
|
||||
Suppression d'un domaine de formation
|
||||
regles :
|
||||
Si la condition (_id) n'est pas utiliser dans les collection
|
||||
- myclasss
|
||||
|
@ -288,8 +288,8 @@ def Delete_Class_domaine(diction):
|
|||
|
||||
if (is_existe_class_domaine < 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de le domaine de formation n'est pas valide ")
|
||||
return False, " L'identifiant de le domaine de formation n'est pas valide "
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du domaine de formation n'est pas valide ")
|
||||
return False, " L'identifiant du domaine de formation n'est pas valide "
|
||||
|
||||
|
||||
"""
|
||||
|
@ -302,8 +302,8 @@ def Delete_Class_domaine(diction):
|
|||
|
||||
if( is_domaine_in_myclass > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Cette catégorie de formation est utilisée dans "+str(is_domaine_in_myclass)+" formations ")
|
||||
return False, " Cette catégorie de formation est utilisée dans "+str(is_domaine_in_myclass)+" formations "
|
||||
str(inspect.stack()[0][3]) + " Ce domaine de formation est utilisé dans "+str(is_domaine_in_myclass)+" formation(s) ")
|
||||
return False, " Ce domaine de formation est utilisé dans "+str(is_domaine_in_myclass)+" formation(s) "
|
||||
|
||||
|
||||
|
||||
|
@ -314,7 +314,7 @@ def Delete_Class_domaine(diction):
|
|||
|
||||
|
||||
|
||||
return True, " le domaine de formation a été correctement supprimée"
|
||||
return True, " Le domaine de formation a été correctement supprimé"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -460,6 +460,6 @@ def Get_Given_Class_domaine(diction):
|
|||
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 de récupérer les données de la domaine de formation "
|
||||
return False, " Impossible de récupérer les données du domaine de formation "
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,454 @@
|
|||
"""
|
||||
Gestion des groupes clients
|
||||
"""
|
||||
|
||||
import bson
|
||||
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
|
||||
import jinja2
|
||||
from flask import send_file
|
||||
from xhtml2pdf import pisa
|
||||
from email.message import EmailMessage
|
||||
from email.mime.text import MIMEText
|
||||
from email import encoders
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
|
||||
"""
|
||||
Ajout d'un groupe de client
|
||||
"""
|
||||
|
||||
def Add_Groupe_Client(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'description',]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.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 = ['token', 'code',]
|
||||
|
||||
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 la liste des arguments ")
|
||||
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']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
# Verifier que ce code n'existe pas déjà
|
||||
is_existe_class_domaine = MYSY_GV.dbname['partner_groupe_client'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_existe_class_domaine > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Un groupe de client avec le code '" + str(diction['code']) + "' existe déjà ")
|
||||
return False, " Un groupe de client avec le code '" + str(diction['code']) + "' existe déjà "
|
||||
|
||||
|
||||
|
||||
new_data = diction
|
||||
del diction['token']
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['partner_groupe_client'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer le groupe de clients (2) ")
|
||||
return False, " Impossible de créer le groupe de clients (2) "
|
||||
|
||||
|
||||
return True, " La domaine a été correctement ajoutée"
|
||||
|
||||
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 de créer le groupe de clients "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'un groupe de clients
|
||||
"""
|
||||
|
||||
def Update_Groupe_Client(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'code', 'description',]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.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 = ['token', '_id',]
|
||||
|
||||
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 la liste des arguments ")
|
||||
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']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
new_data = diction
|
||||
|
||||
# Verifier que la domaine
|
||||
is_existe_cdtion_paiement = MYSY_GV.dbname['partner_groupe_client'].count_documents(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_existe_cdtion_paiement < 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du groupe de clients est invalide ")
|
||||
return False, " L'identifiant du groupe de clients est invalide "
|
||||
|
||||
|
||||
# Verifier que code n'est pas pris par un autre domaine
|
||||
is_existe_class_domaine = MYSY_GV.dbname['partner_groupe_client'].count_documents({'code': str(diction['code']),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"_id": {"$ne": ObjectId(
|
||||
str(diction['_id']))}
|
||||
})
|
||||
|
||||
if (is_existe_class_domaine > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Un groupe de clients avec le code '" + str(diction['code']) + "' existe déjà ")
|
||||
return False, " Un groupe de clients avec le code '" + str(diction['code']) + "' existe déjà "
|
||||
|
||||
|
||||
local_id = str(diction['_id'])
|
||||
|
||||
del diction['token']
|
||||
del diction['_id']
|
||||
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = ObjectId(local_id)
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
result = MYSY_GV.dbname['partner_groupe_client'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
if ("_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour le groupe de clients (2) ")
|
||||
return False, " Impossible de mettre à jour le groupe de clients (2) "
|
||||
|
||||
return True, " Le groupe de clients 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 de mettre à jour le groupe de clients "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'un groupe de clients
|
||||
regles :
|
||||
Si la condition (_id) n'est pas utiliser dans les collection
|
||||
- partner_client
|
||||
"""
|
||||
|
||||
def Delete_Groupe_Client(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id',]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.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 = ['token', '_id',]
|
||||
|
||||
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 la liste des arguments ")
|
||||
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']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
is_existe_class_domaine = MYSY_GV.dbname['partner_groupe_client'].count_documents(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_existe_class_domaine < 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du groupe de client n'est pas valide ")
|
||||
return False, "L'identifiant du groupe de client n'est pas valide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que le groupe de clients n'est pas utilisé (collection : partner_client)
|
||||
"""
|
||||
is_domaine_in_myclass = MYSY_GV.dbname['partner_client'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'partner_groupe_client_id':str(diction['_id'])})
|
||||
|
||||
|
||||
if( is_domaine_in_myclass > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Ce groupe de clients est utilisé par "+str(is_domaine_in_myclass)+" client(s) ")
|
||||
return False, "Ce groupe de clients est utilisé par "+str(is_domaine_in_myclass)+" client(s) "
|
||||
|
||||
|
||||
|
||||
|
||||
delete = MYSY_GV.dbname['partner_groupe_client'].delete_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
||||
|
||||
return True, "Le groupe de client a été correctement supprimé"
|
||||
|
||||
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 de supprimer le groupe de clients "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des groupes de client d'un partenaire
|
||||
"""
|
||||
def Get_List_Groupe_Client(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
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', ]
|
||||
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 la liste des arguments ")
|
||||
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']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['partner_groupe_client'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
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 de récupérer la liste des groupes de clients "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données d'un groupe de clients
|
||||
"""
|
||||
def Get_Given_Groupe_Client(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
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', '_id' ]
|
||||
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 la liste des arguments ")
|
||||
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']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['_id'] = ObjectId(str(diction['_id']))
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['partner_groupe_client'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
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 de récupérer les données du groupe de client "
|
||||
|
72
main.py
72
main.py
|
@ -101,6 +101,7 @@ import jury_mgt as jury_mgt
|
|||
import financial_caracteristique_mgt as financial_caracteristique_mgt
|
||||
import reference_pedagogique_mgt as reference_pedagogique_mgt
|
||||
import ent_student_common as ent_student_common
|
||||
import groupe_client_mgt as groupe_client_mgt
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
@ -525,7 +526,7 @@ def get_partner_class_Without_Scope_Action():
|
|||
def update_class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### update_class payload = (trop long cherif) ")
|
||||
print(" ### update_class payload = (trop long cherif) " )
|
||||
status, retval, class_id = cm.update_class(payload)
|
||||
|
||||
|
||||
|
@ -13348,6 +13349,75 @@ def Create_Bar_Chart_And_Save():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API Pour créer un groupe de clients
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Groupe_Client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Groupe_Client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Groupe_Client payload = ",payload)
|
||||
status, retval = groupe_client_mgt.Add_Groupe_Client(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API Pour mettre à jour un groupe de clients
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Groupe_Client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Groupe_Client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Groupe_Client payload = ",payload)
|
||||
status, retval = groupe_client_mgt.Update_Groupe_Client(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API Pour supprimer un groupe de clients
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Groupe_Client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Groupe_Client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Groupe_Client payload = ",payload)
|
||||
status, retval = groupe_client_mgt.Delete_Groupe_Client(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API Pour la liste des groupes de client d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Groupe_Client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Groupe_Client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Groupe_Client payload = ",payload)
|
||||
status, retval = groupe_client_mgt.Get_List_Groupe_Client(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API Pour recuperer les données d'un groupe de client
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Groupe_Client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Groupe_Client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Groupe_Client payload = ",payload)
|
||||
status, retval = groupe_client_mgt.Get_Given_Groupe_Client(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
|
@ -49,7 +49,7 @@ def Add_Partner_Client(diction):
|
|||
'invoice_tva', 'invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', "client_type_id",
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'is_company', 'invoice_automatique',
|
||||
'type_financeur_id', 'type_pouvoir_public_id'
|
||||
'type_financeur_id', 'type_pouvoir_public_id', 'partner_groupe_client_id'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
@ -102,7 +102,7 @@ def Add_Partner_Client(diction):
|
|||
nom, ou la meme adresse email
|
||||
"""
|
||||
|
||||
qry = {'nom': str(diction['nom']), 'valide': '1', 'partner_recid': str(my_partner['recid'])}
|
||||
qry = {'nom': str(diction['nom']), 'valide': '1', 'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
tmp_count = MYSY_GV.dbname['partner_client'].count_documents(qry)
|
||||
if (tmp_count > 0):
|
||||
|
@ -112,7 +112,7 @@ def Add_Partner_Client(diction):
|
|||
return False, " - Vous avez déjà un client qui porte le même nom "
|
||||
|
||||
tmp_count = MYSY_GV.dbname['partner_client'].count_documents({'email': str(diction['email']),
|
||||
'valide': '1', 'partner_recid': my_partner['recid']})
|
||||
'valide': '1', 'partner_owner_recid': my_partner['recid']})
|
||||
if (tmp_count > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
|
@ -126,7 +126,7 @@ def Add_Partner_Client(diction):
|
|||
Recuperation des données fournies en entrée
|
||||
"""
|
||||
data = {}
|
||||
data['partner_recid'] = my_partner['recid']
|
||||
data['partner_owner_recid'] = my_partner['recid']
|
||||
|
||||
raison_sociale = ""
|
||||
if ("raison_sociale" in diction.keys()):
|
||||
|
@ -308,6 +308,22 @@ def Add_Partner_Client(diction):
|
|||
|
||||
data['type_pouvoir_public_id'] = type_pouvoir_public_id
|
||||
|
||||
partner_groupe_client_id = ""
|
||||
if ("partner_groupe_client_id" in diction.keys()):
|
||||
if (diction['partner_groupe_client_id']):
|
||||
partner_groupe_client_id = diction['partner_groupe_client_id']
|
||||
|
||||
is_valide_partner_groupe_client_id_count = MYSY_GV.dbname['partner_groupe_client'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_groupe_client_id'])),
|
||||
'vallide': '1', 'locked': '0'})
|
||||
|
||||
if (is_valide_partner_groupe_client_id_count != 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du groupe de client est invalide ")
|
||||
return False, " L'identifiant du groupe de client est invalide "
|
||||
|
||||
data['partner_groupe_client_id'] = partner_groupe_client_id
|
||||
|
||||
|
||||
|
||||
invoice_nom = ""
|
||||
|
@ -435,6 +451,7 @@ def Add_Partner_Prospect(diction):
|
|||
'invoice_tva', 'invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', "client_type_id",
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'is_company', 'invoice_automatique',
|
||||
'partner_groupe_client_id'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
@ -487,7 +504,7 @@ def Add_Partner_Prospect(diction):
|
|||
nom, ou la meme adresse email
|
||||
"""
|
||||
|
||||
qry = {'nom': str(diction['nom']), 'valide': '1', 'partner_recid': str(my_partner['recid'])}
|
||||
qry = {'nom': str(diction['nom']), 'valide': '1', 'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
tmp_count = MYSY_GV.dbname['partner_client'].count_documents(qry)
|
||||
if (tmp_count > 0):
|
||||
|
@ -497,7 +514,7 @@ def Add_Partner_Prospect(diction):
|
|||
return False, " Vous avez déjà un client qui porte le même nom "
|
||||
|
||||
tmp_count = MYSY_GV.dbname['partner_client'].count_documents({'email': str(diction['email']),
|
||||
'valide': '1', 'partner_recid': my_partner['recid']})
|
||||
'valide': '1', 'partner_owner_recid': my_partner['recid']})
|
||||
if (tmp_count > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
|
@ -511,7 +528,7 @@ def Add_Partner_Prospect(diction):
|
|||
Recuperation des données fournies en entrée
|
||||
"""
|
||||
data = {}
|
||||
data['partner_recid'] = my_partner['recid']
|
||||
data['partner_owner_recid'] = my_partner['recid']
|
||||
data['partner_owner_recid'] = my_partner['recid']
|
||||
data['is_prospect'] = "1"
|
||||
|
||||
|
@ -551,6 +568,22 @@ def Add_Partner_Prospect(diction):
|
|||
invoice_automatique = diction['invoice_automatique']
|
||||
data['invoice_automatique'] = invoice_automatique
|
||||
|
||||
partner_groupe_client_id = ""
|
||||
if ("partner_groupe_client_id" in diction.keys()):
|
||||
if (diction['partner_groupe_client_id']):
|
||||
partner_groupe_client_id = diction['partner_groupe_client_id']
|
||||
|
||||
is_valide_partner_groupe_client_id_count = MYSY_GV.dbname['partner_groupe_client'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_groupe_client_id'])),
|
||||
'vallide': '1', 'locked': '0'})
|
||||
|
||||
if (is_valide_partner_groupe_client_id_count != 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du groupe de client est invalide ")
|
||||
return False, " L'identifiant du groupe de client est invalide "
|
||||
|
||||
data['partner_groupe_client_id'] = partner_groupe_client_id
|
||||
|
||||
|
||||
is_fournisseur = ""
|
||||
if ("is_fournisseur" in diction.keys() and diction['is_fournisseur']):
|
||||
|
@ -822,7 +855,7 @@ def Update_Partner_Client_Contact(diction):
|
|||
adresse = ""
|
||||
if ("adresse" in diction.keys()):
|
||||
adresse = diction['adresse']
|
||||
data_update['partner_recid'] = my_partner['recid']
|
||||
data_update['partner_owner_recid'] = my_partner['recid']
|
||||
data_update["address.$[elem].adresse"] = adresse
|
||||
|
||||
ville = ""
|
||||
|
@ -865,7 +898,7 @@ def Update_Partner_Client_Contact(diction):
|
|||
"""
|
||||
|
||||
result = MYSY_GV.dbname['partner_client'].update_one(
|
||||
{'partner_recid':str(partner_recid)},
|
||||
{'partner_owner_recid':str(partner_recid)},
|
||||
{ "$set": data_update},
|
||||
upsert=True,
|
||||
array_filters=[{"elem.recid": str(partner_client_contact_recid) }],
|
||||
|
@ -906,7 +939,7 @@ def Update_Partner_Client(diction):
|
|||
'invoice_tva','invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', 'client_type_id',
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'is_company', 'invoice_automatique',
|
||||
'type_financeur_id', 'type_pouvoir_public_id']
|
||||
'type_financeur_id', 'type_pouvoir_public_id', 'partner_groupe_client_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -946,7 +979,7 @@ def Update_Partner_Client(diction):
|
|||
"""
|
||||
|
||||
qry_update = {"_id":ObjectId(str(diction['_id'])), 'valide':'1', 'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])}
|
||||
'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
|
||||
|
||||
|
@ -1074,6 +1107,21 @@ def Update_Partner_Client(diction):
|
|||
|
||||
data_update['type_pouvoir_public_id'] = type_pouvoir_public_id
|
||||
|
||||
partner_groupe_client_id = ""
|
||||
if ("partner_groupe_client_id" in diction.keys()):
|
||||
if (diction['partner_groupe_client_id']):
|
||||
partner_groupe_client_id = diction['partner_groupe_client_id']
|
||||
|
||||
is_valide_partner_groupe_client_id_count = MYSY_GV.dbname['partner_groupe_client'].count_documents(
|
||||
{'_id': ObjectId(str(diction['partner_groupe_client_id'])),
|
||||
'vallide': '1', 'locked': '0'})
|
||||
|
||||
if (is_valide_partner_groupe_client_id_count != 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du groupe de client est invalide ")
|
||||
return False, " L'identifiant du groupe de client est invalide "
|
||||
|
||||
data_update['partner_groupe_client_id'] = partner_groupe_client_id
|
||||
|
||||
|
||||
adr_adresse = ""
|
||||
|
@ -1218,7 +1266,7 @@ def Update_Partner_Client(diction):
|
|||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = ObjectId(str(diction['_id']))
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
@ -1300,7 +1348,7 @@ def Get_Partner_List_Partner_Client(diction):
|
|||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
@ -1321,6 +1369,20 @@ def Get_Partner_List_Partner_Client(diction):
|
|||
if ("intranet_account_id" not in retval.keys()):
|
||||
user['intranet_account_id'] = ""
|
||||
|
||||
partner_groupe_client_code = ""
|
||||
if ("partner_groupe_client_id" not in user.keys()):
|
||||
user['partner_groupe_client_id'] = ""
|
||||
|
||||
elif (user['partner_groupe_client_id']):
|
||||
partner_groupe_client_data = MYSY_GV.dbname['partner_groupe_client'].find_one({"_id":ObjectId(str(user['partner_groupe_client_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
if( partner_groupe_client_data and "code" in partner_groupe_client_data.keys()):
|
||||
partner_groupe_client_code = partner_groupe_client_data['code']
|
||||
|
||||
user['partner_groupe_client_code'] = partner_groupe_client_code
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
@ -1416,7 +1478,7 @@ def Get_Partner_List_Partner_Client_with_filter_Like(diction):
|
|||
filt_class_partner_recid = {'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
qry = {'$and': [filt_raison_sociale, filt_email, filt_nom, filt_client_is_client,
|
||||
filt_client_is_financeur,filt_client_is_fournisseur, {'partner_recid': str(my_partner['recid'])}
|
||||
filt_client_is_financeur,filt_client_is_fournisseur, {'partner_owner_recid': str(my_partner['recid'])}
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -1447,6 +1509,21 @@ def Get_Partner_List_Partner_Client_with_filter_Like(diction):
|
|||
if ("intranet_account_id" not in New_retVal.keys()):
|
||||
user['intranet_account_id'] = ""
|
||||
|
||||
partner_groupe_client_code = ""
|
||||
if ("partner_groupe_client_id" not in user.keys()):
|
||||
user['partner_groupe_client_id'] = ""
|
||||
|
||||
elif (user['partner_groupe_client_id']):
|
||||
partner_groupe_client_data = MYSY_GV.dbname['partner_groupe_client'].find_one(
|
||||
{"_id": ObjectId(str(user['partner_groupe_client_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
if (partner_groupe_client_data and "code" in partner_groupe_client_data.keys()):
|
||||
partner_groupe_client_code = partner_groupe_client_data['code']
|
||||
|
||||
user['partner_groupe_client_code'] = partner_groupe_client_code
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -1514,7 +1591,7 @@ def Get_Given_Partner_Client(diction):
|
|||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['email'] = str(diction['email'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
@ -1565,6 +1642,21 @@ def Get_Given_Partner_Client(diction):
|
|||
if ("intranet_account_id" not in retval.keys()):
|
||||
user['intranet_account_id'] = ""
|
||||
|
||||
partner_groupe_client_code = ""
|
||||
if ("partner_groupe_client_id" not in user.keys()):
|
||||
user['partner_groupe_client_id'] = ""
|
||||
|
||||
elif (user['partner_groupe_client_id']):
|
||||
partner_groupe_client_data = MYSY_GV.dbname['partner_groupe_client'].find_one(
|
||||
{"_id": ObjectId(str(user['partner_groupe_client_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
if (partner_groupe_client_data and "code" in partner_groupe_client_data.keys()):
|
||||
partner_groupe_client_code = partner_groupe_client_data['code']
|
||||
|
||||
user['partner_groupe_client_code'] = partner_groupe_client_code
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
|
@ -1630,7 +1722,7 @@ def Get_Given_Partner_Client_From_Id(diction):
|
|||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = ObjectId(str(diction['_id']))
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
@ -1680,6 +1772,22 @@ def Get_Given_Partner_Client_From_Id(diction):
|
|||
if ("intranet_account_id" not in retval.keys()):
|
||||
user['intranet_account_id'] = ""
|
||||
|
||||
partner_groupe_client_code = ""
|
||||
if ("partner_groupe_client_id" not in user.keys()):
|
||||
user['partner_groupe_client_id'] = ""
|
||||
|
||||
elif (user['partner_groupe_client_id']):
|
||||
partner_groupe_client_data = MYSY_GV.dbname['partner_groupe_client'].find_one(
|
||||
{"_id": ObjectId(str(user['partner_groupe_client_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
if (partner_groupe_client_data and "code" in partner_groupe_client_data.keys()):
|
||||
partner_groupe_client_code = partner_groupe_client_data['code']
|
||||
|
||||
user['partner_groupe_client_code'] = partner_groupe_client_code
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
|
@ -1932,7 +2040,7 @@ def Delete_Given_Partner_Client(diction):
|
|||
|
||||
|
||||
# Verification de la validé du client
|
||||
is_existe_client_count = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(diction['_id'])), 'partner_recid':str(my_partner['recid'])})
|
||||
is_existe_client_count = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(diction['_id'])), 'partner_owner_recid':str(my_partner['recid'])})
|
||||
if( is_existe_client_count <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Le client n'est pas valide ")
|
||||
|
@ -1969,12 +2077,12 @@ def Delete_Given_Partner_Client(diction):
|
|||
MYSY_GV.dbname['contact'].delete_one(
|
||||
{'related_collection':'partner_client',
|
||||
'related_collection_recid':str(diction['_id']),
|
||||
'partner_recid': str(my_partner['recid'])}
|
||||
'partner_owner_recid': str(my_partner['recid'])}
|
||||
)
|
||||
|
||||
|
||||
# Supression à faire
|
||||
MYSY_GV.dbname['partner_client'].delete_one({'_id':ObjectId(str(diction['_id'])), 'partner_recid':str(my_partner['recid'])})
|
||||
MYSY_GV.dbname['partner_client'].delete_one({'_id':ObjectId(str(diction['_id'])), 'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
return True, "La suppression du client a été correctement faite."
|
||||
|
||||
|
@ -2331,7 +2439,7 @@ def Delete_Client_Type(diction):
|
|||
|
||||
# Verifier que ce type de client n'est utilisé par aucun client
|
||||
# Si non on refuse la suppression car cela peut entrainter une incohérence d'info
|
||||
type_client_used_count = MYSY_GV.dbname['partner_client'].count_documents({'partner_recid':str(my_partner['recid']),
|
||||
type_client_used_count = MYSY_GV.dbname['partner_client'].count_documents({'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'client_type_id':str(diction['_id'])})
|
||||
|
||||
|
@ -2411,7 +2519,7 @@ def Get_Partner_Client_Communication_Contact(diction):
|
|||
is_client_exist_valide = MYSY_GV.dbname['partner_client'].count_documents({"_id":ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_client_exist_valide <= 0 ):
|
||||
mycommon.myprint(
|
||||
|
@ -2423,7 +2531,7 @@ def Get_Partner_Client_Communication_Contact(diction):
|
|||
new_diction = {}
|
||||
new_diction['related_collection'] = "partner_client"
|
||||
new_diction['related_collection_recid'] = diction['_id']
|
||||
new_diction['partner_recid'] = my_partner['recid']
|
||||
new_diction['partner_owner_recid'] = my_partner['recid']
|
||||
new_diction['valide'] = "1"
|
||||
new_diction['locked'] = "0"
|
||||
new_diction['include_com'] = "1"
|
||||
|
@ -2485,7 +2593,7 @@ def Get_Partner_Client_Communication_Contact_NO_TOKEN(diction):
|
|||
is_client_exist_valide = MYSY_GV.dbname['partner_client'].count_documents({"_id":ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(diction['partner_owner_recid'])})
|
||||
'partner_owner_recid':str(diction['partner_owner_recid'])})
|
||||
|
||||
if( is_client_exist_valide <= 0 ):
|
||||
mycommon.myprint(
|
||||
|
@ -2497,7 +2605,7 @@ def Get_Partner_Client_Communication_Contact_NO_TOKEN(diction):
|
|||
new_diction = {}
|
||||
new_diction['related_collection'] = "partner_client"
|
||||
new_diction['related_collection_recid'] = diction['_id']
|
||||
new_diction['partner_recid'] = str(diction['partner_owner_recid'])
|
||||
new_diction['partner_owner_recid'] = str(diction['partner_owner_recid'])
|
||||
new_diction['valide'] = "1"
|
||||
new_diction['locked'] = "0"
|
||||
new_diction['include_com'] = "1"
|
||||
|
@ -2586,7 +2694,7 @@ def Create_Partner_Client_Intranet_Account(diction):
|
|||
"""
|
||||
is_valide_client_partner = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(diction['partner_client_id'])),
|
||||
'valide':'1', 'locked':'0',
|
||||
'partner_recid':my_partner['recid']})
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
|
||||
if( is_valide_client_partner != 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -2596,7 +2704,7 @@ def Create_Partner_Client_Intranet_Account(diction):
|
|||
is_valide_client_partner_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_recid': my_partner['recid']})
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
client_email = is_valide_client_partner_data['email']
|
||||
client_id = str(is_valide_client_partner_data['_id'])
|
||||
|
@ -2852,7 +2960,7 @@ def Update_Pwd_Partner_Client_Intranet_Account(diction):
|
|||
"""
|
||||
is_valide_client_partner = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(diction['partner_client_id'])),
|
||||
'valide':'1', 'locked':'0',
|
||||
'partner_recid':my_partner['recid']})
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
|
||||
if( is_valide_client_partner != 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -2862,7 +2970,7 @@ def Update_Pwd_Partner_Client_Intranet_Account(diction):
|
|||
is_valide_client_partner_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_recid': my_partner['recid']})
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
|
||||
"""
|
||||
|
@ -2961,7 +3069,7 @@ def Disable_Partner_Client_Intranet_Account(diction):
|
|||
"""
|
||||
is_valide_client_partner = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(diction['partner_client_id'])),
|
||||
'valide':'1', 'locked':'0',
|
||||
'partner_recid':my_partner['recid']})
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
|
||||
if( is_valide_client_partner != 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -2971,7 +3079,7 @@ def Disable_Partner_Client_Intranet_Account(diction):
|
|||
is_valide_client_partner_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_recid': my_partner['recid']})
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
|
||||
"""
|
||||
|
@ -3065,7 +3173,7 @@ def Enable_Partner_Client_Intranet_Account(diction):
|
|||
"""
|
||||
is_valide_client_partner = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(diction['partner_client_id'])),
|
||||
'valide':'1', 'locked':'0',
|
||||
'partner_recid':my_partner['recid']})
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
|
||||
if( is_valide_client_partner != 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -3075,7 +3183,7 @@ def Enable_Partner_Client_Intranet_Account(diction):
|
|||
is_valide_client_partner_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1', 'locked': '0',
|
||||
'partner_recid': my_partner['recid']})
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
|
||||
"""
|
||||
|
|
12
wrapper.py
12
wrapper.py
|
@ -343,6 +343,9 @@ def get_all_class(diction):
|
|||
"""
|
||||
A l'image de la fonction get_all_class, cette fonction
|
||||
retourne les formation avec un recid donnée
|
||||
|
||||
03/07/205 : Avec l'ajout du champs 'published_catalog_prive' dans la collection myclass
|
||||
on ne retourne que les formation dont published_catalog_prive != 0
|
||||
"""
|
||||
|
||||
|
||||
|
@ -495,7 +498,8 @@ def get_all_class_Given_partner_owner_recid_No_Login(diction):
|
|||
{'coeur': 1, 'published': '1'}]},
|
||||
{'external_code': {'$nin': alread_found}},
|
||||
{'display_rank': {'$nin': []}},
|
||||
{'partner_owner_recid':partner_owner_recid}
|
||||
{'partner_owner_recid':partner_owner_recid},
|
||||
{'published_catalog_prive': {'$ne': "0"}}
|
||||
]}
|
||||
},
|
||||
{'$project': {'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0,
|
||||
|
@ -1174,6 +1178,9 @@ def recherche_text_simple(diction):
|
|||
A l'image de la recherche_text_simple, cette fonction
|
||||
fait une recheche pour la catalogue public du partner
|
||||
|
||||
03/07/205 : Avec l'ajout du champs 'published_catalog_prive' dans la collection myclass
|
||||
on ne retourne que les formation dont published_catalog_prive != 0
|
||||
|
||||
DONC LA NOTION DE PUBLICATION (PUBLISH) NE DOIT PAS ETRE PRISE EN COMPTE
|
||||
|
||||
"""
|
||||
|
@ -1372,6 +1379,7 @@ def recherche_text_simple_for_partner_catalog(diction):
|
|||
nb_result = 0
|
||||
|
||||
for x in coll_name.find({"external_code": {"$in": final_message2}, },
|
||||
{'published_catalog_prive': {'$ne': "0"}},
|
||||
{"indexed": 0, "indexed_desc": 0, "indexed_obj": 0,
|
||||
"indexed_title": 0, "valide": 0, "locked": 0, }). \
|
||||
sort([("display_rank", pymongo.DESCENDING), ("price", pymongo.ASCENDING),
|
||||
|
@ -1460,7 +1468,7 @@ def recherche_text_simple_for_partner_catalog(diction):
|
|||
"""
|
||||
|
||||
pipe = [
|
||||
{'$match': {'external_code': {"$in": tab_training}, }},
|
||||
{'$match': {'external_code': {"$in": tab_training}, 'published_catalog_prive': {'$ne': "0"} }},
|
||||
{'$project': {'_id': 0, 'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0, "valide": 0,
|
||||
"locked": 0}},
|
||||
{'$lookup':
|
||||
|
|
Loading…
Reference in New Issue