améliorer gestion des photos dans RDF et dossier
This commit is contained in:
@@ -154,7 +154,7 @@ def get_devis_lig_by_no(request,nodossier):
|
||||
results = request.dbsession.execute(query, {'societe': societe, 'no_id': no_id}).fetchall()
|
||||
return results
|
||||
|
||||
def get_docs_attaches(request, nodossier, norapport, filename):
|
||||
def get_docs_attaches(request, nodossier, norapport, nosection, filename):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
|
||||
@@ -167,15 +167,19 @@ def get_docs_attaches(request, nodossier, norapport, filename):
|
||||
|
||||
return results
|
||||
|
||||
def get_photos(request, nochantier, norapport):
|
||||
|
||||
query = "SELECT * FROM dossier_attaches WHERE nomrep = 'DOCS_ATTACHES' AND societe = 'PL' AND nochantier = :nochantier AND nodossier = :norapport ORDER BY cree_le;"
|
||||
results = request.dbsession.execute(query, {'nochantier': nochantier, 'norapport': norapport}).fetchall()
|
||||
def get_photos(request, nodossier, norapport, nosection):
|
||||
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, {'nochantier': nochantier, 'norapport': norapport, 'nosection': nosection}).fetchall()
|
||||
return results
|
||||
|
||||
def delete_photos(request, nochantier, norapport, nomfic):
|
||||
query = "DELETE FROM dossier_attaches WHERE nomrep='DOCS_ATTACHES' AND societe='PL' AND nochantier=:nochantier AND nodossier=:norapport AND nomfichier=:nomfic;"
|
||||
execute_query(request, query, {'nochantier': nochantier, 'norapport': norapport, 'nomfic': nomfic})
|
||||
def delete_photos(request, nodossier, norapport, nosection, nomfic):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
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})
|
||||
|
||||
|
||||
def update_dossier(request, nodossier, new_values):
|
||||
@@ -196,18 +200,18 @@ def update_dossier(request, nodossier, new_values):
|
||||
query = "UPDATE dem_devis SET %s WHERE societe=:societe AND no_id=:nochantier" % s
|
||||
execute_query(request, query, new_values)
|
||||
|
||||
def insert_dossier_attaches(request, nodossier, norapport, filename, filesize, user):
|
||||
def insert_dossier_attaches(request, nodossier, norapport, nosection, filename, filesize, user):
|
||||
societe = nodossier[0:2]
|
||||
nochantier = int(nodossier[3:])
|
||||
|
||||
# fichier existe ?
|
||||
item = get_docs_attaches(request, nodossier, norapport, filename)
|
||||
item = get_docs_attaches(request, nodossier, norapport, nosection, filename)
|
||||
if item:
|
||||
return
|
||||
# enregistrer dans la table dossier_attaches
|
||||
query = """INSERT INTO dossier_attaches (nomrep, societe, nochantier, nodossier, nomfichier, taillefichier, cree_le, usermaj)
|
||||
VALUES('DOCS_ATTACHES',:societe,:nochantier,:norapport,:filename,:filesize,NOW(),:user);"""
|
||||
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'filename': filename, 'filesize': filesize, 'user': user})
|
||||
query = """INSERT INTO dossier_attaches (nomrep, societe, nochantier, nodossier, nosection, nomfichier, taillefichier, cree_le, usermaj)
|
||||
VALUES('DOCS_ATTACHES',:societe,:nochantier,:norapport,:nosection,:filename,:filesize,NOW(),:user);"""
|
||||
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'nosection': nosection, 'filename': filename, 'filesize': filesize, 'user': user})
|
||||
|
||||
def get_rapport_by_no(request,nodossier,date_inter):
|
||||
societe = nodossier[0:2]
|
||||
@@ -307,3 +311,8 @@ def insert_log_nuit(request, proc, msg):
|
||||
query = "INSERT INTO t_log_nuit (proc,msg) VALUES (:proc, :msg);"
|
||||
execute_query(request, query, {'proc': proc, 'msg': msg})
|
||||
|
||||
def get_log_demandes(request, ):
|
||||
# lire le log de nuit
|
||||
query = """SELECT * FROM t_log_nuit WHERE proc = 'GENERER';"""
|
||||
results = request.dbsession.execute(query, )
|
||||
return results.fetchall()
|
||||
|
||||
Reference in New Issue
Block a user