24/07/23 - 17h

master
cherif 2023-07-24 17:54:20 +02:00
parent f3a5138efb
commit 1b3261802b
4 changed files with 2896 additions and 31 deletions

View File

@ -1,14 +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="22/07/2023 - 17h">
<change afterPath="$PROJECT_DIR$/Activite.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Contact.py" afterDir="false" />
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="23/07/2023 - 21h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.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$/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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -408,7 +405,14 @@
<option name="project" value="LOCAL" />
<updated>1690040555929</updated>
</task>
<option name="localTasksCounter" value="49" />
<task id="LOCAL-00049" summary="23/07/2023 - 21h">
<created>1690141881201</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1690141881201</updated>
</task>
<option name="localTasksCounter" value="50" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -423,7 +427,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="21/05/23 - 22h" />
<MESSAGE value="22/05/23 - 23h" />
<MESSAGE value="23/05/23 - 23h" />
<MESSAGE value="25/05/23 - 17h" />
@ -448,6 +451,7 @@
<MESSAGE value="16/07/23 - 21h" />
<MESSAGE value="16/07/23 - 22h" />
<MESSAGE value="22/07/2023 - 17h" />
<option name="LAST_COMMIT_MESSAGE" value="22/07/2023 - 17h" />
<MESSAGE value="23/07/2023 - 21h" />
<option name="LAST_COMMIT_MESSAGE" value="23/07/2023 - 21h" />
</component>
</project>

View File

@ -3,7 +3,7 @@ Ce fichier est dedié à la gestion des contact de tout type
Chaque ligne contriendra le nom de la collection du recid concerné
ex :
- id,
- relected_collection
- related_collection
- relected_recid
- type (standard, livraison, facturation, etc)
- nom
@ -53,7 +53,7 @@ def Add_Contact(diction):
field_list = ['token', "raison_sociale", "nom", "siret", "tva", "email",
"telephone", "website", "comment",'adr_adresse', 'adr_code_postal',
'adr_ville', 'adr_pays', 'type', 'telephone_mobile', 'linkedin',
'facebook', 'twitter', 'related_collection_recid', 'related_collection_recid', ]
'facebook', 'twitter', 'related_collection', 'related_collection_owner_email', ]
incom_keys = diction.keys()
for val in incom_keys:
@ -65,7 +65,7 @@ def Add_Contact(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', "email", 'related_collection', 'related_collection_recid',]
field_list_obligatoire = ['token', "email", 'related_collection', 'related_collection_owner_email',]
for val in field_list_obligatoire:
if val not in diction:
@ -102,22 +102,18 @@ def Add_Contact(diction):
"""
Verification s'il n'existe pas un cient du partenaire qui perte le meme
nom, ou la meme adresse email
Verification s'il n'existe pas un cient du partenaire qui porte la meme adresse email
"""
qry = {'nom': str(diction['nom']), 'valide': '1', 'partner_recid': str(my_partner['recid'])}
tmp_count = MYSY_GV.dbname['contact'].count_documents({'email': str(diction['email']),
'valide': '1', 'partner_recid': my_partner['recid']})
if (tmp_count > 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Il existe déjà un client qui porte le même email principal = " +str(diction['email']))
3]) + " - Il existe déjà un contact qui porte le même email principal = " +str(diction['email']))
return False, " - Vous avez déjà un client qui a le même email principal "
return False, " - Vous avez déjà un contact qui a le même email principal "
@ -253,11 +249,19 @@ def Add_Contact(diction):
return False, "- La collection " + str(related_collection) + " n'accepte pas de contact"
related_collection_recid = ""
if ("related_collection_recid" in diction.keys()):
if diction['related_collection_recid']:
related_collection_recid = diction['related_collection_recid']
data['related_collection_recid'] = diction['related_collection_recid']
if ("related_collection_owner_email" in diction.keys()):
related_collection_owner_email = str(diction['related_collection_owner_email'])
"""
Recuperation du recid associé au related_collection_owner_email dans la collection : related_collection
"""
#print(" #### on cherche le recid du mail "+ str(related_collection_owner_email)+" dans la collection "+str(diction['related_collection'])+" ." )
local_tmp_val = MYSY_GV.dbname[str(diction['related_collection'])].find_one({'email':related_collection_owner_email})
if (local_tmp_val is None or "recid" not in local_tmp_val.keys()):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - impossible de recuperer les données de "+ str(related_collection_owner_email)+" dans la collection "+str(diction['related_collection']) )
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données de "+str(related_collection_owner_email)+" dans la collection "+str(diction['related_collection'])+" . "
data['related_collection_recid'] = str(local_tmp_val['recid'])
data['valide'] = '1'
@ -512,9 +516,11 @@ def Update_Contact(diction):
"""
Recuperation de la liste des contacts d'une entité en se basant sur
- relected_collection
- related_collection
- token (partner_recid)
- related_collection_recid (s'il est fourni)
- related_collection_owner_email (s'il est fourni)
alog :
on va aller chercher le recid du related_collection_owner_email dans la collection concerné
"""
def Get_List_Entity_Contact(diction):
try:
@ -523,7 +529,7 @@ def Get_List_Entity_Contact(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'relected_collection', 'related_collection_recid']
field_list = ['token', 'related_collection', 'related_collection_owner_email']
incom_keys = diction.keys()
for val in incom_keys:
@ -535,7 +541,7 @@ def Get_List_Entity_Contact(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'relected_collection']
field_list_obligatoire = ['token', 'related_collection']
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
@ -568,11 +574,22 @@ def Get_List_Entity_Contact(diction):
"""
data_cle = {}
data_cle['partner_recid'] = str(my_partner['recid'])
data_cle['relected_collection'] = str(diction['relected_collection'])
data_cle['related_collection'] = str(diction['related_collection'])
if ("related_collection_recid" in diction.keys()):
data_cle['related_collection_recid'] = str(diction['related_collection_recid'])
if ("related_collection_owner_email" in diction.keys()):
related_collection_owner_email = str(diction['related_collection_owner_email'])
"""
Recuperation du recid associé au related_collection_owner_email dans la collection : related_collection
"""
print(" #### on cherche le recid du mail "+ str(related_collection_owner_email)+" dans la collection "+str(diction['related_collection'])+" ." )
local_tmp_val = MYSY_GV.dbname[str(diction['related_collection'])].find_one({'email':related_collection_owner_email})
print(" #### local_tmp_val = ", local_tmp_val)
if (local_tmp_val is None or "recid" not in local_tmp_val.keys()):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - impossible de recuperer les données de "+ str(related_collection_owner_email)+" dans la collection "+str(diction['related_collection']) )
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données de "+str(related_collection_owner_email)+" dans la collection "+str(diction['related_collection'])+" . "
data_cle['related_collection_recid'] = str(local_tmp_val['recid'])
data_cle['locked'] = "0"

File diff suppressed because it is too large Load Diff

View File

@ -2140,6 +2140,7 @@ def get_partner_class(diction):
my_token = diction['token']
# Verifier la validité du token
retval = mycommon.check_partner_token_validity("", my_token)
if retval is False:
return "Err_Connexion", " La session de connexion n'est pas valide"