26/03/2024 - 21h30
parent
85f0dda394
commit
c5aeb47364
|
@ -3,9 +3,16 @@
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="25/03/2024 - 18h30">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="25/03/2024 - 18h30">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Ela_Spacy.py" beforeDir="false" afterPath="$PROJECT_DIR$/Ela_Spacy.py" 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$/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$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|
|
@ -75,6 +75,8 @@ import hashlib
|
||||||
from Crypto.Cipher import PKCS1_OAEP
|
from Crypto.Cipher import PKCS1_OAEP
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
import segno
|
import segno
|
||||||
|
import attached_file_mgt as attached_file_mgt
|
||||||
|
|
||||||
|
|
||||||
class SignedMessage:
|
class SignedMessage:
|
||||||
message: bytes = None
|
message: bytes = None
|
||||||
|
@ -165,8 +167,8 @@ def Create_E_Document(diction):
|
||||||
secret_key = secrets.token_urlsafe(5)
|
secret_key = secrets.token_urlsafe(5)
|
||||||
new_diction = {}
|
new_diction = {}
|
||||||
new_diction['document_data'] = encoded_pdf_to_string
|
new_diction['document_data'] = encoded_pdf_to_string
|
||||||
new_diction['related_collection'] = "aaaa"
|
new_diction['related_collection'] = diction['related_collection']
|
||||||
new_diction['related_collection_id'] = 'bbbb'
|
new_diction['related_collection_id'] = diction['related_collection_id']
|
||||||
new_diction['partner_owner_recid'] = my_partner['recid']
|
new_diction['partner_owner_recid'] = my_partner['recid']
|
||||||
new_diction['statut'] = '0'
|
new_diction['statut'] = '0'
|
||||||
new_diction['valide'] = '1'
|
new_diction['valide'] = '1'
|
||||||
|
@ -1004,6 +1006,30 @@ def Create_E_Signature_For_E_Document(file_img=None, Folder=None, diction=None):
|
||||||
smtpserver.close()
|
smtpserver.close()
|
||||||
print(" Email envoyé " + str(val))
|
print(" Email envoyé " + str(val))
|
||||||
|
|
||||||
|
"""
|
||||||
|
Le fichier est envoyé par email, il faudrait à present le stocker
|
||||||
|
le fichier dans l'espace documentaire du client
|
||||||
|
-field_list = ['token', 'file_business_object', 'file_name', 'status','object_owner_collection', 'object_owner_id']
|
||||||
|
|
||||||
|
"""
|
||||||
|
ts = datetime.now().timestamp()
|
||||||
|
ts = str(ts).replace(".", "").replace(",", "")[-3:]
|
||||||
|
|
||||||
|
new_file = {}
|
||||||
|
new_file['token'] = temp_admin_account['token']
|
||||||
|
new_file['file_business_object'] = "e_Convention_signe_"+str(ts)
|
||||||
|
new_file['file_name'] = str(orig_file_name)
|
||||||
|
new_file['status'] = "1"
|
||||||
|
new_file['object_owner_collection'] = e_document_date_2['related_collection']
|
||||||
|
new_file['object_owner_id'] = e_document_date_2['related_collection_id']
|
||||||
|
new_file['file_name_to_store'] = outputFilename
|
||||||
|
|
||||||
|
print(" new_file == ", new_file)
|
||||||
|
local_status, local_retval = attached_file_mgt.Internal_Usage_Store_User_Downloaded_File(MYSY_GV.upload_folder, new_file)
|
||||||
|
|
||||||
|
if( local_status is False ):
|
||||||
|
print(" ## WARNONGGG Impossible de stocker le fichier")
|
||||||
|
|
||||||
return True, " Le document a été correction signé. Vous allez recevoir le document par email"
|
return True, " Le document a été correction signé. Vous allez recevoir le document par email"
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -444,13 +444,14 @@ def ela_index_record_field(lines, class_id, source_field = "", partner_owner_rec
|
||||||
"""
|
"""
|
||||||
update du 21/09/2023
|
update du 21/09/2023
|
||||||
Verifier la validé du 'partner_owner_recid'. Il doit appartenir à un 'partnair_account' valide
|
Verifier la validé du 'partner_owner_recid'. Il doit appartenir à un 'partnair_account' valide
|
||||||
"""
|
|
||||||
is_Valide_partner_owner_recid_count = MYSY_GV.dbname['partnair_account'].count_documents({'recid':str(partner_owner_recid), 'valide':'1', 'locked':'0'})
|
is_Valide_partner_owner_recid_count = MYSY_GV.dbname['partnair_account'].count_documents({'recid':str(partner_owner_recid), 'valide':'1', 'locked':'0'})
|
||||||
|
|
||||||
if( is_Valide_partner_owner_recid_count != 1 ):
|
if( is_Valide_partner_owner_recid_count != 1 ):
|
||||||
mycommon.myprint(
|
mycommon.myprint(
|
||||||
" ela_index_record_field - INDEXATION IMPOSSIBLE. 'is_Valide_partner_owner_recid_count' est invalide ")
|
" ela_index_record_field - INDEXATION IMPOSSIBLE. 'is_Valide_partner_owner_recid_count' est invalide ")
|
||||||
return False
|
return False
|
||||||
|
"""
|
||||||
|
|
||||||
# check default value of parameter : source_field
|
# check default value of parameter : source_field
|
||||||
if len(str(source_field)) == 0 :
|
if len(str(source_field)) == 0 :
|
||||||
|
|
|
@ -7996,8 +7996,8 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
|
||||||
new_e_document_diction['email_destinataire'] = str(toaddrs)
|
new_e_document_diction['email_destinataire'] = str(toaddrs)
|
||||||
new_e_document_diction['source_document'] = new_model_courrier_with_code_tag
|
new_e_document_diction['source_document'] = new_model_courrier_with_code_tag
|
||||||
|
|
||||||
new_e_document_diction['related_collection'] = ""
|
new_e_document_diction['related_collection'] = "inscription"
|
||||||
new_e_document_diction['related_collection_id'] = ""
|
new_e_document_diction['related_collection_id'] = str(inscription_data['_id'])
|
||||||
local_status_e_doc, local_retval_e_doc = E_Sign_Document.Create_E_Document(new_e_document_diction)
|
local_status_e_doc, local_retval_e_doc = E_Sign_Document.Create_E_Document(new_e_document_diction)
|
||||||
|
|
||||||
if (local_status_e_doc is False):
|
if (local_status_e_doc is False):
|
||||||
|
@ -9838,8 +9838,8 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
||||||
new_e_document_diction['email_destinataire'] = str(toaddrs)
|
new_e_document_diction['email_destinataire'] = str(toaddrs)
|
||||||
new_e_document_diction['source_document'] = new_model_courrier_with_code_tag
|
new_e_document_diction['source_document'] = new_model_courrier_with_code_tag
|
||||||
|
|
||||||
new_e_document_diction['related_collection'] = ""
|
new_e_document_diction['related_collection'] = "partner_client"
|
||||||
new_e_document_diction['related_collection_id'] = ""
|
new_e_document_diction['related_collection_id'] = str(client_data['_id'])
|
||||||
local_status_e_doc, local_retval_e_doc = E_Sign_Document.Create_E_Document(new_e_document_diction)
|
local_status_e_doc, local_retval_e_doc = E_Sign_Document.Create_E_Document(new_e_document_diction)
|
||||||
|
|
||||||
if(local_status_e_doc is False ):
|
if(local_status_e_doc is False ):
|
||||||
|
|
6454
Log/log_file.log
6454
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -192,6 +192,129 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
|
||||||
return False, "Error "
|
return False, "Error "
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette fonction est la copie de la première a l'exception qu'il s'agit d'une utilisation interne
|
||||||
|
"""
|
||||||
|
def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None):
|
||||||
|
try:
|
||||||
|
full_file_path = ""
|
||||||
|
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', 'file_business_object', 'file_name', 'status','object_owner_collection', 'object_owner_id',
|
||||||
|
'file_name_to_store']
|
||||||
|
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', 'file_business_object', 'object_owner_collection', 'object_owner_id', 'file_name_to_store' ]
|
||||||
|
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",
|
||||||
|
|
||||||
|
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||||
|
if (local_status is not True):
|
||||||
|
return local_status, my_partner
|
||||||
|
|
||||||
|
basename = os.path.basename(str(diction['file_name_to_store']))
|
||||||
|
basename2 = basename.split(".")
|
||||||
|
|
||||||
|
|
||||||
|
if (len(basename2) != 2):
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " - : Le nom du fichier est incorrect")
|
||||||
|
return False, "Le nom du fichier est incorrect"
|
||||||
|
|
||||||
|
if (str(basename2[1]).lower() not in MYSY_GV.ALLOWED_EXTENSIONS):
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " - : le format de fichier '"+str(basename2[1])+"' n'est pas autorisé. Les extentions autorisées sont : "+str(MYSY_GV.ALLOWED_EXTENSIONS))
|
||||||
|
return False, "le format de fichier '"+str(basename2[1])+"' n'est pas autorisé. Les extentions autorisées sont : "+str(MYSY_GV.ALLOWED_EXTENSIONS)
|
||||||
|
|
||||||
|
file_extention = str(basename2[1]).lower().strip()
|
||||||
|
|
||||||
|
new_basename2 = str(basename2[0])
|
||||||
|
|
||||||
|
timestr = time.strftime("%Y%m%d_%H%M%S")
|
||||||
|
local_base_name = str(new_basename2).replace('(', '').replace(')', '').replace(' ', '')
|
||||||
|
|
||||||
|
partial_file_name_without_folder = str(local_base_name) + "_" + str(timestr) +"_"+str(my_partner['recid'])+ "." + str(basename2[1])
|
||||||
|
|
||||||
|
new_file_name = MYSY_GV.upload_folder+str(local_base_name) + "_" + str(timestr) +"_"+str(my_partner['recid'])+ "." + str(basename2[1])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
os.rename(str(diction['file_name_to_store']), new_file_name)
|
||||||
|
|
||||||
|
Global_file_name = new_file_name
|
||||||
|
|
||||||
|
file_business_object = ""
|
||||||
|
if ("file_business_object" in diction.keys()):
|
||||||
|
if diction['file_business_object']:
|
||||||
|
file_business_object = diction['file_business_object']
|
||||||
|
|
||||||
|
token = ""
|
||||||
|
if ("token" in diction.keys()):
|
||||||
|
if diction['token']:
|
||||||
|
token = diction['token']
|
||||||
|
|
||||||
|
object_owner_collection = ""
|
||||||
|
if ("object_owner_collection" in diction.keys()):
|
||||||
|
if diction['object_owner_collection']:
|
||||||
|
object_owner_collection = diction['object_owner_collection']
|
||||||
|
|
||||||
|
object_owner_id = ""
|
||||||
|
if ("object_owner_id" in diction.keys()):
|
||||||
|
if diction['object_owner_id']:
|
||||||
|
object_owner_id = diction['object_owner_id']
|
||||||
|
|
||||||
|
document_display_order = ""
|
||||||
|
if ("document_display_order" in diction.keys()):
|
||||||
|
if diction['document_display_order']:
|
||||||
|
document_display_order = diction['document_display_order']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mydata = {}
|
||||||
|
mydata['file_business_object'] = file_business_object
|
||||||
|
mydata['date_update'] = str(datetime.now())
|
||||||
|
mydata['file_name'] = partial_file_name_without_folder
|
||||||
|
mydata['full_path'] = Global_file_name
|
||||||
|
mydata['file_extention'] = file_extention
|
||||||
|
mydata['object_owner_collection'] = object_owner_collection
|
||||||
|
mydata['object_owner_id'] = object_owner_id
|
||||||
|
mydata['document_display_order'] = document_display_order
|
||||||
|
mydata['partner_owner_recid'] = str(my_partner['recid'])
|
||||||
|
mydata['valide'] = "1"
|
||||||
|
mydata['status'] = "0"
|
||||||
|
|
||||||
|
ret_val = MYSY_GV.dbname['download_files'].find_one_and_update({'file_business_object': str(file_business_object),
|
||||||
|
'object_owner_collection':str(object_owner_collection),
|
||||||
|
'object_owner_id':str(object_owner_id),
|
||||||
|
'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'valide': '1'},
|
||||||
|
{"$set": mydata},
|
||||||
|
upsert=True,
|
||||||
|
return_document=ReturnDocument.AFTER
|
||||||
|
)
|
||||||
|
|
||||||
|
return True, Global_file_name
|
||||||
|
|
||||||
|
|
||||||
|
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))
|
||||||
|
return False, "Error "
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Fonction de recuperation des pièces jointes d'objet
|
Fonction de recuperation des pièces jointes d'objet
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -76,7 +76,6 @@ def add_class(diction):
|
||||||
mycommon.myprint(str(inspect.stack()[0][3])+" - La valeur '" + val + "' n'est pas presente dans liste ")
|
mycommon.myprint(str(inspect.stack()[0][3])+" - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||||
return False, " La valeur '" + val + "' n'est pas presente dans liste"
|
return False, " La valeur '" + val + "' n'est pas presente dans liste"
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Verification si le token et l'email sont valident
|
Verification si le token et l'email sont valident
|
||||||
'''
|
'''
|
||||||
|
@ -280,7 +279,7 @@ def add_class(diction):
|
||||||
methode_pedagogique = ""
|
methode_pedagogique = ""
|
||||||
if ("methode_pedagogique" in diction.keys()):
|
if ("methode_pedagogique" in diction.keys()):
|
||||||
if diction['methode_pedagogique']:
|
if diction['methode_pedagogique']:
|
||||||
programme = diction['methode_pedagogique']
|
methode_pedagogique = diction['methode_pedagogique']
|
||||||
if (len(mycommon.cleanhtml(diction['methode_pedagogique'])) > MYSY_GV.CLASS_ZONE_PROGRAM_LIMIT):
|
if (len(mycommon.cleanhtml(diction['methode_pedagogique'])) > MYSY_GV.CLASS_ZONE_PROGRAM_LIMIT):
|
||||||
mycommon.myprint(
|
mycommon.myprint(
|
||||||
str(inspect.stack()[0][3]) + " : le champ 'methode pedagogique' de La formation " + str(
|
str(inspect.stack()[0][3]) + " : le champ 'methode pedagogique' de La formation " + str(
|
||||||
|
@ -3362,7 +3361,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
||||||
suivi_eval = str(df['suivi_eval'].values[n]).strip()
|
suivi_eval = str(df['suivi_eval'].values[n]).strip()
|
||||||
suivi_eval = mycommon.format_MySy_Text_Tag(suivi_eval)
|
suivi_eval = mycommon.format_MySy_Text_Tag(suivi_eval)
|
||||||
|
|
||||||
mydata['condition_handicape'] = suivi_eval
|
mydata['suivi_eval'] = suivi_eval
|
||||||
|
|
||||||
|
|
||||||
prerequis = ""
|
prerequis = ""
|
||||||
|
@ -3524,7 +3523,6 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
||||||
|
|
||||||
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
|
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
|
||||||
|
|
||||||
#print( clean_dict)
|
|
||||||
status, retval = add_class(clean_dict)
|
status, retval = add_class(clean_dict)
|
||||||
|
|
||||||
if( status is False ):
|
if( status is False ):
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Empty DataFrame
|
|
||||||
Columns: [mots, occurence, moyenne, id_formation, source_field, partner_owner_recid]
|
|
||||||
Index: []
|
|
|
@ -1,12 +1,16 @@
|
||||||
"""
|
"""
|
||||||
Ce ficher gerer l'emargement à une session de formation
|
Ce ficher gerer l'emargement à une session de formation
|
||||||
"""
|
"""
|
||||||
|
import ast
|
||||||
|
|
||||||
import pymongo
|
import pymongo
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
import json
|
import json
|
||||||
from bson import ObjectId
|
from bson import ObjectId
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
import partners
|
||||||
import prj_common as mycommon
|
import prj_common as mycommon
|
||||||
import secrets
|
import secrets
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -744,17 +748,58 @@ def GerneratePDFEmargementList(diction):
|
||||||
|
|
||||||
#print(json.dumps(date_for_tmplate, indent=1))
|
#print(json.dumps(date_for_tmplate, indent=1))
|
||||||
|
|
||||||
|
# Recuperation des données du partenaire associé à l'utilisateur connecté
|
||||||
|
local_status, local_retval = mycommon.Get_Connected_User_Partner_Data_From_RecID(my_partner['recid'])
|
||||||
|
if (local_status is False):
|
||||||
|
return local_status, local_retval
|
||||||
|
|
||||||
|
local_company_data = local_retval
|
||||||
|
|
||||||
|
# Recuperation des données de la société
|
||||||
|
company_data = {}
|
||||||
|
|
||||||
|
company_liste_champ = ['nom', 'email', 'telephone', 'num_nda', 'website', 'adr_street', 'adr_zip', 'adr_city',
|
||||||
|
'adr_country']
|
||||||
|
for champ in company_liste_champ:
|
||||||
|
if (champ in local_company_data):
|
||||||
|
new_champ_name = "societe_" + str(champ)
|
||||||
|
new_field = {new_champ_name: str(local_company_data[champ])}
|
||||||
|
company_data.update(new_field)
|
||||||
|
else:
|
||||||
|
new_champ_name = "societe_" + str(champ)
|
||||||
|
new_field = {new_champ_name: ""}
|
||||||
|
company_data.update(new_field)
|
||||||
|
|
||||||
|
# Recuperation du logo et du cachet de la société si il y en a
|
||||||
|
local_part_status, local_part_imgs = partners.getRecodedParnterImage_from_front(
|
||||||
|
{'token': str(diction['token'])})
|
||||||
|
if (local_part_status is False):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " WARNING : Impossible de récuperer le logo et le cachet du partenaire ")
|
||||||
|
new_field_logo = {'societe_logo': ''}
|
||||||
|
new_field_cachet = {'societe_cachet': ''}
|
||||||
|
company_data.update(new_field_logo)
|
||||||
|
company_data.update(new_field_cachet)
|
||||||
|
else:
|
||||||
|
|
||||||
|
local_JSON = ast.literal_eval(local_part_imgs[0])
|
||||||
|
|
||||||
|
new_field_logo = {'societe_logo': "data:image/png;base64," + local_JSON['logo_img']}
|
||||||
|
new_field_cachet = {'societe_cachet': "data:image/png;base64," + local_JSON['cachet_img']}
|
||||||
|
company_data.update(new_field_logo)
|
||||||
|
company_data.update(new_field_cachet)
|
||||||
|
|
||||||
|
|
||||||
#print(" -------- ")
|
#print(" -------- ")
|
||||||
|
|
||||||
#print(json.dumps(tab_users, indent=1))
|
#print(json.dumps(tab_users, indent=1))
|
||||||
# This data can come from database query
|
# This data can come from database query
|
||||||
body = {
|
body = {
|
||||||
"data": date_for_tmplate,
|
"data": date_for_tmplate,
|
||||||
"user": tab_users
|
"user": tab_users,
|
||||||
|
"company_data" :company_data
|
||||||
}
|
}
|
||||||
|
|
||||||
#print( " body = ", body)
|
|
||||||
|
|
||||||
### Recuperation du modèle de courrier pdf pour l'emargement
|
### Recuperation du modèle de courrier pdf pour l'emargement
|
||||||
|
|
||||||
|
|
||||||
|
@ -773,7 +818,7 @@ def GerneratePDFEmargementList(diction):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sourceHtml = contenu_doc_Template.render(json_data=body["data"], users=body["user"])
|
sourceHtml = contenu_doc_Template.render(json_data=body["data"], users=body["user"], company_data=body["company_data"])
|
||||||
orig_file_name = "Emargement.pdf"
|
orig_file_name = "Emargement.pdf"
|
||||||
outputFilename = str(MYSY_GV.EMARGEMENT_DIRECTORY) + str(orig_file_name)
|
outputFilename = str(MYSY_GV.EMARGEMENT_DIRECTORY) + str(orig_file_name)
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ Ce fichier permet de gerer la facturation des commandes des partenaires vers leu
|
||||||
Il se base sur les commandes faite à l'aide du fichier "partner_order.py"
|
Il se base sur les commandes faite à l'aide du fichier "partner_order.py"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
import ast
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
|
|
||||||
import bson
|
import bson
|
||||||
|
@ -13,6 +14,8 @@ import json
|
||||||
from bson import ObjectId
|
from bson import ObjectId
|
||||||
import re
|
import re
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
import partners
|
||||||
import prj_common as mycommon
|
import prj_common as mycommon
|
||||||
import secrets
|
import secrets
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -1642,7 +1645,52 @@ def GerneratePDF_Partner_Invoice(diction):
|
||||||
#print(" ### Order_header_data = ", Order_header_data)
|
#print(" ### Order_header_data = ", Order_header_data)
|
||||||
#print(" ### Order_header_lines_data = ", Order_header_lines_data)
|
#print(" ### Order_header_lines_data = ", Order_header_lines_data)
|
||||||
|
|
||||||
sourceHtml = contenu_doc_Template.render(params=Order_header_data, param_order_lines=Order_header_lines_data)
|
# Recuperation des données du partenaire associé à l'utilisateur connecté
|
||||||
|
|
||||||
|
local_status, local_retval = mycommon.Get_Connected_User_Partner_Data_From_RecID(my_partner['recid'])
|
||||||
|
if (local_status is False):
|
||||||
|
return local_status, local_retval
|
||||||
|
return local_status, local_retval
|
||||||
|
|
||||||
|
local_company_data = local_retval
|
||||||
|
|
||||||
|
# Recuperation des données de la société
|
||||||
|
company_data = {}
|
||||||
|
|
||||||
|
company_liste_champ = ['nom', 'email', 'telephone', 'num_nda', 'website', 'adr_street', 'adr_zip', 'adr_city',
|
||||||
|
'adr_country']
|
||||||
|
for champ in company_liste_champ:
|
||||||
|
if (champ in local_company_data):
|
||||||
|
new_champ_name = "societe_" + str(champ)
|
||||||
|
new_field = {new_champ_name: str(local_company_data[champ])}
|
||||||
|
company_data.update(new_field)
|
||||||
|
else:
|
||||||
|
new_champ_name = "societe_" + str(champ)
|
||||||
|
new_field = {new_champ_name: ""}
|
||||||
|
company_data.update(new_field)
|
||||||
|
|
||||||
|
# Recuperation du logo et du cachet de la société si il y en a
|
||||||
|
local_part_status, local_part_imgs = partners.getRecodedParnterImage_from_front(
|
||||||
|
{'token': str(diction['token'])})
|
||||||
|
if (local_part_status is False):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " WARNING : Impossible de récuperer le logo et le cachet du partenaire ")
|
||||||
|
new_field_logo = {'societe_logo': ''}
|
||||||
|
new_field_cachet = {'societe_cachet': ''}
|
||||||
|
company_data.update(new_field_logo)
|
||||||
|
company_data.update(new_field_cachet)
|
||||||
|
else:
|
||||||
|
|
||||||
|
local_JSON = ast.literal_eval(local_part_imgs[0])
|
||||||
|
|
||||||
|
new_field_logo = {'societe_logo': "data:image/png;base64," + local_JSON['logo_img']}
|
||||||
|
new_field_cachet = {'societe_cachet': "data:image/png;base64," + local_JSON['cachet_img']}
|
||||||
|
company_data.update(new_field_logo)
|
||||||
|
company_data.update(new_field_cachet)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sourceHtml = contenu_doc_Template.render(params=Order_header_data, param_order_lines=Order_header_lines_data, company_data=company_data)
|
||||||
|
|
||||||
|
|
||||||
orig_file_name = "Partner_Invoice_"+str(Order_header_data['invoice_header_ref_interne'])+".pdf"
|
orig_file_name = "Partner_Invoice_"+str(Order_header_data['invoice_header_ref_interne'])+".pdf"
|
||||||
|
@ -1711,7 +1759,7 @@ def Send_Partner_Invoice_By_Email(diction):
|
||||||
# Verification de la validité de l'order
|
# Verification de la validité de l'order
|
||||||
qry = {'_id': ObjectId(str(diction['invoice_id'])), 'valide': '1', 'locked': '0',
|
qry = {'_id': ObjectId(str(diction['invoice_id'])), 'valide': '1', 'locked': '0',
|
||||||
'partner_owner_recid': str(my_partner['recid'])}
|
'partner_owner_recid': str(my_partner['recid'])}
|
||||||
print(" ### qry = ", qry)
|
#print(" ### qry = ", qry)
|
||||||
|
|
||||||
is_Invoice_Existe_Count = MYSY_GV.dbname['partner_invoice_header'].count_documents(
|
is_Invoice_Existe_Count = MYSY_GV.dbname['partner_invoice_header'].count_documents(
|
||||||
{'_id': ObjectId(str(diction['invoice_id'])),
|
{'_id': ObjectId(str(diction['invoice_id'])),
|
||||||
|
@ -1912,10 +1960,54 @@ def Send_Partner_Invoice_By_Email(diction):
|
||||||
|
|
||||||
contenu_doc_Template = jinja2.Template(str(partner_document_INVOICE_data['contenu_doc']))
|
contenu_doc_Template = jinja2.Template(str(partner_document_INVOICE_data['contenu_doc']))
|
||||||
|
|
||||||
|
# Recuperation des données du partenaire associé à l'utilisateur connecté
|
||||||
|
|
||||||
|
local_status, local_retval = mycommon.Get_Connected_User_Partner_Data_From_RecID(my_partner['recid'])
|
||||||
|
if (local_status is False):
|
||||||
|
return local_status, local_retval
|
||||||
|
return local_status, local_retval
|
||||||
|
|
||||||
|
local_company_data = local_retval
|
||||||
|
|
||||||
|
# Recuperation des données de la société
|
||||||
|
company_data = {}
|
||||||
|
|
||||||
|
company_liste_champ = ['nom', 'email', 'telephone', 'num_nda', 'website', 'adr_street', 'adr_zip', 'adr_city',
|
||||||
|
'adr_country']
|
||||||
|
for champ in company_liste_champ:
|
||||||
|
if (champ in local_company_data):
|
||||||
|
new_champ_name = "societe_" + str(champ)
|
||||||
|
new_field = {new_champ_name: str(local_company_data[champ])}
|
||||||
|
company_data.update(new_field)
|
||||||
|
else:
|
||||||
|
new_champ_name = "societe_" + str(champ)
|
||||||
|
new_field = {new_champ_name: ""}
|
||||||
|
company_data.update(new_field)
|
||||||
|
|
||||||
|
# Recuperation du logo et du cachet de la société si il y en a
|
||||||
|
local_part_status, local_part_imgs = partners.getRecodedParnterImage_from_front(
|
||||||
|
{'token': str(diction['token'])})
|
||||||
|
if (local_part_status is False):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " WARNING : Impossible de récuperer le logo et le cachet du partenaire ")
|
||||||
|
new_field_logo = {'societe_logo': ''}
|
||||||
|
new_field_cachet = {'societe_cachet': ''}
|
||||||
|
company_data.update(new_field_logo)
|
||||||
|
company_data.update(new_field_cachet)
|
||||||
|
else:
|
||||||
|
|
||||||
|
local_JSON = ast.literal_eval(local_part_imgs[0])
|
||||||
|
|
||||||
|
new_field_logo = {'societe_logo': "data:image/png;base64," + local_JSON['logo_img']}
|
||||||
|
new_field_cachet = {'societe_cachet': "data:image/png;base64," + local_JSON['cachet_img']}
|
||||||
|
company_data.update(new_field_logo)
|
||||||
|
company_data.update(new_field_cachet)
|
||||||
|
|
||||||
|
|
||||||
contenu_doc_Template_subject = jinja2.Template(str(partner_document_INVOICE_data['sujet']))
|
contenu_doc_Template_subject = jinja2.Template(str(partner_document_INVOICE_data['sujet']))
|
||||||
|
|
||||||
#print(" #### Order_header_data = ", Order_header_data)
|
#print(" #### Order_header_data = ", Order_header_data)
|
||||||
sourceHtml = contenu_doc_Template.render(params=Order_header_data, param_order_lines=Order_header_lines_data)
|
sourceHtml = contenu_doc_Template.render(params=Order_header_data, param_order_lines=Order_header_lines_data, company_data=company_data)
|
||||||
sujetHtml = contenu_doc_Template_subject.render(params=Order_header_data)
|
sujetHtml = contenu_doc_Template_subject.render(params=Order_header_data)
|
||||||
|
|
||||||
#print(" #### sourceHtml = ", sourceHtml)
|
#print(" #### sourceHtml = ", sourceHtml)
|
||||||
|
|
|
@ -4515,7 +4515,7 @@ def Send_Partner_Order_By_Email(diction):
|
||||||
# Verification de la validité de l'order
|
# Verification de la validité de l'order
|
||||||
qry = {'_id': ObjectId(str(diction['order_id'])), 'valide': '1', 'locked': '0',
|
qry = {'_id': ObjectId(str(diction['order_id'])), 'valide': '1', 'locked': '0',
|
||||||
'partner_owner_recid': str(my_partner['recid'])}
|
'partner_owner_recid': str(my_partner['recid'])}
|
||||||
print(" ### qry = ", qry)
|
#print(" ### qry = ", qry)
|
||||||
|
|
||||||
is_Order_Existe_Count = MYSY_GV.dbname['partner_order_header'].count_documents(
|
is_Order_Existe_Count = MYSY_GV.dbname['partner_order_header'].count_documents(
|
||||||
{'_id': ObjectId(str(diction['order_id'])),
|
{'_id': ObjectId(str(diction['order_id'])),
|
||||||
|
@ -4704,8 +4704,7 @@ def Send_Partner_Order_By_Email(diction):
|
||||||
#print(" #### Order_header_data = ", Order_header_data)
|
#print(" #### Order_header_data = ", Order_header_data)
|
||||||
Order_header_data['order_header_type'] = str(Order_header_data['order_header_type']).capitalize()
|
Order_header_data['order_header_type'] = str(Order_header_data['order_header_type']).capitalize()
|
||||||
sourceHtml = contenu_doc_Template.render(params=Order_header_data, param_order_lines=Order_header_lines_data)
|
sourceHtml = contenu_doc_Template.render(params=Order_header_data, param_order_lines=Order_header_lines_data)
|
||||||
sujetHtml = contenu_doc_Template_subject.render(params=Order_header_data)
|
sujetHtml = str(Order_header_data['order_header_type']) + " : "+ str(Order_header_data['order_header_ref_interne'])
|
||||||
|
|
||||||
#print(" #### sourceHtml = ", sourceHtml)
|
#print(" #### sourceHtml = ", sourceHtml)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue