refonte gestion image + rotation +/-90
This commit is contained in:
@@ -121,7 +121,7 @@ WHERE societe<>:societe AND C_NOM=:C_NOM AND C_ADR=:C_ADR AND C_CP=:C_CP AND C_V
|
||||
|
||||
return results
|
||||
|
||||
def get_docs_attaches(request, nodossier, norapport, nosection, origine, filename):
|
||||
def get_docs_attaches(request, nodossier, norapport, origine, filename):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
|
||||
@@ -134,26 +134,38 @@ def get_docs_attaches(request, nodossier, norapport, nosection, origine, filenam
|
||||
'norapport': norapport, 'origine': origine, 'filename': filename}).fetchall()
|
||||
return results
|
||||
|
||||
def get_photos(request, nodossier, norapport, nosection):
|
||||
def get_photos(request, nodossier, norapport, origine):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
query = """SELECT * FROM dossier_attaches WHERE nomrep = 'DOCS_ATTACHES' AND societe = :societe AND nochantier = :nochantier
|
||||
AND nodossier = :norapport AND nosection = :nosection AND UPPER(RIGHT(nomfichier,3)) <> 'PDF' ORDER BY cree_le;"""
|
||||
results = request.dbsession.execute(query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'nosection': nosection}).fetchall()
|
||||
AND nodossier = :norapport AND origine = :origine AND UPPER(RIGHT(nomfichier,3)) <> 'PDF' ORDER BY cree_le;"""
|
||||
results = request.dbsession.execute(query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'origine': origine}).fetchall()
|
||||
return results
|
||||
|
||||
def delete_photos(request, nodossier, norapport, nosection, nomfic):
|
||||
def delete_photos(request, nodossier, norapport, origine, nomfic):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
|
||||
# supprimer d'abord le fichier
|
||||
file_path = '%s/%s/%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'], societe, nochantier, norapport, nomfic)
|
||||
if len(origine) > 1:
|
||||
file_path = '%s/%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'], societe, nochantier, nomfic)
|
||||
else:
|
||||
file_path = '%s/%s/%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'], societe, nochantier, norapport, nomfic)
|
||||
if os.path.exists(file_path):
|
||||
os.remove(file_path)
|
||||
|
||||
query = "DELETE FROM dossier_attaches WHERE nomrep='DOCS_ATTACHES' AND societe=:societe AND nochantier=:nochantier AND nodossier=:norapport AND nosection=:nosection AND nomfichier=:nomfic;"
|
||||
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'nosection': nosection, 'nomfic': nomfic})
|
||||
|
||||
query = "DELETE FROM dossier_attaches WHERE nomrep='DOCS_ATTACHES' AND societe=:societe AND nochantier=:nochantier AND nodossier=:norapport AND origine=:origine AND nomfichier=:nomfic;"
|
||||
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'origine': origine, 'nomfic': nomfic})
|
||||
|
||||
def rename_photos(request, nodossier, norapport, origine, nomfic, new_nomfic):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
|
||||
query = """
|
||||
UPDATE dossier_attaches SET nomfichier = :new_nomfic
|
||||
WHERE nomrep='DOCS_ATTACHES' AND societe=:societe AND nochantier=:nochantier AND nodossier=:norapport AND origine=:origine AND nomfichier=:nomfic;
|
||||
"""
|
||||
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport,
|
||||
'origine': origine, 'nomfic': nomfic, 'new_nomfic': new_nomfic})
|
||||
|
||||
def update_dossier(request, nodossier, new_values):
|
||||
societe = nodossier[0:2]
|
||||
@@ -183,19 +195,19 @@ def update_dossier_cloture(request, nodossier, logged_in):
|
||||
query = "UPDATE dem_devis SET mtregl = 0.01, USERMAJ = :logged_in WHERE societe=:societe AND no_id=:nochantier"
|
||||
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'logged_in': logged_in})
|
||||
|
||||
def insert_dossier_attaches(request, nodossier, norapport, nosection, origine, filename, filesize, user):
|
||||
def insert_dossier_attaches(request, nodossier, norapport, origine, filename, filesize, user):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
|
||||
# fichier existe ?
|
||||
item = get_docs_attaches(request, nodossier, norapport, nosection, origine, filename)
|
||||
item = get_docs_attaches(request, nodossier, norapport, origine, filename)
|
||||
if item:
|
||||
return
|
||||
# enregistrer dans la table dossier_attaches
|
||||
query = """INSERT INTO dossier_attaches (nomrep, societe, nochantier, nodossier, nosection, origine, nomfichier, taillefichier, cree_le, usermaj)
|
||||
VALUES('DOCS_ATTACHES',:societe,:nochantier,:norapport,:nosection,:origine,:filename,:filesize,NOW(),:user);"""
|
||||
query = """INSERT INTO dossier_attaches (nomrep, societe, nochantier, nodossier, origine, nomfichier, taillefichier, cree_le, usermaj)
|
||||
VALUES('DOCS_ATTACHES',:societe,:nochantier,:norapport,:origine,:filename,:filesize,NOW(),:user);"""
|
||||
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport,
|
||||
'nosection': nosection, 'origine': origine, 'filename': filename, 'filesize': filesize, 'user': user})
|
||||
'origine': origine, 'filename': filename, 'filesize': filesize, 'user': user})
|
||||
|
||||
def get_rapport_by_no(request,nodossier,date_inter):
|
||||
societe = nodossier[0:2]
|
||||
|
||||
Reference in New Issue
Block a user