mise au point creation rdf

This commit is contained in:
2019-03-25 14:20:10 +01:00
parent 22a0fd03fd
commit e408fcc9b0
11 changed files with 126 additions and 142 deletions

View File

@@ -136,12 +136,16 @@ 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):
def get_docs_attaches(request, nodossier, norapport, filename):
societe = nodossier[0:2]
nochantier = int(nodossier[3:])
query = "SELECT * FROM dossier_attaches WHERE nomrep = 'DOCS_ATTACHES' AND societe = :societe AND nochantier = :nochantier ORDER BY cree_le;"
results = request.dbsession.execute(query, {'societe': societe, 'nochantier': nochantier}).fetchall()
if filename == '':
query = "SELECT * FROM dossier_attaches WHERE nomrep = 'DOCS_ATTACHES' AND societe = :societe AND nochantier = :nochantier ORDER BY cree_le;"
else:
query = """SELECT * FROM dossier_attaches WHERE nomrep = 'DOCS_ATTACHES' AND societe = :societe AND nochantier = :nochantier
AND nodossier = :norapport AND nomfichier = :filename ORDER BY cree_le;"""
results = request.dbsession.execute(query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'filename': filename}).fetchall()
return results
@@ -172,8 +176,12 @@ def insert_dossier_attaches(request, nodossier, norapport, filename, filesize, u
societe = nodossier[0:2]
nochantier = int(nodossier[3:])
# fichier existe ?
item = get_docs_attaches(request, nodossier, norapport, filename)
if item:
return
# enregistrer dans la table dossier_attaches
query = """REPLACE INTO dossier_attaches (nomrep, societe, nochantier, nodossier, nomfichier, taillefichier, cree_le, usermaj)
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})