Commit ca17d5741e60eca40845b1f1ea61fa60bc3e6c56

Authored by Thiago Farias
1 parent 1eab0463

AJustes: US042 refs #8517

dto/PenRelHipoteseLegalDTO.php
@@ -14,11 +14,14 @@ class PenRelHipoteseLegalDTO extends InfraDTO { @@ -14,11 +14,14 @@ class PenRelHipoteseLegalDTO extends InfraDTO {
14 public function montar() { 14 public function montar() {
15 $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdMap', 'id_mapeamento'); 15 $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdMap', 'id_mapeamento');
16 $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal', 'id_hipotese_legal'); 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'); 17 $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Tipo', 'tipo');
19 $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Ativo', 'sin_ativo'); 18 $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Ativo', 'sin_ativo');
  19 + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdBarramento', 'id_hipotese_legal_pen');
  20 +
  21 + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'Identificacao', 'identificacao', 'md_pen_hipotese_legal');
20 22
21 $this->configurarPK('IdMap',InfraDTO::$TIPO_PK_SEQUENCIAL); 23 $this->configurarPK('IdMap',InfraDTO::$TIPO_PK_SEQUENCIAL);
  24 + $this->configurarFK('IdBarramento', 'md_pen_hipotese_legal', 'id_hipotese_legal');
