bug générer demande MAIF + suppression photo
This commit is contained in:
@@ -189,6 +189,12 @@ def get_photos(request, nodossier, norapport, nosection):
|
|||||||
def delete_photos(request, nodossier, norapport, nosection, nomfic):
|
def delete_photos(request, nodossier, norapport, nosection, nomfic):
|
||||||
societe = nodossier[0:2]
|
societe = nodossier[0:2]
|
||||||
nochantier = int(nodossier[3:])
|
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 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;"
|
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})
|
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'nosection': nosection, 'nomfic': nomfic})
|
||||||
|
|
||||||
|
|||||||
@@ -661,6 +661,11 @@ def rdf_view(request):
|
|||||||
return HTTPFound(location=request.route_url('dossier_view', nodossier=nodossier))
|
return HTTPFound(location=request.route_url('dossier_view', nodossier=nodossier))
|
||||||
|
|
||||||
if 'form.delete' in request.params:
|
if 'form.delete' in request.params:
|
||||||
|
# le rapport a-t-il des photos ?
|
||||||
|
if len(photos1) > 0 or len(photos2) > 0:
|
||||||
|
request.session.flash(u"Veuillez supprimer les photos avant de supprimer Le rapport.", 'warning')
|
||||||
|
return HTTPFound(location=url)
|
||||||
|
|
||||||
delete_rapport(request, norapport)
|
delete_rapport(request, norapport)
|
||||||
request.session.flash(u"Le rapport a été supprimé avec succès.", 'success')
|
request.session.flash(u"Le rapport a été supprimé avec succès.", 'success')
|
||||||
return HTTPFound(location=request.route_url('dossier_view', nodossier=nodossier))
|
return HTTPFound(location=request.route_url('dossier_view', nodossier=nodossier))
|
||||||
@@ -734,11 +739,6 @@ def delete_img(request):
|
|||||||
else:
|
else:
|
||||||
url_retour = location=request.route_url("upload_img", norapport=norapport, nosection=nosection)
|
url_retour = location=request.route_url("upload_img", norapport=norapport, nosection=nosection)
|
||||||
|
|
||||||
# supprimer le fichier
|
|
||||||
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)
|
|
||||||
|
|
||||||
delete_photos(request, nodossier, norapport, nosection, nomfic)
|
delete_photos(request, nodossier, norapport, nosection, nomfic)
|
||||||
request.session.flash(u"La photo %s a été supprimé avec succès" % (nomfic), 'success')
|
request.session.flash(u"La photo %s a été supprimé avec succès" % (nomfic), 'success')
|
||||||
return HTTPFound(url_retour)
|
return HTTPFound(url_retour)
|
||||||
@@ -1205,13 +1205,15 @@ def get_pdf_infos1(extracted_file):
|
|||||||
no_sinistre = line[:-1]
|
no_sinistre = line[:-1]
|
||||||
if line.find('Bénéficiaire des travaux :') == 0:
|
if line.find('Bénéficiaire des travaux :') == 0:
|
||||||
elt = line[:-1].split(' :')
|
elt = line[:-1].split(' :')
|
||||||
|
import pdb;pdb.set_trace()
|
||||||
if len(elt) == 1:
|
if len(elt) == 1:
|
||||||
# le nom du chantier est sur la ligne suivante
|
# le nom du chantier est sur la ligne suivante
|
||||||
line = fp.readline()
|
line = fp.readline()
|
||||||
c_nom = line[:-1]
|
c_nom = line[:-1]
|
||||||
|
c_nom = c_nom[:40] # ne prendre que 40 carac
|
||||||
else:
|
else:
|
||||||
# le nom du chantier est sur la même ligne
|
# le nom du chantier est sur la même ligne
|
||||||
c_nom = elt[1].strip()
|
c_nom = elt[1].strip()[:40]
|
||||||
line = fp.readline()
|
line = fp.readline()
|
||||||
line = fp.readline()
|
line = fp.readline()
|
||||||
line = fp.readline()
|
line = fp.readline()
|
||||||
|
|||||||
Reference in New Issue
Block a user