diff --git a/mondumas/models/dossier.py b/mondumas/models/dossier.py index 1318075..2a6e3eb 100644 --- a/mondumas/models/dossier.py +++ b/mondumas/models/dossier.py @@ -170,9 +170,9 @@ def get_docs_attaches(request, nodossier, norapport, nosection, filename): 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 + 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() + results = request.dbsession.execute(query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'nosection': nosection}).fetchall() return results def delete_photos(request, nodossier, norapport, nosection, nomfic): diff --git a/mondumas/views/dossier.py b/mondumas/views/dossier.py index f762643..941817b 100644 --- a/mondumas/views/dossier.py +++ b/mondumas/views/dossier.py @@ -381,7 +381,7 @@ def upload_img(request): request.session.flash('%s : Ce fichier est téléchargé avec succès.' % input_name, 'success') # lire tous les photos attachées - photos = get_photos(request, nodossier, norapport, nosection) + photos = get_photos(request, nodossier, int(norapport), int(nosection)) return { 'page_title': titre,