22 25
23 //$this->configurarExclusaoLogica('Ativo', 'N'); 26 //$this->configurarExclusaoLogica('Ativo', 'N');
24 } 27 }
dto/PenRelTipoDocMapEnviadoDTO.php
@@ -17,7 +17,7 @@ class PenRelTipoDocMapEnviadoDTO extends InfraDTO { @@ -17,7 +17,7 @@ class PenRelTipoDocMapEnviadoDTO extends InfraDTO {
17 17
18 $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeSerie', 'nome', 'serie'); 18 $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeSerie', 'nome', 'serie');
19 $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeEspecie','nome_especie', 'md_pen_especie_documental'); 19 $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeEspecie','nome_especie', 'md_pen_especie_documental');
20 - 20 +
21 $this->configurarPK('IdMap', InfraDTO::$TIPO_PK_SEQUENCIAL); 21 $this->configurarPK('IdMap', InfraDTO::$TIPO_PK_SEQUENCIAL);
22 $this->configurarFK('IdSerie', 'serie', 'id_serie'); 22 $this->configurarFK('IdSerie', 'serie', 'id_serie');
23 $this->configurarFK('CodigoEspecie', 'md_pen_especie_documental', 'id_especie'); 23 $this->configurarFK('CodigoEspecie', 'md_pen_especie_documental', 'id_especie');
pen_parametros_configuracao.php
@@ -14,14 +14,33 @@ try { @@ -14,14 +14,33 @@ try {
14 $objBanco = BancoSEI::getInstance(); 14 $objBanco = BancoSEI::getInstance();
15 $objSessao = SessaoSEI::getInstance(); 15 $objSessao = SessaoSEI::getInstance();
16 16
  17 +
  18 + $o = new PenRelHipoteseLegalEnvioRN();
  19 + $os = new PenRelHipoteseLegalRecebidoRN();
  20 +
17 $objSessao->validarPermissao('pen_parametros_configuracao'); 21 $objSessao->validarPermissao('pen_parametros_configuracao');
18 22
19 $objPENParametroDTO = new PenParametroDTO(); 23 $objPENParametroDTO = new PenParametroDTO();
20 $objPENParametroDTO->retTodos(); 24 $objPENParametroDTO->retTodos();
21 -  
22 $objPENParametroRN = new PENParametroRN(); 25 $objPENParametroRN = new PENParametroRN();
23 $retParametros = $objPENParametroRN->listar($objPENParametroDTO); 26 $retParametros = $objPENParametroRN->listar($objPENParametroDTO);
24 27
  28 + /* Busca os dados para montar dropdown ( TIPO DE PROCESSO EXTERNO ) */
  29 + $objTipoProcedimentoDTO = new TipoProcedimentoDTO();
  30 + $objTipoProcedimentoDTO->retNumIdTipoProcedimento();
  31 + $objTipoProcedimentoDTO->retStrNome();
  32 + $objTipoProcedimentoDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
  33 + $objTipoProcedimentoRN = new TipoProcedimentoRN();
  34 + $arrObjTipoProcedimentoDTO = $objTipoProcedimentoRN->listarRN0244($objTipoProcedimentoDTO);
  35 +
  36 + /* Busca os dados para montar dropdown ( UNIDADE GERADORA DOCUMENTO RECEBIDO ) */
  37 + $objUnidadeDTO = new UnidadeDTO();
  38 + $objUnidadeDTO->retNumIdUnidade();
  39 + $objUnidadeDTO->retStrSigla();
  40 + $objUnidadeDTO->setOrdStrSigla(InfraDTO::$TIPO_ORDENACAO_ASC);
  41 + $objUnidadeRN = new UnidadeRN();
  42 + $arrObjUnidade = $objUnidadeRN->listarRN0127($objUnidadeDTO);
  43 +
25 if ($objPENParametroDTO===null){ 44 if ($objPENParametroDTO===null){
26 throw new PENException("Registros não encontrados."); 45 throw new PENException("Registros não encontrados.");
27 } 46 }
@@ -131,17 +150,21 @@ $objPagina->abrirBody($strTitulo, 'onload="inicializar();"'); @@ -131,17 +150,21 @@ $objPagina->abrirBody($strTitulo, 'onload="inicializar();"');
131 echo '<select>'; 150 echo '<select>';
132 break; 151 break;
133 152
134 -// case 'PEN_TIPO_PROCESSO_EXTERNO':  
135 -// echo '<select name="PEN_TIPO_PROCESSO_EXTERNO" class="input-field" >';  
136 -//  
137 -// echo '<select>';  
138 -// break;  
139 -//  
140 -// case 'PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO':  
141 -// echo '<select name="PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO" class="input-field" >';  
142 -//  
143 -// echo '<select>';  
144 -// break; 153 + case 'PEN_TIPO_PROCESSO_EXTERNO':
  154 + echo '<select name="parametro[PEN_TIPO_PROCESSO_EXTERNO]" class="input-field" >';
  155 + foreach ($arrObjTipoProcedimentoDTO as $procedimento) {
  156 + echo '<option ' . ($parametro->getStrValor() == $procedimento->getNumIdTipoProcedimento() ? 'selected="selected"' : '') . ' value="'.$procedimento->getNumIdTipoProcedimento().'">'.$procedimento->getStrNome().'</option>';
  157 + }
  158 + echo '<select>';
  159 + break;
  160 +
  161 + case 'PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO':
  162 + echo '<select name="parametro[PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO]" class="input-field" >';
  163 + foreach ($arrObjUnidade as $unidade) {
  164 + echo '<option ' . ($parametro->getStrValor() == $unidade->getNumIdUnidade() ? 'selected="selected"' : '') . ' value="'.$unidade->getNumIdUnidade().'">'.$unidade->getStrSigla().'</option>';
  165 + }
  166 + echo '<select>';
  167 + break;
145 168
146 default: 169 default:
147 echo '<input type="text" id="PARAMETRO_'.$parametro->getStrNome().'" name="parametro['.$parametro->getStrNome().']" class="infraText input-field-input" value="'.$objPagina->tratarHTML($parametro->getStrValor()).'" onkeypress="return infraMascaraTexto(this,event);" tabindex="'.$objPagina->getProxTabDados().'" maxlength="100" /><br>'; 170 echo '<input type="text" id="PARAMETRO_'.$parametro->getStrNome().'" name="parametro['.$parametro->getStrNome().']" class="infraText input-field-input" value="'.$objPagina->tratarHTML($parametro->getStrValor()).'" onkeypress="return infraMascaraTexto(this,event);" tabindex="'.$objPagina->getProxTabDados().'" maxlength="100" /><br>';
rn/ExpedirProcedimentoRN.php
@@ -386,7 +386,8 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -386,7 +386,8 @@ class ExpedirProcedimentoRN extends InfraRN {
386 386
387 //TODO: Passar dados do ProcedimentoDTO via parâmetro já carregado anteriormente 387 //TODO: Passar dados do ProcedimentoDTO via parâmetro já carregado anteriormente
388 $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); 388 $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento);
389 - 389 + $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN();
  390 +
390 $objProcesso = new stdClass(); 391 $objProcesso = new stdClass();
391 $objProcesso->protocolo = utf8_encode($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); 392 $objProcesso->protocolo = utf8_encode($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado());
392 $objProcesso->nivelDeSigilo = $this->obterNivelSigiloPEN($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()); 393 $objProcesso->nivelDeSigilo = $this->obterNivelSigiloPEN($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo());
@@ -394,6 +395,10 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -394,6 +395,10 @@ class ExpedirProcedimentoRN extends InfraRN {
394 $objProcesso->descricao = utf8_encode($objProcedimentoDTO->getStrDescricaoProtocolo()); 395 $objProcesso->descricao = utf8_encode($objProcedimentoDTO->getStrDescricaoProtocolo());
395 $objProcesso->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($objProcedimentoDTO->getDtaGeracaoProtocolo()); 396 $objProcesso->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($objProcedimentoDTO->getDtaGeracaoProtocolo());
396 397
  398 + if($this->obterNivelSigiloPEN($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()) == ProtocoloRN::$NA_RESTRITO){
  399 + $objProcesso->hipoteseLegal = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($objProcedimentoDTO->getNumIdHipoteseLegalProtocolo());
  400 + }
  401 +
397 $this->atribuirProdutorProcesso($objProcesso, 402 $this->atribuirProdutorProcesso($objProcesso,
398 $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(), 403 $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(),
399 $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo()); 404 $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo());
@@ -808,7 +813,7 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -808,7 +813,7 @@ class ExpedirProcedimentoRN extends InfraRN {
808 //$protocoloDocumentoDTO = $this->consultarProtocoloDocumento($documeto->getDblIdProcedimento()); 813 //$protocoloDocumentoDTO = $this->consultarProtocoloDocumento($documeto->getDblIdProcedimento());
809 814
810 $documento = new stdClass(); 815 $documento = new stdClass();
811 - 816 + $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN();
812 //TODO: Atribuir das informações abaixo ao documento 817 //TODO: Atribuir das informações abaixo ao documento
813 //<protocoloDoDocumentoAnexado>123</protocoloDoDocumentoAnexado> 818 //<protocoloDoDocumentoAnexado>123</protocoloDoDocumentoAnexado>
814 //<protocoloDoProcessoAnexado>456</protocoloDoProcessoAnexado> 819 //<protocoloDoProcessoAnexado>456</protocoloDoProcessoAnexado>
@@ -843,7 +848,11 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -843,7 +848,11 @@ class ExpedirProcedimentoRN extends InfraRN {
843 $documento->descricao = utf8_encode($strDescricaoDocumento); 848 $documento->descricao = utf8_encode($strDescricaoDocumento);
844 $documento->nivelDeSigilo = $this->obterNivelSigiloPEN($documentoDTO->getStrStaNivelAcessoLocalProtocolo()); 849 $documento->nivelDeSigilo = $this->obterNivelSigiloPEN($documentoDTO->getStrStaNivelAcessoLocalProtocolo());
845 $documento->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($documentoDTO->getDtaGeracaoProtocolo()); 850 $documento->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($documentoDTO->getDtaGeracaoProtocolo());
846 - 851 +
  852 + if($this->obterNivelSigiloPEN($documentoDTO->getStrStaNivelAcessoLocalProtocolo()) == ProtocoloRN::$NA_RESTRITO){
  853 + $documento->hipoteseLegal = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($documentoDTO->getNumIdHipoteseLegalProtocolo());
  854 + }
  855 +
847 $usuarioDTO = $this->consultarUsuario($documentoDTO->getNumIdUsuarioGeradorProtocolo()); 856 $usuarioDTO = $this->consultarUsuario($documentoDTO->getNumIdUsuarioGeradorProtocolo());
848 if(isset($usuarioDTO)) { 857 if(isset($usuarioDTO)) {
849 $documento->produtor = new stdClass(); 858 $documento->produtor = new stdClass();
@@ -1250,6 +1259,7 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -1250,6 +1259,7 @@ class ExpedirProcedimentoRN extends InfraRN {
1250 $objProcedimentoDTO->retDtaGeracaoProtocolo(); 1259 $objProcedimentoDTO->retDtaGeracaoProtocolo();
1251 $objProcedimentoDTO->retStrStaEstadoProtocolo(); 1260 $objProcedimentoDTO->retStrStaEstadoProtocolo();
1252 $objProcedimentoDTO->retDblIdProcedimento(); 1261 $objProcedimentoDTO->retDblIdProcedimento();
  1262 + $objProcedimentoDTO->retNumIdHipoteseLegalProtocolo();
1253 1263
1254 return $this->objProcedimentoRN->consultarRN0201($objProcedimentoDTO); 1264 return $this->objProcedimentoRN->consultarRN0201($objProcedimentoDTO);
1255 } 1265 }
@@ -1341,6 +1351,7 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -1341,6 +1351,7 @@ class ExpedirProcedimentoRN extends InfraRN {
1341 $documentoDTO->retStrNumero(); 1351 $documentoDTO->retStrNumero();
1342 $documentoDTO->retNumIdTipoConferencia(); 1352 $documentoDTO->retNumIdTipoConferencia();
1343 $documentoDTO->retStrStaDocumento(); 1353 $documentoDTO->retStrStaDocumento();
  1354 + $documentoDTO->retNumIdHipoteseLegalProtocolo();
1344 $documentoDTO->setOrdStrProtocoloDocumentoFormatado(InfraDTO::$TIPO_ORDENACAO_ASC); 1355 $documentoDTO->setOrdStrProtocoloDocumentoFormatado(InfraDTO::$TIPO_ORDENACAO_ASC);
1345 1356
1346 return $this->objDocumentoRN->listarRN0008($documentoDTO); 1357 return $this->objDocumentoRN->listarRN0008($documentoDTO);
@@ -1398,6 +1409,7 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -1398,6 +1409,7 @@ class ExpedirProcedimentoRN extends InfraRN {
1398 $documentoDTO->retStrConteudoAssinatura(); 1409 $documentoDTO->retStrConteudoAssinatura();
1399 $documentoDTO->retStrStaDocumento(); 1410 $documentoDTO->retStrStaDocumento();
1400 $documentoDTO->retStrStaEstadoProtocolo(); 1411 $documentoDTO->retStrStaEstadoProtocolo();
  1412 + $documentoDTO->retNumIdHipoteseLegalProtocolo();
1401 //$documentoDTO->retStrNumero(); 1413 //$documentoDTO->retStrNumero();
1402 1414
1403 return $this->objDocumentoRN->consultarRN0005($documentoDTO); 1415 return $this->objDocumentoRN->consultarRN0005($documentoDTO);
@@ -1536,11 +1548,12 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -1536,11 +1548,12 @@ class ExpedirProcedimentoRN extends InfraRN {
1536 } 1548 }
1537 1549
1538 private function validarDadosDocumentos(InfraException $objInfraException, $arrDocumentoDTO, $strAtributoValidacao = null) { 1550 private function validarDadosDocumentos(InfraException $objInfraException, $arrDocumentoDTO, $strAtributoValidacao = null) {
1539 - 1551 +
1540 if(!empty($arrDocumentoDTO)) { 1552 if(!empty($arrDocumentoDTO)) {
1541 1553
1542 $objDocMapDTO = new PenRelTipoDocMapEnviadoDTO(); 1554 $objDocMapDTO = new PenRelTipoDocMapEnviadoDTO();
1543 $objGenericoBD = new GenericoBD($this->inicializarObjInfraIBanco()); 1555 $objGenericoBD = new GenericoBD($this->inicializarObjInfraIBanco());
  1556 + $objPenRelHipoteseLegalEnvioRN = new PenRelHipoteseLegalEnvioRN();
1544 1557
1545 foreach($arrDocumentoDTO as $objDocumentoDTO) { 1558 foreach($arrDocumentoDTO as $objDocumentoDTO) {
1546 1559
@@ -1557,6 +1570,12 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -1557,6 +1570,12 @@ class ExpedirProcedimentoRN extends InfraRN {
1557 1570
1558 $objInfraException->adicionarValidacao($strDescricao, $strAtributoValidacao); 1571 $objInfraException->adicionarValidacao($strDescricao, $strAtributoValidacao);
1559 } 1572 }
  1573 +
  1574 + if (!empty($objDocumentoDTO->getNumIdHipoteseLegalProtocolo())
  1575 + && empty($objPenRelHipoteseLegalEnvioRN->getIdHipoteseLegalPEN($objDocumentoDTO->getNumIdHipoteseLegalProtocolo()))) {
  1576 +
  1577 + $objInfraException->adicionarValidacao('Hipótese Legal do Documento Não Mapeada', $strAtributoValidacao);
  1578 + }
1560 } 1579 }
1561 } 1580 }
1562 } 1581 }
@@ -1586,11 +1605,27 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -1586,11 +1605,27 @@ class ExpedirProcedimentoRN extends InfraRN {
1586 // $objProcedimentoDTO->retStrStaNivelAcessoGlobalProtocolo(); 1605 // $objProcedimentoDTO->retStrStaNivelAcessoGlobalProtocolo();
1587 1606
1588 // $objProcedimentoDTO = $this->objProcedimentoRN->consultarRN0201($objProcedimentoDTO); 1607 // $objProcedimentoDTO = $this->objProcedimentoRN->consultarRN0201($objProcedimentoDTO);
1589 -  
1590 - if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo() != ProtocoloRN::$NA_PUBLICO) {  
1591 - $objInfraException->adicionarValidacao('Não é possível expedir processo com informações restritas ou sigilosas.', $strAtributoValidacao); 1608 +
  1609 + if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo() == ProtocoloRN::$NA_SIGILOSO) {
  1610 + $objInfraException->adicionarValidacao('Não é possível expedir processo com informações sigilosas.', $strAtributoValidacao);
1592 } 1611 }
1593 } 1612 }
  1613 +
  1614 + /**
  1615 + * Valida existência da Hipótese legal de Envio
  1616 + * @param InfraException $objInfraException
  1617 + * @param ProcedimentoDTO $objProcedimentoDTO
  1618 + * @param string $strAtributoValidacao
  1619 + */
  1620 + private function validarHipoteseLegalEnvio(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) {
  1621 + if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo() != ProtocoloRN::$NA_RESTRITO) {
  1622 +
  1623 + if (empty($objProcedimentoDTO->getNumIdHipoteseLegalProtocolo())) {
  1624 + $objInfraException->adicionarValidacao('Não é possível expedir processo de nível restrito sem a hipótese legal mapeada.', $strAtributoValidacao);
  1625 + }
  1626 +
  1627 + }
  1628 + }
1594 1629
1595 private function validarAssinaturas(InfraException $objInfraException, $objProcedimentoDTO, $strAtributoValidacao = null) { 1630 private function validarAssinaturas(InfraException $objInfraException, $objProcedimentoDTO, $strAtributoValidacao = null) {
1596 1631
@@ -1647,6 +1682,7 @@ class ExpedirProcedimentoRN extends InfraRN { @@ -1647,6 +1682,7 @@ class ExpedirProcedimentoRN extends InfraRN {
1647 $this->validarDocumentacaoExistende($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); 1682 $this->validarDocumentacaoExistende($objInfraException, $objProcedimentoDTO, $strAtributoValidacao);
1648 $this->validarProcessoAbertoUnidade($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); 1683 $this->validarProcessoAbertoUnidade($objInfraException, $objProcedimentoDTO, $strAtributoValidacao);
1649 $this->validarNivelAcessoProcesso($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); 1684 $this->validarNivelAcessoProcesso($objInfraException, $objProcedimentoDTO, $strAtributoValidacao);
  1685 + $this->validarHipoteseLegalEnvio($objInfraException, $objProcedimentoDTO, $strAtributoValidacao);
1650 $this->validarAssinaturas($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); 1686 $this->validarAssinaturas($objInfraException, $objProcedimentoDTO, $strAtributoValidacao);
1651 } 1687 }
1652 1688
rn/PenRelHipoteseLegalEnvioRN.php
@@ -25,4 +25,31 @@ class PenRelHipoteseLegalEnvioRN extends PenRelHipoteseLegalRN { @@ -25,4 +25,31 @@ class PenRelHipoteseLegalEnvioRN extends PenRelHipoteseLegalRN {
25 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_envio_excluir', __METHOD__, $objDTO); 25 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_envio_excluir', __METHOD__, $objDTO);
26 return parent::excluirConectado($objDTO); 26 return parent::excluirConectado($objDTO);
27 } 27 }
  28 + public function consultar(PenRelHipoteseLegalDTO $objDTO){
  29 + return parent::consultarConectado($objDTO);
  30 + }
  31 +
  32 + /**
  33 + * Pega o ID hipotese sei para buscar o ID do barramento
  34 + * @param integer $numIdHipoteseSEI
  35 + * @return integer
  36 + */
  37 + public function getIdHipoteseLegalPEN($numIdHipoteseSEI) {
  38 + $objBanco = BancoSEI::getInstance();
  39 + $objGenericoBD = new GenericoBD($objBanco);
  40 +
  41 + // Mapeamento da hipotese legal remota
  42 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  43 + $objPenRelHipoteseLegalDTO->setStrTipo('E');
  44 + $objPenRelHipoteseLegalDTO->retNumIdentificacao();
  45 + $objPenRelHipoteseLegalDTO->setNumIdHipoteseLegal($numIdHipoteseSEI);
  46 +
  47 + $objPenRelHipoteseLegal = $objGenericoBD->consultar($objPenRelHipoteseLegalDTO);
  48 +
  49 + if ($objPenRelHipoteseLegal) {
  50 + return $objPenRelHipoteseLegal->getNumIdentificacao();
  51 + } else {
  52 + return null;
  53 + }
  54 + }
28 } 55 }
rn/PenRelHipoteseLegalRecebidoRN.php
@@ -9,20 +9,58 @@ require_once dirname(__FILE__) . &#39;/../../../SEI.php&#39;; @@ -9,20 +9,58 @@ require_once dirname(__FILE__) . &#39;/../../../SEI.php&#39;;
9 */ 9 */
10 class PenRelHipoteseLegalRecebidoRN extends PenRelHipoteseLegalRN { 10 class PenRelHipoteseLegalRecebidoRN extends PenRelHipoteseLegalRN {
11 11
12 - public function listar(PenRelHipoteseLegalDTO $objDTO){ 12 + public function listar(PenRelHipoteseLegalDTO $objDTO) {
13 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_listar', __METHOD__, $objDTO); 13 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_listar', __METHOD__, $objDTO);
14 return parent::listarConectado($objDTO); 14 return parent::listarConectado($objDTO);
15 } 15 }
16 - public function alterar(PenRelHipoteseLegalDTO $objDTO){ 16 +
  17 + public function alterar(PenRelHipoteseLegalDTO $objDTO) {
17 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_alterar', __METHOD__, $objDTO); 18 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_alterar', __METHOD__, $objDTO);
18 return parent::alterarConectado($objDTO); 19 return parent::alterarConectado($objDTO);
19 } 20 }
20 - public function cadastrar(PenRelHipoteseLegalDTO $objDTO){ 21 +
  22 + public function cadastrar(PenRelHipoteseLegalDTO $objDTO) {
21 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_cadastrar', __METHOD__, $objDTO); 23 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_cadastrar', __METHOD__, $objDTO);
22 return parent::cadastrarConectado($objDTO); 24 return parent::cadastrarConectado($objDTO);
23 } 25 }
24 - public function excluir(PenRelHipoteseLegalDTO $objDTO){ 26 +
  27 + public function excluir(PenRelHipoteseLegalDTO $objDTO) {
25 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_excluir', __METHOD__, $objDTO); 28 SessaoSEI::getInstance()->validarAuditarPermissao('pen_map_hipotese_legal_recebimento_excluir', __METHOD__, $objDTO);
26 return parent::excluirConectado($objDTO); 29 return parent::excluirConectado($objDTO);
27 } 30 }
  31 +
  32 + /**
  33 + * Pega o ID hipotese PEN para buscar o ID do SEI
  34 + * @param integer $numIdentificacao
  35 + * @return integer
  36 + */
  37 + public function getIdHipoteseLegalSEI($numIdentificacao) {
  38 + $objBanco = BancoSEI::getInstance();
  39 + $objGenericoBD = new GenericoBD($objBanco);
  40 +
  41 + $objPenHipoteseLegalDTO = new PenHipoteseLegalDTO();
  42 + $objPenHipoteseLegalDTO->setNumIdentificacao($numIdentificacao);
  43 + $objPenHipoteseLegalDTO->retNumIdHipoteseLegal();
  44 + $objPenHipoteseLegalDTO = $objGenericoBD->consultar($objPenHipoteseLegalDTO);
  45 +
  46 + if ($objPenHipoteseLegalDTO) {
  47 +
  48 + // Mapeamento da hipotese legal remota
  49 + $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
  50 + $objPenRelHipoteseLegalDTO->setStrTipo('R');
  51 + $objPenRelHipoteseLegalDTO->retNumIdHipoteseLegal();
  52 + $objPenRelHipoteseLegalDTO->setNumIdBarramento($objPenHipoteseLegalDTO->getNumIdHipoteseLegal());
  53 +
  54 + $objPenRelHipoteseLegal = $objGenericoBD->consultar($objPenRelHipoteseLegalDTO);
  55 +
  56 + if ($objPenRelHipoteseLegal) {
  57 + return $objPenRelHipoteseLegal->getNumIdHipoteseLegal();
  58 + } else {
  59 + return null;
  60 + }
  61 + } else {
  62 + return null;
  63 + }
  64 + }
  65 +
