Commit 640f095e7ffb32116866aaf51a92dd0f50a0888c

Authored by Thiago Farias
1 parent cda4f9ab

Sprint 1 Release 5 - Primeiro commit

PENControlador.php
... ... @@ -54,6 +54,9 @@ class PENControlador implements ISeiControlador {
54 54 case 'pen_procedimento_estado':
55 55 require_once dirname(__FILE__) . '/pen_procedimento_estado.php';
56 56 return true;
  57 +
  58 +
  59 +
57 60 }
58 61  
59 62 return false;
... ...
PENIntegracao.php
... ... @@ -206,6 +206,33 @@ class PENIntegracao extends SeiIntegracao {
206 206 case 'pen_procedimento_estado':
207 207 require_once dirname(__FILE__) . '/pen_procedimento_estado.php';
208 208 return true;
  209 +
  210 + // Mapeamento de Hipóteses Legais de Envio
  211 + case 'pen_map_hipotese_legal_enviado_cadastrar':
  212 + case 'pen_map_hipotese_legal_enviado_visualizar':
  213 + require_once dirname(__FILE__) . '/pen_map_hipotese_legal_enviado_cadastrar.php';
  214 + return true;
  215 +
  216 + case 'pen_map_hipotese_legal_enviado_listar':
  217 + case 'pen_map_hipotese_legal_enviado_excluir':
  218 + require_once dirname(__FILE__) . '/pen_map_hipotese_legal_enviado_listar.php';
  219 + return true;
  220 +
  221 + // Mapeamento de Hipóteses Legais de Recebimento
  222 + case 'pen_map_hipotese_legal_recebido_cadastrar':
  223 + case 'pen_map_hipotese_legal_recebido_visualizar':
  224 + require_once dirname(__FILE__) . '/pen_map_hipotese_legal_recebido_cadastrar.php';
  225 + return true;
  226 +
  227 + case 'pen_map_hipotese_legal_recebido_listar':
  228 + case 'pen_map_hipotese_legal_recebido_excluir':
  229 + require_once dirname(__FILE__) . '/pen_map_hipotese_legal_recebido_listar.php';
  230 + return true;
  231 +
  232 + case 'pen_map_hipotese_legal_padrao_cadastrar':
  233 + case 'pen_map_hipotese_legal_padrao_visualizar':
  234 + require_once dirname(__FILE__) . '/pen_map_hipotese_legal_padrao_cadastrar.php';
  235 + return true;
209 236 }
210 237  
211 238 return false;
... ...
bd/PenHipoteseLegalBD.php 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../../SEI.php';
  4 +
  5 +/**
  6 + * Description of PenHipoteseLegalBD
  7 + *
  8 + * @author Join Tecnologia
  9 + */
  10 +class PenHipoteseLegalBD extends InfraBD {
  11 +
  12 +}
... ...
bd/PenParametroBD.php 0 → 100644
... ... @@ -0,0 +1,59 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../../SEI.php';
  4 +
  5 +/**
  6 + * Classe gererica de persistncia com o banco de dados
  7 + *
  8 + * @author Join Tecnologia
  9 + */
  10 +class PenParametroBD extends InfraBD {
  11 +
  12 + public function setValor($strNome, $strValor) {
  13 +
  14 + $sql = '';
  15 + $sql .= ' SELECT count(*) as existe';
  16 + $sql .= ' FROM md_pen_parametro ';
  17 + $sql .= ' WHERE nome=' . $this->getObjInfraIBanco()->formatarGravacaoStr($strNome);
  18 +
  19 + $rs = $this->getObjInfraIBanco()->consultarSql($sql);
  20 +
  21 + if ($rs[0]['existe'] == 0) {
  22 +
  23 + if (strlen($strNome) > 100) {
  24 + throw new InfraException('Nome do parmetro possui tamanho superior a 100 caracteres.');
  25 + }
  26 +
  27 + $sql = '';
  28 + $sql .= ' INSERT INTO infra_parametro (nome,valor)';
  29 + $sql .= ' VALUES ';
  30 + $sql .= ' (' . $this->getObjInfraIBanco()->formatarGravacaoStr($strNome) . ',' . $this->getObjInfraIBanco()->formatarGravacaoStr($strValor) . ')';
  31 +
  32 + } else {
  33 + $sql = '';
  34 + $sql .= ' UPDATE infra_parametro ';
  35 + $sql .= ' SET valor = ' . $this->getObjInfraIBanco()->formatarGravacaoStr($strValor);
  36 + $sql .= ' WHERE nome = ' . $this->getObjInfraIBanco()->formatarGravacaoStr($strNome);
  37 + }
  38 +
  39 + $ret = $this->getObjInfraIBanco()->executarSql($sql);
  40 +
  41 + return $ret;
  42 + }
  43 +
  44 + public function isSetValor($strNome) {
  45 +
  46 + $sql = '';
  47 + $sql .= ' SELECT valor';
  48 + $sql .= ' FROM md_pen_parametro ';
  49 + $sql .= ' WHERE nome = ' . $this->getObjInfraIBanco()->formatarGravacaoStr($strNome);
  50 +
  51 + $rs = $this->getObjInfraIBanco()->consultarSql($sql);
  52 +
  53 + if (count($rs) == 0) {
  54 + return false;
  55 + }
  56 +
  57 + return true;
  58 + }
  59 +}
... ...
dto/PenHipoteseLegalDTO.php 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__).'/../../../SEI.php';
  4 +/**
  5 + * DTO de cadastro do Hipotese Legal no Barramento
  6 + *
  7 + * @author Join Tecnologia
  8 + */
  9 +
  10 +class PenHipoteseLegalDTO extends InfraDTO {
  11 +
  12 + public function getStrNomeTabela() {
  13 + return 'md_pen_hipotese_legal';
  14 + }
  15 +
  16 + public function montar() {
  17 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal', 'id_hipotese_legal');
  18 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Nome', 'nome');
  19 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Ativo', 'sin_ativo');
  20 +
  21 + $this->configurarPK('IdHipoteseLegal',InfraDTO::$TIPO_PK_SEQUENCIAL);
  22 +
  23 + //$this->configurarExclusaoLogica('Ativo', 'N');
  24 + }
  25 +}
... ...
dto/PenParametroDTO.php 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__).'/../../../SEI.php';
  4 +
  5 +/**
  6 + * Data Transfer Object de parmtros do mdulo PEN
  7 + *
  8 + * @author Join Tecnologia
  9 + */
  10 +class PenParametroDTO extends InfraDTO {
  11 +
  12 + public function getStrNomeTabela() {
  13 +
  14 + return 'md_pen_parametro';
  15 + }
  16 +
  17 + public function montar() {
  18 +
  19 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Nome', 'nome');
  20 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Valor', 'valor');
  21 +
  22 + $this->configurarPK('Nome',InfraDTO::$TIPO_PK_INFORMADO);
  23 + }
  24 +}
... ...
dto/PenRelHipoteseLegalDTO.php 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +<?
  2 +require_once dirname(__FILE__).'/../../../SEI.php';
  3 +/**
  4 + * DTO de cadastro do Hipotese Legal no Barramento
  5 + *
  6 + * @author Join Tecnologia
  7 + */
  8 +class PenRelHipoteseLegalDTO extends InfraDTO {
  9 +
  10 + public function getStrNomeTabela() {
  11 + return 'md_pen_rel_hipotese_legal';
  12 + }
  13 +
  14 + public function montar() {
  15 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdMap', 'id_mapeamento');
  16 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal', 'id_hipotese_legal');
  17 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdBarramento', 'id_hipotese_legal_pen');
  18 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Tipo', 'tipo');
  19 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Ativo', 'sin_ativo');
  20 +
  21 + $this->configurarPK('IdMap',InfraDTO::$TIPO_PK_SEQUENCIAL);
  22 +
  23 + //$this->configurarExclusaoLogica('Ativo', 'N');
  24 + }
  25 +}
