mise au point creation rdf
This commit is contained in:
@@ -48,9 +48,8 @@ class GlobalLayout(object):
|
|||||||
return is_admin
|
return is_admin
|
||||||
|
|
||||||
def isWebPage(self):
|
def isWebPage(self):
|
||||||
# get view name
|
# test view name
|
||||||
view_name = self.request.matched_route.name
|
if self.request.matched_route.name == 'rdf_rapport':
|
||||||
if view_name == 'rdf_rapport':
|
|
||||||
# oui, page PDF
|
# oui, page PDF
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -136,12 +136,16 @@ def get_devis_lig_by_no(request,nodossier):
|
|||||||
results = request.dbsession.execute(query, {'societe': societe, 'no_id': no_id}).fetchall()
|
results = request.dbsession.execute(query, {'societe': societe, 'no_id': no_id}).fetchall()
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def get_docs_attaches(request, nodossier):
|
def get_docs_attaches(request, nodossier, norapport, filename):
|
||||||
societe = nodossier[0:2]
|
societe = nodossier[0:2]
|
||||||
nochantier = int(nodossier[3:])
|
nochantier = int(nodossier[3:])
|
||||||
|
|
||||||
|
if filename == '':
|
||||||
query = "SELECT * FROM dossier_attaches WHERE nomrep = 'DOCS_ATTACHES' AND societe = :societe AND nochantier = :nochantier ORDER BY cree_le;"
|
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()
|
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
|
return results
|
||||||
|
|
||||||
@@ -172,8 +176,12 @@ def insert_dossier_attaches(request, nodossier, norapport, filename, filesize, u
|
|||||||
societe = nodossier[0:2]
|
societe = nodossier[0:2]
|
||||||
nochantier = int(nodossier[3:])
|
nochantier = int(nodossier[3:])
|
||||||
|
|
||||||
|
# fichier existe ?
|
||||||
|
item = get_docs_attaches(request, nodossier, norapport, filename)
|
||||||
|
if item:
|
||||||
|
return
|
||||||
# enregistrer dans la table dossier_attaches
|
# 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);"""
|
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})
|
execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'norapport': norapport, 'filename': filename, 'filesize': filesize, 'user': user})
|
||||||
|
|
||||||
|
|||||||
@@ -181,5 +181,4 @@
|
|||||||
width: 350px;
|
width: 350px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border: 1px solid black;
|
|
||||||
}
|
}
|
||||||
@@ -170,11 +170,11 @@
|
|||||||
<div class="panel panel-default" tal:condition="nodossier.startswith('PL')">
|
<div class="panel panel-default" tal:condition="nodossier.startswith('PL')">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<a data-toggle="collapse" data-parent="#accordion" href="#panel-documents">
|
<a data-toggle="collapse" data-parent="#accordion" href="#panel-rdf">
|
||||||
<span class="glyphicon glyphicon-plus"></span> RECHERCHE DE FUITE</a>
|
<span class="glyphicon glyphicon-plus"></span> RECHERCHE DE FUITE</a>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div id="panel-documents" class="panel-collapse collapse">
|
<div id="panel-rdf" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>
|
<p>
|
||||||
<a class="btn btn-success" role="button" href="${request.route_url('rdf_edit', nodossier=nodossier, date_inter='new')}">
|
<a class="btn btn-success" role="button" href="${request.route_url('rdf_edit', nodossier=nodossier, date_inter='new')}">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<th>Client</th>
|
<th>Client</th>
|
||||||
<th>No sinistre</th>
|
<th>No sinistre</th>
|
||||||
<th>Auteur</th>
|
<th>Auteur</th>
|
||||||
<th>Numéro</th>
|
<th>Rapport</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -252,14 +252,18 @@
|
|||||||
<br />
|
<br />
|
||||||
<h4 class="text-center text-primary">PHOTOS</h4>
|
<h4 class="text-center text-primary">PHOTOS</h4>
|
||||||
<br />
|
<br />
|
||||||
<div tal:repeat="detail photos">
|
<p tal:repeat="detail photos">
|
||||||
<img src="${docs_url}${detail.nomrep}/${detail.societe}/${nochantier}/${norapport}/${detail.nomfichier}" align="center" />
|
<img src="${docs_url}${detail.nomrep}/${detail.societe}/${nochantier}/${norapport}/${detail.nomfichier}"
|
||||||
</div>
|
width="800" align="center" />
|
||||||
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<h4 class="text-center text-primary">CONCLUSIONS</h4>
|
<h4 class="text-center text-primary">CONCLUSIONS</h4>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<br /> ${rapport.conclusions}
|
<br /> ${rapport.conclusions}
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
</div> <!-- row -->
|
</div> <!-- row -->
|
||||||
<table class="table table-condensed ">
|
<table class="table table-condensed ">
|
||||||
@@ -267,7 +271,7 @@
|
|||||||
<td width="40%">
|
<td width="40%">
|
||||||
<p>
|
<p>
|
||||||
<label>Date du rapport :</label>
|
<label>Date du rapport :</label>
|
||||||
<br />${rapport.modif_le.strftime('%d-%m-%Y')}
|
<br />${date_rapport}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<label>Etabli par :</label>
|
<label>Etabli par :</label>
|
||||||
@@ -285,8 +289,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
<br/>
|
|
||||||
<br/>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
//afficher signature
|
//afficher signature
|
||||||
|
|||||||
@@ -253,25 +253,27 @@
|
|||||||
<span class="glyphicon glyphicon-cloud-upload"></span> Ajouter une photo</a>
|
<span class="glyphicon glyphicon-cloud-upload"></span> Ajouter une photo</a>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<div class="fotorama" data-nav="thumbs">
|
<p tal:repeat="detail photos">
|
||||||
<div tal:repeat="detail photos">
|
|
||||||
<img src="${docs_url}${detail.nomrep}/${detail.societe}/${nochantier}/${norapport}/${detail.nomfichier}"
|
<img src="${docs_url}${detail.nomrep}/${detail.societe}/${nochantier}/${norapport}/${detail.nomfichier}"
|
||||||
data-caption="${detail.nomfichier}" align="center" />
|
width="800" align="center" />
|
||||||
</div>
|
</p>
|
||||||
</div>
|
|
||||||
<br />
|
<br />
|
||||||
<h4 class="text-center text-primary">CONCLUSIONS</h4>
|
<h4 class="text-center text-primary">CONCLUSIONS</h4>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<br /> ${rapport.conclusions}
|
<br /> ${rapport.conclusions}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-5">
|
||||||
<p>
|
<p>
|
||||||
Date du rapport : ${rapport.modif_le.strftime('%d-%m-%Y')}<br />
|
<label>Date du rapport :</label>
|
||||||
Etabli par ${rapport.auteur_nom}
|
<br />${date_rapport}
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<label>Etabli par :</label>
|
||||||
|
<br />${rapport.auteur_nom}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-7">
|
||||||
<label>Signature du client :</label>
|
<label>Signature du client :</label>
|
||||||
<div tal:condition="not rapport.signature_svg">
|
<div tal:condition="not rapport.signature_svg">
|
||||||
<div id="signature"></div>
|
<div id="signature"></div>
|
||||||
|
|||||||
@@ -29,21 +29,16 @@
|
|||||||
</div> <!-- row -->
|
</div> <!-- row -->
|
||||||
|
|
||||||
<h3>Photos déjà téléchargées</h3>
|
<h3>Photos déjà téléchargées</h3>
|
||||||
<div class="fotorama" data-nav="thumbs">
|
<p tal:repeat="detail photos">
|
||||||
<div tal:repeat="detail photos">
|
|
||||||
<img src="${docs_url}${detail.nomrep}/${detail.societe}/${nochantier}/${norapport}/${detail.nomfichier}"
|
<img src="${docs_url}${detail.nomrep}/${detail.societe}/${nochantier}/${norapport}/${detail.nomfichier}"
|
||||||
data-caption="${detail.nomfichier}" align="center" />
|
width="800" align="center" />
|
||||||
</div>
|
</p>
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('#uploadButton').on('click', function(){
|
$('#uploadButton').on('click', function(){
|
||||||
$('i.gly-spin').removeClass('gly-spin');
|
$('i.gly-spin').removeClass('gly-spin');
|
||||||
$('i').addClass('gly-spin');
|
$('i').addClass('gly-spin');
|
||||||
});
|
});
|
||||||
$(function () {
|
|
||||||
$('.fotorama').fotorama();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -42,9 +42,6 @@
|
|||||||
<script src="${request.static_url('mondumas:static/dist/formvalidation/js/language/fr_FR.js')}" type="text/javascript"></script>
|
<script src="${request.static_url('mondumas:static/dist/formvalidation/js/language/fr_FR.js')}" type="text/javascript"></script>
|
||||||
<!-- JSignature plugin -->
|
<!-- JSignature plugin -->
|
||||||
<script src="${request.static_url('mondumas:static/dist/jSignature/libs/jSignature.min.js')}"></script>
|
<script src="${request.static_url('mondumas:static/dist/jSignature/libs/jSignature.min.js')}"></script>
|
||||||
<!-- fotorama.css & fotorama.js. -->
|
|
||||||
<link href="http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.css" rel="stylesheet"> <!-- 3 KB -->
|
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.js"></script> <!-- 16 KB -->
|
|
||||||
|
|
||||||
<!-- Less -->
|
<!-- Less -->
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.3/less.min.js" type="text/javascript"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.3/less.min.js" type="text/javascript"></script>
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
|
||||||
xmlns:metal="http://xml.zope.org/namespaces/metal"
|
|
||||||
xmlns:tal="http://xml.zope.org/namespaces/tal"
|
|
||||||
lang="fr">
|
|
||||||
<head>
|
|
||||||
<title>${page_title}</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<img src="http://www.caes.cnrs.fr/logo.jpg" class="caes-logo" alt="CAES du CNRS" title="CAES du CNRS" />
|
|
||||||
|
|
||||||
<div metal:define-slot="content" />
|
|
||||||
|
|
||||||
<div id="footer">
|
|
||||||
<div class="well">
|
|
||||||
Siège : <a href="http://www.caes.cnrs.fr">CAES du CNRS</a> - 2, Allée Georges Méliès - 94306 Vincennes CEDEX - France
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -100,7 +100,7 @@ def dossier_view(request):
|
|||||||
# lire toutes les dossiers similaires
|
# lire toutes les dossiers similaires
|
||||||
similaires = get_similaires_byChantier(request, dossier.societe, dossier.C_NOM, dossier.C_ADR, dossier.C_CP, dossier.C_VILLE)
|
similaires = get_similaires_byChantier(request, dossier.societe, dossier.C_NOM, dossier.C_ADR, dossier.C_CP, dossier.C_VILLE)
|
||||||
# lire tous les documents attachés
|
# lire tous les documents attachés
|
||||||
docs_attaches = get_docs_attaches(request, nodossier)
|
docs_attaches = get_docs_attaches(request, nodossier, 0, '')
|
||||||
if nodossier.startswith('PL'):
|
if nodossier.startswith('PL'):
|
||||||
# lire rapport de rdf
|
# lire rapport de rdf
|
||||||
rapports = get_rapport_by_no(request, nodossier, '')
|
rapports = get_rapport_by_no(request, nodossier, '')
|
||||||
@@ -271,7 +271,7 @@ def upload_doc(request):
|
|||||||
return HTTPFound(location=request.route_url("dossier_lookup"))
|
return HTTPFound(location=request.route_url("dossier_lookup"))
|
||||||
|
|
||||||
# lire tous les documents attachés
|
# lire tous les documents attachés
|
||||||
docs_attaches = get_docs_attaches(request, nodossier)
|
docs_attaches = get_docs_attaches(request, nodossier, 0, '')
|
||||||
|
|
||||||
if 'form.submitted' in request.params:
|
if 'form.submitted' in request.params:
|
||||||
# récupère le fichier lui-même
|
# récupère le fichier lui-même
|
||||||
@@ -290,11 +290,8 @@ def upload_doc(request):
|
|||||||
filename = '%s-DD%s-%s' % (societe, nochantier, request.POST['filename'].filename)
|
filename = '%s-DD%s-%s' % (societe, nochantier, request.POST['filename'].filename)
|
||||||
# créer le répertoire du chantier s'il n'existe pas encore
|
# créer le répertoire du chantier s'il n'existe pas encore
|
||||||
path = '%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'],societe,nochantier)
|
path = '%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'],societe,nochantier)
|
||||||
try:
|
os.makedirs(path, exist_ok=True)
|
||||||
os.mkdir(path)
|
|
||||||
except OSError:
|
|
||||||
pass # ignorer erreor si déjà créé
|
|
||||||
finally:
|
|
||||||
file_path = os.path.join(path, filename)
|
file_path = os.path.join(path, filename)
|
||||||
# We first write to a temporary file to prevent incomplete files
|
# We first write to a temporary file to prevent incomplete files
|
||||||
temp_file_path = file_path + '~'
|
temp_file_path = file_path + '~'
|
||||||
@@ -320,7 +317,7 @@ def upload_doc(request):
|
|||||||
insert_dossier_attaches(request, nodossier, 0, filename, '%s Ko' % str(filesize), logged_in)
|
insert_dossier_attaches(request, nodossier, 0, filename, '%s Ko' % str(filesize), logged_in)
|
||||||
request.session.flash('%s : Ce fichier est téléchargé avec succès.' % input_name, 'success')
|
request.session.flash('%s : Ce fichier est téléchargé avec succès.' % input_name, 'success')
|
||||||
# lire tous les documents attachés
|
# lire tous les documents attachés
|
||||||
docs_attaches = get_docs_attaches(request, nodossier)
|
docs_attaches = get_docs_attaches(request, nodossier, 0, '')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'page_title': u"Télécharger un document",
|
'page_title': u"Télécharger un document",
|
||||||
@@ -367,11 +364,8 @@ def upload_img(request):
|
|||||||
|
|
||||||
# créer le répertoire du chantier s'il n'existe pas encore
|
# créer le répertoire du chantier s'il n'existe pas encore
|
||||||
path = '%s/%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'], societe, nochantier, norapport)
|
path = '%s/%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'], societe, nochantier, norapport)
|
||||||
try:
|
os.makedirs(path, exist_ok=True)
|
||||||
os.makedirs(path)
|
|
||||||
except OSError:
|
|
||||||
pass # ignorer erreor si déjà créé
|
|
||||||
finally:
|
|
||||||
file_path = os.path.join('%s/%s' % (path, filename))
|
file_path = os.path.join('%s/%s' % (path, filename))
|
||||||
# We first write to a temporary file to prevent incomplete files
|
# We first write to a temporary file to prevent incomplete files
|
||||||
temp_file_path = file_path + '~'
|
temp_file_path = file_path + '~'
|
||||||
@@ -421,7 +415,6 @@ def rdf_edit(request):
|
|||||||
if not rapport:
|
if not rapport:
|
||||||
# creer un nouveau rapport
|
# creer un nouveau rapport
|
||||||
insert_rapport(request, nodossier, logged_in)
|
insert_rapport(request, nodossier, logged_in)
|
||||||
else:
|
|
||||||
# lire le rapport
|
# lire le rapport
|
||||||
rapport = get_rapport_by_no(request, nodossier, date_inter)
|
rapport = get_rapport_by_no(request, nodossier, date_inter)
|
||||||
url = request.route_url('rdf_edit', nodossier=nodossier, date_inter=date_inter)
|
url = request.route_url('rdf_edit', nodossier=nodossier, date_inter=date_inter)
|
||||||
@@ -524,7 +517,7 @@ def rdf_list(request):
|
|||||||
else:
|
else:
|
||||||
date_rapport = ''
|
date_rapport = ''
|
||||||
|
|
||||||
d = (item.nochantier, item.date_inter.strftime('%d-%m-%Y'), '', '%s %s' % (item.C_QUALITE, item.C_NOM), item.NOMCLI, item.NOSIN,
|
d = (item.nochantier, item.date_inter.strftime('%d-%m-%Y'), date_rapport, '%s %s' % (item.C_QUALITE, item.C_NOM), item.NOMCLI, item.NOSIN,
|
||||||
item.auteur_code, item.no_id)
|
item.auteur_code, item.no_id)
|
||||||
liste.append(d)
|
liste.append(d)
|
||||||
|
|
||||||
@@ -542,17 +535,15 @@ def rdf_view(request):
|
|||||||
# lire le rapport
|
# lire le rapport
|
||||||
rapport = get_rapport_by_no_id(request, norapport)
|
rapport = get_rapport_by_no_id(request, norapport)
|
||||||
nodossier = 'PL-' + str(rapport.nochantier)
|
nodossier = 'PL-' + str(rapport.nochantier)
|
||||||
|
if rapport.date_rapport:
|
||||||
|
date_rapport = rapport.date_rapport.strftime('%d-%m-%Y')
|
||||||
|
else:
|
||||||
|
date_rapport = ''
|
||||||
|
|
||||||
# lire tous les photos attachées
|
# lire tous les photos attachées
|
||||||
photos = get_photos(request, rapport.nochantier, norapport)
|
photos = get_photos(request, rapport.nochantier, norapport)
|
||||||
|
|
||||||
if 'form.generate' in request.params:
|
if 'form.generate' in request.params:
|
||||||
# génère la page rapport
|
|
||||||
result = rdf_rapport(request)
|
|
||||||
result['main_template'] = get_renderer('../templates/layouts/pdf.pt').implementation()
|
|
||||||
htmlcontent = render('../templates/dossier/rdf_rapport.pt', result, request)
|
|
||||||
htmlcontent = htmlcontent.encode('iso8859-15')
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
'page-size': 'A4',
|
'page-size': 'A4',
|
||||||
'margin-top': '0.75in',
|
'margin-top': '0.75in',
|
||||||
@@ -561,6 +552,9 @@ def rdf_view(request):
|
|||||||
'margin-left': '0.75in',
|
'margin-left': '0.75in',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# créer le répertoire du rapport s'il n'existe pas encore
|
||||||
|
path = '%s/%s/%s/%s' % (request.registry.settings['mondumas.devfac_dir'], 'PL', rapport.nochantier, norapport)
|
||||||
|
os.makedirs(path, exist_ok=True)
|
||||||
# générer le rapport en PDF
|
# générer le rapport en PDF
|
||||||
filename = "PL-DD%s-rapport RDF no %s.PDF" % (str(rapport.nochantier), norapport)
|
filename = "PL-DD%s-rapport RDF no %s.PDF" % (str(rapport.nochantier), norapport)
|
||||||
dest = "mondumas/static/DEVFAC/DOCS_ATTACHES/PL/%s/%s" % (str(rapport.nochantier), filename)
|
dest = "mondumas/static/DEVFAC/DOCS_ATTACHES/PL/%s/%s" % (str(rapport.nochantier), filename)
|
||||||
@@ -568,12 +562,15 @@ def rdf_view(request):
|
|||||||
config = pdfkit.configuration(wkhtmltopdf="C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe")
|
config = pdfkit.configuration(wkhtmltopdf="C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe")
|
||||||
try:
|
try:
|
||||||
pdfkit.from_url(origin, dest, configuration=config, options=options)
|
pdfkit.from_url(origin, dest, configuration=config, options=options)
|
||||||
# pdfkit.from_string(htmlcontent, dest, configuration=config)
|
|
||||||
except:
|
except:
|
||||||
request.session.flash(u"Une erreur est survenue pendant la génération du PDF.", 'danger')
|
request.session.flash(u"Une erreur est survenue pendant la génération du PDF.", 'danger')
|
||||||
return HTTPFound(location=request.route_url('rdf_view', no_id=norapport))
|
return HTTPFound(location=request.route_url('rdf_view', no_id=norapport))
|
||||||
else:
|
else:
|
||||||
insert_dossier_attaches(request, nodossier, 0, filename, '160 Ko', logged_in)
|
insert_dossier_attaches(request, nodossier, 0, filename, '160 Ko', logged_in)
|
||||||
|
# si generation pdf, maj de la date du rapport
|
||||||
|
new_values = {}
|
||||||
|
new_values['date_rapport'] = date.today()
|
||||||
|
update_rapport(request, nodossier, rapport.date_inter.strftime('%Y-%m-%d'), new_values)
|
||||||
|
|
||||||
request.session.flash(u"Le rapport a été génré avec succès.", 'success')
|
request.session.flash(u"Le rapport a été génré avec succès.", 'success')
|
||||||
return HTTPFound(location=request.route_url('dossier_view', nodossier=nodossier))
|
return HTTPFound(location=request.route_url('dossier_view', nodossier=nodossier))
|
||||||
@@ -586,6 +583,7 @@ def rdf_view(request):
|
|||||||
'nodossier': nodossier,
|
'nodossier': nodossier,
|
||||||
'nochantier': rapport.nochantier,
|
'nochantier': rapport.nochantier,
|
||||||
'norapport': norapport,
|
'norapport': norapport,
|
||||||
|
'date_rapport': date_rapport,
|
||||||
'photos': photos,
|
'photos': photos,
|
||||||
'docs_url': request.static_url(request.registry.settings['mondumas.devfac_url']),
|
'docs_url': request.static_url(request.registry.settings['mondumas.devfac_url']),
|
||||||
}
|
}
|
||||||
@@ -597,6 +595,10 @@ def rdf_rapport(request):
|
|||||||
# lire le rapport
|
# lire le rapport
|
||||||
rapport = get_rapport_by_no_id(request, norapport)
|
rapport = get_rapport_by_no_id(request, norapport)
|
||||||
nodossier = 'PL-' + str(rapport.nochantier)
|
nodossier = 'PL-' + str(rapport.nochantier)
|
||||||
|
if rapport.date_rapport:
|
||||||
|
date_rapport = rapport.date_rapport.strftime('%d-%m-%Y')
|
||||||
|
else:
|
||||||
|
date_rapport = ''
|
||||||
|
|
||||||
# lire tous les photos attachées
|
# lire tous les photos attachées
|
||||||
photos = get_photos(request, rapport.nochantier, norapport)
|
photos = get_photos(request, rapport.nochantier, norapport)
|
||||||
@@ -607,6 +609,7 @@ def rdf_rapport(request):
|
|||||||
'nodossier': nodossier,
|
'nodossier': nodossier,
|
||||||
'nochantier': rapport.nochantier,
|
'nochantier': rapport.nochantier,
|
||||||
'norapport': norapport,
|
'norapport': norapport,
|
||||||
|
'date_rapport': date_rapport,
|
||||||
'photos': photos,
|
'photos': photos,
|
||||||
'docs_url': request.static_url(request.registry.settings['mondumas.devfac_url']),
|
'docs_url': request.static_url(request.registry.settings['mondumas.devfac_url']),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user