28 } 66 }
rn/ReceberProcedimentoRN.php
@@ -578,6 +578,18 @@ class ReceberProcedimentoRN extends InfraRN @@ -578,6 +578,18 @@ class ReceberProcedimentoRN extends InfraRN
578 $objProtocoloDTO->setDblIdProtocolo(null); 578 $objProtocoloDTO->setDblIdProtocolo(null);
579 $objProtocoloDTO->setStrDescricao(utf8_decode($objProcesso->descricao)); 579 $objProtocoloDTO->setStrDescricao(utf8_decode($objProcesso->descricao));
580 $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($objProcesso->nivelDeSigilo)); 580 $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($objProcesso->nivelDeSigilo));
  581 +
  582 + if($this->obterNivelSigiloSEI($objProcesso->nivelDeSigilo) == ProtocoloRN::$NA_RESTRITO){
  583 + $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN();
  584 + $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($objProcesso->hipoteseLegal);
  585 + if (empty($numIdHipoteseLegal)) {
  586 + $objPENParametroRN = new PENParametroRN();
  587 + $objProtocoloDTO->setNumIdHipoteseLegal($objPENParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'));
  588 + } else {
  589 + $objProtocoloDTO->setNumIdHipoteseLegal($numIdHipoteseLegal);
  590 + }
  591 + }
  592 +
581 $objProtocoloDTO->setStrProtocoloFormatado(utf8_decode($objProcesso->protocolo)); 593 $objProtocoloDTO->setStrProtocoloFormatado(utf8_decode($objProcesso->protocolo));
582 $objProtocoloDTO->setDtaGeracao($this->objProcessoEletronicoRN->converterDataSEI($objProcesso->dataHoraDeProducao)); 594 $objProtocoloDTO->setDtaGeracao($this->objProcessoEletronicoRN->converterDataSEI($objProcesso->dataHoraDeProducao));
583 $objProtocoloDTO->setArrObjAnexoDTO(array()); 595 $objProtocoloDTO->setArrObjAnexoDTO(array());
@@ -587,6 +599,8 @@ class ReceberProcedimentoRN extends InfraRN @@ -587,6 +599,8 @@ class ReceberProcedimentoRN extends InfraRN
587 $this->atribuirRemetente($objProtocoloDTO, $objRemetente); 599 $this->atribuirRemetente($objProtocoloDTO, $objRemetente);
588 $this->atribuirParticipantes($objProtocoloDTO, $objProcesso->interessado); 600 $this->atribuirParticipantes($objProtocoloDTO, $objProcesso->interessado);
589 601
  602 +
  603 +
590 $strDescricao = sprintf('Tipo de processo no órgão de origem: %s', utf8_decode($objProcesso->processoDeNegocio)).PHP_EOL; 604 $strDescricao = sprintf('Tipo de processo no órgão de origem: %s', utf8_decode($objProcesso->processoDeNegocio)).PHP_EOL;
591 $strDescricao .= $objProcesso->observacao; 605 $strDescricao .= $objProcesso->observacao;
592 606
@@ -1100,7 +1114,18 @@ class ReceberProcedimentoRN extends InfraRN @@ -1100,7 +1114,18 @@ class ReceberProcedimentoRN extends InfraRN
1100 $objDocumentoDTO->getObjProtocoloDTO()->setStrStaGrauSigilo($objTipoProcedimentoDTO->getStrStaGrauSigiloSugestao()); 1114 $objDocumentoDTO->getObjProtocoloDTO()->setStrStaGrauSigilo($objTipoProcedimentoDTO->getStrStaGrauSigiloSugestao());
1101 $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($objTipoProcedimentoDTO->getNumIdHipoteseLegalSugestao()); 1115 $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($objTipoProcedimentoDTO->getNumIdHipoteseLegalSugestao());
1102 } 1116 }
1103 - 1117 +
  1118 + if ($this->obterNivelSigiloSEI($objDocumento->nivelDeSigilo) == ProtocoloRN::$NA_RESTRITO) {
  1119 + $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN();
  1120 + $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($objDocumento->hipoteseLegal);
  1121 + if (empty($numIdHipoteseLegal)) {
  1122 + $objPENParametroRN = new PENParametroRN();
  1123 + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($objPENParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'));
  1124 + } else {
  1125 + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegal);
  1126 + }
  1127 + }
  1128 +
1104 $objDocumentoDTO->getObjProtocoloDTO()->setArrObjParticipanteDTO($this->prepararParticipantes($objDocumentoDTO->getObjProtocoloDTO()->getArrObjParticipanteDTO())); 1129 $objDocumentoDTO->getObjProtocoloDTO()->setArrObjParticipanteDTO($this->prepararParticipantes($objDocumentoDTO->getObjProtocoloDTO()->getArrObjParticipanteDTO()));
1105 1130
1106 $objDocumentoRN = new DocumentoRN(); 1131 $objDocumentoRN = new DocumentoRN();