From 0cc296f6a2dbc65288db026ac5cd343fd7d152b3 Mon Sep 17 00:00:00 2001 From: Cesar Augusto de Carvalho Date: Tue, 29 Jan 2019 20:11:11 -0200 Subject: [PATCH] =?UTF-8?q?Fix=202461=20-=20Logotipo=20em=20relat=C3=B3rio?= =?UTF-8?q?s=20(#2463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix erro ao gerar pdf sem logotipo * retira ipdb e ajusta codigo --- .../templates/pdf_documento_administrativo_gerar.py | 6 ++++-- sapl/relatorios/templates/pdf_espelho_gerar.py | 6 ++++-- sapl/relatorios/templates/pdf_materia_gerar.py | 4 +++- sapl/relatorios/templates/pdf_ordem_dia_gerar.py | 7 ++++--- sapl/relatorios/templates/pdf_pauta_sessao_gerar.py | 6 ++++-- sapl/relatorios/templates/pdf_protocolo_gerar.py | 4 +++- sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py | 7 +++++-- sapl/relatorios/views.py | 3 +-- 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/sapl/relatorios/templates/pdf_documento_administrativo_gerar.py b/sapl/relatorios/templates/pdf_documento_administrativo_gerar.py index b102322ab..2dc8d363e 100755 --- a/sapl/relatorios/templates/pdf_documento_administrativo_gerar.py +++ b/sapl/relatorios/templates/pdf_documento_administrativo_gerar.py @@ -8,6 +8,7 @@ versão: 1.0 """ import time +import os from trml2pdf import parseString @@ -15,8 +16,9 @@ from trml2pdf import parseString def cabecalho(dic_cabecalho, imagem): """Gera o codigo rml do cabecalho""" tmp_data = '' - tmp_data += '\t\t\t\t\n' + if os.path.isfile(imagem): + tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t2cm 25.4cm 19cm 25.4cm\n' tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t' + \ diff --git a/sapl/relatorios/templates/pdf_espelho_gerar.py b/sapl/relatorios/templates/pdf_espelho_gerar.py index ba3cd373c..769d56790 100644 --- a/sapl/relatorios/templates/pdf_espelho_gerar.py +++ b/sapl/relatorios/templates/pdf_espelho_gerar.py @@ -7,6 +7,7 @@ versão: 1.0 """ import time +import os from trml2pdf import parseString @@ -14,8 +15,9 @@ from trml2pdf import parseString def cabecalho(dic_cabecalho, imagem): """Gera o codigo rml do cabecalho""" tmp_data = '' - tmp_data += '\t\t\t\t\n' + if os.path.isfile(imagem): + tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t2cm 25cm 19cm 25cm\n' tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t' + \ diff --git a/sapl/relatorios/templates/pdf_materia_gerar.py b/sapl/relatorios/templates/pdf_materia_gerar.py index 125d147e6..cadc6501c 100755 --- a/sapl/relatorios/templates/pdf_materia_gerar.py +++ b/sapl/relatorios/templates/pdf_materia_gerar.py @@ -7,6 +7,7 @@ versão: 1.0 """ import time +import os from trml2pdf import parseString @@ -14,7 +15,8 @@ from trml2pdf import parseString def cabecalho(dic_cabecalho, imagem): """Gera o codigo rml do cabecalho""" tmp_data = '' - tmp_data += '\t\t\t\t\n' + if os.path.isfile(imagem): + tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t2cm 25cm 19cm 25cm\n' tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t' + \ diff --git a/sapl/relatorios/templates/pdf_ordem_dia_gerar.py b/sapl/relatorios/templates/pdf_ordem_dia_gerar.py index 559a2d979..41cf8f2eb 100755 --- a/sapl/relatorios/templates/pdf_ordem_dia_gerar.py +++ b/sapl/relatorios/templates/pdf_ordem_dia_gerar.py @@ -6,8 +6,8 @@ Empresa: Interlegis versão: 1.0 """ -import os import time +import os from trml2pdf import parseString @@ -16,8 +16,9 @@ def cabecalho(dic_cabecalho, dat_ordem, imagem): """Gera o codigo rml do cabecalho""" tmp = '' - tmp += '\t\t\t\t\n' + if os.path.isfile(imagem): + tmp += '\t\t\t\t\n' tmp += '\t\t\t\t2cm 25cm 19cm 25cm\n' tmp += '\t\t\t\t\n' #tmp+='\t\t\t\t' + str(dic_cabecalho['nom_casa']) + '\n' diff --git a/sapl/relatorios/templates/pdf_pauta_sessao_gerar.py b/sapl/relatorios/templates/pdf_pauta_sessao_gerar.py index 24cd5ed4a..e570e38ea 100755 --- a/sapl/relatorios/templates/pdf_pauta_sessao_gerar.py +++ b/sapl/relatorios/templates/pdf_pauta_sessao_gerar.py @@ -4,6 +4,7 @@ versão: 1.0 """ import time +import os from trml2pdf import parseString @@ -12,8 +13,9 @@ def cabecalho(inf_basicas_dic, imagem): """ """ tmp = '' - tmp += '\t\t\t\t\n' + if os.path.isfile(imagem): + tmp += '\t\t\t\t\n' tmp += '\t\t\t\t2cm 25.4cm 19cm 25.4cm\n' tmp += '\t\t\t\t\n' tmp += '\t\t\t\t' + \ diff --git a/sapl/relatorios/templates/pdf_protocolo_gerar.py b/sapl/relatorios/templates/pdf_protocolo_gerar.py index a3fc82dd1..752f19c9a 100755 --- a/sapl/relatorios/templates/pdf_protocolo_gerar.py +++ b/sapl/relatorios/templates/pdf_protocolo_gerar.py @@ -7,6 +7,7 @@ versão: 1.0 """ import time +import os from trml2pdf import parseString @@ -14,7 +15,8 @@ from trml2pdf import parseString def cabecalho(dic_cabecalho, imagem): """Gera o codigo rml do cabecalho""" tmp_data = '' - tmp_data += '\t\t\t\t\n' + if os.path.isfile(imagem): + tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t2cm 25.4cm 19cm 25.4cm\n' tmp_data += '\t\t\t\t\n' tmp_data += '\t\t\t\t' + \ diff --git a/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py b/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py index 3a3512764..c1be7c3f9 100644 --- a/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py +++ b/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py @@ -5,6 +5,7 @@ versão: 1.0 """ import time +import os from django.template.defaultfilters import safe from django.utils.html import strip_tags @@ -18,8 +19,10 @@ def cabecalho(inf_basicas_dic, imagem): """ """ tmp = '' - tmp += '\t\t\t\t\n' + + if os.path.isfile(imagem): + tmp += '\t\t\t\t\n' tmp += '\t\t\t\t2cm 25.4cm 19cm 25.4cm\n' tmp += '\t\t\t\t\n' tmp += '\t\t\t\t' + \ diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index f4bc8cda2..aad44fc1d 100755 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -55,8 +55,7 @@ def get_cabecalho(casa): def get_imagem(casa): if casa.logotipo: return casa.logotipo.path - else: - return STATIC_ROOT + '/img/brasao_transp.gif' + return STATIC_ROOT + '/img/brasao_transp.gif' def get_rodape(casa):