11/02/2025 - 21h

master
cherif 2025-02-11 20:41:50 +01:00
parent 0fb4ab69f1
commit a1270ba76d
4 changed files with 967 additions and 14 deletions

View File

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="10/02/205 - 21h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="11/02/2025 - 15h30">
<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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -77,13 +76,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00388" summary="01/09/2024 - 20:00">
<created>1725213634326</created>
<option name="number" value="00388" />
<option name="presentableId" value="LOCAL-00388" />
<option name="project" value="LOCAL" />
<updated>1725213634327</updated>
</task>
<task id="LOCAL-00389" summary="03/09/2024 - 20:00">
<created>1725389636274</created>
<option name="number" value="00389" />
@ -420,7 +412,14 @@
<option name="project" value="LOCAL" />
<updated>1739217938934</updated>
</task>
<option name="localTasksCounter" value="437" />
<task id="LOCAL-00437" summary="11/02/2025 - 15h30">
<created>1739284937310</created>
<option name="number" value="00437" />
<option name="presentableId" value="LOCAL-00437" />
<option name="project" value="LOCAL" />
<updated>1739284937312</updated>
</task>
<option name="localTasksCounter" value="438" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -462,7 +461,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="29/10/2024 - 18h30" />
<MESSAGE value="qsd" />
<MESSAGE value="22/11/2024 - 18h" />
<MESSAGE value="27/11/2024 : 12h30" />
@ -487,6 +485,7 @@
<MESSAGE value="06-02-2025 - new_design_2025" />
<MESSAGE value="08/02/205 - 22h30" />
<MESSAGE value="10/02/205 - 21h" />
<option name="LAST_COMMIT_MESSAGE" value="10/02/205 - 21h" />
<MESSAGE value="11/02/2025 - 15h30" />
<option name="LAST_COMMIT_MESSAGE" value="11/02/2025 - 15h30" />
</component>
</project>

File diff suppressed because one or more lines are too long

16
main.py
View File

@ -6493,6 +6493,22 @@ def Get_List_Partner_Document_with_filter():
return jsonify(status=status, message=retval)
"""
API qui permet de récupérer la liste des documents personnalisables d'un partenaire avec filtre en mode Super ADMIN
"""
@app.route('/myclass/api/Get_List_Partner_Document_with_filter_Admin/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Partner_Document_with_filter_Admin():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Partner_Document_with_filter_Admin payload = ",payload)
status, retval = partner_document_mgt.Get_List_Partner_Document_with_filter_Admin(payload)
return jsonify(status=status, message=retval)
"""
API d'impression pdf d'un commande / devis
"""

View File

@ -1087,7 +1087,7 @@ def Get_Given_Partner_Document(diction):
"""
Recuperation d'un modèle de dcument donnée en se basant sur on token, _id,
Recuperation d'un modèle de document donnée en se basant sur on token, _id,
par un super admin, donc pas de controle sur sur le partner_owner
"""
def Get_Given_Partner_Document_Super_Admin(diction):
@ -1513,6 +1513,110 @@ def Get_List_Partner_Document_with_filter(diction):
return False, " Impossible de récupérer la liste des modèles de document "
"""
Recherche d'un document avec filter pour en mode super Admin
"""
"""
Recherche de la liste des modèles de document avec des filter
"""
def Get_List_Partner_Document_with_filter_Admin(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'nom', 'ref_interne', ]
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 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']
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
filt_nom = {}
if ("nom" in diction.keys()):
filt_nom = {'nom': {'$regex': str(diction['nom']), "$options": "i"}}
filt_ref_interne = {}
if ("ref_interne" in diction.keys()):
filt_ref_interne = {
'ref_interne': {'$regex': str(diction['ref_interne']), "$options": "i"}}
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = str(my_partner['recid'])
data_cle['locked'] = "0"
data_cle['valide'] = "1"
find_qry = {'$and': [ filt_nom, filt_ref_interne, ]}
#print(" ### materiel find_qry = ", find_qry)
RetObject = []
val_tmp = 1
for retval in MYSY_GV.dbname['courrier_template'].find(find_qry).sort([("_id", pymongo.DESCENDING)]):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if( "duplicate" not in retval.keys()):
user['duplicate'] = "0"
"""
Recuprer le nom du client
"""
if ("partner_owner_recid" in user.keys() and user['partner_owner_recid'] == "default"):
user['partner_owner_nom'] = "default"
else:
partnair_account_data = MYSY_GV.dbname['partnair_account'].find_one(
{'recid': user['partner_owner_recid']}, {'nom': 1})
if (partnair_account_data and "nom" in partnair_account_data.keys()):
user['partner_owner_nom'] = partnair_account_data['nom']
if ("partner_owner_nom" not in user.keys()):
user['partner_owner_nom'] = "???"
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 modèles de document "
"""