From fc95dd4c9aac1f5ea260b4ee4a78c5039e6de3bf Mon Sep 17 00:00:00 2001 From: VictorFabreF Date: Tue, 2 Jan 2018 16:27:54 -0200 Subject: [PATCH] Fixes #1643 --- .../templates/pdf_sessao_plenaria_gerar.py | 7 +++- sapl/relatorios/views.py | 11 +++++- sapl/utils.py | 38 ++++++++++++++++++- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py b/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py index a8677c5e1..42c74b796 100644 --- a/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py +++ b/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py @@ -70,9 +70,14 @@ def paraStyle(): tmp += '\t\t\t\n' tmp += '\t\t\t\n' tmp += '\t\t\t\n' - tmp += '\t\t\t\n' tmp += '\t\t\t\n' tmp += '\t\t\n' + + tmp += '\t\t\n' + tmp += '\t\t\t\n' + tmp += '\t\t\t\n' + tmp += '\t\t\n' + tmp += '\t\t\n' tmp += '\t\t\t\n' tmp += '\t\t\n' diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index f4ffb03a0..07c2164ea 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -19,7 +19,7 @@ from sapl.sessao.models import (ExpedienteMateria, ExpedienteSessao, OrdemDia, PresencaOrdemDia, SessaoPlenaria, SessaoPlenariaPresenca) from sapl.settings import STATIC_ROOT -from sapl.utils import UF, filiacao_data +from sapl.utils import UF, filiacao_data, TrocaTag, ExtraiTag from .templates import (pdf_capa_processo_gerar, pdf_documento_administrativo_gerar, pdf_espelho_gerar, @@ -792,6 +792,15 @@ def relatorio_sessao_plenaria(request, pk): lst_votacao, lst_oradores) = get_sessao_plenaria(sessao, casa) + + for idx in range(len(lst_expedientes)): + txt_expedientes = lst_expedientes[idx]['txt_expediente'] + txt_expedientes = TrocaTag(txt_expedientes, '', 6, 6, 'expedientes') + lst_expedientes[idx]['txt_expediente'] = txt_expedientes + + + + pdf = pdf_sessao_plenaria_gerar.principal( cabecalho, rodape, diff --git a/sapl/utils.py b/sapl/utils.py index 1569cedca..0ec8e72cb 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -673,4 +673,40 @@ def get_mime_type_from_file_extension(filename): mime = 'application/vnd.oasis.opendocument.text' else: mime = "application/%s" % (ext,) - return mime \ No newline at end of file + return mime + +def ExtraiTag(texto, posicao): + for i in range(posicao, len(texto)): + if (texto[i] == '>'): + return i + 1 + + +def TrocaTag(texto, startTag, endTag, sizeStart, sizeEnd, styleName): + textoSaida = '' + insideTag = 0 + i = 0 + if texto is None or texto.strip() == '': + return texto + if '' in texto: + texto = texto.replace('', '') + texto = texto.replace('', '') + while (i < len(texto)): + shard = texto[i:i + sizeStart] + if (shard == startTag): + i = ExtraiTag(texto, i) + textoSaida += '' + insideTag = 1 + else: + if (insideTag == 1): + if (texto[i:i + sizeEnd] == endTag): + textoSaida += 'blockTable>' + insideTag = 0 + i = i + sizeEnd + else: + textoSaida += texto[i] + i = i + 1 + else: + textoSaida += texto[i] + i = i + 1 + + return textoSaida \ No newline at end of file