... ...
pen_map_hipotese_legal_enviado_cadastrar.php 0 → 100644
... ... @@ -0,0 +1,221 @@
  1 +<?php
  2 +/**
  3 + *
  4 + * @author Join Tecnologia
  5 + */
  6 +
  7 +require_once dirname(__FILE__) . '/../../SEI.php';
  8 +
  9 +session_start();
  10 +
  11 +define('PEN_RECURSO_ATUAL', 'pen_map_hipotese_legal_enviado_cadastrar');
  12 +define('PEN_RECURSO_BASE', 'pen_map_hipotese_legal_enviado');
  13 +define('PEN_PAGINA_TITULO', 'Mapeamento de Hipóteses Legais de Envio');
  14 +define('PEN_PAGINA_GET_ID', 'id_mapeamento');
  15 +
  16 +
  17 +$objPagina = PaginaSEI::getInstance();
  18 +$objBanco = BancoSEI::getInstance();
  19 +$objSessao = SessaoSEI::getInstance();
  20 +
  21 +
  22 +try {
  23 +
  24 + $objBanco->abrirConexao();
  25 +
  26 + $objSessao->validarLink();
  27 + $objSessao->validarPermissao(PEN_RECURSO_ATUAL);
  28 +
  29 + $arrComandos = array();
  30 +
  31 + $bolSomenteLeitura = false;
  32 +
  33 + switch ($_GET['acao']) {
  34 + case PEN_RECURSO_BASE.'_cadastrar':
  35 + $arrComandos[] = '<button type="submit" id="btnSalvar" value="Salvar" class="infraButton"><span class="infraTeclaAtalho">S</span>alvar</button>';
  36 + $arrComandos[] = '<button type="button" id="btnCancelar" value="Cancelar" onclick="location.href=\'' . $objPagina->formatarXHTML($objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem=' . $_GET['acao'])) . '\';" class="infraButton">Cancelar</button>';
  37 +
  38 + if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])){
  39 + $strTitulo = sprintf('Editar %s', PEN_PAGINA_TITULO);
  40 + }
  41 + else {
  42 + $strTitulo = sprintf('Novo %s', PEN_PAGINA_TITULO);
  43 + }
  44 + break;
  45 +
  46 + case PEN_RECURSO_BASE.'_visualizar':
  47 + $arrComandos[] = '<button type="button" name="btnFechar" value="Fechar" class="infraButton" onclick="location.href=\'' . $objPagina->formatarXHTML($objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem=' . $_GET['acao'])) . '\';">Fechar</button>';
  48 + $bolSomenteLeitura = true;
  49 + $strTitulo = sprintf('Consultar %s', PEN_PAGINA_TITULO);
  50 + break;
  51 +
  52 +
  53 + default:
  54 + throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida.");
  55 + }
  56 +
  57 + $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN();
  58 +
  59 + //--------------------------------------------------------------------------
  60 + // Ao por POST esta salvando o formulrio
  61 + if(strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
  62 +
  63 + if(!array_key_exists('id_hipotese_legal', $_POST) || empty($_POST['id_hipotese_legal'])) {
  64 + throw new InfraException('Nenhuma "Espécie Documental" foi selecionada');
  65 + }
  66 +
  67 + if(!array_key_exists('id_barramento', $_POST) || empty($_POST['id_barramento'])) {
  68 + throw new InfraException('Nenhum "Tipo de Documento" foi selecionado');
  69 + }
  70 +
  71 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  72 + $objPenRelHipoteseLegalDTO->setNumIdHipoteseLegal($_POST['id_hipotese_legal']);
  73 + $objPenRelHipoteseLegalDTO->setNumIdBarramento($_POST['id_barramento']);
  74 + $objPenRelHipoteseLegalDTO->setStrTipo('E');// Enviado
  75 +
  76 + $numIdMapeamento = 0;
  77 + if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])) {
  78 + $objPenRelHipoteseLegalDTO->setDblIdMap($_GET[PEN_PAGINA_GET_ID]);
  79 + $mapeamento = $objPenRelHipoteseLegalRN->alterar($objPenRelHipoteseLegalDTO);
  80 + $numIdMapeamento = $_GET[PEN_PAGINA_GET_ID];
  81 + }
  82 + else {
  83 + $mapeamento = $objPenRelHipoteseLegalRN->cadastrar($objPenRelHipoteseLegalDTO);
  84 + $numIdMapeamento = $mapeamento->getDblIdMap();
  85 + }
  86 +
  87 + header('Location: '.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem='.$_GET['acao'].'&id_mapeamento='.$numIdMapeamento.PaginaSEI::getInstance()->montarAncora($numIdMapeamento)));
  88 + exit(0);
  89 + }
  90 + // Ao por GET + ID esta carregando o formulrio
  91 + else if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])){
  92 +
  93 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  94 + $objPenRelHipoteseLegalDTO->setDblIdMap($_GET[PEN_PAGINA_GET_ID]);
  95 + $objPenRelHipoteseLegalDTO->retTodos();
  96 +
  97 + $objEspecieDocumentalBD = new GenericoBD(BancoSEI::getInstance());
  98 + $objPenRelHipoteseLegalDTO = $objEspecieDocumentalBD->consultar($objPenRelHipoteseLegalDTO);
  99 + }
  100 +
  101 + if(empty($objPenRelHipoteseLegalDTO)){
  102 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  103 + $objPenRelHipoteseLegalDTO->setNumIdHipoteseLegal(0);
  104 + $objPenRelHipoteseLegalDTO->setNumIdBarramento(0);
  105 + }
  106 +
  107 +
  108 + if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])) {
  109 + $objPenRelHipoteseLegalDTO->setDblIdMap($_GET[PEN_PAGINA_GET_ID]);
  110 + }
  111 +
  112 + //--------------------------------------------------------------------------
  113 + // Auto-Complete
  114 + //--------------------------------------------------------------------------
  115 + // Mapeamento da hipotese legal do local j utilizados
  116 + $arrNumIdHipoteseLegal = $objPenRelHipoteseLegalRN->getIdHipoteseLegalEmUso($objPenRelHipoteseLegalDTO, 'E');
  117 +
  118 + // Mapeamento da hipotese legal local
  119 + $objHipoteseLegalDTO = new HipoteseLegalDTO();
  120 + if(!empty($arrNumIdHipoteseLegal)) {
  121 + // Remove os que j esto em uso
  122 + $objHipoteseLegalDTO->setNumIdHipoteseLegal($arrNumIdHipoteseLegal, InfraDTO::$OPER_NOT_IN);
  123 + }
  124 + $objHipoteseLegalDTO->setStrStaNivelAcesso(ProtocoloRN::$NA_RESTRITO); //Restrito
  125 + $objHipoteseLegalDTO->setStrSinAtivo('S');
  126 + $objHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  127 + $objHipoteseLegalDTO->retNumIdHipoteseLegal();
  128 + $objHipoteseLegalDTO->retStrNome();
  129 +
  130 + $objHipoteseLegalRN = new HipoteseLegalRN();
  131 + $arrMapIdHipoteseLegal = InfraArray::converterArrInfraDTO($objHipoteseLegalRN->listar($objHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  132 +
  133 + // Mapeamento da hipotese legal remota
  134 + $objPenHipoteseLegalDTO = new PenHipoteseLegalDTO();
  135 + $objPenHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  136 + $objPenHipoteseLegalDTO->retNumIdHipoteseLegal();
  137 + $objPenHipoteseLegalDTO->retStrNome();
  138 +
  139 + $objPenHipoteseLegalRN = new PenHipoteseLegalRN();
  140 + $arrMapIdBarramento = InfraArray::converterArrInfraDTO($objPenHipoteseLegalRN->listar($objPenHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  141 + //--------------------------------------------------------------------------
  142 +}
  143 +catch (InfraException $e) {
  144 + $objPagina->processarExcecao($e);
  145 +}
  146 +catch(Exception $e) {
  147 + $objPagina->processarExcecao($e);
  148 +}
  149 +
  150 +// View
  151 +ob_clean();
  152 +
  153 +$objPagina->montarDocType();
  154 +$objPagina->abrirHtml();
  155 +$objPagina->abrirHead();
  156 +$objPagina->montarMeta();
  157 +$objPagina->montarTitle(':: ' . $objPagina->getStrNomeSistema() . ' - ' . $strTitulo . ' ::');
  158 +$objPagina->montarStyle();
  159 +?>
  160 +<style type="text/css">
  161 +
  162 +.input-label-first{position:absolute;left:0%;top:0%;width:25%; color: #666!important}
  163 +.input-field-first{position:absolute;left:0%;top:15%;width:25%}
  164 +
  165 +.input-label-third {position:absolute;left:0%;top:40%;width:25%; color:#666!important}
  166 +.input-field-third {position:absolute;left:0%;top:55%;width:25%;}
  167 +
  168 +</style>
  169 +<?php $objPagina->montarJavaScript(); ?>
  170 +<script type="text/javascript">
  171 +
  172 +function inicializar(){
  173 +
  174 +
  175 +}
  176 +
  177 +function onSubmit() {
  178 +
  179 + var form = jQuery('#<?php print PEN_RECURSO_BASE; ?>_form');
  180 + var field = jQuery('select[name=id_hipotese_legal]', form);
  181 +
  182 + if(field.val() === 'null'){
  183 + alert('Nenhuma "Hipótese Legal - SEI <?php print $objSessao->getStrSiglaOrgaoUnidadeAtual(); ?>" foi selecionada');
  184 + field.focus();
  185 + return false;
  186 + }
  187 +
  188 + field = jQuery('select[name=id_barramento]', form);
  189 +
  190 + if(field.val() === 'null'){
  191 + alert('Nenhum "Hipótese Legal - Tramitação PEN" foi selecionado');
  192 + field.focus();
  193 + return false;
  194 + }
  195 +}
  196 +
  197 +</script>
  198 +<?php
  199 +$objPagina->fecharHead();
  200 +$objPagina->abrirBody($strTitulo,'onload="inicializar();"');
  201 +?>
  202 +<form id="<?php print PEN_RECURSO_BASE; ?>_form" onsubmit="return onSubmit();" method="post" action="<?php //print $objSessaoSEI->assinarLink($strProprioLink); ?>">
  203 + <?php $objPagina->montarBarraComandosSuperior($arrComandos); ?>
  204 + <?php $objPagina->montarAreaValidacao(); ?>
  205 + <?php $objPagina->abrirAreaDados('12em'); ?>
  206 +
  207 + <label for="id_hipotese_legal" class="infraLabelObrigatorio input-label-first">Hipótese Legal - SEI <?php print $objSessao->getStrSiglaOrgaoUnidadeAtual(); ?>:</label>
  208 +
  209 + <select name="id_hipotese_legal" class="infraSelect input-field-first"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  210 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objPenRelHipoteseLegalDTO->getNumIdHipoteseLegal(), $arrMapIdHipoteseLegal); ?>
  211 + </select>
  212 +
  213 + <label for="id_barramento" class="infraLabelObrigatorio input-label-third">Hipótese Legal - Tramitação PEN:</label>
  214 + <select name="id_barramento" class="infraSelect input-field-third"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  215 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objPenRelHipoteseLegalDTO->getNumIdBarramento(), $arrMapIdBarramento); ?>
  216 + </select>
  217 +
  218 + <?php print $objPagina->fecharAreaDados(); ?>
  219 +</form>
  220 +<?php $objPagina->fecharBody(); ?>
  221 +<?php $objPagina->fecharHtml(); ?>
... ...
pen_map_hipotese_legal_enviado_listar.php 0 → 100644
... ... @@ -0,0 +1,385 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../SEI.php';
  4 +
  5 +/**
  6 + * Consulta os logs do estado do procedimento ao ser expedido
  7 + *
  8 + * @author Join Tecnologia
  9 + */
  10 +
  11 +session_start();
  12 +
  13 +define('PEN_RECURSO_ATUAL', 'pen_map_hipotese_legal_enviado_listar');
  14 +define('PEN_RECURSO_BASE', 'pen_map_hipotese_legal_enviado');
  15 +define('PEN_PAGINA_TITULO', 'Mapeamento de Hipóteses Legais de Envio');
  16 +define('PEN_PAGINA_GET_ID', 'id_mapeamento');
  17 +
  18 +
  19 +$objPagina = PaginaSEI::getInstance();
  20 +$objBanco = BancoSEI::getInstance();
  21 +$objSessao = SessaoSEI::getInstance();
  22 +$objDebug = InfraDebug::getInstance();
  23 +
  24 +
  25 +try {
  26 +
  27 + $objDebug->setBolLigado(false);
  28 + $objDebug->setBolDebugInfra(true);
  29 + $objDebug->limpar();
  30 +
  31 + $objSessao->validarLink();
  32 + $objSessao->validarPermissao(PEN_RECURSO_ATUAL);
  33 +
  34 + $objBanco->abrirConexao();
  35 +
  36 +
  37 + //--------------------------------------------------------------------------
  38 + // Ações
  39 + if(array_key_exists('acao', $_GET)) {
  40 +
  41 + $arrParam = array_merge($_GET, $_POST);
  42 +
  43 + switch($_GET['acao']) {
  44 +
  45 + case PEN_RECURSO_BASE.'_excluir':
  46 +
  47 + if(array_key_exists('hdnInfraItensSelecionados', $arrParam) && !empty($arrParam['hdnInfraItensSelecionados'])) {
  48 +
  49 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  50 + $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN();
  51 +
  52 + if(is_array($arrParam['hdnInfraItensSelecionados'])) {
  53 +
  54 + foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) {
  55 +
  56 + $objPenRelHipoteseLegalDTO->setDblIdMap($dblIdMap);
  57 + $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO);
  58 + }
  59 + }
  60 + else {
  61 +
  62 + $objPenRelHipoteseLegalDTO->setDblIdMap($arrParam['hdnInfraItensSelecionados']);
  63 + $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO);
  64 + }
  65 +
  66 + $objPagina->adicionarMensagem(sprintf('%s foi excluido com sucesso.', PEN_PAGINA_TITULO), InfraPagina::$TIPO_MSG_AVISO);
  67 +
  68 + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem']));
  69 + exit(0);
  70 + }
  71 + else {
  72 +
  73 + throw new InfraException('Nenhum Registro foi selecionado para executar esta ação');
  74 + }
  75 + break;
  76 +
  77 + case PEN_RECURSO_BASE.'_desativar':
  78 +
  79 + if(array_key_exists('hdnInfraItensSelecionados', $arrParam) && !empty($arrParam['hdnInfraItensSelecionados'])) {
  80 +
  81 + PenRelHipoteseLegalRN::mudarEstado(explode(',', $arrParam['hdnInfraItensSelecionados']), 'N');
  82 +
  83 + $objPagina->adicionarMensagem('Desativado com sucesso.', InfraPagina::$TIPO_MSG_AVISO);
  84 +
  85 + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem']));
  86 + exit(0);
  87 + }
  88 + else {
  89 +
  90 + throw new InfraException('Nenhum Registro foi selecionado para executar esta ação');
  91 + }
  92 + break;
  93 +
  94 + case PEN_RECURSO_BASE.'_ativar':
  95 + if(array_key_exists('hdnInfraItensSelecionados', $arrParam) && !empty($arrParam['hdnInfraItensSelecionados'])) {
  96 +
  97 + PenRelHipoteseLegalRN::mudarEstado(explode(',', $arrParam['hdnInfraItensSelecionados']), 'S');
  98 +
  99 + $objPagina->adicionarMensagem('Ativado com sucesso.', InfraPagina::$TIPO_MSG_AVISO);
  100 +
  101 + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem']));
  102 + exit(0);
  103 + }
  104 + break;
  105 +
  106 + case PEN_RECURSO_BASE.'_listar':
  107 + // Ação padrão desta tela
  108 + break;
  109 +
  110 + default:
  111 + throw new InfraException('Ação não permitida nesta tela');
  112 +
  113 + }
  114 + }
  115 + //--------------------------------------------------------------------------
  116 +
  117 + $arrComandos = array();
  118 + $arrComandos[] = '<button type="button" accesskey="P" onclick="onClickBtnPesquisar();" id="btnPesquisar" value="Pesquisar" class="infraButton">Pesquisar</button>';
  119 + $arrComandos[] = '<button type="button" value="Novo" onclick="onClickBtnNovo()" class="infraButton">Novo</button>';
  120 + //$arrComandos[] = '<button type="button" value="Ativar" onclick="onClickBtnAtivar()" class="infraButton">Ativar</button>';
  121 + //$arrComandos[] = '<button type="button" value="Desativar" onclick="onClickBtnDesativar()" class="infraButton">Desativar</button>';
  122 + $arrComandos[] = '<button type="button" value="Excluir" onclick="onClickBtnExcluir()" class="infraButton">Excluir</button>';
  123 + $arrComandos[] = '<button type="button" accesskey="I" id="btnImprimir" value="Imprimir" onclick="infraImprimirTabela();" class="infraButton">Imprimir</button>';
  124 +
  125 + //--------------------------------------------------------------------------
  126 + // DTO de paginao
  127 +
  128 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  129 + $objPenRelHipoteseLegalDTO->setStrTipo('E');
  130 + $objPenRelHipoteseLegalDTO->retTodos();
  131 + //--------------------------------------------------------------------------
  132 + // Filtragem
  133 + if(array_key_exists('id_barramento', $_POST) && (!empty($_POST['id_barramento']) && $_POST['id_barramento'] !== 'null')) {
  134 + $objPenRelHipoteseLegalDTO->setNumIdBarramento($_POST['id_barramento']);
  135 + }
  136 +
  137 + if(array_key_exists('id_hipotese_legal', $_POST) && (!empty($_POST['id_hipotese_legal']) && $_POST['id_barramento'] !== 'null')) {
  138 + $objPenRelHipoteseLegalDTO->setNumIdHipoteseLegal($_POST['id_hipotese_legal']);
  139 + }
  140 +
  141 + $objFiltroDTO = clone $objPenRelHipoteseLegalDTO;
  142 +
  143 + if(!$objFiltroDTO->isSetNumIdBarramento()) {
  144 + $objFiltroDTO->setNumIdBarramento('');
  145 + }
  146 +
  147 + if(!$objFiltroDTO->isSetNumIdHipoteseLegal()) {
  148 + $objFiltroDTO->setNumIdHipoteseLegal('');
  149 + }
  150 + //--------------------------------------------------------------------------
  151 + $objGenericoBD = new GenericoBD($objBanco);
  152 +
  153 + // Mapeamento da hipotese legal remota
  154 + $objPenHipoteseLegalDTO = new PenHipoteseLegalDTO();
  155 + $objPenHipoteseLegalDTO->setDistinct(true);
  156 + $objPenHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  157 + $objPenHipoteseLegalDTO->retNumIdHipoteseLegal();
  158 + $objPenHipoteseLegalDTO->retStrNome();
  159 +
  160 + $objPenHipoteseLegalRN = new PenHipoteseLegalRN();
  161 + $arrMapIdBarramento = InfraArray::converterArrInfraDTO($objPenHipoteseLegalRN->listar($objPenHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  162 +
  163 + // Mapeamento da hipotese legal local
  164 + $objHipoteseLegalDTO = new HipoteseLegalDTO();
  165 + $objHipoteseLegalDTO->setDistinct(true);
  166 + $objHipoteseLegalDTO->setStrStaNivelAcesso(ProtocoloRN::$NA_RESTRITO); //Restrito
  167 + $objHipoteseLegalDTO->setStrSinAtivo('S');
  168 + $objHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  169 + $objHipoteseLegalDTO->retNumIdHipoteseLegal();
  170 + $objHipoteseLegalDTO->retStrNome();
  171 +
  172 + $objHipoteseLegalRN = new HipoteseLegalRN();
  173 + $arrMapIdHipoteseLegal = InfraArray::converterArrInfraDTO($objHipoteseLegalRN->listar($objHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  174 + //--------------------------------------------------------------------------
  175 + //
  176 + //$objPagina->prepararOrdenacao($objPenRelHipoteseLegalDTO, 'IdMapeamento', InfraDTO::$TIPO_ORDENACAO_ASC);
  177 + $objPagina->prepararPaginacao($objPenRelHipoteseLegalDTO);
  178 +
  179 + $arrObjPenRelHipoteseLegalDTO = $objGenericoBD->listar($objPenRelHipoteseLegalDTO);
  180 +
  181 + $objPagina->processarPaginacao($objPenRelHipoteseLegalDTO);
  182 +
  183 + $numRegistros = count($arrObjPenRelHipoteseLegalDTO);
  184 +
  185 + if(!empty($arrObjPenRelHipoteseLegalDTO)){
  186 +
  187 + $strResultado = '';
  188 +
  189 + $strResultado .= '<table width="99%" class="infraTable">'."\n";
  190 + $strResultado .= '<caption class="infraCaption">'.$objPagina->gerarCaptionTabela(PEN_PAGINA_TITULO, $numRegistros).'</caption>';
  191 +
  192 + $strResultado .= '<tr>';
  193 + $strResultado .= '<th class="infraTh" width="1%">'.$objPagina->getThCheck().'</th>'."\n";
  194 + $strResultado .= '<th class="infraTh" width="35%">Hipótese Legal - SEI '.$objSessao->getStrSiglaOrgaoUnidadeAtual().'</th>'."\n";
  195 + $strResultado .= '<th class="infraTh" width="35%">Hipótese Legal - Tramitação PEN</th>'."\n";
  196 + $strResultado .= '<th class="infraTh" width="14%">Ações</th>'."\n";
  197 + $strResultado .= '</tr>'."\n";
  198 + $strCssTr = '';
  199 +
  200 + $index = 0;
  201 + foreach($arrObjPenRelHipoteseLegalDTO as $objPenRelHipoteseLegalDTO) {
  202 +
  203 + $strCssTr = ($strCssTr == 'infraTrClara') ? 'infraTrEscura' : 'infraTrClara';
  204 +
  205 + $strResultado .= '<tr class="'.$strCssTr.'">';
  206 + $strResultado .= '<td>'.$objPagina->getTrCheck($index, $objPenRelHipoteseLegalDTO->getDblIdMap(), '').'</td>';
  207 + $strResultado .= '<td>'.$arrMapIdHipoteseLegal[$objPenRelHipoteseLegalDTO->getNumIdHipoteseLegal()].'</td>';
  208 + $strResultado .= '<td>'.$arrMapIdBarramento[$objPenRelHipoteseLegalDTO->getNumIdBarramento()].'</td>';
  209 + $strResultado .= '<td align="center">';
  210 +
  211 + //$strResultado .= '<a href="'.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_visualizar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&'.PEN_PAGINA_GET_ID.'='.$objPenRelHipoteseLegalDTO->getDblIdMap()).'"><img src="imagens/consultar.gif" title="Consultar Mapeamento" alt="Consultar Mapeamento" class="infraImg"></a>';
  212 + if($objSessao->verificarPermissao('pen_map_hipotese_legal_enviado_alterar')) {
  213 + $strResultado .= '<a href="'.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_cadastrar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&'.PEN_PAGINA_GET_ID.'='.$objPenRelHipoteseLegalDTO->getDblIdMap()).'"><img src="imagens/alterar.gif" title="Alterar Mapeamento" alt="Alterar Mapeamento" class="infraImg"></a>';
  214 + }
  215 +
  216 + if($objSessao->verificarPermissao('pen_map_hipotese_legal_enviado_excluir')) {
  217 + $strResultado .= '<a href="#" onclick="onCLickLinkDelete(\''.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_excluir&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&hdnInfraItensSelecionados='.$objPenRelHipoteseLegalDTO->getDblIdMap()).'\', this)"><img src="imagens/excluir.gif" title="Excluir Mapeamento" alt="Excluir Mapeamento" class="infraImg"></a>';
  218 + }
  219 +
  220 + $strResultado .= '</td>';
  221 + $strResultado .= '</tr>'."\n";
  222 +
  223 + $index++;
  224 + }
  225 + $strResultado .= '</table>';
  226 + }
  227 +}
  228 +catch(InfraException $e){
  229 +
  230 + print '<pre>';
  231 + print_r($e);
  232 + print '</pre>';
  233 + exit(0);
  234 + //$objPagina->processarExcecao($e);
  235 +}
  236 +
  237 +
  238 +$objPagina->montarDocType();
  239 +$objPagina->abrirHtml();
  240 +$objPagina->abrirHead();
  241 +$objPagina->montarMeta();
  242 +$objPagina->montarTitle(':: '.$objPagina->getStrNomeSistema().' - '.PEN_PAGINA_TITULO.' ::');
  243 +$objPagina->montarStyle();
  244 +?>
  245 +<style type="text/css">
  246 +
  247 +.input-label-first{position:absolute;left:0%;top:0%;width:25%; color: #666!important}
  248 +.input-field-first{position:absolute;left:0%;top:15%;width:25%}
  249 +
  250 +.input-label-second{position:absolute;left:30%;top:0%;width:25%; color: #666!important}
  251 +.input-field-second{position:absolute;left:30%;top:15%;width:25%;}
  252 +
  253 +.input-label-third {position:absolute;left:0%;top:40%;width:25%; color:#666!important}
  254 +.input-field-third {position:absolute;left:0%;top:55%;width:25%;}
  255 +
  256 +</style>
  257 +<?php $objPagina->montarJavaScript(); ?>
  258 +<script type="text/javascript">
  259 +
  260 +function inicializar(){
  261 +
  262 + infraEfeitoTabelas();
  263 +
  264 +}
  265 +
  266 +function onClickBtnPesquisar(){
  267 + document.getElementById('frmAcompanharEstadoProcesso').action='<?php print $objSessao->assinarLink('controlador.php?acao='.$_GET['acao'].'&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao_retorno']); ?>';
  268 + document.getElementById('frmAcompanharEstadoProcesso').submit();
  269 +}
  270 +
  271 +function tratarEnter(ev){
  272 + var key = infraGetCodigoTecla(ev);
  273 + if (key == 13){
  274 + onClickBtnPesquisar();
  275 + }
  276 + return true;
  277 +}
  278 +
  279 +function onCLickLinkDelete(url, link) {
  280 +
  281 + var row = jQuery(link).parents('tr:first');
  282 +
  283 + var strEspecieDocumental = row.find('td:eq(1)').text();
  284 + var strTipoDocumento = row.find('td:eq(2)').text();
  285 +
  286 + if(confirm('Confirma a exclusão do mapeamento "' + strEspecieDocumental + ' x ' + strTipoDocumento +'"?')){
  287 +
  288 + window.location = url;
  289 + }
  290 +
  291 +}
  292 +
  293 +function onClickBtnNovo(){
  294 +
  295 + window.location = '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_cadastrar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao_origem']); ?>';
  296 +}
  297 +
  298 +function onClickBtnAtivar(){
  299 +
  300 + try {
  301 +
  302 + var form = jQuery('#frmAcompanharEstadoProcesso');
  303 + form.attr('action', '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_ativar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.PEN_RECURSO_BASE.'_listar'); ?>');
  304 + form.submit();
  305 + }
  306 + catch(e){
  307 +
  308 + alert('Erro : ' + e.message);
  309 + }
  310 +
  311 +}
  312 +
  313 +function onClickBtnDesativar(){
  314 +
  315 + try {
  316 +
  317 + var form = jQuery('#frmAcompanharEstadoProcesso');
  318 + form.attr('action', '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_desativar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.PEN_RECURSO_BASE.'_listar'); ?>');
  319 + form.submit();
  320 + }
  321 + catch(e){
  322 +
  323 + alert('Erro : ' + e.message);
  324 + }
  325 +}
  326 +
  327 +function onClickBtnExcluir(){
  328 +
  329 + try {
  330 +
  331 + var len = jQuery('input[name*=chkInfraItem]:checked').length;
  332 +
  333 + if(len > 0){
  334 +
  335 + if(confirm('Confirma a exclusão de ' + len + ' mapeamento(s) ?')) {
  336 + var form = jQuery('#frmAcompanharEstadoProcesso');
  337 + form.attr('action', '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_excluir&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.PEN_RECURSO_BASE.'_listar'); ?>');
  338 + form.submit();
  339 + }
  340 + }
  341 + else {
  342 +
  343 + alert('Selecione pelo menos um mapeamento para Excluir');
  344 + }
  345 + }
  346 + catch(e){
  347 +
  348 + alert('Erro : ' + e.message);
  349 + }
  350 +}
  351 +
  352 +</script>
  353 +<?php
  354 +$objPagina->fecharHead();
  355 +$objPagina->abrirBody(PEN_PAGINA_TITULO,'onload="inicializar();"');
  356 +?>
  357 +<form id="frmAcompanharEstadoProcesso" method="post" action="<?php// print $objSessao->assinarLink($strProprioLink); ?>">
  358 +
  359 + <?php $objPagina->montarBarraComandosSuperior($arrComandos); ?>
  360 + <?php //$objPagina->montarAreaValidacao(); ?>
  361 + <?php $objPagina->abrirAreaDados('12em'); ?>
  362 +
  363 + <label for="id_hipotese_legal" class="infraLabelObrigatorio input-label-first">Hipótese Legal - SEI <?php print $objSessao->getStrSiglaOrgaoUnidadeAtual(); ?>:</label>
  364 + <select name="id_hipotese_legal" class="infraSelect input-field-first"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  365 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objFiltroDTO->getNumIdHipoteseLegal(), $arrMapIdHipoteseLegal); ?>
  366 + </select>
  367 +
  368 + <label for="id_barramento" class="infraLabelObrigatorio input-label-second">Hipótese Legal - Tramitação PEN:</label>
  369 + <select name="id_barramento" class="infraSelect input-field-second"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  370 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objFiltroDTO->getNumIdBarramento(), $arrMapIdBarramento); ?>
  371 + </select>
  372 +
  373 +
  374 + <?php $objPagina->fecharAreaDados(); ?>
  375 +
  376 + <?php if($numRegistros > 0): ?>
  377 + <?php $objPagina->montarAreaTabela($strResultado, $numRegistros); ?>
  378 + <?php //$objPagina->montarAreaDebug(); ?>
  379 + <?php else: ?>
  380 + <div style="clear:both"></div>
  381 + <p>Nenhum mapeamento foi encontrado</p>
  382 + <?php endif; ?>
  383 +</form>
  384 +<?php $objPagina->fecharBody(); ?>
  385 +<?php $objPagina->fecharHtml(); ?>
... ...
pen_map_hipotese_legal_padrao_cadastrar.php 0 → 100644
... ... @@ -0,0 +1,176 @@
  1 +<?php
  2 +/**
  3 + *
  4 + * @author Join Tecnologia
  5 + */
  6 +
  7 +require_once dirname(__FILE__) . '/../../SEI.php';
  8 +
  9 +session_start();
  10 +
  11 +define('PEN_RECURSO_ATUAL', 'pen_map_hipotese_legal_padrao_cadastrar');
  12 +define('PEN_RECURSO_BASE', 'pen_map_hipotese_legal_padrao');
  13 +define('PEN_PAGINA_TITULO', 'Indicar Hipótese de Restrição Padrão - Tramitação PEN');
  14 +define('PEN_PAGINA_GET_ID', 'id_mapeamento');
  15 +
  16 +
  17 +$objPagina = PaginaSEI::getInstance();
  18 +$objBanco = BancoSEI::getInstance();
  19 +$objSessao = SessaoSEI::getInstance();
  20 +
  21 +
  22 +try {
  23 +
  24 + $objBanco->abrirConexao();
  25 +
  26 + $objSessao->validarLink();
  27 + $objSessao->validarPermissao(PEN_RECURSO_ATUAL);
  28 +
  29 + $arrComandos = array();
  30 +
  31 + $bolSomenteLeitura = false;
  32 +
  33 + switch ($_GET['acao']) {
  34 + case PEN_RECURSO_BASE.'_cadastrar':
  35 + $arrComandos[] = '<button type="submit" id="btnSalvar" value="Salvar" class="infraButton"><span class="infraTeclaAtalho">S</span>alvar</button>';
  36 + $arrComandos[] = '<button type="button" id="btnCancelar" value="Cancelar" onclick="location.href=\'' . $objPagina->formatarXHTML($objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem=' . $_GET['acao'])) . '\';" class="infraButton">Cancelar</button>';
  37 + $strTitulo = PEN_PAGINA_TITULO;
  38 + break;
  39 +
  40 + case PEN_RECURSO_BASE.'_visualizar':
  41 + $arrComandos[] = '<button type="button" name="btnFechar" value="Fechar class="infraButton" onclick="location.href=\'' . $objPagina->formatarXHTML($objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem=' . $_GET['acao'])) . '\';">Fechar</button>';
  42 + $bolSomenteLeitura = true;
  43 + $strTitulo = sprintf('Consultar %s', PEN_PAGINA_TITULO);
  44 + break;
  45 +
  46 +
  47 + default:
  48 + throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida.");
  49 + }
  50 +
  51 + //--------------------------------------------------------------------------
  52 + // Ao por POST esta salvando o formulário
  53 +
  54 + $objPenParametroRN = new PenParametroRN();
  55 +
  56 + if(strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
  57 +
  58 + if(!array_key_exists('id_hipotese_legal', $_POST) || empty($_POST['id_hipotese_legal'])) {
  59 + throw new InfraException('Nenhuma "Espécie Documental" foi selecionada');
  60 + }
  61 +
  62 + $objPenParametroDTO = new PenParametroDTO();
  63 + $objPenParametroDTO->setStrNome('HIPOTESE_LEGAL_PADRAO');
  64 + $objPenParametroDTO->retTodos();
  65 +
  66 + if($objPenParametroRN->contar($objPenParametroDTO) > 0) {
  67 + $objPenParametroDTO->setStrValor($_POST['id_hipotese_legal']);
  68 + $objPenParametroRN->alterar($objPenParametroDTO);
  69 + }
  70 + else {
  71 + $objPenParametroDTO->setStrValor($_POST['id_hipotese_legal']);
  72 + $objPenParametroRN->cadastrar($objPenParametroDTO);
  73 + }
  74 +
  75 + $objPagina->adicionarMensagem('Hipótese de Restrição Padrão foi salva com sucesso', InfraPagina::$TIPO_MSG_AVISO);
  76 +
  77 + header('Location: '.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_cadastrar&acao_origem='.$_GET['acao']));
  78 + exit(0);
  79 + }
  80 + else {
  81 +
  82 + $objPenParametroDTO = new PenParametroDTO();
  83 + $objPenParametroDTO->setStrNome('HIPOTESE_LEGAL_PADRAO');
  84 + $objPenParametroDTO->retTodos();
  85 +
  86 + if($objPenParametroRN->contar($objPenParametroDTO) > 0) {
  87 +
  88 + $objPenParametroDTO = $objPenParametroRN->consultar($objPenParametroDTO);
  89 + }
  90 + else {
  91 +
  92 + $objPenParametroDTO->setStrValor('0');
  93 + }
  94 + }
  95 +
  96 + //--------------------------------------------------------------------------
  97 + // Auto-Complete
  98 + //--------------------------------------------------------------------------
  99 + // Mapeamento da hipotese legal local
  100 + $objHipoteseLegalDTO = new HipoteseLegalDTO();
  101 + $objHipoteseLegalDTO->setStrStaNivelAcesso(ProtocoloRN::$NA_RESTRITO); //Restrito
  102 + $objHipoteseLegalDTO->setStrSinAtivo('S');
  103 + $objHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  104 + $objHipoteseLegalDTO->retNumIdHipoteseLegal();
  105 + $objHipoteseLegalDTO->retStrNome();
  106 +
  107 + $objHipoteseLegalRN = new HipoteseLegalRN();
  108 + $arrMapIdHipoteseLegal = InfraArray::converterArrInfraDTO($objHipoteseLegalRN->listar($objHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  109 +}
  110 +catch (InfraException $e) {
  111 + $objPagina->processarExcecao($e);
  112 +}
  113 +catch(Exception $e) {
  114 + $objPagina->processarExcecao($e);
  115 +}
  116 +
  117 +// View
  118 +ob_clean();
  119 +
  120 +$objPagina->montarDocType();
  121 +$objPagina->abrirHtml();
  122 +$objPagina->abrirHead();
  123 +$objPagina->montarMeta();
  124 +$objPagina->montarTitle(':: ' . $objPagina->getStrNomeSistema() . ' - ' . $strTitulo . ' ::');
  125 +$objPagina->montarStyle();
  126 +?>
  127 +<style type="text/css">
  128 +
  129 +.input-label-first{position:absolute;left:0%;top:0%;width:40%; color: #666!important}
  130 +.input-field-first{position:absolute;left:0%;top:15%;width:40%}
  131 +
  132 +.input-label-third {position:absolute;left:0%;top:40%;width:25%; color:#666!important}
  133 +.input-field-third {position:absolute;left:0%;top:55%;width:25%;}
  134 +
  135 +</style>
  136 +<?php $objPagina->montarJavaScript(); ?>
  137 +<script type="text/javascript">
  138 +
  139 +function inicializar(){
  140 +
  141 +
  142 +}
  143 +
  144 +function onSubmit() {
  145 +
  146 + var form = jQuery('#<?php print PEN_RECURSO_BASE; ?>_form');
  147 + var field = jQuery('select[name=id_hipotese_legal]', form);
  148 +
  149 + if(field.val() === 'null' || !field.val()){
  150 + alert('Nenhuma "Hipótese Legal" foi selecionada');
  151 + field.focus();
  152 + return false;
  153 + }
  154 +}
  155 +
  156 +</script>
  157 +<?php
  158 +$objPagina->fecharHead();
  159 +$objPagina->abrirBody($strTitulo,'onload="inicializar();"');
  160 +?>
  161 +<form id="<?php print PEN_RECURSO_BASE; ?>_form" onsubmit="return onSubmit();" method="post" action="<?php //print $objSessaoSEI->assinarLink($strProprioLink); ?>">
  162 + <?php $objPagina->montarBarraComandosSuperior($arrComandos); ?>
  163 + <?php //$objPagina->montarAreaValidacao(); ?>
  164 + <?php $objPagina->abrirAreaDados('12em'); ?>
  165 +
  166 + <label for="id_hipotese_legal" class="infraLabelObrigatorio input-label-first">Hipótese Legal:</label>
  167 +
  168 + <select name="id_hipotese_legal" class="infraSelect input-field-first"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  169 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objPenParametroDTO->getStrValor(), $arrMapIdHipoteseLegal); ?>
  170 + </select>
  171 +
  172 +
  173 + <?php print $objPagina->fecharAreaDados(); ?>
  174 +</form>
  175 +<?php $objPagina->fecharBody(); ?>
  176 +<?php $objPagina->fecharHtml(); ?>
... ...
pen_map_hipotese_legal_recebido_cadastrar.php 0 → 100644
... ... @@ -0,0 +1,221 @@
  1 +<?php
  2 +/**
  3 + *
  4 + * @author Join Tecnologia
  5 + */
  6 +
  7 +require_once dirname(__FILE__) . '/../../SEI.php';
  8 +
  9 +session_start();
  10 +
  11 +define('PEN_RECURSO_ATUAL', 'pen_map_hipotese_legal_recebido_cadastrar');
  12 +define('PEN_RECURSO_BASE', 'pen_map_hipotese_legal_recebido');
  13 +define('PEN_PAGINA_TITULO', 'Mapeamento de Hipóteses Legais de Recebimento');
  14 +define('PEN_PAGINA_GET_ID', 'id_mapeamento');
  15 +
  16 +
  17 +$objPagina = PaginaSEI::getInstance();
  18 +$objBanco = BancoSEI::getInstance();
  19 +$objSessao = SessaoSEI::getInstance();
  20 +
  21 +
  22 +try {
  23 +
  24 + $objBanco->abrirConexao();
  25 +
  26 + $objSessao->validarLink();
  27 + $objSessao->validarPermissao(PEN_RECURSO_ATUAL);
  28 +
  29 + $arrComandos = array();
  30 +
  31 + $bolSomenteLeitura = false;
  32 +
  33 + switch ($_GET['acao']) {
  34 + case PEN_RECURSO_BASE.'_cadastrar':
  35 + $arrComandos[] = '<button type="submit" id="btnSalvar" value="Salvar" class="infraButton"><span class="infraTeclaAtalho">S</span>alvar</button>';
  36 + $arrComandos[] = '<button type="button" id="btnCancelar" value="Cancelar" onclick="location.href=\'' . $objPagina->formatarXHTML($objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem=' . $_GET['acao'])) . '\';" class="infraButton">Cancelar</button>';
  37 +
  38 + if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])){
  39 + $strTitulo = sprintf('Editar %s', PEN_PAGINA_TITULO);
  40 + }
  41 + else {
  42 + $strTitulo = sprintf('Novo %s', PEN_PAGINA_TITULO);
  43 + }
  44 + break;
  45 +
  46 + case PEN_RECURSO_BASE.'_visualizar':
  47 + $arrComandos[] = '<button type="button" name="btnFechar" value="Fechar class="infraButton" onclick="location.href=\'' . $objPagina->formatarXHTML($objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem=' . $_GET['acao'])) . '\';">Fechar</button>';
  48 + $bolSomenteLeitura = true;
  49 + $strTitulo = sprintf('Consultar %s', PEN_PAGINA_TITULO);
  50 + break;
  51 +
  52 +
  53 + default:
  54 + throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida.");
  55 + }
  56 +
  57 + $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalRecebidoRN();
  58 +
  59 + //--------------------------------------------------------------------------
  60 + // Ao por POST esta salvando o formulrio
  61 + if(strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
  62 +
  63 + if(!array_key_exists('id_hipotese_legal', $_POST) || empty($_POST['id_hipotese_legal'])) {
  64 + throw new InfraException('Nenhuma "Espécie Documental" foi selecionada');
  65 + }
  66 +
  67 + if(!array_key_exists('id_barramento', $_POST) || empty($_POST['id_barramento'])) {
  68 + throw new InfraException('Nenhum "Tipo de Documento" foi selecionado');
  69 + }
  70 +
  71 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  72 + $objPenRelHipoteseLegalDTO->setNumIdHipoteseLegal($_POST['id_hipotese_legal']);
  73 + $objPenRelHipoteseLegalDTO->setNumIdBarramento($_POST['id_barramento']);
  74 + $objPenRelHipoteseLegalDTO->setStrTipo('R');// Recebido
  75 +
  76 + $numIdMapeamento = 0;
  77 + if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])) {
  78 + $objPenRelHipoteseLegalDTO->setDblIdMap($_GET[PEN_PAGINA_GET_ID]);
  79 + $objPenRelHipoteseLegalRN->alterar($objPenRelHipoteseLegalDTO);
  80 + $numIdMapeamento = $_GET[PEN_PAGINA_GET_ID];
  81 + }
  82 + else {
  83 + $mapeamento = $objPenRelHipoteseLegalRN->cadastrar($objPenRelHipoteseLegalDTO);
  84 + $numIdMapeamento = $mapeamento->getDblIdMap();
  85 + }
  86 +
  87 +
  88 + header('Location: '.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_listar&acao_origem='.$_GET['acao'].'&acao_origem='.$_GET['acao'].'&id_mapeamento='.$numIdMapeamento.PaginaSEI::getInstance()->montarAncora($numIdMapeamento)));
  89 + exit(0);
  90 + }
  91 + // Ao por GET + ID esta carregando o formulrio
  92 + else if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])){
  93 +
  94 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  95 + $objPenRelHipoteseLegalDTO->setDblIdMap($_GET[PEN_PAGINA_GET_ID]);
  96 + $objPenRelHipoteseLegalDTO->retTodos();
  97 +
  98 + $objEspecieDocumentalBD = new GenericoBD(BancoSEI::getInstance());
  99 + $objPenRelHipoteseLegalDTO = $objEspecieDocumentalBD->consultar($objPenRelHipoteseLegalDTO);
  100 + }
  101 +
  102 + if(empty($objPenRelHipoteseLegalDTO)){
  103 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  104 + $objPenRelHipoteseLegalDTO->setNumIdHipoteseLegal(0);
  105 + $objPenRelHipoteseLegalDTO->setNumIdBarramento(0);
  106 + }
  107 +
  108 +
  109 + if(array_key_exists(PEN_PAGINA_GET_ID, $_GET) && !empty($_GET[PEN_PAGINA_GET_ID])) {
  110 + $objPenRelHipoteseLegalDTO->setDblIdMap($_GET[PEN_PAGINA_GET_ID]);
  111 + }
  112 +
  113 + //--------------------------------------------------------------------------
  114 + // Auto-Complete
  115 + //--------------------------------------------------------------------------
  116 + // Mapeamento da hipotese legal local
  117 + $objHipoteseLegalDTO = new HipoteseLegalDTO();
  118 + $objHipoteseLegalDTO->setStrStaNivelAcesso(1);
  119 + $objHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  120 + $objHipoteseLegalDTO->retNumIdHipoteseLegal();
  121 + $objHipoteseLegalDTO->retStrNome();
  122 +
  123 + $objHipoteseLegalRN = new HipoteseLegalRN();
  124 + $arrMapIdHipoteseLegal = InfraArray::converterArrInfraDTO($objHipoteseLegalRN->listar($objHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  125 +
  126 + // Mapeamento da hipotese legal do barramento j utilizados
  127 + $arrNumIdHipoteseLegal = $objPenRelHipoteseLegalRN->getIdBarramentoEmUso($objPenRelHipoteseLegalDTO, 'R');
  128 +
  129 + // Mapeamento da hipotese legal remota
  130 + $objPenHipoteseLegalDTO = new PenHipoteseLegalDTO();
  131 + $objPenHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  132 + if(!empty($arrNumIdHipoteseLegal)) {
  133 + // Remove os que j esto em uso
  134 + $objPenHipoteseLegalDTO->setNumIdHipoteseLegal($arrNumIdHipoteseLegal, InfraDTO::$OPER_NOT_IN);
  135 + }
  136 + $objPenHipoteseLegalDTO->retNumIdHipoteseLegal();
  137 + $objPenHipoteseLegalDTO->retStrNome();
  138 +
  139 + $objPenHipoteseLegalRN = new PenHipoteseLegalRN();
  140 + $arrMapIdBarramento = InfraArray::converterArrInfraDTO($objPenHipoteseLegalRN->listar($objPenHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  141 + //--------------------------------------------------------------------------
  142 +}
  143 +catch (InfraException $e) {
  144 + $objPagina->processarExcecao($e);
  145 +}
  146 +catch(Exception $e) {
  147 + $objPagina->processarExcecao($e);
  148 +}
  149 +
  150 +// View
  151 +ob_clean();
  152 +
  153 +$objPagina->montarDocType();
  154 +$objPagina->abrirHtml();
  155 +$objPagina->abrirHead();
  156 +$objPagina->montarMeta();
  157 +$objPagina->montarTitle(':: ' . $objPagina->getStrNomeSistema() . ' - ' . $strTitulo . ' ::');
  158 +$objPagina->montarStyle();
  159 +?>
  160 +<style type="text/css">
  161 +
  162 +.input-label-first{position:absolute;left:0%;top:0%;width:25%; color: #666!important}
  163 +.input-field-first{position:absolute;left:0%;top:15%;width:25%}
  164 +
  165 +.input-label-third {position:absolute;left:0%;top:40%;width:25%; color:#666!important}
  166 +.input-field-third {position:absolute;left:0%;top:55%;width:25%;}
  167 +
  168 +</style>
  169 +<?php $objPagina->montarJavaScript(); ?>
  170 +<script type="text/javascript">
  171 +
  172 +function inicializar(){
  173 +
  174 +
  175 +}
  176 +
  177 +function onSubmit() {
  178 +
  179 + var form = jQuery('#<?php print PEN_RECURSO_BASE; ?>_form');
  180 + var field = jQuery('select[name=id_hipotese_legal]', form);
  181 +
  182 + if(field.val() === 'null' || !field.val()){
  183 + alert('Nenhuma "Hipótese Legal - SEI <?php print $objSessao->getStrSiglaOrgaoUnidadeAtual(); ?>" foi selecionada');
  184 + field.focus();
  185 + return false;
  186 + }
  187 +
  188 + field = jQuery('select[name=id_barramento]', form);
  189 +
  190 + if(field.val() === 'null' || !field.val()){
  191 + alert('Nenhum "Hipótese Legal - Tramitação PEN" foi selecionado');
  192 + field.focus();
  193 + return false;
  194 + }
  195 +}
  196 +
  197 +</script>
  198 +<?php
  199 +$objPagina->fecharHead();
  200 +$objPagina->abrirBody($strTitulo,'onload="inicializar();"');
  201 +?>
  202 +<form id="<?php print PEN_RECURSO_BASE; ?>_form" onsubmit="return onSubmit();" method="post" action="<?php //print $objSessaoSEI->assinarLink($strProprioLink); ?>">
  203 + <?php $objPagina->montarBarraComandosSuperior($arrComandos); ?>
  204 + <?php $objPagina->montarAreaValidacao(); ?>
  205 + <?php $objPagina->abrirAreaDados('12em'); ?>
  206 +
  207 + <label for="id_hipotese_legal" class="infraLabelObrigatorio input-label-first">Hipótese Legal - SEI <?php print $objSessao->getStrSiglaOrgaoUnidadeAtual(); ?>:</label>
  208 +
  209 + <select name="id_hipotese_legal" class="infraSelect input-field-first"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  210 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objPenRelHipoteseLegalDTO->getNumIdHipoteseLegal(), $arrMapIdHipoteseLegal); ?>
  211 + </select>
  212 +
  213 + <label for="id_barramento" class="infraLabelObrigatorio input-label-third">Hipótese Legal - Tramitação PEN:</label>
  214 + <select name="id_barramento" class="infraSelect input-field-third"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  215 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objPenRelHipoteseLegalDTO->getNumIdBarramento(), $arrMapIdBarramento); ?>
  216 + </select>
  217 +
  218 + <?php print $objPagina->fecharAreaDados(); ?>
  219 +</form>
  220 +<?php $objPagina->fecharBody(); ?>
  221 +<?php $objPagina->fecharHtml(); ?>
... ...
pen_map_hipotese_legal_recebido_listar.php 0 → 100644
... ... @@ -0,0 +1,390 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../SEI.php';
  4 +
  5 +/**
  6 + * Consulta os logs do estado do procedimento ao ser expedido
  7 + *
  8 + * @author Join Tecnologia
  9 + */
  10 +
  11 +session_start();
  12 +
  13 +
  14 +require_once dirname(__FILE__) . '/../../SEI.php';
  15 +
  16 +session_start();
  17 +
  18 +define('PEN_RECURSO_ATUAL', 'pen_map_hipotese_legal_recebido_listar');
  19 +define('PEN_RECURSO_BASE', 'pen_map_hipotese_legal_recebido');
  20 +define('PEN_PAGINA_TITULO', 'Mapeamento de Hipóteses Legais de Recebimento');
  21 +define('PEN_PAGINA_GET_ID', 'id_mapeamento');
  22 +
  23 +
  24 +$objPagina = PaginaSEI::getInstance();
  25 +$objBanco = BancoSEI::getInstance();
  26 +$objSessao = SessaoSEI::getInstance();
  27 +$objDebug = InfraDebug::getInstance();
  28 +
  29 +
  30 +try {
  31 +
  32 + $objDebug->setBolLigado(false);
  33 + $objDebug->setBolDebugInfra(true);
  34 + $objDebug->limpar();
  35 +
  36 + $objSessao->validarLink();
  37 + $objSessao->validarPermissao(PEN_RECURSO_ATUAL);
  38 +
  39 + $objBanco->abrirConexao();
  40 +
  41 + //--------------------------------------------------------------------------
  42 + // Aes
  43 + if(array_key_exists('acao', $_GET)) {
  44 +
  45 + $arrParam = array_merge($_GET, $_POST);
  46 +
  47 + switch($_GET['acao']) {
  48 +
  49 + case PEN_RECURSO_BASE.'_excluir':
  50 +
  51 + if(array_key_exists('hdnInfraItensSelecionados', $arrParam) && !empty($arrParam['hdnInfraItensSelecionados'])) {
  52 +
  53 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  54 + $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalRecebidoRN();
  55 +
  56 + if(is_array($arrParam['hdnInfraItensSelecionados'])) {
  57 +
  58 + foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) {
  59 +
  60 + $objPenRelHipoteseLegalDTO->setDblIdMap($dblIdMap);
  61 + $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO);
  62 + }
  63 + }
  64 + else {
  65 +
  66 + $objPenRelHipoteseLegalDTO->setDblIdMap($arrParam['hdnInfraItensSelecionados']);
  67 + $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO);
  68 + }
  69 +
  70 + $objPagina->adicionarMensagem(sprintf('%s foi excluido com sucesso.', PEN_PAGINA_TITULO), InfraPagina::$TIPO_MSG_AVISO);
  71 +
  72 + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem']));
  73 + exit(0);
  74 + }
  75 + else {
  76 +
  77 + throw new InfraException('Nenhum Registro foi selecionado para executar esta ação');
  78 + }
  79 + break;
  80 +
  81 + case PEN_RECURSO_BASE.'_desativar':
  82 +
  83 + if(array_key_exists('hdnInfraItensSelecionados', $arrParam) && !empty($arrParam['hdnInfraItensSelecionados'])) {
  84 +
  85 + PenRelHipoteseLegalRN::mudarEstado(explode(',', $arrParam['hdnInfraItensSelecionados']), 'N');
  86 +
  87 + $objPagina->adicionarMensagem('Desativado com sucesso.', InfraPagina::$TIPO_MSG_AVISO);
  88 +
  89 + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem']));
  90 + exit(0);
  91 + }
  92 + else {
  93 +
  94 + throw new InfraException('Nenhum Registro foi selecionado para executar esta ação');
  95 + }
  96 + break;
  97 +
  98 + case PEN_RECURSO_BASE.'_ativar':
  99 + if(array_key_exists('hdnInfraItensSelecionados', $arrParam) && !empty($arrParam['hdnInfraItensSelecionados'])) {
  100 +
  101 + PenRelHipoteseLegalRN::mudarEstado(explode(',', $arrParam['hdnInfraItensSelecionados']), 'S');
  102 +
  103 + $objPagina->adicionarMensagem('Ativado com sucesso.', InfraPagina::$TIPO_MSG_AVISO);
  104 +
  105 + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem']));
  106 + exit(0);
  107 + }
  108 + break;
  109 +
  110 + case PEN_RECURSO_BASE.'_listar':
  111 + // Ação padrão desta tela
  112 + break;
  113 +
  114 + default:
  115 + throw new InfraException('Ação não permitida nesta tela');
  116 +
  117 + }
  118 + }
  119 + //--------------------------------------------------------------------------
  120 +
  121 + $arrComandos = array();
  122 + $arrComandos[] = '<button type="button" accesskey="P" onclick="onClickBtnPesquisar();" id="btnPesquisar" value="Pesquisar" class="infraButton">Pesquisar</button>';
  123 + $arrComandos[] = '<button type="button" value="Novo" onclick="onClickBtnNovo()" class="infraButton">Novo</button>';
  124 + //$arrComandos[] = '<button type="button" value="Ativar" onclick="onClickBtnAtivar()" class="infraButton">Ativar</button>';
  125 + //$arrComandos[] = '<button type="button" value="Desativar" onclick="onClickBtnDesativar()" class="infraButton">Desativar</button>';
  126 + $arrComandos[] = '<button type="button" value="Excluir" onclick="onClickBtnExcluir()" class="infraButton">Excluir</button>';
  127 + $arrComandos[] = '<button type="button" accesskey="I" id="btnImprimir" value="Imprimir" onclick="infraImprimirTabela();" class="infraButton">Imprimir</button>';
  128 +
  129 + //--------------------------------------------------------------------------
  130 + // DTO de paginao
  131 +
  132 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  133 + $objPenRelHipoteseLegalDTO->setStrTipo('R');
  134 + $objPenRelHipoteseLegalDTO->retTodos();
  135 + //--------------------------------------------------------------------------
  136 + // Filtragem
  137 + if(array_key_exists('id_barramento', $_POST) && (!empty($_POST['id_barramento']) && $_POST['id_barramento'] !== 'null')) {
  138 + $objPenRelHipoteseLegalDTO->setNumIdBarramento($_POST['id_barramento']);
  139 + }
  140 +
  141 + if(array_key_exists('id_hipotese_legal', $_POST) && (!empty($_POST['id_hipotese_legal']) && $_POST['id_barramento'] !== 'null')) {
  142 + $objPenRelHipoteseLegalDTO->setNumIdHipoteseLegal($_POST['id_hipotese_legal']);
  143 + }
  144 +
  145 + $objFiltroDTO = clone $objPenRelHipoteseLegalDTO;
  146 +
  147 + if(!$objFiltroDTO->isSetNumIdBarramento()) {
  148 + $objFiltroDTO->setNumIdBarramento('');
  149 + }
  150 +
  151 + if(!$objFiltroDTO->isSetNumIdHipoteseLegal()) {
  152 + $objFiltroDTO->setNumIdHipoteseLegal('');
  153 + }
  154 + //--------------------------------------------------------------------------
  155 + $objGenericoBD = new GenericoBD($objBanco);
  156 +
  157 + // Mapeamento da hipotese legal remota
  158 + $objPenHipoteseLegalDTO = new PenHipoteseLegalDTO();
  159 + $objPenHipoteseLegalDTO->setDistinct(true);
  160 + $objPenHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  161 + $objPenHipoteseLegalDTO->retNumIdHipoteseLegal();
  162 + $objPenHipoteseLegalDTO->retStrNome();
  163 +
  164 + $objPenHipoteseLegalRN = new PenHipoteseLegalRN();
  165 + $arrMapIdBarramento = InfraArray::converterArrInfraDTO($objPenHipoteseLegalRN->listar($objPenHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  166 +
  167 + // Mapeamento da hipotese legal local
  168 + $objHipoteseLegalDTO = new HipoteseLegalDTO();
  169 + $objHipoteseLegalDTO->setStrStaNivelAcesso(ProtocoloRN::$NA_RESTRITO); //Restrito
  170 + $objHipoteseLegalDTO->setStrSinAtivo('S');
  171 + $objHipoteseLegalDTO->setDistinct(true);
  172 + $objHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  173 + $objHipoteseLegalDTO->retNumIdHipoteseLegal();
  174 + $objHipoteseLegalDTO->retStrNome();
  175 +
  176 + $objHipoteseLegalRN = new HipoteseLegalRN();
  177 + $arrMapIdHipoteseLegal = InfraArray::converterArrInfraDTO($objHipoteseLegalRN->listar($objHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  178 + //--------------------------------------------------------------------------
  179 + //
  180 + //$objPagina->prepararOrdenacao($objPenRelHipoteseLegalDTO, 'IdMapeamento', InfraDTO::$TIPO_ORDENACAO_ASC);
  181 + $objPagina->prepararPaginacao($objPenRelHipoteseLegalDTO);
  182 +
  183 + $arrObjPenRelHipoteseLegalDTO = $objGenericoBD->listar($objPenRelHipoteseLegalDTO);
  184 +
  185 + $objPagina->processarPaginacao($objPenRelHipoteseLegalDTO);
  186 +
  187 + $numRegistros = count($arrObjPenRelHipoteseLegalDTO);
  188 +
  189 + if(!empty($arrObjPenRelHipoteseLegalDTO)){
  190 +
  191 + $strResultado = '';
  192 +
  193 + $strResultado .= '<table width="99%" class="infraTable">'."\n";
  194 + $strResultado .= '<caption class="infraCaption">'.$objPagina->gerarCaptionTabela(PEN_PAGINA_TITULO, $numRegistros).'</caption>';
  195 +
  196 + $strResultado .= '<tr>';
  197 + $strResultado .= '<th class="infraTh" width="1%">'.$objPagina->getThCheck().'</th>'."\n";
  198 + $strResultado .= '<th class="infraTh" width="35%">Hipótese Legal - SEI '.$objSessao->getStrSiglaOrgaoUnidadeAtual().'</th>'."\n";
  199 + $strResultado .= '<th class="infraTh" width="35%">Hipótese Legal - Tramitação PEN</th>'."\n";
  200 + $strResultado .= '<th class="infraTh" width="14%">Ações</th>'."\n";
  201 + $strResultado .= '</tr>'."\n";
  202 + $strCssTr = '';
  203 +
  204 + $index = 0;
  205 + foreach($arrObjPenRelHipoteseLegalDTO as $objPenRelHipoteseLegalDTO) {
  206 +
  207 + $strCssTr = ($strCssTr == 'infraTrClara') ? 'infraTrEscura' : 'infraTrClara';
  208 +
  209 + $strResultado .= '<tr class="'.$strCssTr.'">';
  210 + $strResultado .= '<td>'.$objPagina->getTrCheck($index, $objPenRelHipoteseLegalDTO->getDblIdMap(), '').'</td>';
  211 + $strResultado .= '<td>'.$arrMapIdHipoteseLegal[$objPenRelHipoteseLegalDTO->getNumIdHipoteseLegal()].'</td>';
  212 + $strResultado .= '<td>'.$arrMapIdBarramento[$objPenRelHipoteseLegalDTO->getNumIdBarramento()].'</td>';
  213 + $strResultado .= '<td align="center">';
  214 +
  215 + //$strResultado .= '<a href="'.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_visualizar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&'.PEN_PAGINA_GET_ID.'='.$objPenRelHipoteseLegalDTO->getDblIdMap()).'"><img src="imagens/consultar.gif" title="Consultar Mapeamento" alt="Consultar Mapeamento" class="infraImg"></a>';
  216 + if($objSessao->verificarPermissao('pen_map_hipotese_legal_recebido_alterar')) {
  217 + $strResultado .= '<a href="'.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_cadastrar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&'.PEN_PAGINA_GET_ID.'='.$objPenRelHipoteseLegalDTO->getDblIdMap()).'"><img src="imagens/alterar.gif" title="Alterar Mapeamento" alt="Alterar Mapeamento" class="infraImg"></a>';
  218 + }
  219 +
  220 + if($objSessao->verificarPermissao('pen_map_hipotese_legal_recebido_excluir')) {
  221 + $strResultado .= '<a href="#" onclick="onCLickLinkDelete(\''.$objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_excluir&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&hdnInfraItensSelecionados='.$objPenRelHipoteseLegalDTO->getDblIdMap()).'\', this)"><img src="imagens/excluir.gif" title="Excluir Mapeamento" alt="Excluir Mapeamento" class="infraImg"></a>';
  222 + }
  223 +
  224 + $strResultado .= '</td>';
  225 + $strResultado .= '</tr>'."\n";
  226 +
  227 + $index++;
  228 + }
  229 + $strResultado .= '</table>';
  230 + }
  231 +}
  232 +catch(InfraException $e){
  233 +
  234 + print '<pre>';
  235 + print_r($e);
  236 + print '</pre>';
  237 + exit(0);
  238 + //$objPagina->processarExcecao($e);
  239 +}
  240 +
  241 +
  242 +$objPagina->montarDocType();
  243 +$objPagina->abrirHtml();
  244 +$objPagina->abrirHead();
  245 +$objPagina->montarMeta();
  246 +$objPagina->montarTitle(':: '.$objPagina->getStrNomeSistema().' - '.PEN_PAGINA_TITULO.' ::');
  247 +$objPagina->montarStyle();
  248 +?>
  249 +<style type="text/css">
  250 +
  251 +.input-label-first{position:absolute;left:0%;top:0%;width:25%; color: #666!important}
  252 +.input-field-first{position:absolute;left:0%;top:15%;width:25%}
  253 +
  254 +.input-label-second{position:absolute;left:30%;top:0%;width:25%; color: #666!important}
  255 +.input-field-second{position:absolute;left:30%;top:15%;width:25%;}
  256 +
  257 +.input-label-third {position:absolute;left:0%;top:40%;width:25%; color:#666!important}
  258 +.input-field-third {position:absolute;left:0%;top:55%;width:25%;}
  259 +
  260 +</style>
  261 +<?php $objPagina->montarJavaScript(); ?>
  262 +<script type="text/javascript">
  263 +
  264 +function inicializar(){
  265 +
  266 + infraEfeitoTabelas();
  267 +
  268 +}
  269 +
  270 +function onClickBtnPesquisar(){
  271 + document.getElementById('frmAcompanharEstadoProcesso').action='<?php print $objSessao->assinarLink('controlador.php?acao='.$_GET['acao'].'&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao_retorno']); ?>';
  272 + document.getElementById('frmAcompanharEstadoProcesso').submit();
  273 +}
  274 +
  275 +function tratarEnter(ev){
  276 + var key = infraGetCodigoTecla(ev);
  277 + if (key == 13){
  278 + onClickBtnPesquisar();
  279 + }
  280 + return true;
  281 +}
  282 +
  283 +function onCLickLinkDelete(url, link) {
  284 +
  285 + var row = jQuery(link).parents('tr:first');
  286 +
  287 + var strEspecieDocumental = row.find('td:eq(1)').text();
  288 + var strTipoDocumento = row.find('td:eq(2)').text();
  289 +
  290 + if(confirm('Confirma a exclusão do mapeamento "' + strEspecieDocumental + ' x ' + strTipoDocumento +'"?')){
  291 +
  292 + window.location = url;
  293 + }
  294 +
  295 +}
  296 +
  297 +function onClickBtnNovo(){
  298 +
  299 + window.location = '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_cadastrar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao_origem']); ?>';
  300 +}
  301 +
  302 +function onClickBtnAtivar(){
  303 +
  304 + try {
  305 +
  306 + var form = jQuery('#frmAcompanharEstadoProcesso');
  307 + form.attr('action', '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_ativar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.PEN_RECURSO_BASE.'_listar'); ?>');
  308 + form.submit();
  309 + }
  310 + catch(e){
  311 +
  312 + alert('Erro : ' + e.message);
  313 + }
  314 +
  315 +}
  316 +
  317 +function onClickBtnDesativar(){
  318 +
  319 + try {
  320 +
  321 + var form = jQuery('#frmAcompanharEstadoProcesso');
  322 + form.attr('action', '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_desativar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.PEN_RECURSO_BASE.'_listar'); ?>');
  323 + form.submit();
  324 + }
  325 + catch(e){
  326 +
  327 + alert('Erro : ' + e.message);
  328 + }
  329 +}
  330 +
  331 +function onClickBtnExcluir(){
  332 +
  333 + try {
  334 +
  335 + var len = jQuery('input[name*=chkInfraItem]:checked').length;
  336 +
  337 + if(len > 0){
  338 +
  339 + if(confirm('Confirma a exclusão de ' + len + ' mapeamento(s) ?')) {
  340 +
  341 + var form = jQuery('#frmAcompanharEstadoProcesso');
  342 + form.attr('action', '<?php print $objSessao->assinarLink('controlador.php?acao='.PEN_RECURSO_BASE.'_excluir&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.PEN_RECURSO_BASE.'_listar'); ?>');
  343 + form.submit();
  344 + }
  345 + }
  346 + else {
  347 +
  348 + alert('Selecione pelo menos um mapeamento para Excluir');
  349 + }
  350 + }
  351 + catch(e){
  352 +
  353 + alert('Erro : ' + e.message);
  354 + }
  355 +}
  356 +
  357 +</script>
  358 +<?php
  359 +$objPagina->fecharHead();
  360 +$objPagina->abrirBody(PEN_PAGINA_TITULO,'onload="inicializar();"');
  361 +?>
  362 +<form id="frmAcompanharEstadoProcesso" method="post" action="<?php// print $objSessao->assinarLink($strProprioLink); ?>">
  363 +
  364 + <?php $objPagina->montarBarraComandosSuperior($arrComandos); ?>
  365 + <?php //$objPagina->montarAreaValidacao(); ?>
  366 + <?php $objPagina->abrirAreaDados('12em'); ?>
  367 +
  368 + <label for="id_hipotese_legal" class="infraLabelObrigatorio input-label-first">Hipótese Legal - SEI <?php print $objSessao->getStrSiglaOrgaoUnidadeAtual(); ?>:</label>
  369 + <select name="id_hipotese_legal" class="infraSelect input-field-first"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  370 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objFiltroDTO->getNumIdHipoteseLegal(), $arrMapIdHipoteseLegal); ?>
  371 + </select>
  372 +
  373 + <label for="id_barramento" class="infraLabelObrigatorio input-label-second">Hipótese Legal - Tramitação PEN:</label>
  374 + <select name="id_barramento" class="infraSelect input-field-second"<?php if($bolSomenteLeitura): ?> disabled="disabled" readonly="readonly"<?php endif; ?>>
  375 + <?php print InfraINT::montarSelectArray('', 'Selecione', $objFiltroDTO->getNumIdBarramento(), $arrMapIdBarramento); ?>
  376 + </select>
  377 +
  378 +
  379 + <?php $objPagina->fecharAreaDados(); ?>
  380 +
  381 + <?php if($numRegistros > 0): ?>
  382 + <?php $objPagina->montarAreaTabela($strResultado, $numRegistros); ?>
  383 + <?php //$objPagina->montarAreaDebug(); ?>
  384 + <?php else: ?>
  385 + <div style="clear:both"></div>
  386 + <p>Nenhum mapeamento foi encontrado</p>
  387 + <?php endif; ?>
  388 +</form>
  389 +<?php $objPagina->fecharBody(); ?>
  390 +<?php $objPagina->fecharHtml(); ?>
... ...
rn/PenAtualizadorRN.php
1 1 <?php
  2 +
2 3 /**
3 4 * Atualizador abstrato para sistema do SEI para instalar/atualizar o módulo PEN
4 5 *
5 6 * @autor Join Tecnologia
6 7 */
7   -abstract class PenAtualizadorRN extends InfraRN {
8   -
9   - const VER_NONE = '0.0.0';// Modulo não instalado
10   - const VER_001 = '0.0.1';
11   - const VER_002 = '0.0.2';
12   - const VER_003 = '0.0.3';
13   - const VER_004 = '0.0.4';
14   - const VER_005 = '0.0.5';
15   - const VER_006 = '0.0.6';
16   - const VER_007 = '0.0.7';
17   - const VER_008 = '0.0.8';
18   - const VER_100 = '1.0.0';
19   -
  8 +abstract class PenAtualizadorRN extends InfraRN {
  9 +
20 10 protected $sei_versao;
21   -
  11 +
22 12 /**
23 13 * @var string Versão mínima requirida pelo sistema para instalação do PEN
24 14 */
25 15 protected $versaoMinRequirida;
26   -
  16 +
27 17 /**
28 18 * @var InfraIBanco Instância da classe de persistência com o banco de dados
29 19 */
... ... @@ -43,22 +33,29 @@ abstract class PenAtualizadorRN extends InfraRN {
43 33 * @var integer Tempo de execução do script
44 34 */
45 35 protected $numSeg = 0;
46   -
47   - /**
48   - * @var array Argumentos passados por linha de comando ao script
49   - */
50   - protected $arrArgs = array();
51 36  
  37 + protected $objInfraBanco ;
  38 +
  39 + protected function inicializarObjInfraIBanco() {
  40 +
  41 + if (empty($this->objInfraBanco)) {
  42 + $this->objInfraBanco = BancoSEI::getInstance();
  43 + $this->objInfraBanco->abrirConexao();
  44 + }
  45 +
  46 + return $this->objInfraBanco;
  47 + }
  48 +
52 49 /**
53 50 * Inicia a conexão com o banco de dados
54 51 */
55   - protected function inicializarObjMetaBanco(){
56   - if(empty($this->objMeta)) {
  52 + protected function inicializarObjMetaBanco() {
  53 + if (empty($this->objMeta)) {
57 54 $this->objMeta = new PenMetaBD($this->inicializarObjInfraIBanco());
58 55 }
59 56 return $this->objMeta;
60 57 }
61   -
  58 +
62 59 /**
63 60 * Adiciona uma mensagem ao output para o usuário
64 61 *
... ... @@ -67,7 +64,7 @@ abstract class PenAtualizadorRN extends InfraRN {
67 64 protected function logar($strMsg) {
68 65 $this->objDebug->gravar($strMsg);
69 66 }
70   -
  67 +
71 68 /**
72 69 * Inicia o script criando um contator interno do tempo de execução
73 70 *
... ... @@ -88,259 +85,37 @@ abstract class PenAtualizadorRN extends InfraRN {
88 85 protected function finalizar() {
89 86  
90 87 $this->logar('TEMPO TOTAL DE EXECUCAO: ' . InfraUtil::verificarTempoProcessamento($this->numSeg) . ' s');
91   -
  88 +
92 89 $this->objDebug->setBolLigado(false);
93 90 $this->objDebug->setBolDebugInfra(false);
94 91 $this->objDebug->setBolEcho(false);
95   -
  92 +
96 93 print PHP_EOL;
97 94 die();
98 95 }
99   -
100   - /**
101   - * Método criado em função de um bug com a InfraRN na linha 69, onde usamos
102   - * uma instância do banco do SIP e a versão esta no banco SEI, essa verificação
103   - * e lançamento de uma excessão pelos bancos terem nome diferentes tava o
104   - * atualizado
105   - *
106   - * @todo Migrar para classe PenMetaBD
107   - * @return null
108   - */
109   - protected function setVersao($strRegexVersao, $objInfraBanco = null){
110   -
111   - InfraDebug::getInstance()->gravarInfra(sprintf('[%s->%s]', get_class($this), __FUNCTION__));
112   -
113   -
114   - if($this->getVersao($objInfraBanco)) {
115   -
116   - $sql = sprintf("UPDATE infra_parametro SET valor = '%s' WHERE nome = '%s'", $strRegexVersao, $this->sei_versao);
117   - }
118   - else {
119   -
120   - $sql = sprintf("INSERT INTO infra_parametro(nome, valor) VALUES('%s', '%s')", $this->sei_versao, $strRegexVersao);
121   - }
122   -
123   - if(empty($objInfraBanco)) {
124   -
125   - $objInfraBanco = $this->inicializarObjInfraIBanco();
126   - }
127   -
128   - $objInfraBanco->executarSql($sql);
129   -
130   - return $strRegexVersao;
131   - }
132   -
133   - /**
134   - * Retorna a versão atual do modulo, se já foi instalado
135   - *
136   - * @todo Migrar para classe PenMetaBD
137   - * @param InfraBanco $objInfraBanco Conexão com o banco SEI ou SIP
138   - * @return string
139   - */
140   - protected function getVersao($objInfraBanco = null){
141   -
142   - InfraDebug::getInstance()->gravarInfra(sprintf('[%s->%s]', get_class($this), __FUNCTION__));
143   -
144   - $sql = sprintf("SELECT valor FROM infra_parametro WHERE nome = '%s'", $this->sei_versao);
145   -
146   - if(empty($objInfraBanco)) {
147   -
148   - $objInfraBanco = $this->inicializarObjInfraIBanco();
149   - }
150   -
151   - $arrResultado = $objInfraBanco->consultarSql($sql);
152   -
153   - if(empty($arrResultado)) {
154   - return null;
155   - }
156   -
157   - $arrLinha = current($arrResultado);
158   -
159   - return $arrLinha['valor'];
160   - }
161   -
162   - /**
163   - * Verifica se o número da versão é valido
164   - *
165   - * @param string $strVersao Versão a ser instalada
166   - * @return bool
167   - */
168   - protected function isVersaoValida($strVersao = self::VER_NONE){
169   -
170   - if(empty($strVersao)) {
171   - return false;
172   - }
173   -
174   - // Remove os caracteres não númericos
175   - $strVersao = preg_replace('/\D+/', '', $strVersao);
176   -
177   - // Tem que no mínimo 3 digitos
178   - if (strlen($strVersao) < 3) {
179   - return false;
180   - }
181   -
182   - return is_numeric($strVersao) ? true : false;
183   - }
184   -
185   - /**
186   - * Verifica se um paramêtro existe, caso sim retorna o seu valor, senão
187   - * retorna o default especificado.
188   - *
189   - * @param string $strChave Nome do paramêtro
190   - * @param string $strParam String a ser formatada com o valor do paramêtro
191   - * @param string $strParamDefault String que retorna caso o valor do
192   - * paramêtro não exista
193   - * @param bool $bolAlgumFiltroUsado Ponteiro de controle para verificar se
194   - * pelo menos um paramêtro foi encontrado
195   - * @return string
196   - */
197   - private function getStrArg($strChave = '', $strParam = '', $strParamDefault = '', &$bolAlgumFiltroUsado){
198   -
199   - if(array_key_exists($strChave, $this->arrArgs)) {
200   - $bolAlgumFiltroUsado = true;
201   - return sprintf($strParam, str_pad($this->arrArgs[$strChave], 3, '0', STR_PAD_LEFT));
202   - }
203   - return $strParamDefault;
204   - }
205   -
206   - /**
207   - * Retorna a última versão disponivel. Verifica as constantes que iniciam
208   - * com VER_
209   - */
210   - private function getUltimaVersao(){
211   -
212   - $objReflection = new ReflectionClass(__CLASS__);
213   - $arrVersao = array_flip(preg_grep('/^VER\_/', array_flip($objReflection->getConstants())));
214   - sort($arrVersao);
215   - return array_pop($arrVersao);
216   - }
217   -
218   - /**
219   - * Encontra os métodos com notação para instalar a versão selecionada
220   - *
221   - * @return string Número da versão
222   - */
223   - protected function executarControlado(){
224   -
225   - $this->inicializarObjMetaBanco()
226   - ->isDriverSuportado()
227   - ->isDriverPermissao()
228   - ->isVersaoSuportada(SEI_VERSAO, $this->versaoMinRequirida);
229   -
230   - $arrMetodo = array();
231   -
232   - // Retorna a última versão disponibilizada pelo script. Sempre tenta atualizar
233   - // para versão mais antiga
234   - $strVersaoInstalar = $this->getUltimaVersao();
235   -
236   - //throw new InfraException($strVersaoInstalar);
237   - $objInfraBanco = $this->inicializarObjInfraIBanco();
238   - // Versão atual
239   - $strPenVersao = $this->getVersao($objInfraBanco);
240   - if(!$this->isVersaoValida($strPenVersao)) {
241   - // Não instalado
242   - $strPenVersao = $this->setVersao(self::VER_NONE, $objInfraBanco);
243   - }
244   -
245   - $numPenVersao = str_replace('.', '', $strPenVersao);
246   - $numVersaoInstalar = intval(preg_replace('/\D+/', '', $strVersaoInstalar));
247   -
248   - $bolAlgumFiltroUsado = false;
249   - $strRegexRelease = $this->getStrArg('release', '(R%s)', '(R[0-9]{1,3})?', $bolAlgumFiltroUsado);
250   - $strRegexSprint = $this->getStrArg('sprint', '(S%s)', '(S[0-9]{1,3})?', $bolAlgumFiltroUsado);
251   - $strRegexItem = $this->getStrArg('user-story', '(US%s)', '(US|IW[0-9]{1,3})?', $bolAlgumFiltroUsado);
252   - $strRegexItem = $this->getStrArg('item-worker', '(IW%s)', $strRegexItem, $bolAlgumFiltroUsado);
253   -
254   - // Instalar todas atualizações
255   - if($bolAlgumFiltroUsado === false) {
256   -
257   - $strRegexVersao = sprintf('[%d-%d]', ($numPenVersao + 1), $numVersaoInstalar);
258   - }
259   - // Instalar somente a solicitada
260   - else {
261   - // Caso algum paramêtro seja adicionado não deve passar para próxima versão
262   - $strVersaoInstalar = $strPenVersao;
263   - $strRegexVersao = intval(substr($strPenVersao, -1) + 1);
264   - }
265   -
266   - // instalarV[0-9]{1,2}[0-9](R[0-9]{1,3})?(S[0-9]{1,3})?(US|IW[0-9]{1,4})?
267   - $strRegex = sprintf('/^instalarV%s%s%s%s/i', $strRegexVersao, $strRegexRelease, $strRegexSprint, $strRegexItem);
268   -
269   - // Tenta encontrar métodos que iniciem com instalar
270   - $arrMetodo = (array)preg_grep ($strRegex, get_class_methods($this));
271   -
272   - $proximaVersao = $numPenVersao + 1;
273   -
274   - foreach($arrMetodo as $key => $metodo){
275   - $vers = str_replace('instalarV', '', $metodo);
276   - $vers = (int) substr($vers, 0, 3);
277   -
278   - if($proximaVersao > $vers){
279   - unset($arrMetodo[$key]);
280   - }
281   - }
282   -
283   - if(empty($arrMetodo)) {
284   -
285   - throw new InfraException(sprintf('NENHUMA ATUALIZACAO FOI ENCONTRADA SUPERIOR A VERSAO %s DO MODULO PEN', $strPenVersao));
286   - }
287   - else {
288   -
289   - foreach($arrMetodo as $strMetodo) {
290   -
291   - $this->{$strMetodo}();
292   - }
293   - }
294   - $this->setVersao($strVersaoInstalar, $objInfraBanco);
295   -
296   - return $strVersaoInstalar;
297   - }
298   -
299   - /**
300   - * Método que inicia o processo
301   - */
302   - public function atualizarVersao() {
303   -
304   - $this->inicializar('INICIANDO ATUALIZACAO DO MODULO PEN NO SEI VERSAO '.SEI_VERSAO);
305   -
306   - try {
307 96  
308   - $strRegexVersao = $this->executar();
309   - $this->logar('ATUALIZADA VERSAO: '.$strRegexVersao);
310   - }
311   - catch(InfraException $e) {
312   -
313   - $this->logar('Erro: '.$e->getStrDescricao());
314   - }
315   - catch (\Exception $e) {
316   -
317   - $this->logar('Erro: '.$e->getMessage());
318   - }
319   -
320   - $this->finalizar();
321   - }
322   -
323 97 /**
324 98 * Construtor
325 99 *
326 100 * @param array $arrArgs Argumentos enviados pelo script
327 101 */
328   - public function __construct($arrArgs = array()) {
329   -
  102 + public function __construct() {
  103 +
  104 + parent::__construct();
330 105 ini_set('max_execution_time', '0');
331 106 ini_set('memory_limit', '-1');
332 107 @ini_set('zlib.output_compression', '0');
333 108 @ini_set('implicit_flush', '1');
334 109 ob_implicit_flush();
335 110  
336   - $this->arrArgs = $arrArgs;
337   -
  111 + $this->inicializarObjInfraIBanco();
338 112 $this->inicializarObjMetaBanco();
339   -
  113 +
340 114 $this->objDebug = InfraDebug::getInstance();
341 115 $this->objDebug->setBolLigado(true);
342 116 $this->objDebug->setBolDebugInfra(true);
343 117 $this->objDebug->setBolEcho(true);
344 118 $this->objDebug->limpar();
345 119 }
346   -}
347 120 \ No newline at end of file
  121 +
  122 +}
... ...
rn/PenAtualizarSeiRN.php
1   -<?php
  1 +<?
2 2 /**
3   - * Atualizador do sistema SEI para instalar/atualizar o módulo PEN
4   - *
5   - * @author Join Tecnologia
  3 + *
  4 + * 12/08/2017 - criado por thiago.farias
  5 + *
6 6 */
7 7 class PenAtualizarSeiRN extends PenAtualizadorRN {
  8 +
  9 + private $nomeParametroModulo = 'PEN_VERSAO_MODULO_SEI';
  10 +// private $versionFunctions = [
  11 +// '0' => [
  12 +// 'instalarv100',
  13 +// ],
  14 +// '1.0.0' => [
  15 +//// 'instalarv101',
  16 +// ],
  17 +// ];
  18 +
  19 + public function __construct() {
  20 + parent::__construct();
  21 + }
8 22  
9   - protected $versaoMinRequirida = '2.6.0';
10   - protected $sei_versao = 'PEN_VERSAO_MODULO_SEI';
11   -
12   - protected function inicializarObjInfraIBanco() {
13   - if(empty($this->objBanco)) {
  23 + public function atualizarVersao() {
  24 + try {
  25 + $this->inicializar('INICIANDO ATUALIZACAO DO MODULO PEN NO SEI VERSAO ' . SEI_VERSAO);
  26 +
  27 + //testando se esta usando BDs suportados
  28 + if (!(BancoSEI::getInstance() instanceof InfraMySql) &&
  29 + !(BancoSEI::getInstance() instanceof InfraSqlServer) &&
  30 + !(BancoSEI::getInstance() instanceof InfraOracle)) {
  31 +
  32 + $this->finalizar('BANCO DE DADOS NAO SUPORTADO: ' . get_parent_class(BancoSEI::getInstance()), true);
  33 + }
  34 +
  35 + //testando permissoes de criações de tabelas
  36 + $objInfraMetaBD = new InfraMetaBD($this->objInfraBanco);
14 37  
15   - $this->objBanco = BancoSEI::getInstance();
  38 + if (count($objInfraMetaBD->obterTabelas('pen_sei_teste')) == 0) {
  39 + BancoSEI::getInstance()->executarSql('CREATE TABLE pen_sei_teste (id ' . $objInfraMetaBD->tipoNumero() . ' null)');
  40 + }
  41 + BancoSEI::getInstance()->executarSql('DROP TABLE pen_sei_teste');
  42 +
  43 +
  44 + $objInfraParametro = new InfraParametro($this->objInfraBanco);
  45 +
  46 + //$strVersaoAtual = $objInfraParametro->getValor('SEI_VERSAO', false);
  47 + $strVersaoModuloPen = $objInfraParametro->getValor($this->nomeParametroModulo, false);
  48 +
  49 + //VERIFICANDO QUAL VERSAO DEVE SER INSTALADA NESTA EXECUCAO
  50 + if (InfraString::isBolVazia($strVersaoModuloPen)) {
  51 + //nao tem nenhuma versao ainda, instalar todas
  52 + $this->instalarV100();
  53 + $this->instalarV101();
  54 + } else if ($strVersaoModuloPen == '1.0.0') {
  55 + $this->instalarV101();
  56 + } else if ($strVersaoModuloPen == '1.0.1') {
  57 + }
  58 +
  59 +
  60 + InfraDebug::getInstance()->setBolDebugInfra(true);
  61 + } catch (Exception $e) {
  62 +
  63 + InfraDebug::getInstance()->setBolLigado(false);
  64 + InfraDebug::getInstance()->setBolDebugInfra(false);
  65 + InfraDebug::getInstance()->setBolEcho(false);
  66 + throw new InfraException('Erro atualizando VERSAO.', $e);
16 67 }
17   - return $this->objBanco;
18 68 }
19   -
20   - protected function instalarV001(){
21 69  
22   - $objInfraBanco = $this->inicializarObjInfraIBanco();
23   - $objMetaBD = $this->inicializarObjMetaBanco();
  70 + /* Contem atualizações da versao 1.0.0 do modulo */
  71 + protected function instalarV100() {
  72 +
  73 + $objInfraBanco = $this->objInfraBanco;
  74 + $objMetaBD = $this->objMeta;
24 75  
25 76 $objMetaBD->criarTabela(array(
26 77 'tabela' => 'md_pen_processo_eletronico',
27 78 'cols' => array(
28   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  79 + 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
29 80 'id_procedimento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO)
30 81 ),
31 82 'pk' => array('numero_registro'),
... ... @@ -34,17 +85,17 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
34 85 'procedimento' => array('id_procedimento', 'id_procedimento')
35 86 )
36 87 ));
37   -
  88 +
38 89 $objMetaBD->criarTabela(array(
39 90 'tabela' => 'md_pen_tramite',
40 91 'cols' => array(
41 92 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
42   - 'id_tramite'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
43   - 'ticket_envio_componentes'=> array($objMetaBD->tipoTextoGrande(), PenMetaBD::SNULLO),
44   - 'dth_registro'=> array($objMetaBD->tipoDataHora(), PenMetaBD::SNULLO),
45   - 'id_andamento'=> array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO),
46   - 'id_usuario'=> array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO),
47   - 'id_unidade'=> array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO)
  93 + 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  94 + 'ticket_envio_componentes' => array($objMetaBD->tipoTextoGrande(), PenMetaBD::SNULLO),
  95 + 'dth_registro' => array($objMetaBD->tipoDataHora(), PenMetaBD::SNULLO),
  96 + 'id_andamento' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO),
  97 + 'id_usuario' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO),
  98 + 'id_unidade' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO)
48 99 ),
49 100 'pk' => array('id_tramite'),
50 101 'uk' => array('numero_registro', 'id_tramite'),
... ... @@ -54,13 +105,13 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
54 105 'unidade' => array('id_unidade', 'id_unidade')
55 106 )
56 107 ));
57   -
  108 +
58 109 $objMetaBD->criarTabela(array(
59 110 'tabela' => 'md_pen_especie_documental',
60 111 'cols' => array(
61   - 'id_especie'=> array($objMetaBD->tipoNumero(16), PenMetaBD::NNULLO),
62   - 'nome_especie'=> array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO),
63   - 'descricao'=> array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO)
  112 + 'id_especie' => array($objMetaBD->tipoNumero(16), PenMetaBD::NNULLO),
  113 + 'nome_especie' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO),
  114 + 'descricao' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO)
64 115 ),
65 116 'pk' => array('id_especie')
66 117 ));
... ... @@ -68,9 +119,9 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
68 119 $objMetaBD->criarTabela(array(
69 120 'tabela' => 'md_pen_tramite_pendente',
70 121 'cols' => array(
71   - 'id'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
72   - 'numero_tramite'=> array($objMetaBD->tipoTextoVariavel(255)),
73   - 'id_atividade_expedicao'=> array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO)
  122 + 'id' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  123 + 'numero_tramite' => array($objMetaBD->tipoTextoVariavel(255)),
  124 + 'id_atividade_expedicao' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO)
74 125 ),
75 126 'pk' => array('id')
76 127 ));
... ... @@ -78,19 +129,19 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
78 129 $objMetaBD->criarTabela(array(
79 130 'tabela' => 'md_pen_tramite_recibo_envio',
80 131 'cols' => array(
81   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  132 + 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
82 133 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
83 134 'dth_recebimento' => array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO),
84 135 'hash_assinatura' => array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO)
85 136 ),
86   - 'pk' => array('numero_registro', 'id_tramite')
  137 + 'pk' => array('numero_registro', 'id_tramite')
87 138 ));
88 139  
89 140  
90 141 $objMetaBD->criarTabela(array(
91 142 'tabela' => 'md_pen_procedimento_andamento',
92 143 'cols' => array(
93   - 'id_andamento'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  144 + 'id_andamento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
94 145 'id_procedimento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
95 146 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
96 147 'situacao' => array($objMetaBD->tipoTextoFixo(1), 'N'),
... ... @@ -99,13 +150,13 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
99 150 'hash' => array($objMetaBD->tipoTextoFixo(32), PenMetaBD::NNULLO),
100 151 'id_tarefa' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO)
101 152 ),
102   - 'pk' => array('id_andamento')
  153 + 'pk' => array('id_andamento')
103 154 ));
104 155  
105 156 $objMetaBD->criarTabela(array(
106 157 'tabela' => 'md_pen_protocolo',
107 158 'cols' => array(
108   - 'id_protocolo'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  159 + 'id_protocolo' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
109 160 'sin_obteve_recusa' => array($objMetaBD->tipoTextoFixo(1), 'N')
110 161 ),
111 162 'pk' => array('id_protocolo'),
... ... @@ -114,14 +165,14 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
114 165 )
115 166 ));
116 167  
117   - /* $objMetaBD->criarTabela(array(
118   - 'tabela' => 'md_pen_tramite_recusado',
119   - 'cols' => array(
120   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
121   - 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO)
122   - ),
123   - 'pk' => array('id_tramite')
124   - ));*/
  168 + /* $objMetaBD->criarTabela(array(
  169 + 'tabela' => 'md_pen_tramite_recusado',
  170 + 'cols' => array(
  171 + 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  172 + 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO)
  173 + ),
  174 + 'pk' => array('id_tramite')
  175 + )); */
125 176  
126 177 $objMetaBD->criarTabela(array(
127 178 'tabela' => 'md_pen_recibo_tramite',
... ... @@ -141,10 +192,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
141 192 $objMetaBD->criarTabela(array(
142 193 'tabela' => 'md_pen_recibo_tramite_enviado',
143 194 'cols' => array(
144   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  195 + 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
145 196 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
146   - 'dth_recebimento'=> array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO),
147   - 'hash_assinatura'=> array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO),
  197 + 'dth_recebimento' => array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO),
  198 + 'hash_assinatura' => array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO),
148 199 'cadeia_certificado ' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO)
149 200 ),
150 201 'pk' => array('numero_registro', 'id_tramite'),
... ... @@ -156,10 +207,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
156 207 $objMetaBD->criarTabela(array(
157 208 'tabela' => 'md_pen_recibo_tramite_recebido',
158 209 'cols' => array(
159   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  210 + 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
160 211 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
161   - 'dth_recebimento'=> array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO),
162   - 'hash_assinatura'=> array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO)
  212 + 'dth_recebimento' => array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO),
  213 + 'hash_assinatura' => array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO)
163 214 ),
164 215 'pk' => array('numero_registro', 'id_tramite', 'hash_assinatura'),
165 216 'fks' => array(
... ... @@ -170,9 +221,9 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
170 221 $objMetaBD->criarTabela(array(
171 222 'tabela' => 'md_pen_rel_processo_apensado',
172 223 'cols' => array(
173   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  224 + 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
174 225 'id_procedimento_apensado' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
175   - 'protocolo'=> array($objMetaBD->tipoTextoVariavel(50), PenMetaBD::NNULLO)
  226 + 'protocolo' => array($objMetaBD->tipoTextoVariavel(50), PenMetaBD::NNULLO)
176 227 ),
177 228 'pk' => array('numero_registro', 'id_procedimento_apensado'),
178 229 'fks' => array(
... ... @@ -183,9 +234,9 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
183 234 $objMetaBD->criarTabela(array(
184 235 'tabela' => 'md_pen_rel_serie_especie',
185 236 'cols' => array(
186   - 'codigo_especie'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  237 + 'codigo_especie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
187 238 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
188   - 'sin_padrao'=> array($objMetaBD->tipoTextoFixo(1), 'N')
  239 + 'sin_padrao' => array($objMetaBD->tipoTextoFixo(1), 'N')
189 240 ),
190 241 'pk' => array('id_serie'),
191 242 'uk' => array('codigo_especie', 'id_serie'),
... ... @@ -193,12 +244,12 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
193 244 'serie' => array('id_serie', 'id_serie')
194 245 )
195 246 ));
196   -
  247 +
197 248 $objMetaBD->criarTabela(array(
198 249 'tabela' => 'md_pen_rel_tarefa_operacao',
199 250 'cols' => array(
200   - 'id_tarefa'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
201   - 'codigo_operacao'=> array($objMetaBD->tipoTextoFixo(2), PenMetaBD::NNULLO)
  251 + 'id_tarefa' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  252 + 'codigo_operacao' => array($objMetaBD->tipoTextoFixo(2), PenMetaBD::NNULLO)
202 253 ),
203 254 'pk' => array('id_tarefa', 'codigo_operacao'),
204 255 'fks' => array(
... ... @@ -209,9 +260,9 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
209 260 $objMetaBD->criarTabela(array(
210 261 'tabela' => 'md_pen_rel_tipo_documento_mapeamento_recebido',
211 262 'cols' => array(
212   - 'codigo_especie'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
213   - 'id_serie'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
214   - 'sin_padrao'=> array($objMetaBD->tipoTextoFixo(2), PenMetaBD::NNULLO)
  263 + 'codigo_especie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  264 + 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  265 + 'sin_padrao' => array($objMetaBD->tipoTextoFixo(2), PenMetaBD::NNULLO)
215 266 ),
216 267 'pk' => array('codigo_especie', 'id_serie'),
217 268 'fks' => array(
... ... @@ -222,21 +273,21 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
222 273 $objMetaBD->criarTabela(array(
223 274 'tabela' => 'md_pen_componente_digital',
224 275 'cols' => array(
225   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
226   - 'id_procedimento'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
227   - 'id_documento'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
228   - 'id_tramite'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
229   - 'id_anexo'=> array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO),
230   - 'protocolo'=> array($objMetaBD->tipoTextoVariavel(50), PenMetaBD::NNULLO),
231   - 'nome'=> array($objMetaBD->tipoTextoVariavel(100), PenMetaBD::NNULLO),
232   - 'hash_conteudo'=> array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO),
233   - 'algoritmo_hash'=> array($objMetaBD->tipoTextoVariavel(20), PenMetaBD::NNULLO),
234   - 'tipo_conteudo'=> array($objMetaBD->tipoTextoFixo(3), PenMetaBD::NNULLO),
235   - 'mime_type'=> array($objMetaBD->tipoTextoVariavel(100), PenMetaBD::NNULLO),
236   - 'dados_complementares'=> array($objMetaBD->tipoTextoVariavel(1000), PenMetaBD::SNULLO),
237   - 'tamanho'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
238   - 'ordem'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
239   - 'sin_enviar'=> array($objMetaBD->tipoTextoFixo(1), 'N')
  276 + 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  277 + 'id_procedimento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  278 + 'id_documento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  279 + 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  280 + 'id_anexo' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO),
  281 + 'protocolo' => array($objMetaBD->tipoTextoVariavel(50), PenMetaBD::NNULLO),
  282 + 'nome' => array($objMetaBD->tipoTextoVariavel(100), PenMetaBD::NNULLO),
  283 + 'hash_conteudo' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO),
  284 + 'algoritmo_hash' => array($objMetaBD->tipoTextoVariavel(20), PenMetaBD::NNULLO),
  285 + 'tipo_conteudo' => array($objMetaBD->tipoTextoFixo(3), PenMetaBD::NNULLO),
  286 + 'mime_type' => array($objMetaBD->tipoTextoVariavel(100), PenMetaBD::NNULLO),
  287 + 'dados_complementares' => array($objMetaBD->tipoTextoVariavel(1000), PenMetaBD::SNULLO),
  288 + 'tamanho' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  289 + 'ordem' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  290 + 'sin_enviar' => array($objMetaBD->tipoTextoFixo(1), 'N')
240 291 ),
241 292 'pk' => array('numero_registro', 'id_procedimento', 'id_documento', 'id_tramite'),
242 293 'fks' => array(
... ... @@ -251,33 +302,33 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
251 302 $objMetaBD->criarTabela(array(
252 303 'tabela' => 'md_pen_unidade',
253 304 'cols' => array(
254   - 'id_unidade'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
255   - 'id_unidade_rh'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO)
  305 + 'id_unidade' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  306 + 'id_unidade_rh' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO)
256 307 ),
257 308 'pk' => array('id_unidade'),
258 309 'fks' => array(
259 310 'unidade' => array('id_unidade', 'id_unidade')
260 311 )
261 312 ));
262   -
  313 +
263 314 //----------------------------------------------------------------------
264 315 // Novas sequências
265 316 //----------------------------------------------------------------------
266 317 $objInfraSequencia = new InfraSequencia($objInfraBanco);
267   -
268   - if(!$objInfraSequencia->verificarSequencia('md_pen_procedimento_andamento')){
269   -
  318 +
  319 + if (!$objInfraSequencia->verificarSequencia('md_pen_procedimento_andamento')) {
  320 +
270 321 $objInfraSequencia->criarSequencia('md_pen_procedimento_andamento', '1', '1', '9999999999');
271 322 }
272   -
273   - if(!$objInfraSequencia->verificarSequencia('md_pen_tramite_pendente')){
  323 +
  324 + if (!$objInfraSequencia->verificarSequencia('md_pen_tramite_pendente')) {
274 325  
275 326 $objInfraSequencia->criarSequencia('md_pen_tramite_pendente', '1', '1', '9999999999');
276 327 }
277 328 //----------------------------------------------------------------------
278 329 // Parâmetros
279 330 //----------------------------------------------------------------------
280   -
  331 +
281 332 $objInfraParametro = new InfraParametro($objInfraBanco);
282 333  
283 334 $objInfraParametro->setValor('PEN_ID_REPOSITORIO_ORIGEM', '');
... ... @@ -288,223 +339,223 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
288 339 $objInfraParametro->setValor('PEN_ENDERECO_WEBSERVICE_PENDENCIAS', '');
289 340 $objInfraParametro->setValor('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO', '');
290 341 $objInfraParametro->setValor('PEN_LOCALIZACAO_CERTIFICADO_DIGITAL', '');
291   -
  342 +
292 343 //----------------------------------------------------------------------
293 344 // Especie de Documento
294 345 //----------------------------------------------------------------------
295   -
  346 +
296 347 $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
297 348 $objDTO = new EspecieDocumentalDTO();
298 349  
299   - $fnCadastrar = function($dblIdEspecie, $strNomeEspecie, $strDescricao) use($objDTO, $objBD){
300   -
  350 + $fnCadastrar = function($dblIdEspecie, $strNomeEspecie, $strDescricao) use($objDTO, $objBD) {
  351 +
301 352 $objDTO->unSetTodos();
302 353 $objDTO->setStrNomeEspecie($strNomeEspecie);
303 354  
304   - if($objBD->contar($objDTO) == 0){
  355 + if ($objBD->contar($objDTO) == 0) {
305 356 $objDTO->setDblIdEspecie($dblIdEspecie);
306 357 $objDTO->setStrDescricao($strDescricao);
307 358 $objBD->cadastrar($objDTO);
308   - }
  359 + }
309 360 };
310 361  
311   - $fnCadastrar(1,'Abaixo-assinado','Podendo ser complementado: de Reivindicação');
312   - $fnCadastrar(2,'Acórdão','Expressa decisão proferida pelo Conselho Diretor, não abrangida pelos demais instrumentos deliberativos anteriores.');
313   - $fnCadastrar(3,'Acordo','Podendo ser complementado: de Nível de Serviço; Coletivo de Trabalho');
314   - $fnCadastrar(4,'Alvará','Podendo ser complementado: de Funcionamento; Judicial');
315   - $fnCadastrar(5,'Anais','Podendo ser complementado: de Eventos; de Engenharia');
316   - $fnCadastrar(6,'Anteprojeto','Podendo ser complementado: de Lei');
317   - $fnCadastrar(7,'Apólice','Podendo ser complementado: de Seguro');
318   - $fnCadastrar(8,'Apostila','Podendo ser complementado: de Curso');
319   - $fnCadastrar(9,'Ata','Como Documento Externo pode ser complementado: de Reunião; de Realização de Pregão');
320   - $fnCadastrar(10,'Atestado','Podendo ser complementado: Médico; de Comparecimento; de Capacidade Técnica');
321   - $fnCadastrar(11,'Ato','Expressa decisão sobre outorga, expedição, modificação, transferência, prorrogação, adaptação e extinção de concessões, permissões e autorizações para exploração de serviços, uso de recursos escassos e exploração de satélite, e Chamamento Público.');
322   - $fnCadastrar(12,'Auto','Podendo ser complementado: de Vistoria; de Infração');
323   - $fnCadastrar(13,'Aviso','Podendo ser complementado: de Recebimento; de Sinistro; de Férias');
324   - $fnCadastrar(14,'Balancete','Podendo ser complementado: Financeiro');
325   - $fnCadastrar(15,'Balanço','Podendo ser complementado: Patrimonial - BP; Financeiro');
326   - $fnCadastrar(16,'Bilhete','Podendo ser complementado: de Pagamento; de Loteria');
327   - $fnCadastrar(17,'Boletim','Podendo ser complementado: de Ocorrência; Informativo');
328   - $fnCadastrar(18,'Carta','Podendo ser complementado: Convite');
329   - $fnCadastrar(19,'Cartaz','Podendo ser complementado: de Evento');
330   - $fnCadastrar(20,'Cédula','Podendo ser complementado: de Identidade; de Crédito Bancário; de Crédito Comercial; de Crédito Imobiliário');
331   - $fnCadastrar(21,'Certidão','Como Documento Externo pode ser complementado: de Tempo de Serviço; de Nascimento; de Casamento; de Óbito; Negativa de Falência ou Concordata; Negativa de Débitos Trabalhistas; Negativa de Débitos Tributários');
332   - $fnCadastrar(22,'Certificado','Podendo ser complementado: de Conclusão de Curso; de Calibração de Equipamento; de Marca');
333   - $fnCadastrar(23,'Cheque','Podendo ser complementado: Caução');
334   - $fnCadastrar(24,'Comprovante','Podendo ser complementado: de Despesa; de Rendimento; de Residência; de Matrícula; de União Estável');
335   - $fnCadastrar(25,'Comunicado','Expediente interno entre uma unidade administrativa e um servidor ou entre um servidor e uma unidade administrativa de um mesmo órgão público.');
336   - $fnCadastrar(26,'Consulta','Podendo ser complementado: Pública; Interna');
337   - $fnCadastrar(27,'Contracheque','Espécie própria');
338   - $fnCadastrar(28,'Contrato','Como Documento Externo pode ser complementado: Social');
339   - $fnCadastrar(29,'Convênio','Espécie própria');
340   - $fnCadastrar(30,'Convite','Podendo ser complementado: de Reunião; para Evento; de Casamento');
341   - $fnCadastrar(31,'Convenção','Podendo ser complementado: Coletiva de Trabalho; Internacional');
342   - $fnCadastrar(32,'Crachá','Podendo ser complementado: de Identificação; de Evento');
343   - $fnCadastrar(33,'Cronograma','Podendo ser complementado: de Projeto; de Estudos');
344   - $fnCadastrar(34,'Currículo','Podendo ser complementado: de Candidato');
345   - $fnCadastrar(35,'Debênture','Espécie própria');
346   - $fnCadastrar(36,'Decisão','Podendo ser complementado: Administrativa; Judicial');
347   - $fnCadastrar(37,'Declaração','Como Documento Externo pode ser complementado: de Imposto de Renda; de Conformidade; de Responsabilidade Técnica; de Acumulação de Aposentadoria; de Acumulação de Cargos; de Informações Econômico-Fiscais da Pessoa Jurídica $fnCadastrar(DIPJ);');
348   - $fnCadastrar(38,'Decreto','Espécie própria');
349   - $fnCadastrar(39,'Deliberação','Podendo ser complementado: de Recursos; do Conselho');
350   - $fnCadastrar(40,'Demonstrativo','Podendo ser complementado: Financeiro; de Pagamento; de Arrecadação');
351   - $fnCadastrar(41,'Depoimento','Podendo ser complementado: das Testemunhas');
352   - $fnCadastrar(42,'Despacho','Espécie própria');
353   - $fnCadastrar(43,'Diário','Podendo ser complementado: de Justiça; Oficial');
354   - $fnCadastrar(44,'Diploma','Podendo ser complementado: de Conclusão de Curso');
355   - $fnCadastrar(45,'Diretriz','Podendo ser complementado: Orçamentária');
356   - $fnCadastrar(46,'Dissertação','Podendo ser complementado: de Mestrado');
357   - $fnCadastrar(47,'Dossiê','Podendo ser complementado: de Processo; Técnico');
358   - $fnCadastrar(48,'Edital','Podendo ser complementado: de Convocação; de Intimação; de Lançamento');
359   - $fnCadastrar(49,'E-mail','Indicado nos Parâmetros para corresponder ao envio de Correspondência Eletrônica do SEI');
360   - $fnCadastrar(50,'Embargos','Podendo ser complementado: de Declaração; de Execução ou Infringentes');
361   - $fnCadastrar(51,'Emenda','Podendo ser complementado: Constitucional; de Comissão; de Bancada; de Relatoria');
362   - $fnCadastrar(52,'Escala','Podendo ser complementado: de Férias');
363   - $fnCadastrar(53,'Escritura','Podendo ser complementado: Pública; de Imóvel');
364   - $fnCadastrar(54,'Estatuto','Podendo ser complementado: Social');
365   - $fnCadastrar(55,'Exposição de Motivos','Espécie própria');
366   - $fnCadastrar(56,'Extrato','Podendo ser complementado: de Sistemas; Bancário');
367   - $fnCadastrar(57,'Fatura','Espécie própria');
368   - $fnCadastrar(58,'Ficha','Podendo ser complementado: de Cadastro; de Inscrição');
369   - $fnCadastrar(59,'Fluxograma','Podendo ser complementado: de Processo; de Documentos; de Blocos');
370   - $fnCadastrar(60,'Folha','Podendo ser complementado: de Frequência de Estagiário; de Frequência de Servidor');
371   - $fnCadastrar(61,'Folheto/Folder','Podendo ser complementado: de Evento');
372   - $fnCadastrar(62,'Formulário','Podendo ser complementado: de Contato; de Revisão');
373   - $fnCadastrar(63,'Grade Curricular','Podendo ser complementado: do Curso');
374   - $fnCadastrar(64,'Guia','Podendo ser complementado: de Recolhimento da União');
375   - $fnCadastrar(65,'Histórico','Podendo ser complementado: Escolar');
376   - $fnCadastrar(66,'Indicação','Espécie própria utilizada pelo Poder Legislativo');
377   - $fnCadastrar(67,'Informe','Como Documento Externo pode ser complementado: de Rendimentos');
378   - $fnCadastrar(68,'Instrução','Podendo ser complementado: Normativa');
379   - $fnCadastrar(69,'Inventário','Podendo ser complementado: de Estoque; Extrajudicial; Judicial; em Cartório');
380   - $fnCadastrar(70,'Laudo','Podendo ser complementado: Médico; Conclusivo');
381   - $fnCadastrar(71,'Lei','Podendo ser complementado: Complementar');
382   - $fnCadastrar(72,'Lista/Listagem','Podendo ser complementado: de Presença');
383   - $fnCadastrar(73,'Livro','Podendo ser complementado: Caixa');
384   - $fnCadastrar(74,'Mandado','Podendo ser complementado: de Busca e Apreensão; de Citação; de Intimação');
385   - $fnCadastrar(75,'Manifesto','Espécie própria');
386   - $fnCadastrar(76,'Manual','Podendo ser complementado: do Usuário; do Sistema; do Equipamento');
387   - $fnCadastrar(77,'Mapa','Podendo ser complementado: de Ruas; de Risco');
388   - $fnCadastrar(78,'Medida Provisória','Espécie própria');
389   - $fnCadastrar(79,'Memorando','Como Documento Externo pode ser complementado: de Entendimento');
390   - $fnCadastrar(80,'Memorando-circular','Mesma definição do Memorando com apenas uma diferença: é encaminhado simultaneamente a mais de um cargo.');
391   - $fnCadastrar(81,'Memorial','Podendo ser complementado: Descritivo; de Incorporação');
392   - $fnCadastrar(82,'Mensagem','Podendo ser complementado: de Aniversário; de Boas Vindas');
393   - $fnCadastrar(83,'Minuta','Podendo ser complementado: de Portaria; de Resolução');
394   - $fnCadastrar(84,'Moção','Podendo ser complementado: de Apoio; de Pesar; de Repúdio');
395   - $fnCadastrar(85,'Norma','Podendo ser complementado: Técnica; de Conduta');
396   - $fnCadastrar(86,'Nota','Podendo ser complementado: Técnica; de Empenho');
397   - $fnCadastrar(87,'Notificação','Podendo ser complementado: de Lançamento');
398   - $fnCadastrar(88,'Ofício','Modalidades de comunicação oficial. É expedido para e pelas autoridades. Tem como finalidade o tratamento de assuntos oficiais pelos órgãos da Administração Pública entre si e também com particulares.');
399   - $fnCadastrar(89,'Ofício-Circular','Espécie própria');
400   - $fnCadastrar(90,'Orçamento','Podendo ser complementado: de Obra; de Serviço');
401   - $fnCadastrar(91,'Ordem','Podendo ser complementado: de Serviço; de Compra; do Dia');
402   - $fnCadastrar(92,'Organograma','Podendo ser complementado: da Empresa');
403   - $fnCadastrar(93,'Orientação','Podendo ser complementado: Normativa; Jurisprudencial');
404   - $fnCadastrar(94,'Panfleto','Podendo ser complementado: de Promoção; de Evento');
405   - $fnCadastrar(95,'Parecer','Tipo de Documento próprio da AGU e outros órgãos públicos.');
406   - $fnCadastrar(96,'Passaporte','Espécie própria');
407   - $fnCadastrar(97,'Pauta','Podendo ser complementado: de Julgamentos; de Audiências; das Seções');
408   - $fnCadastrar(98,'Petição','Podendo ser complementado: Inicial; Incidental');
409   - $fnCadastrar(99,'Planilha','Podendo ser complementado: de Custos e Formação de Preços');
410   - $fnCadastrar(100,'Plano','Podendo ser complementado: de Serviço; de Contas Contábil');
411   - $fnCadastrar(101,'Planta','Podendo ser complementado: Baixa; de Localização; de Situação');
412   - $fnCadastrar(102,'Portaria','Expressa decisão relativa a assuntos de interesse interno da Agência.');
413   - $fnCadastrar(103,'Precatório','Podendo ser complementado: Alimentar; Federal; Estadual; Municipal');
414   - $fnCadastrar(104,'Processo','Processo');
415   - $fnCadastrar(105,'Procuração','Espécie própria');
416   - $fnCadastrar(106,'Programa','Podendo ser complementado: de Governo; de Melhoria');
417   - $fnCadastrar(107,'Projeto','Podendo ser complementado: Técnico; Comercial');
418   - $fnCadastrar(108,'Prontuário','Podendo ser complementado: Médico; Odontológico');
419   - $fnCadastrar(109,'Pronunciamento','Espécie própria');
420   - $fnCadastrar(110,'Proposta','Podendo ser complementado: Comercial; de Orçamento; Técnica');
421   - $fnCadastrar(111,'Prospecto','Podendo ser complementado: de Fundos');
422   - $fnCadastrar(112,'Protocolo','Podendo ser complementado: de Entendimentos; de Entrega');
423   - $fnCadastrar(113,'Prova','Podendo ser complementado: de Conceito; de Proficiência');
424   - $fnCadastrar(114,'Questionário','Podendo ser complementado: de Avaliação; de Pesquisa; Socioeconômico');
425   - $fnCadastrar(115,'Receita','Espécie própria');
426   - $fnCadastrar(116,'Recibo','Podendo ser complementado: de Pagamento; de Entrega');
427   - $fnCadastrar(117,'Recurso','Podendo ser complementado: Administrativo; Judicial');
428   - $fnCadastrar(118,'Regimento','Podendo ser complementado: Interno');
429   - $fnCadastrar(119,'Registro','Podendo ser complementado: de Detalhes de Chamadas - CDR; de Acesso; Comercial');
430   - $fnCadastrar(120,'Regulamento','Podendo ser complementado: Geral; Disciplinar; de Administração');
431   - $fnCadastrar(121,'Relação','Podendo ser complementado: de Bens Reversíveis - RBR');
432   - $fnCadastrar(122,'Relatório','Podendo ser complementado: de Conformidade; de Medições; de Prestação de Contas; de Viagem a Serviço; Fotográfico; Técnico');
433   - $fnCadastrar(123,'Release','Podendo ser complementado: de Resultados; de Produtos; de Serviços');
434   - $fnCadastrar(124,'Representação','Podendo ser complementado: Comercial; Processual; Fiscal');
435   - $fnCadastrar(125,'Requerimento','Podendo ser complementado: Administrativo; de Adaptação; de Alteração Técnica; de Alteração Técnica; de Autocadastramento de Estação; de Licenciamento de Estação; de Serviço de Telecomunicações');
436   - $fnCadastrar(126,'Requisição','Podendo ser complementado: de Auditoria; de Exclusão; de Segunda Via');
437   - $fnCadastrar(127,'Resolução','Expressa decisão quanto ao provimento normativo que regula a implementação da política de telecomunicações brasileira, a prestação dos serviços de telecomunicações, a administração dos recursos à prestação e o funcionamento da Agência.');
438   - $fnCadastrar(128,'Resumo','Podendo ser complementado: Técnico');
439   - $fnCadastrar(129,'Roteiro','Podendo ser complementado: de Instalação; de Inspeção');
440   - $fnCadastrar(130,'Sentença','Podendo ser complementado: de Mérito; Terminativa; Declaratória; Constitutiva; Condenatória; Mandamental; Executiva');
441   - $fnCadastrar(131,'Sinopse','Podendo ser complementado: do Livro; do Estudo Técnico');
442   - $fnCadastrar(132,'Solicitação','Podendo ser complementado: de Pagamento');
443   - $fnCadastrar(133,'Súmula','Expressa decisão quanto à interpretação da legislação de telecomunicações e fixa entendimento sobre matérias de competência da Agência, com efeito vinculativo.');
444   - $fnCadastrar(134,'Tabela','Podendo ser complementado: de Visto; de Passaporte; de Certidão');
445   - $fnCadastrar(135,'Telegrama','Espécie própria');
446   - $fnCadastrar(136,'Termo','Podendo ser complementado: de Opção por Auxílio Financeiro; de Opção para Contribuição ao CPSS; de Conciliação; de Devolução; de Doação; de Recebimento; de Rescisão; de Compromisso de Estágio; de Representação; de Responsabilidade de Instalação - TRI');
447   - $fnCadastrar(137,'Tese','Podendo ser complementado: de Doutorado');
448   - $fnCadastrar(138,'Testamento','Podendo ser complementado: Particular; Vital; Cerrado; Conjuntivo');
449   - $fnCadastrar(139,'Título','Podendo ser complementado: de Eleitor; Público; de Capitalização');
450   - $fnCadastrar(140,'Voto','Espécie própria');
451   - $fnCadastrar(141,'Carteira','Podendo ser complementado: Nacional de Habilitação');
452   - $fnCadastrar(142,'Cartão','Podendo ser complementado: de Identificação');
453   - $fnCadastrar(143,'CPF/CIC','Espécie própria');
454   - $fnCadastrar(144,'CNPJ','Espécie própria');
455   - $fnCadastrar(145,'Calendário','Podendo ser complementado: de Reuniões');
456   - $fnCadastrar(146,'CNH','CNH');
457   - $fnCadastrar(147,'RG','RG');
458   - $fnCadastrar(148,'Agenda','Podendo ser complementado: de Reunião');
459   - $fnCadastrar(149,'Análise','Como Documento Externo pode ser complementado: Contábil');
460   - $fnCadastrar(150,'Anotação','Podendo ser complementado: de Responsabilidade Técnica - ART');
461   - $fnCadastrar(151,'Áudio','Podendo ser complementado: de Reunião');
462   - $fnCadastrar(152,'Boleto','Podendo ser complementado: de Pagamento; de Cobrança; de Cobrança Registrada; de Cobrança sem Registro');
463   - $fnCadastrar(153,'Conta','Podendo ser complementado: Telefônica; de Água; de Luz');
464   - $fnCadastrar(154,'Contrarrazões','Podendo ser complementado: em Recurso; em Apelação; em Embargos Infringentes');
465   - $fnCadastrar(155,'Correspondência','Espécie própria');
466   - $fnCadastrar(156,'Cota','Tipo de Documento próprio da AGU.');
467   - $fnCadastrar(157,'Credencial','Podendo ser complementado: de Segurança; de Agente de Fiscalização');
468   - $fnCadastrar(158,'Croqui','Podendo ser complementado: de Acesso, Urbano');
469   - $fnCadastrar(159,'Defesa','Podendo ser complementado: Administrativa; Judicial');
470   - $fnCadastrar(160,'Demonstração','Podendo ser complementado: de Resultado do Exercício - DRE; de Fluxo de Caixa; Financeira; Contábil');
471   - $fnCadastrar(161,'Denúncia','Espécie própria');
472   - $fnCadastrar(162,'Esclarecimento','Espécie própria utilizada em Licitação $fnCadastrar(ComprasNet);');
473   - $fnCadastrar(163,'Escrituração','Podendo ser complementado: Contábil Digital - ECD; Fiscal Digital - EFD; Fiscal Digital - EFD-Contribuições');
474   - $fnCadastrar(164,'Estratégia','Podendo ser complementado: da Contratação');
475   - $fnCadastrar(165,'Impugnação','Espécie própria utilizada em Licitação $fnCadastrar(ComprasNet);');
476   - $fnCadastrar(166,'Informação','Tipo de Documento próprio da AGU.');
477   - $fnCadastrar(167,'Intenção','Podendo ser complementado: de Recurso; de Compra; de Venda');
478   - $fnCadastrar(168,'Licença','Podendo ser complementado: de Estação');
479   - $fnCadastrar(169,'Matéria','Podendo ser complementado: para Apreciação');
480   - $fnCadastrar(170,'Material','Podendo ser complementado: Publicitário; de Evento; de Promoção');
481   - $fnCadastrar(171,'Memória','Podendo ser complementado: de Cálculo');
482   - $fnCadastrar(172,'Movimentação','Podendo ser complementado: de Bens Móveis');
483   - $fnCadastrar(173,'Pedido','Podendo ser complementado: de Reconsideração; de Esclarecimento');
484   - $fnCadastrar(174,'Reclamação','Espécie própria');
485   - $fnCadastrar(175,'Referendo','Espécie própria');
486   - $fnCadastrar(176,'Resultado','Podendo ser complementado: de Exame Médico; de Contestação');
487   - $fnCadastrar(177,'Vídeo','Podendo ser complementado: de Reunião');
488   -
489   -
  362 + $fnCadastrar(1, 'Abaixo-assinado', 'Podendo ser complementado: de Reivindicação');
  363 + $fnCadastrar(2, 'Acórdão', 'Expressa decisão proferida pelo Conselho Diretor, não abrangida pelos demais instrumentos deliberativos anteriores.');
  364 + $fnCadastrar(3, 'Acordo', 'Podendo ser complementado: de Nível de Serviço; Coletivo de Trabalho');
  365 + $fnCadastrar(4, 'Alvará', 'Podendo ser complementado: de Funcionamento; Judicial');
  366 + $fnCadastrar(5, 'Anais', 'Podendo ser complementado: de Eventos; de Engenharia');
  367 + $fnCadastrar(6, 'Anteprojeto', 'Podendo ser complementado: de Lei');
  368 + $fnCadastrar(7, 'Apólice', 'Podendo ser complementado: de Seguro');
  369 + $fnCadastrar(8, 'Apostila', 'Podendo ser complementado: de Curso');
  370 + $fnCadastrar(9, 'Ata', 'Como Documento Externo pode ser complementado: de Reunião; de Realização de Pregão');
  371 + $fnCadastrar(10, 'Atestado', 'Podendo ser complementado: Médico; de Comparecimento; de Capacidade Técnica');
  372 + $fnCadastrar(11, 'Ato', 'Expressa decisão sobre outorga, expedição, modificação, transferência, prorrogação, adaptação e extinção de concessões, permissões e autorizações para exploração de serviços, uso de recursos escassos e exploração de satélite, e Chamamento Público.');
  373 + $fnCadastrar(12, 'Auto', 'Podendo ser complementado: de Vistoria; de Infração');
  374 + $fnCadastrar(13, 'Aviso', 'Podendo ser complementado: de Recebimento; de Sinistro; de Férias');
  375 + $fnCadastrar(14, 'Balancete', 'Podendo ser complementado: Financeiro');
  376 + $fnCadastrar(15, 'Balanço', 'Podendo ser complementado: Patrimonial - BP; Financeiro');
  377 + $fnCadastrar(16, 'Bilhete', 'Podendo ser complementado: de Pagamento; de Loteria');
  378 + $fnCadastrar(17, 'Boletim', 'Podendo ser complementado: de Ocorrência; Informativo');
  379 + $fnCadastrar(18, 'Carta', 'Podendo ser complementado: Convite');
  380 + $fnCadastrar(19, 'Cartaz', 'Podendo ser complementado: de Evento');
  381 + $fnCadastrar(20, 'Cédula', 'Podendo ser complementado: de Identidade; de Crédito Bancário; de Crédito Comercial; de Crédito Imobiliário');
  382 + $fnCadastrar(21, 'Certidão', 'Como Documento Externo pode ser complementado: de Tempo de Serviço; de Nascimento; de Casamento; de Óbito; Negativa de Falência ou Concordata; Negativa de Débitos Trabalhistas; Negativa de Débitos Tributários');
  383 + $fnCadastrar(22, 'Certificado', 'Podendo ser complementado: de Conclusão de Curso; de Calibração de Equipamento; de Marca');
  384 + $fnCadastrar(23, 'Cheque', 'Podendo ser complementado: Caução');
  385 + $fnCadastrar(24, 'Comprovante', 'Podendo ser complementado: de Despesa; de Rendimento; de Residência; de Matrícula; de União Estável');
  386 + $fnCadastrar(25, 'Comunicado', 'Expediente interno entre uma unidade administrativa e um servidor ou entre um servidor e uma unidade administrativa de um mesmo órgão público.');
  387 + $fnCadastrar(26, 'Consulta', 'Podendo ser complementado: Pública; Interna');
  388 + $fnCadastrar(27, 'Contracheque', 'Espécie própria');
  389 + $fnCadastrar(28, 'Contrato', 'Como Documento Externo pode ser complementado: Social');
  390 + $fnCadastrar(29, 'Convênio', 'Espécie própria');
  391 + $fnCadastrar(30, 'Convite', 'Podendo ser complementado: de Reunião; para Evento; de Casamento');
  392 + $fnCadastrar(31, 'Convenção', 'Podendo ser complementado: Coletiva de Trabalho; Internacional');
  393 + $fnCadastrar(32, 'Crachá', 'Podendo ser complementado: de Identificação; de Evento');
  394 + $fnCadastrar(33, 'Cronograma', 'Podendo ser complementado: de Projeto; de Estudos');
  395 + $fnCadastrar(34, 'Currículo', 'Podendo ser complementado: de Candidato');
  396 + $fnCadastrar(35, 'Debênture', 'Espécie própria');
  397 + $fnCadastrar(36, 'Decisão', 'Podendo ser complementado: Administrativa; Judicial');
  398 + $fnCadastrar(37, 'Declaração', 'Como Documento Externo pode ser complementado: de Imposto de Renda; de Conformidade; de Responsabilidade Técnica; de Acumulação de Aposentadoria; de Acumulação de Cargos; de Informações Econômico-Fiscais da Pessoa Jurídica $fnCadastrar(DIPJ);');
  399 + $fnCadastrar(38, 'Decreto', 'Espécie própria');
  400 + $fnCadastrar(39, 'Deliberação', 'Podendo ser complementado: de Recursos; do Conselho');
  401 + $fnCadastrar(40, 'Demonstrativo', 'Podendo ser complementado: Financeiro; de Pagamento; de Arrecadação');
  402 + $fnCadastrar(41, 'Depoimento', 'Podendo ser complementado: das Testemunhas');
  403 + $fnCadastrar(42, 'Despacho', 'Espécie própria');
  404 + $fnCadastrar(43, 'Diário', 'Podendo ser complementado: de Justiça; Oficial');
  405 + $fnCadastrar(44, 'Diploma', 'Podendo ser complementado: de Conclusão de Curso');
  406 + $fnCadastrar(45, 'Diretriz', 'Podendo ser complementado: Orçamentária');
  407 + $fnCadastrar(46, 'Dissertação', 'Podendo ser complementado: de Mestrado');
  408 + $fnCadastrar(47, 'Dossiê', 'Podendo ser complementado: de Processo; Técnico');
  409 + $fnCadastrar(48, 'Edital', 'Podendo ser complementado: de Convocação; de Intimação; de Lançamento');
  410 + $fnCadastrar(49, 'E-mail', 'Indicado nos Parâmetros para corresponder ao envio de Correspondência Eletrônica do SEI');
  411 + $fnCadastrar(50, 'Embargos', 'Podendo ser complementado: de Declaração; de Execução ou Infringentes');
  412 + $fnCadastrar(51, 'Emenda', 'Podendo ser complementado: Constitucional; de Comissão; de Bancada; de Relatoria');
  413 + $fnCadastrar(52, 'Escala', 'Podendo ser complementado: de Férias');
  414 + $fnCadastrar(53, 'Escritura', 'Podendo ser complementado: Pública; de Imóvel');
  415 + $fnCadastrar(54, 'Estatuto', 'Podendo ser complementado: Social');
  416 + $fnCadastrar(55, 'Exposição de Motivos', 'Espécie própria');
  417 + $fnCadastrar(56, 'Extrato', 'Podendo ser complementado: de Sistemas; Bancário');
  418 + $fnCadastrar(57, 'Fatura', 'Espécie própria');
  419 + $fnCadastrar(58, 'Ficha', 'Podendo ser complementado: de Cadastro; de Inscrição');
  420 + $fnCadastrar(59, 'Fluxograma', 'Podendo ser complementado: de Processo; de Documentos; de Blocos');
  421 + $fnCadastrar(60, 'Folha', 'Podendo ser complementado: de Frequência de Estagiário; de Frequência de Servidor');
  422 + $fnCadastrar(61, 'Folheto/Folder', 'Podendo ser complementado: de Evento');
  423 + $fnCadastrar(62, 'Formulário', 'Podendo ser complementado: de Contato; de Revisão');
  424 + $fnCadastrar(63, 'Grade Curricular', 'Podendo ser complementado: do Curso');
  425 + $fnCadastrar(64, 'Guia', 'Podendo ser complementado: de Recolhimento da União');
  426 + $fnCadastrar(65, 'Histórico', 'Podendo ser complementado: Escolar');
  427 + $fnCadastrar(66, 'Indicação', 'Espécie própria utilizada pelo Poder Legislativo');
  428 + $fnCadastrar(67, 'Informe', 'Como Documento Externo pode ser complementado: de Rendimentos');
  429 + $fnCadastrar(68, 'Instrução', 'Podendo ser complementado: Normativa');
  430 + $fnCadastrar(69, 'Inventário', 'Podendo ser complementado: de Estoque; Extrajudicial; Judicial; em Cartório');
  431 + $fnCadastrar(70, 'Laudo', 'Podendo ser complementado: Médico; Conclusivo');
  432 + $fnCadastrar(71, 'Lei', 'Podendo ser complementado: Complementar');
  433 + $fnCadastrar(72, 'Lista/Listagem', 'Podendo ser complementado: de Presença');
  434 + $fnCadastrar(73, 'Livro', 'Podendo ser complementado: Caixa');
  435 + $fnCadastrar(74, 'Mandado', 'Podendo ser complementado: de Busca e Apreensão; de Citação; de Intimação');
  436 + $fnCadastrar(75, 'Manifesto', 'Espécie própria');
  437 + $fnCadastrar(76, 'Manual', 'Podendo ser complementado: do Usuário; do Sistema; do Equipamento');
  438 + $fnCadastrar(77, 'Mapa', 'Podendo ser complementado: de Ruas; de Risco');
  439 + $fnCadastrar(78, 'Medida Provisória', 'Espécie própria');
  440 + $fnCadastrar(79, 'Memorando', 'Como Documento Externo pode ser complementado: de Entendimento');
  441 + $fnCadastrar(80, 'Memorando-circular', 'Mesma definição do Memorando com apenas uma diferença: é encaminhado simultaneamente a mais de um cargo.');
  442 + $fnCadastrar(81, 'Memorial', 'Podendo ser complementado: Descritivo; de Incorporação');
  443 + $fnCadastrar(82, 'Mensagem', 'Podendo ser complementado: de Aniversário; de Boas Vindas');
  444 + $fnCadastrar(83, 'Minuta', 'Podendo ser complementado: de Portaria; de Resolução');
  445 + $fnCadastrar(84, 'Moção', 'Podendo ser complementado: de Apoio; de Pesar; de Repúdio');
  446 + $fnCadastrar(85, 'Norma', 'Podendo ser complementado: Técnica; de Conduta');
  447 + $fnCadastrar(86, 'Nota', 'Podendo ser complementado: Técnica; de Empenho');
  448 + $fnCadastrar(87, 'Notificação', 'Podendo ser complementado: de Lançamento');
  449 + $fnCadastrar(88, 'Ofício', 'Modalidades de comunicação oficial. É expedido para e pelas autoridades. Tem como finalidade o tratamento de assuntos oficiais pelos órgãos da Administração Pública entre si e também com particulares.');
  450 + $fnCadastrar(89, 'Ofício-Circular', 'Espécie própria');
  451 + $fnCadastrar(90, 'Orçamento', 'Podendo ser complementado: de Obra; de Serviço');
  452 + $fnCadastrar(91, 'Ordem', 'Podendo ser complementado: de Serviço; de Compra; do Dia');
  453 + $fnCadastrar(92, 'Organograma', 'Podendo ser complementado: da Empresa');
  454 + $fnCadastrar(93, 'Orientação', 'Podendo ser complementado: Normativa; Jurisprudencial');
  455 + $fnCadastrar(94, 'Panfleto', 'Podendo ser complementado: de Promoção; de Evento');
  456 + $fnCadastrar(95, 'Parecer', 'Tipo de Documento próprio da AGU e outros órgãos públicos.');
  457 + $fnCadastrar(96, 'Passaporte', 'Espécie própria');
  458 + $fnCadastrar(97, 'Pauta', 'Podendo ser complementado: de Julgamentos; de Audiências; das Seções');
  459 + $fnCadastrar(98, 'Petição', 'Podendo ser complementado: Inicial; Incidental');
  460 + $fnCadastrar(99, 'Planilha', 'Podendo ser complementado: de Custos e Formação de Preços');
  461 + $fnCadastrar(100, 'Plano', 'Podendo ser complementado: de Serviço; de Contas Contábil');
  462 + $fnCadastrar(101, 'Planta', 'Podendo ser complementado: Baixa; de Localização; de Situação');
  463 + $fnCadastrar(102, 'Portaria', 'Expressa decisão relativa a assuntos de interesse interno da Agência.');
  464 + $fnCadastrar(103, 'Precatório', 'Podendo ser complementado: Alimentar; Federal; Estadual; Municipal');
  465 + $fnCadastrar(104, 'Processo', 'Processo');
  466 + $fnCadastrar(105, 'Procuração', 'Espécie própria');
  467 + $fnCadastrar(106, 'Programa', 'Podendo ser complementado: de Governo; de Melhoria');
  468 + $fnCadastrar(107, 'Projeto', 'Podendo ser complementado: Técnico; Comercial');
  469 + $fnCadastrar(108, 'Prontuário', 'Podendo ser complementado: Médico; Odontológico');
  470 + $fnCadastrar(109, 'Pronunciamento', 'Espécie própria');
  471 + $fnCadastrar(110, 'Proposta', 'Podendo ser complementado: Comercial; de Orçamento; Técnica');
  472 + $fnCadastrar(111, 'Prospecto', 'Podendo ser complementado: de Fundos');
  473 + $fnCadastrar(112, 'Protocolo', 'Podendo ser complementado: de Entendimentos; de Entrega');
  474 + $fnCadastrar(113, 'Prova', 'Podendo ser complementado: de Conceito; de Proficiência');
  475 + $fnCadastrar(114, 'Questionário', 'Podendo ser complementado: de Avaliação; de Pesquisa; Socioeconômico');
  476 + $fnCadastrar(115, 'Receita', 'Espécie própria');
  477 + $fnCadastrar(116, 'Recibo', 'Podendo ser complementado: de Pagamento; de Entrega');
  478 + $fnCadastrar(117, 'Recurso', 'Podendo ser complementado: Administrativo; Judicial');
  479 + $fnCadastrar(118, 'Regimento', 'Podendo ser complementado: Interno');
  480 + $fnCadastrar(119, 'Registro', 'Podendo ser complementado: de Detalhes de Chamadas - CDR; de Acesso; Comercial');
  481 + $fnCadastrar(120, 'Regulamento', 'Podendo ser complementado: Geral; Disciplinar; de Administração');
  482 + $fnCadastrar(121, 'Relação', 'Podendo ser complementado: de Bens Reversíveis - RBR');
  483 + $fnCadastrar(122, 'Relatório', 'Podendo ser complementado: de Conformidade; de Medições; de Prestação de Contas; de Viagem a Serviço; Fotográfico; Técnico');
  484 + $fnCadastrar(123, 'Release', 'Podendo ser complementado: de Resultados; de Produtos; de Serviços');
  485 + $fnCadastrar(124, 'Representação', 'Podendo ser complementado: Comercial; Processual; Fiscal');
  486 + $fnCadastrar(125, 'Requerimento', 'Podendo ser complementado: Administrativo; de Adaptação; de Alteração Técnica; de Alteração Técnica; de Autocadastramento de Estação; de Licenciamento de Estação; de Serviço de Telecomunicações');
  487 + $fnCadastrar(126, 'Requisição', 'Podendo ser complementado: de Auditoria; de Exclusão; de Segunda Via');
  488 + $fnCadastrar(127, 'Resolução', 'Expressa decisão quanto ao provimento normativo que regula a implementação da política de telecomunicações brasileira, a prestação dos serviços de telecomunicações, a administração dos recursos à prestação e o funcionamento da Agência.');
  489 + $fnCadastrar(128, 'Resumo', 'Podendo ser complementado: Técnico');
  490 + $fnCadastrar(129, 'Roteiro', 'Podendo ser complementado: de Instalação; de Inspeção');
  491 + $fnCadastrar(130, 'Sentença', 'Podendo ser complementado: de Mérito; Terminativa; Declaratória; Constitutiva; Condenatória; Mandamental; Executiva');
  492 + $fnCadastrar(131, 'Sinopse', 'Podendo ser complementado: do Livro; do Estudo Técnico');
  493 + $fnCadastrar(132, 'Solicitação', 'Podendo ser complementado: de Pagamento');
  494 + $fnCadastrar(133, 'Súmula', 'Expressa decisão quanto à interpretação da legislação de telecomunicações e fixa entendimento sobre matérias de competência da Agência, com efeito vinculativo.');
  495 + $fnCadastrar(134, 'Tabela', 'Podendo ser complementado: de Visto; de Passaporte; de Certidão');
  496 + $fnCadastrar(135, 'Telegrama', 'Espécie própria');
  497 + $fnCadastrar(136, 'Termo', 'Podendo ser complementado: de Opção por Auxílio Financeiro; de Opção para Contribuição ao CPSS; de Conciliação; de Devolução; de Doação; de Recebimento; de Rescisão; de Compromisso de Estágio; de Representação; de Responsabilidade de Instalação - TRI');
  498 + $fnCadastrar(137, 'Tese', 'Podendo ser complementado: de Doutorado');
  499 + $fnCadastrar(138, 'Testamento', 'Podendo ser complementado: Particular; Vital; Cerrado; Conjuntivo');
  500 + $fnCadastrar(139, 'Título', 'Podendo ser complementado: de Eleitor; Público; de Capitalização');
  501 + $fnCadastrar(140, 'Voto', 'Espécie própria');
  502 + $fnCadastrar(141, 'Carteira', 'Podendo ser complementado: Nacional de Habilitação');
  503 + $fnCadastrar(142, 'Cartão', 'Podendo ser complementado: de Identificação');
  504 + $fnCadastrar(143, 'CPF/CIC', 'Espécie própria');
  505 + $fnCadastrar(144, 'CNPJ', 'Espécie própria');
  506 + $fnCadastrar(145, 'Calendário', 'Podendo ser complementado: de Reuniões');
  507 + $fnCadastrar(146, 'CNH', 'CNH');
  508 + $fnCadastrar(147, 'RG', 'RG');
  509 + $fnCadastrar(148, 'Agenda', 'Podendo ser complementado: de Reunião');
  510 + $fnCadastrar(149, 'Análise', 'Como Documento Externo pode ser complementado: Contábil');
  511 + $fnCadastrar(150, 'Anotação', 'Podendo ser complementado: de Responsabilidade Técnica - ART');
  512 + $fnCadastrar(151, 'Áudio', 'Podendo ser complementado: de Reunião');
  513 + $fnCadastrar(152, 'Boleto', 'Podendo ser complementado: de Pagamento; de Cobrança; de Cobrança Registrada; de Cobrança sem Registro');
  514 + $fnCadastrar(153, 'Conta', 'Podendo ser complementado: Telefônica; de Água; de Luz');
  515 + $fnCadastrar(154, 'Contrarrazões', 'Podendo ser complementado: em Recurso; em Apelação; em Embargos Infringentes');
  516 + $fnCadastrar(155, 'Correspondência', 'Espécie própria');
  517 + $fnCadastrar(156, 'Cota', 'Tipo de Documento próprio da AGU.');
  518 + $fnCadastrar(157, 'Credencial', 'Podendo ser complementado: de Segurança; de Agente de Fiscalização');
  519 + $fnCadastrar(158, 'Croqui', 'Podendo ser complementado: de Acesso, Urbano');
  520 + $fnCadastrar(159, 'Defesa', 'Podendo ser complementado: Administrativa; Judicial');
  521 + $fnCadastrar(160, 'Demonstração', 'Podendo ser complementado: de Resultado do Exercício - DRE; de Fluxo de Caixa; Financeira; Contábil');
  522 + $fnCadastrar(161, 'Denúncia', 'Espécie própria');
  523 + $fnCadastrar(162, 'Esclarecimento', 'Espécie própria utilizada em Licitação $fnCadastrar(ComprasNet);');
  524 + $fnCadastrar(163, 'Escrituração', 'Podendo ser complementado: Contábil Digital - ECD; Fiscal Digital - EFD; Fiscal Digital - EFD-Contribuições');
  525 + $fnCadastrar(164, 'Estratégia', 'Podendo ser complementado: da Contratação');
  526 + $fnCadastrar(165, 'Impugnação', 'Espécie própria utilizada em Licitação $fnCadastrar(ComprasNet);');
  527 + $fnCadastrar(166, 'Informação', 'Tipo de Documento próprio da AGU.');
  528 + $fnCadastrar(167, 'Intenção', 'Podendo ser complementado: de Recurso; de Compra; de Venda');
  529 + $fnCadastrar(168, 'Licença', 'Podendo ser complementado: de Estação');
  530 + $fnCadastrar(169, 'Matéria', 'Podendo ser complementado: para Apreciação');
  531 + $fnCadastrar(170, 'Material', 'Podendo ser complementado: Publicitário; de Evento; de Promoção');
  532 + $fnCadastrar(171, 'Memória', 'Podendo ser complementado: de Cálculo');
  533 + $fnCadastrar(172, 'Movimentação', 'Podendo ser complementado: de Bens Móveis');
  534 + $fnCadastrar(173, 'Pedido', 'Podendo ser complementado: de Reconsideração; de Esclarecimento');
  535 + $fnCadastrar(174, 'Reclamação', 'Espécie própria');
  536 + $fnCadastrar(175, 'Referendo', 'Espécie própria');
  537 + $fnCadastrar(176, 'Resultado', 'Podendo ser complementado: de Exame Médico; de Contestação');
  538 + $fnCadastrar(177, 'Vídeo', 'Podendo ser complementado: de Reunião');
  539 +
  540 +
490 541 //----------------------------------------------------------------------
491 542 // Tarefas
492 543 //----------------------------------------------------------------------
493 544 $objDTO = new TarefaDTO();
494 545  
495   - $fnCadastrar = function($strNome = '', $strHistoricoCompleto = 'N', $strHistoricoCompleto = 'N', $strFecharAndamentosAbertos = 'N', $strLancarAndamentoFechado = 'N', $strPermiteProcessoFechado = 'N', $strIdTarefaModulo = '') use($objDTO, $objBD){
496   -
  546 + $fnCadastrar = function($strNome = '', $strHistoricoCompleto = 'N', $strHistoricoCompleto = 'N', $strFecharAndamentosAbertos = 'N', $strLancarAndamentoFechado = 'N', $strPermiteProcessoFechado = 'N', $strIdTarefaModulo = '') use($objDTO, $objBD) {
  547 +
497 548 $objDTO->unSetTodos();
498 549 $objDTO->setStrIdTarefaModulo($strIdTarefaModulo);
499 550  
500   - if($objBD->contar($objDTO) == 0){
501   -
  551 + if ($objBD->contar($objDTO) == 0) {
  552 +
502 553 $objUltimaTarefaDTO = new TarefaDTO();
503 554 $objUltimaTarefaDTO->retNumIdTarefa();
504 555 $objUltimaTarefaDTO->setNumMaxRegistrosRetorno(1);
505 556 $objUltimaTarefaDTO->setOrd('IdTarefa', InfraDTO::$TIPO_ORDENACAO_DESC);
506 557 $objUltimaTarefaDTO = $objBD->consultar($objUltimaTarefaDTO);
507   -
  558 +
508 559 $objDTO->setNumIdTarefa($objUltimaTarefaDTO->getNumIdTarefa() + 1);
509 560 $objDTO->setStrNome($strNome);
510 561 $objDTO->setStrSinHistoricoResumido($strHistoricoCompleto);
... ... @@ -513,11 +564,11 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
513 564 $objDTO->setStrSinLancarAndamentoFechado($strLancarAndamentoFechado);
514 565 $objDTO->setStrSinPermiteProcessoFechado($strPermiteProcessoFechado);
515 566 $objDTO->setStrIdTarefaModulo($strIdTarefaModulo);
516   - $objBD->cadastrar($objDTO);
517   - }
  567 + $objBD->cadastrar($objDTO);
  568 + }
518 569 };
519   -
520   -
  570 +
  571 +
521 572 $fnCadastrar('Processo trâmitado externamente para a entidade @UNIDADE_DESTINO@ - @REPOSITORIO_DESTINO@ (@PROCESSO@, @UNIDADE@, @USUARIO@)', 'S', 'S', 'N', 'S', 'N', 'PEN_PROCESSO_EXPEDIDO');
522 573 $fnCadastrar('Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@ (@PROCESSO@, @ENTIDADE_ORIGEM@, @UNIDADE_DESTINO@, @USUARIO@)', 'S', 'S', 'N', 'S', 'N', 'PEN_PROCESSO_RECEBIDO');
523 574 $fnCadastrar('O processo foi recusado pelo orgão @UNIDADE_DESTINO@ pelo seguinte motivo: @MOTIVO@', 'S', 'S', 'N', 'N', 'S', 'PEN_PROCESSO_RECUSADO');
... ... @@ -529,195 +580,161 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
529 580 //----------------------------------------------------------------------
530 581 $objDTO = new RelTarefaOperacaoDTO();
531 582  
532   - $fnCadastrar = function($strCodigoOperacao, $numIdTarefa) use($objDTO, $objBD){
  583 + $fnCadastrar = function($strCodigoOperacao, $numIdTarefa) use($objDTO, $objBD) {
533 584  
534 585 $objDTO->unSetTodos();
535 586 $objDTO->setStrCodigoOperacao($strCodigoOperacao);
536 587 $objDTO->setNumIdTarefa($numIdTarefa);
537 588  
538   - if($objBD->contar($objDTO) == 0){
539   - $objBD->cadastrar($objDTO);
540   - }
  589 + if ($objBD->contar($objDTO) == 0) {
  590 + $objBD->cadastrar($objDTO);
  591 + }
541 592 };
542 593  
543 594 //$fnCadastrar("01", 0);// Registro (Padrão);
544   - $fnCadastrar("02", 32);// Envio de documento avulso/processo ($TI_PROCESSO_REMETIDO_UNIDADE = 32;);
545   - $fnCadastrar("03", 51);// Cancelamento/exclusao ou envio de documento ($TI_CANCELAMENTO_DOCUMENTO = 51;);
546   - $fnCadastrar("04", 13);// Recebimento de documento ($TI_RECEBIMENTO_DOCUMENTO = 13;);
547   - $fnCadastrar("05", 1);// Autuacao ($TI_GERACAO_PROCEDIMENTO = 1;);
548   - $fnCadastrar("06", 101);// Juntada por anexacao ($TI_ANEXADO_PROCESSO = 101;);
  595 + $fnCadastrar("02", 32); // Envio de documento avulso/processo ($TI_PROCESSO_REMETIDO_UNIDADE = 32;);
  596 + $fnCadastrar("03", 51); // Cancelamento/exclusao ou envio de documento ($TI_CANCELAMENTO_DOCUMENTO = 51;);
  597 + $fnCadastrar("04", 13); // Recebimento de documento ($TI_RECEBIMENTO_DOCUMENTO = 13;);
  598 + $fnCadastrar("05", 1); // Autuacao ($TI_GERACAO_PROCEDIMENTO = 1;);
  599 + $fnCadastrar("06", 101); // Juntada por anexacao ($TI_ANEXADO_PROCESSO = 101;);
549 600 //$fnCadastrar("07", 0);// Juntada por apensacao;
550 601 //$fnCadastrar("08", 0);// Desapensacao;
551   - $fnCadastrar("09", 24);// Arquivamento ($TI_ARQUIVAMENTO = 24;);
  602 + $fnCadastrar("09", 24); // Arquivamento ($TI_ARQUIVAMENTO = 24;);
552 603 //$fnCadastrar("10", 0);// Arquivamento no Arquivo Nacional;
553 604 //$fnCadastrar("11", 0);// Eliminacao;
554 605 //$fnCadastrar("12", 0);// Sinistro;
555 606 //$fnCadastrar("13", 0);// Reconstituicao de processo;
556   - $fnCadastrar("14", 26);// Desarquivamento ($TI_DESARQUIVAMENTO = 26;);
  607 + $fnCadastrar("14", 26); // Desarquivamento ($TI_DESARQUIVAMENTO = 26;);
557 608 //$fnCadastrar("15", 0);// Desmembramento;
558 609 //$fnCadastrar("16", 0);// Desentranhamento;
559 610 //$fnCadastrar("17", 0);// Encerramento/abertura de volume no processo;
560 611 //$fnCadastrar("18", 0);// Registro de extravio;
561   -
  612 +
562 613 $objDTO = new InfraAgendamentoTarefaDTO();
563 614  
564   - $fnCadastrar = function($strComando, $strDesc) use($objDTO, $objBD, $objRN){
  615 + $fnCadastrar = function($strComando, $strDesc) use($objDTO, $objBD, $objRN) {
565 616  
566 617 $objDTO->unSetTodos();
567 618 $objDTO->setStrComando($strComando);
568   -
569   - if($objBD->contar($objDTO) == 0){
570   -
  619 +
  620 + if ($objBD->contar($objDTO) == 0) {
  621 +
571 622 $objDTO->setStrDescricao($strDesc);
572 623 $objDTO->setStrStaPeriodicidadeExecucao('D');
573 624 $objDTO->setStrPeriodicidadeComplemento('0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23');
574 625 $objDTO->setStrSinAtivo('S');
575 626 $objDTO->setStrSinSucesso('S');
576   -
  627 +
577 628 $objBD->cadastrar($objDTO);
578   - }
  629 + }
579 630 };
580   -
  631 +
581 632 $fnCadastrar('PENAgendamentoRN::seiVerificarServicosBarramento', 'Verificação dos serviços de fila de processamento estão em execução');
582   -
  633 +
583 634 //----------------------------------------------------------------------
584 635 // Correções para id_unidade_rh
585 636 //----------------------------------------------------------------------
586 637 $objDTO = new UnidadeDTO();
587 638 $objDTO->retNumIdUnidade();
588   -
  639 +
589 640 $arrObjDTO = $objBD->listar($objDTO);
590   - if(!empty($arrObjDTO)) {
591   -
  641 + if (!empty($arrObjDTO)) {
  642 +
592 643 $objDTO = new PenUnidadeDTO();
593   -
594   - foreach($arrObjDTO as $objUnidadeDTO) {
595   -
  644 +
  645 + foreach ($arrObjDTO as $objUnidadeDTO) {
  646 +
596 647 $objDTO->unSetTodos();
597 648 $objDTO->setNumIdUnidade($objUnidadeDTO->getNumIdUnidade());
598   -
599   - if($objBD->contar($objDTO) == 0) {
  649 +
  650 + if ($objBD->contar($objDTO) == 0) {
600 651 $objDTO->setNumIdUnidadeRH(0);
601 652 $objBD->cadastrar($objDTO);
602   - }
  653 + }
603 654 }
604 655 }
605   - //----------------------------------------------------------------------
606   - }
607   -
608   - /**
609   - * Tratamento da Fila do Gearman
610   - *
611   - * @refs 3670
612   - */
613   - protected function instalarV002R003S000US024(){
614   -
615   - $objInfraBanco = $this->inicializarObjInfraIBanco();
616   - $objMetaBD = $this->inicializarObjMetaBanco();
617 656  
  657 + /* ---------- antigo método (instalarV002R003S000US024) ---------- */
  658 +
618 659 $objMetaBD->criarTabela(array(
619 660 'tabela' => 'md_pen_tramite_processado',
620 661 'cols' => array(
621   - 'id_tramite'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  662 + 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
622 663 'dth_ultimo_processamento' => array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO),
623 664 'numero_tentativas' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
624 665 'sin_recebimento_concluido' => array($objMetaBD->tipoTextoFixo(1), PenMetaBD::NNULLO)
625 666 ),
626 667 'pk' => array('id_tramite')
627   - ));
628   -
  668 + ));
  669 +
629 670 $objInfraParametro = new InfraParametro($objInfraBanco);
630 671 $objInfraParametro->setValor('PEN_NUMERO_TENTATIVAS_TRAMITE_RECEBIMENTO', '3');
631   - }
632   -
633   - /**
634   - * Erro no histórico de processo no momento do recebimento
635   - *
636   - * @refs 3671
637   - */
638   - protected function instalarV002R003S000IW001(){
639 672  
640   - $objInfraBanco = $this->inicializarObjInfraIBanco();
641   - //$objMetaBD = $this->inicializarObjMetaBanco();
  673 +
  674 + /* ---------- antigo método (instalarV002R003S000IW001) ---------- */
642 675  
643 676  
  677 +
644 678 $objDTO = new TarefaDTO();
645 679 $objBD = new TarefaBD($objInfraBanco);
646   -
647   - $fnAlterar = function($strIdTarefaModulo, $strNome) use($objDTO, $objBD){
648   -
  680 +
  681 + $fnAlterar = function($strIdTarefaModulo, $strNome) use($objDTO, $objBD) {
  682 +
649 683 $objDTO->unSetTodos();
650 684 $objDTO->setStrIdTarefaModulo($strIdTarefaModulo);
651 685 $objDTO->setNumMaxRegistrosRetorno(1);
652 686 $objDTO->retStrNome();
653 687 $objDTO->retNumIdTarefa();
654   -
  688 +
655 689 $objDTO = $objBD->consultar($objDTO);
656   -
657   - if(empty($objDTO)){
658   -
  690 +
  691 + if (empty($objDTO)) {
  692 +
659 693 $objDTO->setStrNome($strNome);
660   - $objBD->cadastrar($objDTO);
661   - }else{
662   -
  694 + $objBD->cadastrar($objDTO);
  695 + } else {
  696 +
663 697 $objDTO->setStrNome($strNome);
664   - $objBD->alterar($objDTO);
665   - }
  698 + $objBD->alterar($objDTO);
  699 + }
666 700 };
667   -
  701 +
668 702 $fnAlterar('PEN_PROCESSO_RECEBIDO', 'Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@');
669   - }
670   -
671   - /**
672   - * Tratamento da Fila do Gearman para Recibos de Conclusão de Trâmite
673   - *
674   - * @refs 3791
675   - */
676   - protected function instalarV002R003S001US035(){
677 703  
  704 + /* ---------- antigo método (instalarV002R003S001US035) ---------- */
678 705 $objMetaBanco = $this->inicializarObjMetaBanco();
679 706  
680   - if(!$objMetaBanco->isColuna('md_pen_tramite_processado', 'tipo_tramite_processo')) {
  707 + if (!$objMetaBanco->isColuna('md_pen_tramite_processado', 'tipo_tramite_processo')) {
681 708 $objMetaBanco->adicionarColuna('md_pen_tramite_processado', 'tipo_tramite_processo', 'CHAR(2)', PenMetaBD::NNULLO);
682 709 $objMetaBanco->adicionarValorPadraoParaColuna('md_pen_tramite_processado', 'tipo_tramite_processo', 'RP');
683 710 }
684   -
685   - if($objMetaBanco->isChaveExiste('md_pen_tramite_processado', 'pk_md_pen_tramite_processado')) {
686   -
  711 +
  712 + if ($objMetaBanco->isChaveExiste('md_pen_tramite_processado', 'pk_md_pen_tramite_processado')) {
  713 +
687 714 $objMetaBanco->removerChavePrimaria('md_pen_tramite_processado', 'pk_md_pen_tramite_processado');
688 715 $objMetaBanco->adicionarChavePrimaria('md_pen_tramite_processado', 'pk_md_pen_tramite_processado', array('id_tramite', 'tipo_tramite_processo'));
689 716 }
690   - }
691   -
692   - /**
693   - * Erro no Mapeamento Tipo de Documento de Envio
694   - *
695   - * @refs 3870
696   - */
697   - protected function instalarV003R003S003IW001() {
698   -
699   - $objMetaBD = $this->inicializarObjMetaBanco();
700   - $objInfraBanco = $this->inicializarObjInfraIBanco();
701   -
702 717  
  718 + /* ---------- antigo método (instalarV003R003S003IW001) ---------- */
  719 +
703 720 //----------------------------------------------------------------------
704 721 // Novas sequências
705 722 //----------------------------------------------------------------------
706 723 $objInfraSequencia = new InfraSequencia($objInfraBanco);
707   -
708   - if(!$objInfraSequencia->verificarSequencia('md_pen_rel_doc_map_enviado')){
  724 +
  725 + if (!$objInfraSequencia->verificarSequencia('md_pen_rel_doc_map_enviado')) {
709 726 $objInfraSequencia->criarSequencia('md_pen_rel_doc_map_enviado', '1', '1', '9999999999');
710 727 }
711   -
712   - if(!$objInfraSequencia->verificarSequencia('md_pen_rel_doc_map_recebido')){
  728 +
  729 + if (!$objInfraSequencia->verificarSequencia('md_pen_rel_doc_map_recebido')) {
713 730 $objInfraSequencia->criarSequencia('md_pen_rel_doc_map_recebido', '1', '1', '9999999999');
714 731 }
715   -
  732 +
716 733 $objMetaBD->criarTabela(array(
717 734 'tabela' => 'md_pen_rel_doc_map_enviado',
718 735 'cols' => array(
719   - 'id_mapeamento'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
720   - 'codigo_especie'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  736 + 'id_mapeamento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  737 + 'codigo_especie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
721 738 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
722 739 'sin_padrao' => array($objMetaBD->tipoTextoFixo(1), 'S')
723 740 ),
... ... @@ -732,8 +749,8 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
732 749 $objMetaBD->criarTabela(array(
733 750 'tabela' => 'md_pen_rel_doc_map_recebido',
734 751 'cols' => array(
735   - 'id_mapeamento'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
736   - 'codigo_especie'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  752 + 'id_mapeamento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  753 + 'codigo_especie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
737 754 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
738 755 'sin_padrao' => array($objMetaBD->tipoTextoFixo(1), 'S')
739 756 ),
... ... @@ -743,104 +760,92 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
743 760 'serie' => array('id_serie', 'id_serie'),
744 761 'md_pen_especie_documental' => array('id_especie', 'codigo_especie'),
745 762 )
746   - ));
747   -
  763 + ));
  764 +
748 765 $objBD = new GenericoBD($objInfraBanco);
749   -
750   - if($objMetaBD->isTabelaExiste('md_pen_rel_tipo_documento_mapeamento_recebido')) {
751   -
  766 +
  767 + if ($objMetaBD->isTabelaExiste('md_pen_rel_tipo_documento_mapeamento_recebido')) {
  768 +
752 769 $objDTO = new PenRelTipoDocMapRecebidoDTO();
753 770  
754   - $fnCadastrar = function($numCodigoEspecie, $numIdSerie) use($objDTO, $objBD){
755   -
  771 + $fnCadastrar = function($numCodigoEspecie, $numIdSerie) use($objDTO, $objBD) {
  772 +
756 773 $objDTO->unSetTodos();
757 774 $objDTO->setNumCodigoEspecie($numCodigoEspecie);
758 775 $objDTO->setNumIdSerie($numIdSerie);
759 776  
760   - if($objBD->contar($objDTO) == 0){
761   -
  777 + if ($objBD->contar($objDTO) == 0) {
  778 +
762 779 $objDTO->setStrPadrao('S');
763   - $objBD->cadastrar($objDTO);
764   - }
  780 + $objBD->cadastrar($objDTO);
  781 + }
765 782 };
766   -
  783 +
767 784 $arrDados = $objInfraBanco->consultarSql('SELECT DISTINCT codigo_especie, id_serie FROM md_pen_rel_tipo_documento_mapeamento_recebido');
768   - if(!empty($arrDados)) {
769   - foreach($arrDados as $arrDocMapRecebido) {
  785 + if (!empty($arrDados)) {
  786 + foreach ($arrDados as $arrDocMapRecebido) {
770 787  
771 788 $fnCadastrar($arrDocMapRecebido['codigo_especie'], $arrDocMapRecebido['id_serie']);
772 789 }
773 790 }
774 791  
775   - $objMetaBD->removerTabela('md_pen_rel_tipo_documento_mapeamento_recebido');
  792 + $objMetaBD->removerTabela('md_pen_rel_tipo_documento_mapeamento_recebido');
776 793 }
777   -
778   -
779   - if($objMetaBD->isTabelaExiste('md_pen_rel_serie_especie')) {
780   -
  794 +
  795 +
  796 + if ($objMetaBD->isTabelaExiste('md_pen_rel_serie_especie')) {
  797 +
781 798 $objDTO = new PenRelTipoDocMapEnviadoDTO();
782 799  
783   - $fnCadastrar = function($numCodigoEspecie, $numIdSerie) use($objDTO, $objBD){
784   -
  800 + $fnCadastrar = function($numCodigoEspecie, $numIdSerie) use($objDTO, $objBD) {
  801 +
785 802 $objDTO->unSetTodos();
786 803 $objDTO->setNumCodigoEspecie($numCodigoEspecie);
787 804 $objDTO->setNumIdSerie($numIdSerie);
788 805  
789   - if($objBD->contar($objDTO) == 0){
790   -
  806 + if ($objBD->contar($objDTO) == 0) {
  807 +
791 808 $objDTO->setStrPadrao('S');
792   - $objBD->cadastrar($objDTO);
793   - }
  809 + $objBD->cadastrar($objDTO);
  810 + }
794 811 };
795   -
  812 +
796 813 $arrDados = $objInfraBanco->consultarSql('SELECT DISTINCT codigo_especie, id_serie FROM md_pen_rel_serie_especie');
797   - if(!empty($arrDados)) {
798   - foreach($arrDados as $arrDocMapEnviado) {
  814 + if (!empty($arrDados)) {
  815 + foreach ($arrDados as $arrDocMapEnviado) {
799 816  
800 817 $fnCadastrar($arrDocMapEnviado['codigo_especie'], $arrDocMapEnviado['id_serie']);
801 818 }
802 819 }
803 820  
804   - $objMetaBD->removerTabela('md_pen_rel_serie_especie');
  821 + $objMetaBD->removerTabela('md_pen_rel_serie_especie');
805 822 }
806   - }
807 823  
808   - protected function instalarV004R003S003IW002(){
809 824  
  825 + /* ---------- antigo método (instalarV004R003S003IW002) ---------- */
810 826 $strTipo = $this->inicializarObjMetaBanco()->tipoTextoGrande();
811 827  
812 828 $this->inicializarObjMetaBanco()
813   - ->alterarColuna('md_pen_recibo_tramite', 'cadeia_certificado', $strTipo)
814   - ->alterarColuna('md_pen_recibo_tramite_enviado', 'cadeia_certificado', $strTipo);
815   - }
816   -
817   - /**
818   - * Criar script de BD para voltar o processo ao normal, como um processo de contingência
819   - *
820   - * @version 4
821   - * @release 3
822   - * @sprint 5
823   - * @refs 4047
824   - * @return null
825   - */
826   - protected function instalarV005R003S005IW018(){
  829 + ->alterarColuna('md_pen_recibo_tramite', 'cadeia_certificado', $strTipo)
  830 + ->alterarColuna('md_pen_recibo_tramite_enviado', 'cadeia_certificado', $strTipo);
827 831  
  832 + /* ---------- antigo método (instalarV005R003S005IW018) ---------- */
828 833 $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
829 834 $objDTO = new TarefaDTO();
830 835  
831   - $fnCadastrar = function($strNome = '', $strHistoricoCompleto = 'N', $strHistoricoCompleto = 'N', $strFecharAndamentosAbertos = 'N', $strLancarAndamentoFechado = 'N', $strPermiteProcessoFechado = 'N', $strIdTarefaModulo = '') use($objDTO, $objBD){
832   -
  836 + $fnCadastrar = function($strNome = '', $strHistoricoCompleto = 'N', $strHistoricoCompleto = 'N', $strFecharAndamentosAbertos = 'N', $strLancarAndamentoFechado = 'N', $strPermiteProcessoFechado = 'N', $strIdTarefaModulo = '') use($objDTO, $objBD) {
  837 +
833 838 $objDTO->unSetTodos();
834 839 $objDTO->setStrIdTarefaModulo($strIdTarefaModulo);
835 840  
836   - if($objBD->contar($objDTO) == 0){
837   -
  841 + if ($objBD->contar($objDTO) == 0) {
  842 +
838 843 $objUltimaTarefaDTO = new TarefaDTO();
839 844 $objUltimaTarefaDTO->retNumIdTarefa();
840 845 $objUltimaTarefaDTO->setNumMaxRegistrosRetorno(1);
841 846 $objUltimaTarefaDTO->setOrd('IdTarefa', InfraDTO::$TIPO_ORDENACAO_DESC);
842 847 $objUltimaTarefaDTO = $objBD->consultar($objUltimaTarefaDTO);
843   -
  848 +
844 849 $objDTO->setNumIdTarefa($objUltimaTarefaDTO->getNumIdTarefa() + 1);
845 850 $objDTO->setStrNome($strNome);
846 851 $objDTO->setStrSinHistoricoResumido($strHistoricoCompleto);
... ... @@ -849,115 +854,196 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
849 854 $objDTO->setStrSinLancarAndamentoFechado($strLancarAndamentoFechado);
850 855 $objDTO->setStrSinPermiteProcessoFechado($strPermiteProcessoFechado);
851 856 $objDTO->setStrIdTarefaModulo($strIdTarefaModulo);
852   - $objBD->cadastrar($objDTO);
853   - }
  857 + $objBD->cadastrar($objDTO);
  858 + }
854 859 };
855   -
  860 +
856 861 $fnCadastrar('O trâmite externo do processo foi abortado manualmente devido a falha no trâmite', 'S', 'S', 'N', 'N', 'S', 'PEN_EXPEDICAO_PROCESSO_ABORTADA');
857   - }
858   -
859   - /**
860   - * Criar script de BD para voltar o processo ao normal, como um processo de contingência
861   - *
862   - * @version 4
863   - * @release 3
864   - * @sprint 5
865   - * @refs 4047
866   - * @return null
867   - */
868   - protected function instalarV005R003S005IW023(){
869 862  
  863 + /* ---------- antigo método (instalarV005R003S005IW023) ---------- */
870 864 $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
871   -
  865 +
872 866 $objDTO = new TarefaDTO();
873 867 $objDTO->retNumIdTarefa();
874 868 $objDTO->retStrNome();
875 869  
876   - $fnAtualizar = function($strIdTarefaModulo, $strNome) use($objDTO, $objBD){
877   -
  870 + $fnAtualizar = function($strIdTarefaModulo, $strNome) use($objDTO, $objBD) {
  871 +
878 872 $objDTO->unSetTodos();
879 873 $objDTO->setStrIdTarefaModulo($strIdTarefaModulo);
880 874  
881 875 $objTarefaDTO = $objBD->consultar($objDTO);
882   -
883   - if(!empty($objTarefaDTO)) {
884   -
  876 +
  877 + if (!empty($objTarefaDTO)) {
  878 +
885 879 $objTarefaDTO->setStrNome($strNome);
886   -
887   - $objBD->alterar($objTarefaDTO);
888   - }
  880 +
  881 + $objBD->alterar($objTarefaDTO);
  882 + }
889 883 };
890 884 // Tramitação externa do processo @processo@ concluída com sucesso. Recebido na @UnidadeDestino@ - @hierarquia_superior@ -@repositório_de_estruturas@
891 885 $fnAtualizar('PEN_PROCESSO_EXPEDIDO', 'Processo em tramitação externa para @UNIDADE_DESTINO@ - @UNIDADE_DESTINO_HIRARQUIA@ - @REPOSITORIO_DESTINO@');
892 886 $fnAtualizar('PEN_PROCESSO_RECEBIDO', 'Processo recebido da unidade externa @ENTIDADE_ORIGEM@ - @ENTIDADE_ORIGEM_HIRARQUIA@ - @REPOSITORIO_ORIGEM@');
893 887 $fnAtualizar('PEN_OPERACAO_EXTERNA', 'Tramitação externa do processo @PROTOCOLO_FORMATADO@ concluída com sucesso. Recebido em @UNIDADE_DESTINO@ - @UNIDADE_DESTINO_HIRARQUIA@ - @REPOSITORIO_DESTINO@');
894   - }
895   -
896   - protected function instalarV006R004S004WI001() {
  888 +
  889 + /* ---------- antigo método (instalarV006R004S004WI001) ---------- */
897 890 $objInfraParametro = new InfraParametro($this->getObjInfraIBanco());
898 891 $objInfraParametro->setValor('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO', 50);
899 892  
900   - }
901   -
902   - protected function instalarV007R004S005WI002() {
903   -
904   - $objMetaBD = $this->inicializarObjMetaBanco();
905   -
906   - $objMetaBD->criarTabela(array(
  893 + /* ---------- antigo método (instalarV007R004S005WI002) ---------- */
  894 +
  895 + $objMetaBD->criarTabela(array(
907 896 'tabela' => 'md_pen_recibo_tramite_hash',
908 897 'cols' => array(
909   - 'id_tramite_hash'=> array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
910   - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
  898 + 'id_tramite_hash' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  899 + 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO),
911 900 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
912 901 'tipo_recibo' => array($objMetaBD->tipoTextoFixo(1), PenMetaBD::NNULLO),
913 902 'hash_componente_digital ' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO)
914 903 ),
915   - 'pk' => array('id_tramite_hash'),
  904 + 'pk' => array('id_tramite_hash'),
916 905 'fks' => array(
917 906 'md_pen_tramite' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite'))
918 907 )
919   - ));
920   -
921   -
922   -
  908 + ));
  909 +
923 910 $objMetaBD->adicionarColuna('md_pen_recibo_tramite_recebido', 'cadeia_certificado', $this->inicializarObjMetaBanco()->tipoTextoGrande(), PenMetaBD::SNULLO);
924   -
  911 +
925 912 $objInfraSequencia = new InfraSequencia($this->getObjInfraIBanco());
926   -
927   - if(!$objInfraSequencia->verificarSequencia('md_pen_recibo_tramite_hash')){
928   -
  913 +
  914 + if (!$objInfraSequencia->verificarSequencia('md_pen_recibo_tramite_hash')) {
  915 +
929 916 $objInfraSequencia->criarSequencia('md_pen_recibo_tramite_hash', '1', '1', '9999999999');
930 917 }
931   - }
932   -
933   - protected function instalarV008R004S006IW003(){
934 918  
935   - $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  919 + /* ---------- antigo método (instalarV008R004S006WI001) ---------- */
  920 +// $objMetaBD = $this->inicializarObjMetaBanco();
  921 +// $objMetaBD->alterarColuna('md_pen_recibo_tramite', 'dth_recebimento', 'VARCHAR(60)', PenMetaBD::NNULLO);
  922 +// $objMetaBD->alterarColuna('md_pen_recibo_tramite_enviado', 'dth_recebimento', 'VARCHAR(60)', PenMetaBD::NNULLO);
  923 +// $objMetaBD->alterarColuna('md_pen_recibo_tramite_recebido', 'dth_recebimento', 'VARCHAR(60)', PenMetaBD::NNULLO);
  924 +
  925 + $objInfraParametroDTO = new InfraParametroDTO();
  926 + $objInfraParametroDTO->setStrNome($this->nomeParametroModulo);
  927 + $objInfraParametroDTO->setStrValor('1.0.0');
936 928  
  929 + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco());
  930 + $objInfraParametroBD->cadastrar($objInfraParametroDTO);
  931 +
  932 + $this->logar(' EXECUTADA A INSTALACAO DA VERSAO 0.0.1 DO MODULO PEN NO SEI COM SUCESSO');
  933 + }
  934 +
  935 + /* Contem atualizações da versao 1.0.1 do modulo */
  936 + protected function instalarV101() {
  937 + /* ---------- antigo método (instalarV008R004S006IW003) ---------- */
  938 + $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  939 +
937 940 $objTarefaDTO = new TarefaDTO();
938 941 $objTarefaDTO->setStrIdTarefaModulo('PEN_PROCESSO_RECEBIDO');
939 942 $objTarefaDTO->retNumIdTarefa();
940   -
  943 +
941 944 $objTarefaDTO = $objBD->consultar($objTarefaDTO);
942   -
  945 +
943 946 $objTarefaDTO->setStrSinLancarAndamentoFechado('N');
944 947 $objTarefaDTO->setStrSinPermiteProcessoFechado('S');
  948 +
  949 + $objBD->alterar($objTarefaDTO);
945 950  
946   - $objBD->alterar($objTarefaDTO);
  951 + /* ---------- antigo método (instalarV006R004S001US039) ---------- */
  952 + $objMetaBD = $this->inicializarObjMetaBanco();
  953 + $objInfraBanco = $this->inicializarObjInfraIBanco();
947 954  
948   - }
949   -
950   - public function instalarV100R004S006IW004(){
951   - //Atualiza o parâmetro
952   - }
953   -
954   -
955   - /* protected function instalarV008R004S006WI001(){
  955 + $objMetaBD->criarTabela(array(
  956 + 'tabela' => 'md_pen_hipotese_legal',
  957 + 'cols' => array(
  958 + 'id_hipotese_legal'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  959 + 'nome' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO),
  960 + 'sin_ativo' => array($objMetaBD->tipoTextoFixo(1), 'S'),
  961 + ),
  962 + 'pk' => array('id_hipotese_legal')
  963 + ));
  964 +
  965 + $objMetaBD->criarTabela(array(
  966 + 'tabela' => 'md_pen_rel_hipotese_legal',
  967 + 'cols' => array(
  968 + 'id_mapeamento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO),
  969 + 'id_hipotese_legal'=> array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO),
  970 + 'id_hipotese_legal_pen'=> array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO),
  971 + 'tipo' => array($objMetaBD->tipoTextoFixo(1), 'E'),
  972 + 'sin_ativo' => array($objMetaBD->tipoTextoFixo(1), 'S'),
  973 + ),
  974 + 'pk' => array('id_mapeamento'),
  975 + 'fks' => array(
  976 + 'hipotese_legal' => array('id_hipotese_legal', 'id_hipotese_legal'),
  977 + 'md_pen_hipotese_legal' => array('id_hipotese_legal', 'id_hipotese_legal_pen')
  978 + )
  979 + ));
  980 +
  981 + $objInfraSequencia = new InfraSequencia($objInfraBanco);
  982 +
  983 + if(!$objInfraSequencia->verificarSequencia('md_pen_hipotese_legal')){
  984 + $objInfraSequencia->criarSequencia('md_pen_hipotese_legal', '1', '1', '9999999999');
  985 + }
  986 +
  987 + if(!$objInfraSequencia->verificarSequencia('md_pen_rel_hipotese_legal')){
  988 + $objInfraSequencia->criarSequencia('md_pen_rel_hipotese_legal', '1', '1', '9999999999');
  989 + }
  990 +
  991 + $objHipoteseLegalDTO = new HipoteseLegalDTO();
  992 + $objHipoteseLegalDTO->setDistinct(true);
  993 + $objHipoteseLegalDTO->setStrStaNivelAcesso(1);
  994 + $objHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  995 + $objHipoteseLegalDTO->retNumIdHipoteseLegal();
  996 + $objHipoteseLegalDTO->retStrNome();
  997 +
  998 + $objHipoteseLegalBD = new HipoteseLegalBD($this->inicializarObjInfraIBanco());
  999 + $arrMapIdHipoteseLegal = InfraArray::converterArrInfraDTO($objHipoteseLegalBD->listar($objHipoteseLegalDTO), 'Nome', 'IdHipoteseLegal');
  1000 +
  1001 + if(!empty($arrMapIdHipoteseLegal)) {
  1002 +
  1003 + $objPenHipoteseLegalDTO = new PenHipoteseLegalDTO();
  1004 + $objPenHipoteseLegalBD = new PenHipoteseLegalBD($this->inicializarObjInfraIBanco());
  1005 +
  1006 + $fnCadastrar = function($numIdHipoteseLegal, $strNome = '') use($objPenHipoteseLegalDTO, $objPenHipoteseLegalBD){
  1007 +
  1008 + $objPenHipoteseLegalDTO->unSetTodos();
  1009 + $objPenHipoteseLegalDTO->setNumIdHipoteseLegal($numIdHipoteseLegal);
  1010 +
  1011 + if($objPenHipoteseLegalBD->contar($objPenHipoteseLegalDTO) == 0){
  1012 +
  1013 + $objPenHipoteseLegalDTO->setStrAtivo('S');
  1014 + $objPenHipoteseLegalDTO->setStrNome($strNome);
  1015 + $objPenHipoteseLegalBD->cadastrar($objPenHipoteseLegalDTO);
  1016 + }
  1017 + };
  1018 +
  1019 + foreach($arrMapIdHipoteseLegal as $numIdHipoteseLegal => $strNome) {
  1020 +
  1021 + $fnCadastrar($numIdHipoteseLegal, $strNome);
  1022 + }
  1023 + }
  1024 +
956 1025 $objMetaBD = $this->inicializarObjMetaBanco();
  1026 +
  1027 + $objMetaBD->criarTabela(array(
  1028 + 'tabela' => 'md_pen_parametro',
  1029 + 'cols' => array(
  1030 + 'nome'=> array($objMetaBD->tipoTextoVariavel(100), PenMetaBD::NNULLO),
  1031 + 'valor' => array($objMetaBD->tipoTextoGrande(), PenMetaBD::NNULLO)
  1032 + ),
  1033 + 'pk' => array('nome')
  1034 + ));
  1035 +
957 1036  
958   - $objMetaBD->alterarColuna('md_pen_recibo_tramite', 'dth_recebimento', 'VARCHAR(60)', PenMetaBD::NNULLO);
959   - $objMetaBD->alterarColuna('md_pen_recibo_tramite_enviado', 'dth_recebimento', 'VARCHAR(60)', PenMetaBD::NNULLO);
960   - $objMetaBD->alterarColuna('md_pen_recibo_tramite_recebido', 'dth_recebimento', 'VARCHAR(60)', PenMetaBD::NNULLO);
961   - } */
  1037 + /* altera o parâmetro da versão de banco */
  1038 + $objInfraParametroDTO = new InfraParametroDTO();
  1039 + $objInfraParametroDTO->setStrNome($this->nomeParametroModulo);
  1040 + $objInfraParametroDTO->setStrValor('1.0.0');
  1041 + $objInfraParametroDTO->retTodos();
  1042 +
  1043 + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco());
  1044 + $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO);
  1045 + $objInfraParametroDTO->setStrValor('1.0.1');
  1046 + $objInfraParametroBD->alterar($objInfraParametroDTO);
  1047 + }
962 1048  
963   -}
964 1049 \ No newline at end of file
  1050 +}
... ...
rn/PenHipoteseLegalRN.php 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../../SEI.php';
  4 +
  5 +/**
  6 + * Description of PenHipoteseLegalRN
  7 + *
  8 + * @author michael
  9 + */
  10 +class PenHipoteseLegalRN extends InfraRN {
  11 +
  12 + protected function inicializarObjInfraIBanco(){
  13 + return BancoSEI::getInstance();
  14 + }
  15 +
  16 +
  17 + protected function listarControlado(PenHipoteseLegalDTO $objDTO){
  18 +
  19 + try {
  20 +
  21 + //SessaoSEI::getInstance()->validarAuditarPermissao('email_sistema_excluir', __METHOD__, $arrObjEmailSistemaDTO);
  22 +
  23 + $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  24 +
  25 + return $objBD->listar($objDTO);
  26 + }
  27 + catch (Exception $e) {
  28 + throw new InfraException('Erro excluindo E-mail do Sistema.', $e);
  29 + }
  30 + }
  31 +}
... ...
rn/PenParametroRN.php 0 → 100644
... ... @@ -0,0 +1,144 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__).'/../../../SEI.php';
  4 +
  5 +/**
  6 + * Regra de negócio para o parâmetros do módulo PEN
  7 + *
  8 + * @author Join Tecnologia
  9 + */
  10 +class PenParametroRN extends InfraRN {
  11 +
  12 + protected function inicializarObjInfraIBanco(){
  13 + return BancoSEI::getInstance();
  14 + }
  15 +
  16 + protected function contarControlado(PenParametroDTO $objDTO){
  17 +
  18 + try {
  19 +
  20 + $objBD = new PenParametroBD($this->inicializarObjInfraIBanco());
  21 +
  22 + return $objBD->contar($objDTO);
  23 + }
  24 + catch (Exception $e) {
  25 + throw new InfraException('Erro ao contar parâmetro.', $e);
  26 + }
  27 +
  28 + }
  29 +
  30 + protected function consultarControlado(PenParametroDTO $objDTO){
  31 +
  32 + try {
  33 +
  34 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_padrao_cadastrar', __METHOD__, $objDTO);
  35 +
  36 + $objBD = new PenParametroBD($this->inicializarObjInfraIBanco());
  37 +
  38 + return $objBD->consultar($objDTO);
  39 + }
  40 + catch (Exception $e) {
  41 + throw new InfraException('Erro ao listar parâmetro.', $e);
  42 + }
  43 + }
  44 +
  45 + protected function listarControlado(PenParametroDTO $objDTO){
  46 +
  47 + try {
  48 +
  49 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_padrao_cadastrar', __METHOD__, $objDTO);
  50 +
  51 + $objBD = new PenParametroBD($this->inicializarObjInfraIBanco());
  52 +
  53 + return $objBD->listar($objDTO);
  54 + }
  55 + catch (Exception $e) {
  56 + throw new InfraException('Erro ao listar parâmetro.', $e);
  57 + }
  58 + }
  59 +
  60 + protected function cadastrarControlado(PenParametroDTO $objDTO){
  61 +
  62 + try {
  63 +
  64 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_padrao_cadastrar', __METHOD__, $objDTO);
  65 +
  66 + $objBD = new PenParametroBD($this->inicializarObjInfraIBanco());
  67 +
  68 + return $objBD->cadastrar($objDTO);
  69 + }
  70 + catch (Exception $e) {
  71 + throw new InfraException('Erro ao cadastrar parâmetro.', $e);
  72 + }
  73 + }
  74 +
  75 + protected function alterarControlado(PenParametroDTO $objDTO){
  76 +
  77 + try {
  78 +
  79 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_padrao_cadastrar', __METHOD__, $objDTO);
  80 +
  81 + $objBD = new PenParametroBD($this->inicializarObjInfraIBanco());
  82 +
  83 + return $objBD->alterar($objDTO);
  84 + }
  85 + catch (Exception $e) {
  86 + throw new InfraException('Erro ao alterar parâmetro.', $e);
  87 + }
  88 + }
  89 +
  90 + protected function excluirControlado(PenParametroDTO $objDTO){
  91 +
  92 + try {
  93 +
  94 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_padrao_cadastrar', __METHOD__, $objDTO);
  95 +
  96 + $objBD = new PenParametroBD($this->inicializarObjInfraIBanco());
  97 +
  98 + return $objBD->excluir($objDTO);
  99 + }
  100 + catch (Exception $e) {
  101 + throw new InfraException('Erro ao excluir parâmetro.', $e);
  102 + }
  103 + }
  104 +
  105 + protected function desativarControlado(PenParametroDTO $objDTO){
  106 +
  107 + try {
  108 +
  109 +
  110 + }
  111 + catch (Exception $e) {
  112 + throw new InfraException('Erro ao desativar parâmetro.', $e);
  113 + }
  114 + }
  115 +
  116 + protected function reativarControlado(PenParametroDTO $objDTO){
  117 +
  118 + try {
  119 +
  120 +
  121 + }
  122 + catch (Exception $e) {
  123 + throw new InfraException('Erro ao reativar parâmetro.', $e);
  124 + }
  125 + }
  126 +
  127 + public function setValor($strNome, $strValor){
  128 +
  129 + try {
  130 +
  131 + $objBD = new PenParametroBD($this->inicializarObjInfraIBanco());
  132 +
  133 + return $objBD->setValor($strNome, $strValor);
  134 + }
  135 + catch (Exception $e) {
  136 + throw new InfraException('Erro ao reativar parâmetro.', $e);
  137 + }
  138 + }
  139 +
  140 + public function isSetValor($strNome){
  141 +
  142 + return $objBD->isSetValor($strNome);
  143 + }
  144 +}
... ...
rn/PenRelHipoteseLegalEnvioRN.php 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../../SEI.php';
  4 +
  5 +/**
  6 + * Description of PenRelHipoteseLegalEnvioRN
  7 + *
  8 + * @author Join Tecnologia
  9 + */
  10 +class PenRelHipoteseLegalEnvioRN extends PenRelHipoteseLegalRN {
  11 +
  12 + public function listar(PenRelHipoteseLegalDTO $objDTO){
  13 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_enviado_listar', __METHOD__, $objDTO);
  14 + return parent::listarConectado($objDTO);
  15 + }
  16 + public function alterar(PenRelHipoteseLegalDTO $objDTO){
  17 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_enviado_alterar', __METHOD__, $objDTO);
  18 + return parent::alterarConectado($objDTO);
  19 + }
  20 + public function cadastrar(PenRelHipoteseLegalDTO $objDTO){
  21 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_enviado_cadastrar', __METHOD__, $objDTO);
  22 + return parent::cadastrarConectado($objDTO);
  23 + }
  24 + public function excluir(PenRelHipoteseLegalDTO $objDTO){
  25 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_enviado_excluir', __METHOD__, $objDTO);
  26 + return parent::excluirConectado($objDTO);
  27 + }
  28 +}
... ...
rn/PenRelHipoteseLegalRN.php 0 → 100644
... ... @@ -0,0 +1,109 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../../SEI.php';
  4 +
  5 +/**
  6 + * Description of PenRelHipoteseLegalRN
  7 + *
  8 + * @author michael
  9 + */
  10 +abstract class PenRelHipoteseLegalRN extends InfraRN {
  11 +
  12 + protected function inicializarObjInfraIBanco(){
  13 + return BancoSEI::getInstance();
  14 + }
  15 +
  16 + protected function listarConectado(PenRelHipoteseLegalDTO $objDTO){
  17 +
  18 + try {
  19 +
  20 + $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  21 +
  22 + return $objBD->listar($objDTO);
  23 + }
  24 + catch (Exception $e) {
  25 + throw new InfraException('Erro excluindo E-mail do Sistema.', $e);
  26 + }
  27 + }
  28 +
  29 + protected function alterarConectado(PenRelHipoteseLegalDTO $objDTO){
  30 +
  31 + try {
  32 +
  33 + $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  34 +
  35 + return $objBD->alterar($objDTO);
  36 + }
  37 + catch (Exception $e) {
  38 + throw new InfraException('Erro excluindo E-mail do Sistema.', $e);
  39 + }
  40 + }
  41 +
  42 + protected function cadastrarConectado(PenRelHipoteseLegalDTO $objDTO){
  43 +
  44 + try {
  45 +
  46 + $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  47 +
  48 + return $objBD->cadastrar($objDTO);
  49 + }
  50 + catch (Exception $e) {
  51 + throw new InfraException('Erro excluindo E-mail do Sistema.', $e);
  52 + }
  53 + }
  54 +
  55 + protected function excluirConectado(PenRelHipoteseLegalDTO $objDTO){
  56 +
  57 + try {
  58 +
  59 + $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  60 +
  61 + return $objBD->excluir($objDTO);
  62 + }
  63 + catch (Exception $e) {
  64 + throw new InfraException('Erro excluindo E-mail do Sistema.', $e);
  65 + }
  66 + }
  67 +
  68 + public function getIdBarramentoEmUso(PenRelHipoteseLegalDTO $objFiltroDTO, $strTipo = 'E'){
  69 +
  70 + $objDTO = new PenRelHipoteseLegalDTO();
  71 + $objDTO->setDistinct(true);
  72 + $objDTO->setStrTipo($strTipo);
  73 + $objDTO->retNumIdBarramento();
  74 +
  75 + if($objFiltroDTO->isSetNumIdBarramento()) {
  76 + $objDTO->setNumIdBarramento($objFiltroDTO->getNumIdBarramento(), InfraDTO::$OPER_DIFERENTE);
  77 + }
  78 +
  79 + $arrObjDTO = $this->listar($objDTO);
  80 +
  81 + $arrIdBarramento = array();
  82 +
  83 + if(!empty($arrObjDTO)) {
  84 + $arrIdBarramento = InfraArray::converterArrInfraDTO($arrObjDTO, 'IdBarramento');
  85 + }
  86 + return $arrIdBarramento;
  87 + }
  88 +
  89 + public function getIdHipoteseLegalEmUso(PenRelHipoteseLegalDTO $objFiltroDTO, $strTipo = 'E'){
  90 +
  91 + $objDTO = new PenRelHipoteseLegalDTO();
  92 + $objDTO->setDistinct(true);
  93 + $objDTO->setStrTipo($strTipo);
  94 + $objDTO->retNumIdHipoteseLegal();
  95 +
  96 + if($objFiltroDTO->isSetNumIdHipoteseLegal()) {
  97 + $objDTO->setNumIdHipoteseLegal($objFiltroDTO->getNumIdHipoteseLegal(), InfraDTO::$OPER_DIFERENTE);
  98 + }
  99 +
  100 + $arrObjDTO = $this->listar($objDTO);
  101 +
  102 + $arrIdBarramento = array();
  103 +
  104 + if(!empty($arrObjDTO)) {
  105 + $arrIdBarramento = InfraArray::converterArrInfraDTO($arrObjDTO, 'IdHipoteseLegal');
  106 + }
  107 + return $arrIdBarramento;
  108 + }
  109 +}
... ...
rn/PenRelHipoteseLegalRecebidoRN.php 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<?php
  2 +
  3 +require_once dirname(__FILE__) . '/../../../SEI.php';
  4 +
  5 +/**
  6 + * Description of PenRelHipoteseLegalEnvioRN
  7 + *
  8 + * @author michael
  9 + */
  10 +class PenRelHipoteseLegalRecebidoRN extends PenRelHipoteseLegalRN {
  11 +
  12 + public function listar(PenRelHipoteseLegalDTO $objDTO){
  13 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebido_listar', __METHOD__, $objDTO);
  14 + return parent::listarConectado($objDTO);
  15 + }
  16 + public function alterar(PenRelHipoteseLegalDTO $objDTO){
  17 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebido_alterar', __METHOD__, $objDTO);
  18 + return parent::alterarConectado($objDTO);
  19 + }
  20 + public function cadastrar(PenRelHipoteseLegalDTO $objDTO){
  21 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebido_cadastrar', __METHOD__, $objDTO);
  22 + return parent::cadastrarConectado($objDTO);
  23 + }
  24 + public function excluir(PenRelHipoteseLegalDTO $objDTO){
  25 + SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebido_excluir', __METHOD__, $objDTO);
  26 + return parent::excluirConectado($objDTO);
  27 + }
  28 +}
... ...
sei_atualizar_versao_modulo_pen.php
... ... @@ -15,10 +15,8 @@ try {
15 15  
16 16 require_once dirname(__FILE__).'/../web/SEI.php';
17 17  
18   - $objPenConsoleRN = new PenConsoleRN();
19   - $arrArgs = $objPenConsoleRN->getTokens();
20 18  
21   - $objAtualizarRN = new PenAtualizarSeiRN($arrArgs);
  19 + $objAtualizarRN = new PenAtualizarSeiRN();
22 20 $objAtualizarRN->atualizarVersao();
23 21  
24 22 exit(0);
... ...
sip_atualizar_versao_modulo_pen.php
... ... @@ -424,15 +424,7 @@ class PenMetaBD extends InfraMetaBD {
424 424  
425 425 abstract class PenAtualizadorRN extends InfraRN {
426 426  
427   - const VER_NONE = '0.0.0'; // Modulo não instalado
428   - const VER_001 = '0.0.1';
429   - const VER_002 = '0.0.2';
430   - const VER_003 = '0.0.3';
431   - const VER_004 = '0.0.4';
432   - const VER_005 = '0.0.5';
433   - const VER_100 = '1.0.0';
434   -
435   - protected $sei_versao;
  427 + protected $sip_versao;
436 428  
437 429 /**
438 430 * @var string Versão mínima requirida pelo sistema para instalação do PEN
... ... @@ -458,11 +450,18 @@ abstract class PenAtualizadorRN extends InfraRN {
458 450 * @var integer Tempo de execução do script
459 451 */
460 452 protected $numSeg = 0;
  453 +
  454 + protected $objInfraBanco ;
461 455  
462   - /**
463   - * @var array Argumentos passados por linha de comando ao script
464   - */
465   - protected $arrArgs = array();
  456 + protected function inicializarObjInfraIBanco() {
  457 +
  458 + if (empty($this->objInfraBanco)) {
  459 + $this->objInfraBanco = BancoSip::getInstance();
  460 + $this->objInfraBanco->abrirConexao();
  461 + }
  462 +
  463 + return $this->objInfraBanco;
  464 + }
466 465  
467 466 /**
468 467 * Inicia a conexão com o banco de dados
... ... @@ -513,286 +512,126 @@ abstract class PenAtualizadorRN extends InfraRN {
513 512 }
514 513  
515 514 /**
516   - * Método criado em função de um bug com a InfraRN na linha 69, onde usamos
517   - * uma instância do banco do SIP e a versão esta no banco SEI, essa verificação
518   - * e lançamento de uma excessão pelos bancos terem nome diferentes tava o
519   - * atualizado
520   - *
521   - * @todo Migrar para classe PenMetaBD
522   - * @return null
523   - */
524   - protected function setVersao($strRegexVersao, $objInfraBanco = null) {
525   -
526   - InfraDebug::getInstance()->gravarInfra(sprintf('[%s->%s]', get_class($this), __FUNCTION__));
527   -
528   -
529   - if ($this->getVersao($objInfraBanco)) {
530   -
531   - $sql = sprintf("UPDATE infra_parametro SET valor = '%s' WHERE nome = '%s'", $strRegexVersao, $this->sei_versao);
532   - } else {
533   -
534   - $sql = sprintf("INSERT INTO infra_parametro(nome, valor) VALUES('%s', '%s')", $this->sei_versao, $strRegexVersao);
535   - }
536   -
537   - if (empty($objInfraBanco)) {
538   -
539   - $objInfraBanco = $this->inicializarObjInfraIBanco();
540   - }
541   -
542   - $objInfraBanco->executarSql($sql);
543   -
544   - return $strRegexVersao;
545   - }
546   -
547   - /**
548   - * Retorna a versão atual do modulo, se já foi instalado
549   - *
550   - * @todo Migrar para classe PenMetaBD
551   - * @param InfraBanco $objInfraBanco Conexão com o banco SEI ou SIP
552   - * @return string
553   - */
554   - protected function getVersao($objInfraBanco = null) {
555   -
556   - InfraDebug::getInstance()->gravarInfra(sprintf('[%s->%s]', get_class($this), __FUNCTION__));
557   -
558   - $sql = sprintf("SELECT valor FROM infra_parametro WHERE nome = '%s'", $this->sei_versao);
559   -
560   - if (empty($objInfraBanco)) {
561   -
562   - $objInfraBanco = $this->inicializarObjInfraIBanco();
563   - }
564   -
565   - $arrResultado = $objInfraBanco->consultarSql($sql);
566   -
567   - if (empty($arrResultado)) {
568   - return null;
569   - }
570   -
571   - $arrLinha = current($arrResultado);
572   -
573   - return $arrLinha['valor'];
574   - }
575   -
576   - /**
577   - * Verifica se o número da versão é valido
578   - *
579   - * @param string $strVersao Versão a ser instalada
580   - * @return bool
581   - */
582   - protected function isVersaoValida($strVersao = self::VER_NONE) {
583   -
584   - if (empty($strVersao)) {
585   - return false;
586   - }
587   -
588   - // Remove os caracteres não númericos
589   - $strVersao = preg_replace('/\D+/', '', $strVersao);
590   -
591   - // Tem que no mínimo 3 digitos
592   - if (strlen($strVersao) < 3) {
593   - return false;
594   - }
595   -
596   - return is_numeric($strVersao) ? true : false;
597   - }
598   -
599   - /**
600   - * Verifica se um paramêtro existe, caso sim retorna o seu valor, senão
601   - * retorna o default especificado.
  515 + * Construtor
602 516 *
603   - * @param string $strChave Nome do paramêtro
604   - * @param string $strParam String a ser formatada com o valor do paramêtro
605   - * @param string $strParamDefault String que retorna caso o valor do
606   - * paramêtro não exista
607   - * @param bool $bolAlgumFiltroUsado Ponteiro de controle para verificar se
608   - * pelo menos um paramêtro foi encontrado
609   - * @return string
610   - */
611   - private function getStrArg($strChave = '', $strParam = '', $strParamDefault = '', &$bolAlgumFiltroUsado) {
612   -
613   - if (array_key_exists($strChave, $this->arrArgs)) {
614   - $bolAlgumFiltroUsado = true;
615   - return sprintf($strParam, str_pad($this->arrArgs[$strChave], 3, '0', STR_PAD_LEFT));
616   - }
617   - return $strParamDefault;
618   - }
619   -
620   - /**
621   - * Retorna a última versão disponivel. Verifica as constantes que iniciam
622   - * com VER_
  517 + * @param array $arrArgs Argumentos enviados pelo script
623 518 */
624   - private function getUltimaVersao() {
  519 + public function __construct() {
  520 +
  521 + parent::__construct();
  522 + ini_set('max_execution_time', '0');
  523 + ini_set('memory_limit', '-1');
  524 + @ini_set('zlib.output_compression', '0');
  525 + @ini_set('implicit_flush', '1');
  526 + ob_implicit_flush();
  527 +
  528 + $this->inicializarObjInfraIBanco();
  529 + $this->inicializarObjMetaBanco();
625 530  
626   - $objReflection = new ReflectionClass(__CLASS__);
627   - $arrVersao = array_flip(preg_grep('/^VER\_/', array_flip($objReflection->getConstants())));
628   - sort($arrVersao);
629   - return array_pop($arrVersao);
  531 + $this->objDebug = InfraDebug::getInstance();
  532 + $this->objDebug->setBolLigado(true);
  533 + $this->objDebug->setBolDebugInfra(true);
  534 + $this->objDebug->setBolEcho(true);
  535 + $this->objDebug->limpar();
630 536 }
  537 +}
631 538  
632   - /**
633   - * Encontra os métodos com notação para instalar a versão selecionada
634   - *
635   - * @return string Número da versão
636   - */
637   - protected function executarControlado() {
638   -
639   - $this->inicializarObjMetaBanco()
640   - ->isDriverSuportado()
641   - ->isDriverPermissao();
642   - //->isVersaoSuportada(SEI_VERSAO, $this->versaoMinRequirida);
643   -
644   - $arrMetodo = array();
645   -
646   - // Retorna a última versão disponibilizada pelo script. Sempre tenta atualizar
647   - // para versão mais antiga
648   - $strVersaoInstalar = $this->getUltimaVersao();
649   -
650   - //throw new InfraException($strVersaoInstalar);
651   - $objInfraBanco = $this->inicializarObjInfraIBanco();
652   - // Versão atual
653   - $strPenVersao = $this->getVersao($objInfraBanco);
654   - if (!$this->isVersaoValida($strPenVersao)) {
655   - // Não instalado
656   - $strPenVersao = $this->setVersao(self::VER_NONE, $objInfraBanco);
657   - }
658   -
659   - $numPenVersao = str_replace('.', '', $strPenVersao);
660   -
661   - $numVersaoInstalar = intval(preg_replace('/\D+/', '', $strVersaoInstalar));
662   - //$numVersaoInstalar = intval(substr($strVersaoInstalar, -1));
663   -
664   - $bolAlgumFiltroUsado = false;
665   - $strRegexRelease = $this->getStrArg('release', '(R%s)', '(R[0-9]{1,3})?', $bolAlgumFiltroUsado);
666   - $strRegexSprint = $this->getStrArg('sprint', '(S%s)', '(S[0-9]{1,3})?', $bolAlgumFiltroUsado);
667   - $strRegexItem = $this->getStrArg('user-story', '(US%s)', '(US|IW[0-9]{1,3})?', $bolAlgumFiltroUsado);
668   - $strRegexItem = $this->getStrArg('item-worker', '(IW%s)', $strRegexItem, $bolAlgumFiltroUsado);
  539 +class PenAtualizarSipRN extends PenAtualizadorRN {
669 540  
670   - // Instalar todas atualizações
671   - if ($bolAlgumFiltroUsado === false) {
672   -
673   - /*list($v1, $r1, $s1) = explode('.', '1.0.1');
674   - list($v2, $r2, $s2) = explode('.', $strVersaoInstalar);
  541 + protected $versaoMinRequirida = '1.30.0';
  542 + protected $sip_versao = 'PEN_VERSAO_MODULO_SIP';
  543 + private $arrRecurso = array();
  544 + private $arrMenu = array();
  545 +
  546 + public function atualizarVersao() {
  547 + try {
  548 + $this->inicializar('INICIANDO ATUALIZACAO DO MODULO PEN NO SIP VERSAO 1.0.0');
675 549  
676   - $s1 = intval($s1) + 1;
677   - $r1 = intval($r1) + 1; */
  550 + //testando versao do framework
  551 +// $numVersaoInfraRequerida = '1.415';
  552 +// if (VERSAO_INFRA >= $numVersaoInfraRequerida) {
  553 +// $this->finalizar('VERSAO DO FRAMEWORK PHP INCOMPATIVEL (VERSAO ATUAL ' . VERSAO_INFRA . ', VERSAO REQUERIDA ' . $numVersaoInfraRequerida . ')', true);
  554 +// }
678 555  
679   - // 0.0.5 - 1.5.0
680   - // 1.1.1 - 1.5.0
  556 + //testando se esta usando BDs suportados
  557 + if (!(BancoSip::getInstance() instanceof InfraMySql) &&
  558 + !(BancoSip::getInstance() instanceof InfraSqlServer) &&
  559 + !(BancoSip::getInstance() instanceof InfraOracle)) {
681 560  
682   - // (00[6-9]|1[5-9][0-9])
683   - // (11[1-9]|1[5-9][0-9])
684   - // $strRegexVersao = sprintf('(%s[%s-9][%s-9]|%s[%s-9][%s-9])', $v1, $r1, $s1, $v2, $r2, $s2);
  561 + $this->finalizar('BANCO DE DADOS NAO SUPORTADO: ' . get_parent_class(BancoSip::getInstance()), true);
  562 + }
685 563  
686   - $strRegexVersao = sprintf('[%d-%d]', ($numPenVersao + 1), $numVersaoInstalar);
687   - }
688   - // Instalar somente a solicitada
689   - else {
690   - // Caso algum paramêtro seja adicionado não deve passar para próxima versão
691   - $strVersaoInstalar = $strPenVersao;
692   - $strRegexVersao = intval(substr($strPenVersao, -1) + 1);
693   - }
  564 +
  565 + //testando permissoes de criações de tabelas
  566 + $objInfraMetaBD = new InfraMetaBD($this->objInfraBanco);
  567 +
  568 + if (count($objInfraMetaBD->obterTabelas('pen_sip_teste')) == 0) {
  569 + BancoSip::getInstance()->executarSql('CREATE TABLE pen_sip_teste (id ' . $objInfraMetaBD->tipoNumero() . ' null)');
  570 + }
  571 + BancoSip::getInstance()->executarSql('DROP TABLE pen_sip_teste');
694 572  
695   - // instalarV[0-9]{1,2}[0-9](R[0-9]{1,3})?(S[0-9]{1,3})?(US|IW[0-9]{1,4})?
696   - $strRegex = sprintf('/^instalarV%s%s%s%s/i', $strRegexVersao, $strRegexRelease, $strRegexSprint, $strRegexItem
697   - );
698 573  
699   -
700   -
701   - // Tenta encontrar métodos que iniciem com instalar
702   - $arrMetodo = (array) preg_grep($strRegex, get_class_methods($this));
  574 + $objInfraParametro = new InfraParametro($this->objInfraBanco);
703 575  
704   - $proximaVersao = $numPenVersao + 1;
705   -
706   - foreach($arrMetodo as $key => $metodo){
707   - $vers = str_replace('instalarV', '', $metodo);
708   - $vers = (int) substr($vers, 0, 3);
709   -
710   - if($proximaVersao > $vers){
711   - unset($arrMetodo[$key]);
  576 + //$strVersaoAtual = $objInfraParametro->getValor('SEI_VERSAO', false);
  577 + $strVersaoModuloPen = $objInfraParametro->getValor($this->sip_versao, false);
  578 +
  579 + //VERIFICANDO QUAL VERSAO DEVE SER INSTALADA NESTA EXECUCAO
  580 + if (InfraString::isBolVazia($strVersaoModuloPen)) {
  581 + //nao tem nenhuma versao ainda, instalar todas
  582 + $this->instalarV100();
  583 + $this->instalarV101();
  584 + } else if ($strVersaoModuloPen == '1.0.0') {
  585 + $this->instalarV101();
712 586 }
713   - }
714   -
715   - if (empty($arrMetodo)) {
716 587  
717   - throw new InfraException(sprintf('NENHUMA ATUALIZACAO FOI ENCONTRADA SUPERIOR A VERSAO %s DO MODULO PEN', $strPenVersao));
718   - } else {
719 588  
720   - foreach ($arrMetodo as $strMetodo) {
  589 + InfraDebug::getInstance()->setBolDebugInfra(true);
  590 + } catch (Exception $e) {
721 591  
722   - $this->{$strMetodo}();
723   - }
  592 + InfraDebug::getInstance()->setBolLigado(false);
  593 + InfraDebug::getInstance()->setBolDebugInfra(false);
  594 + InfraDebug::getInstance()->setBolEcho(false);
  595 + throw new InfraException('Erro atualizando VERSAO.', $e);
724 596 }
725   - $this->setVersao($strVersaoInstalar, $objInfraBanco);
726   -
727   - return $strVersaoInstalar;
728 597 }
729   -
  598 +
730 599 /**
731   - * Método que inicia o processo
  600 + * Inicia o script criando um contator interno do tempo de execução
  601 + *
  602 + * @return null
732 603 */
733   - public function atualizarVersao() {
734   -
735   - $this->inicializar('INICIANDO ATUALIZACAO DO MODULO PEN NO SEI VERSAO ' . SIP_VERSAO);
736   -
737   - try {
738   -
739   - $strRegexVersao = $this->executar();
740   - $this->logar('ATUALIZADA VERSAO: ' . $strRegexVersao);
741   - } catch (InfraException $e) {
742   -
743   - $this->logar('Erro: ' . $e->getStrDescricao());
744   - } catch (\Exception $e) {
  604 + protected function inicializar($strTitulo) {
745 605  
746   - $this->logar('Erro: ' . $e->getMessage());
747   - }
  606 + $this->numSeg = InfraUtil::verificarTempoProcessamento();
748 607  
749   - $this->finalizar();
  608 + $this->logar($strTitulo);
750 609 }
751   -
  610 +
752 611 /**
753   - * Construtor
  612 + * Finaliza o script informando o tempo de execução.
754 613 *
755   - * @param array $arrArgs Argumentos enviados pelo script
  614 + * @return null
756 615 */
757   - public function __construct($arrArgs = array()) {
758   -
759   - ini_set('max_execution_time', '0');
760   - ini_set('memory_limit', '-1');
761   - @ini_set('zlib.output_compression', '0');
762   - @ini_set('implicit_flush', '1');
763   - ob_implicit_flush();
  616 + protected function finalizar() {
764 617  
765   - $this->arrArgs = $arrArgs;
  618 + $this->logar('TEMPO TOTAL DE EXECUCAO: ' . InfraUtil::verificarTempoProcessamento($this->numSeg) . ' s');
766 619  
767   - $this->inicializarObjMetaBanco();
  620 + $this->objDebug->setBolLigado(false);
  621 + $this->objDebug->setBolDebugInfra(false);
  622 + $this->objDebug->setBolEcho(false);
768 623  
769   - $this->objDebug = InfraDebug::getInstance();
770   - $this->objDebug->setBolLigado(true);
771   - $this->objDebug->setBolDebugInfra(true);
772   - $this->objDebug->setBolEcho(true);
773   - $this->objDebug->limpar();
  624 + print PHP_EOL;
  625 + die();
774 626 }
775   -
776   -}
777   -
778   -class PenAtualizarSipRN extends PenAtualizadorRN {
779   -
780   - protected $versaoMinRequirida = '1.30.0';
781   - protected $sei_versao = 'PEN_VERSAO_MODULO_SIP';
782   - private $arrRecurso = array();
783   - private $arrMenu = array();
784   -
  627 +
785 628 /**
786   - * Retorna/Cria a conexão com o banco de dados
  629 + * Adiciona uma mensagem ao output para o usuário
787 630 *
788   - * @return InfraIBanco
  631 + * @return null
789 632 */
790   - protected function inicializarObjInfraIBanco() {
791   - if (empty($this->objBanco)) {
792   -
793   - $this->objBanco = BancoSip::getInstance();
794   - }
795   - return $this->objBanco;
  633 + protected function logar($strMsg) {
  634 + $this->objDebug->gravar($strMsg);
796 635 }
797 636  
798 637 /**
... ... @@ -883,7 +722,7 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
883 722 $objDTO->setNumMaxRegistrosRetorno(1);
884 723 $objDTO->retNumIdItemMenu();
885 724  
886   - $objBD = new ItemMenuBD($this->inicializarObjInfraIBanco());
  725 + $objBD = new ItemMenuBD($this->objInfraBanco);
887 726 $objDTO = $objBD->consultar($objDTO);
888 727  
889 728 if (empty($objDTO)) {
... ... @@ -917,7 +756,7 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
917 756 if (!empty($this->arrRecurso)) {
918 757  
919 758 $objDTO = new RelPerfilRecursoDTO();
920   - $objBD = new RelPerfilRecursoBD($this->inicializarObjInfraIBanco());
  759 + $objBD = new RelPerfilRecursoBD($this->objInfraBanco);
921 760  
922 761 foreach ($this->arrRecurso as $numIdRecurso) {
923 762  
... ... @@ -937,7 +776,7 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
937 776 if (!empty($this->arrMenu)) {
938 777  
939 778 $objDTO = new RelPerfilItemMenuDTO();
940   - $objBD = new RelPerfilItemMenuBD($this->inicializarObjInfraIBanco());
  779 + $objBD = new RelPerfilItemMenuBD($this->objInfraBanco);
941 780  
942 781 foreach ($this->arrMenu as $array) {
943 782  
... ... @@ -959,7 +798,7 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
959 798 public function atribuirPerfil($numIdSistema) {
960 799  
961 800 $objDTO = new PerfilDTO();
962   - $objBD = new PerfilBD($this->inicializarObjInfraIBanco());
  801 + $objBD = new PerfilBD($this->objInfraBanco);
963 802 $objRN = $this;
964 803  
965 804 // Vincula a um perfil os recursos e menus adicionados nos métodos criarMenu e criarReturso
... ... @@ -986,8 +825,8 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
986 825 /**
987 826 * Instala/Atualiza os módulo PEN para versão 1.0
988 827 */
989   - protected function instalarV001() {
990   - $numIdSistema = $this->getNumIdSistema('SEI');
  828 + protected function instalarV100() {
  829 + $numIdSistema = $this->getNumIdSistema('SEI');
991 830 $numIdMenu = $this->getNumIdMenu('Principal', $numIdSistema);
992 831  
993 832 //----------------------------------------------------------------------
... ... @@ -1010,7 +849,7 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
1010 849 $objItemMenuDTO->setNumMaxRegistrosRetorno(1);
1011 850 $objItemMenuDTO->retNumIdItemMenu();
1012 851  
1013   - $objItemMenuBD = new ItemMenuBD($this->inicializarObjInfraIBanco());
  852 + $objItemMenuBD = new ItemMenuBD($this->objInfraBanco);
1014 853 $objItemMenuDTO = $objItemMenuBD->consultar($objItemMenuDTO);
1015 854  
1016 855 if (empty($objItemMenuDTO)) {
... ... @@ -1045,16 +884,12 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
1045 884 $this->criarMenu('Listar', 20, $numIdItemMenuPai, $numIdMenu, $numIdRecurso, $numIdSistema);
1046 885  
1047 886 //Atribui as permissões aos recursos e menus
1048   - $this->atribuirPerfil($numIdSistema);
1049   - }
1050   -
1051   - protected function instalarV003R003S003IW001() {
1052   -
1053   - $objBD = new ItemMenuBD($this->inicializarObjInfraIBanco());
  887 + $this->atribuirPerfil($numIdSistema);
  888 +
  889 + // ---------- antigo método (instalarV003R003S003IW001) ---------- //
  890 + $objBD = new ItemMenuBD($this->objInfraBanco);
1054 891  
1055   - //----------------------------------------------------------------------
1056 892 // Achar o root
1057   -
1058 893 $numIdSistema = $this->getNumIdSistema('SEI');
1059 894 $numIdMenu = $this->getNumIdMenu('Principal', $numIdSistema);
1060 895  
... ... @@ -1110,165 +945,137 @@ class PenAtualizarSipRN extends PenAtualizadorRN {
1110 945  
1111 946 $objBD->excluir($objItemMenuDTO);
1112 947 }
1113   - }
1114   - }
1115   -
1116   - protected function instalarV100R001S001IW001(){
1117   -
1118   - }
1119   -
1120   -}
1121   -
1122   -class PenConsoleRN extends InfraRN {
1123   -
1124   - protected $objRN;
1125   - protected $strAction;
1126   - protected $arrTokens = array();
1127   - protected $objInfraBanco;
1128   -
1129   - public function __construct($objRN = null, $tokens = array()) {
1130   -
1131   - if(!is_null($objRN)) {
1132   -
1133   - parent::__construct();
1134   -
1135   - if(!is_object($objRN)) {
1136   - throw new InfraException('Requerido objeto Infra');
1137   - }
1138   -
1139   - if(get_parent_class($objRN) !== 'InfraRN') {
1140   - throw new InfraException('Requerido objeto Infra que seja extendido de InfraRN');
1141   - }
1142   -
1143   - $this->objRN = $objRN;
1144 948 }
1145 949  
1146   - if(empty($tokens)) {
1147   - $tokens = $_SERVER['argv'];
1148   - }
  950 + $objInfraParametroDTO = new InfraParametroDTO();
  951 + $objInfraParametroDTO->setStrNome($this->sip_versao);
  952 + $objInfraParametroDTO->setStrValor('1.0.0');
1149 953  
1150   - $this->criarTokens($tokens);
1151   - }
1152   -
1153   - /**
1154   - * Inicializador o banco de dados
1155   - */
1156   - protected function inicializarObjInfraIBanco() {
1157   - if(empty($this->objInfraBanco)){
1158   - $this->objInfraBanco = BancoSEI::getInstance();
1159   - }
1160   - return $this->objInfraBanco;
  954 + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco());
  955 + $objInfraParametroBD->cadastrar($objInfraParametroDTO);
1161 956 }
1162 957  
1163 958 /**
1164   - * Processa os parâmetros passados ao script pelo cli
1165   - *
1166   - * @param array $arguments
1167   - * @return null
  959 + * Instala/Atualiza os módulo PEN para versão 1.0.1
1168 960 */
1169   - protected function criarTokens($arguments = array()){
1170   -
1171   - if(empty($arguments)) {
1172   - throw new InfraException('Script não pode ser executado pela web');
1173   - }
1174   -
1175   - $strScript = array_shift($arguments);
  961 + protected function instalarV101() {
  962 + // ---------- antigo método (instalarV006R004S001US039) ---------- //
  963 + $objItemMenuBD = new ItemMenuBD($this->inicializarObjInfraIBanco());
1176 964  
1177   - if(!empty($this->objRN)) {
1178   -
1179   - $strAction = array_shift($arguments);
1180   -
1181   - if(substr($strAction, 0, 2) == '--') {
1182   - throw new InfraException('O primeiro paramêtro deve ser uma action da RN');
1183   - }
1184   -
1185   - $this->strAction = $strAction;
  965 + $numIdSistema = $this->getNumIdSistema('SEI');
  966 + $numIdMenu = $this->getNumIdMenu('Principal', $numIdSistema);
  967 +
  968 + $objItemMenuDTO = new ItemMenuDTO();
  969 + $objItemMenuDTO->setNumIdSistema($numIdSistema);
  970 + $objItemMenuDTO->setNumIdMenu($numIdMenu);
  971 + $objItemMenuDTO->setStrRotulo('Processo Eletrnico Nacional');
  972 + $objItemMenuDTO->setNumMaxRegistrosRetorno(1);
  973 + $objItemMenuDTO->retNumIdItemMenu();
  974 +
  975 + $objItemMenuDTO = $objItemMenuBD->consultar($objItemMenuDTO);
  976 +
  977 + if(empty($objItemMenuDTO)) {
  978 + throw new InfraException('Menu "Processo Eletrnico Nacional" no foi localizado');
1186 979 }
1187   -
1188   - foreach($arguments as $key => $argument) {
1189 980  
1190   - if(substr($argument, 0, 2) === '--'){
  981 + // Administrao > Mapeamento de Hipteses Legais de Envio
  982 + $numIdItemMenu = $this->criarMenu('Mapeamento de Hipteses Legais', 20, $objItemMenuDTO->getNumIdItemMenu(), $numIdMenu, null, $numIdSistema);
1191 983  
1192   - $string = preg_replace('/^--/', '', $argument);
1193   - $array = explode('=', $string);
  984 + // Administrao > Mapeamento de Hipteses Legais de Envio > Envio
  985 + $numIdItemMenu = $this->criarMenu('Envio', 10, $numIdItemMenu, $numIdMenu, null, $numIdSistema);
1194 986  
1195   - $key = array_shift($array);
1196   - $value = (count($array) > 0) ? array_shift($array) : true;
  987 + // Administrao > Mapeamento de Hipteses Legais de Envio > Envio > Cadastrar
  988 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_enviado_alterar', 'Alterar de mapeamento de Hipteses Legais de Envio', $numIdSistema);
  989 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_enviado_cadastrar', 'Cadastro de mapeamento de Hipteses Legais de Envio', $numIdSistema);
  990 + $this->criarMenu('Cadastrar', 10, $numIdItemMenu, $numIdMenu, $numIdRecurso, $numIdSistema);
1197 991  
1198   - $this->arrTokens[$key] = $value;
1199   - }
1200   - }
1201   - }
1202   -
1203   - /**
1204   - * Retorna os parâmetros
1205   - */
1206   - public function getTokens(){
1207   - return $this->arrTokens;
1208   - }
  992 + // Administrao > Mapeamento de Hipteses Legais de Envio > Envio > Listar
  993 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_enviado_excluir', 'Excluir mapeamento de Hipteses Legais de Envio', $numIdSistema);
  994 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_enviado_listar', 'Listagem de mapeamento de Hipteses Legais de Envio', $numIdSistema);
  995 + $this->criarMenu('Listar', 20, $numIdItemMenu, $numIdMenu, $numIdRecurso, $numIdSistema);
  996 +
  997 + //Atribui as permisses aos recursos e menus
  998 + $this->atribuirPerfil($numIdSistema);
1209 999  
1210   - public function run(){
1211   -
1212   - if(empty($this->objRN)) {
1213   - throw new InfraException('Nenhuma RN foi adicionada ao console');
1214   - }
1215   -
1216   - if(!method_exists($this->objRN, $this->strAction)) {
1217   -
1218   - throw new InfraException(sprintf('Nenhuma ação "%s" foi encontrada em %s '.PHP_EOL.$this->objRN->ajuda(), $this->strAction, get_class($this->objRN)));
1219   - }
1220   -
1221   - if(array_key_exists('ajuda', $this->arrTokens)) {
1222   -
1223   - print $this->objRN->ajuda();
1224   - return true;
  1000 +
  1001 + // ---------- antigo método (instalarV006R004S001US040) ---------- //
  1002 + $objBD = new ItemMenuBD($this->inicializarObjInfraIBanco());
  1003 +
  1004 + //----------------------------------------------------------------------
  1005 + // Achar o root
  1006 +
  1007 + $numIdSistema = $this->getNumIdSistema('SEI');
  1008 + $numIdMenu = $this->getNumIdMenu('Principal', $numIdSistema);
  1009 +
  1010 + $objDTO = new ItemMenuDTO();
  1011 + $objDTO->setNumIdSistema($numIdSistema);
  1012 + $objDTO->setNumIdMenu($numIdMenu);
  1013 + $objDTO->setStrRotulo('Mapeamento de Hipteses Legais');
  1014 + $objDTO->setNumMaxRegistrosRetorno(1);
  1015 + $objDTO->retNumIdItemMenu();
  1016 +
  1017 + $objDTO = $objBD->consultar($objDTO);
  1018 +
  1019 + if(empty($objDTO)) {
  1020 + throw new InfraException('Menu "Processo Eletrnico Nacional" no foi localizado');
1225 1021 }
  1022 +
  1023 + // Administrao > Mapeamento de Hipteses Legais de Envio > Envio
  1024 + $numIdItemMenu = $this->criarMenu('Recebimento', 20, $objDTO->getNumIdItemMenu(), $numIdMenu, null, $numIdSistema);
  1025 +
  1026 + // Administrao > Mapeamento de Hipteses Legais de Envio > Envio > Cadastrar
  1027 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_recebido_alterar', 'Alterar de mapeamento de Hipteses Legais de Recebimento', $numIdSistema);
  1028 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_recebido_cadastrar', 'Cadastro de mapeamento de Hipteses Legais de Recebimento', $numIdSistema);
  1029 + $this->criarMenu('Cadastrar', 10, $numIdItemMenu, $numIdMenu, $numIdRecurso, $numIdSistema);
  1030 +
  1031 + // Administrao > Mapeamento de Hipteses Legais de Envio > Envio > Listar
  1032 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_recebido_excluir', 'Excluir mapeamento de Hipteses Legais de Recebimento', $numIdSistema);
  1033 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_recebido_listar', 'Listagem de mapeamento de Hipteses Legais de Recebimento', $numIdSistema);
  1034 + $this->criarMenu('Listar', 20, $numIdItemMenu, $numIdMenu, $numIdRecurso, $numIdSistema);
  1035 +
  1036 + //Atribui as permisses aos recursos e menus
  1037 + $this->atribuirPerfil($numIdSistema);
1226 1038  
1227   - return call_user_func(array($this->objRN, $this->strAction), $this->getTokens());
1228   - }
1229   -
1230   - public static function format($strMensagem = '', $strFonte = '', $bolBold = false){
1231   -
1232   - $strBold = ($bolBold !== false) ? '1' : '0';
1233   -
1234   - //$strMensagem = escapeshellarg($strMensagem);
1235   -
1236   - if(!empty($strFonte)) {
1237   -
1238   - switch($strFonte){
  1039 + // ---------- antigo método (instalarV006R004S001US043) ---------- //
  1040 + $objBD = new ItemMenuBD($this->inicializarObjInfraIBanco());
1239 1041  
1240   - case 'green':
1241   - $strMensagem = "\033[".$strBold.";32m".$strMensagem;
1242   - break;
1243   -
1244   - case 'red':
1245   - $strMensagem = "\033[".$strBold.";31m".$strMensagem;
1246   - break;
1247   -
1248   - case 'blue':
1249   - $strMensagem = "\033[".$strBold.";34m".$strMensagem;
1250   - break;
1251   -
1252   - case 'yellow':
1253   - $strMensagem = "\033[".$strBold.";33m".$strMensagem;
1254   - break;
  1042 + $numIdSistema = $this->getNumIdSistema('SEI');
  1043 + $numIdMenu = $this->getNumIdMenu('Principal', $numIdSistema);
1255 1044  
1256   - }
  1045 + $objDTO = new ItemMenuDTO();
  1046 + $objDTO->setNumIdSistema($numIdSistema);
  1047 + $objDTO->setNumIdMenu($numIdMenu);
  1048 + $objDTO->setStrRotulo('Mapeamento de Hipteses Legais');
  1049 + $objDTO->setNumMaxRegistrosRetorno(1);
  1050 + $objDTO->retNumIdItemMenu();
  1051 +
  1052 + $objDTO = $objBD->consultar($objDTO);
  1053 +
  1054 + if(empty($objDTO)) {
  1055 + throw new InfraException('Menu "Processo Eletrnico Nacional" no foi localizado');
1257 1056 }
1258   - return static::resetAfter($strMensagem);
1259   - }
1260   -
1261   - public static function resetAfter($strMensagem = ''){
  1057 +
  1058 + $numIdRecurso = $this->criarRecurso('pen_map_hipotese_legal_padrao_cadastrar', 'Acesso ao formulrio de cadastro de mapeamento de Hipteses Legais Padro', $numIdSistema);
  1059 +
  1060 + $this->criarMenu('Indicar Hiptese de Restrio Padro', 30, $objDTO->getNumIdItemMenu(), $numIdMenu, $numIdRecurso, $numIdSistema);
  1061 + $this->criarRecurso('pen_map_hipotese_legal_padrao', 'Mtodo Cadastrar Padro da RN de mapeamento de Hipteses Legais', $numIdSistema);
  1062 + $this->atribuirPerfil($numIdSistema);
  1063 +
  1064 + /* altera o parâmetro da versão de banco */
  1065 + $objInfraParametroDTO = new InfraParametroDTO();
  1066 + $objInfraParametroDTO->setStrNome($this->sip_versao);
  1067 + $objInfraParametroDTO->retTodos();
  1068 +
  1069 + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco());
  1070 + $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO);
  1071 + $objInfraParametroDTO->setStrValor('1.0.1');
  1072 + $objInfraParametroBD->alterar($objInfraParametroDTO);
1262 1073  
1263   - return $strMensagem. "\033[0m";
1264 1074 }
1265 1075 }
1266 1076  
1267 1077 try {
1268   -
1269   - $objPenConsoleRN = new PenConsoleRN();
1270   - $arrArgs = $objPenConsoleRN->getTokens();
1271   -
  1078 +
1272 1079 $objAtualizarRN = new PenAtualizarSipRN($arrArgs);
1273 1080 $objAtualizarRN->atualizarVersao();
1274 1081  
... ... @@ -1278,7 +1085,7 @@ try {
1278 1085 print InfraException::inspecionar($e);
1279 1086  
1280 1087 try {
1281   - LogSEI::getInstance()->gravar(InfraException::inspecionar($e));
  1088 +// LogSEI::getInstance()->gravar(InfraException::inspecionar($e));
1282 1089 } catch (Exception $e) {
1283 1090  
1284 1091 }
... ...