Commit 7d9fa19dd734705063ecc50d513ddf2268fbef12
1 parent
e31e693e
Exists in
master
and in
8 other branches
[Fixed #96] Impedir recusa de recebimento de processo caso este já esteja aberto no órgão
Showing
4 changed files
with
605 additions
and
657 deletions
Show diff stats
rn/ExpedirProcedimentoRN.php
| ... | ... | @@ -624,16 +624,9 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 624 | 624 | |
| 625 | 625 | public function desbloquearProcessoExpedicao($numIdProcedimento) |
| 626 | 626 | { |
| 627 | - //Intancia o objeto de desbloqueio da API do SEI | |
| 628 | - $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | |
| 629 | - $objEntradaDesbloquearProcessoAPI->setIdProcedimento($numIdProcedimento); | |
| 630 | - | |
| 631 | - //Solicita o Desbloqueio do Processo | |
| 632 | - $objSeiRN = new SeiRN(); | |
| 633 | - $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | |
| 627 | + ProcessoEletronicoRN::desbloquearProcesso($numIdProcedimento); | |
| 634 | 628 | } |
| 635 | 629 | |
| 636 | - | |
| 637 | 630 | public function registrarAndamentoExpedicaoAbortada($dblIdProtocolo) |
| 638 | 631 | { |
| 639 | 632 | //Seta todos os atributos do histrico de aborto da expedio |
| ... | ... | @@ -2209,7 +2202,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2209 | 2202 | $objProtocoloBD = new ProtocoloBD($this->getObjInfraIBanco()); |
| 2210 | 2203 | $objDtoProtocolo = $objProtocoloBD->consultar($objDtoProtocolo); |
| 2211 | 2204 | |
| 2212 | - $this->cancelarTramiteInternoControlado($objDtoProtocolo); | |
| 2205 | + $this->cancelarTramiteInterno($objDtoProtocolo); | |
| 2213 | 2206 | |
| 2214 | 2207 | } |
| 2215 | 2208 | |
| ... | ... | @@ -2254,7 +2247,6 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2254 | 2247 | //Verifica se o trâmite est com o status de iniciado |
| 2255 | 2248 | if ($tramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO) { |
| 2256 | 2249 | $this->objProcessoEletronicoRN->cancelarTramite($tramite->IDT); |
| 2257 | - | |
| 2258 | 2250 | return true; |
| 2259 | 2251 | } |
| 2260 | 2252 | |
| ... | ... | @@ -2293,11 +2285,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2293 | 2285 | } |
| 2294 | 2286 | |
| 2295 | 2287 | //Desbloqueia o processo |
| 2296 | - $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | |
| 2297 | - $objEntradaDesbloquearProcessoAPI->setIdProcedimento($dblIdProcedimento); | |
| 2298 | - | |
| 2299 | - $objSeiRN = new SeiRN(); | |
| 2300 | - $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | |
| 2288 | + ProcessoEletronicoRN::desbloquearProcesso($dblIdProcedimento); | |
| 2301 | 2289 | |
| 2302 | 2290 | $objDTOFiltro = new TramiteDTO(); |
| 2303 | 2291 | $objDTOFiltro->setNumIdTramite($tramite->IDT); | ... | ... |
rn/ProcessarPendenciasRN.php
| ... | ... | @@ -112,9 +112,13 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa |
| 112 | 112 | catch(Exception $e){ |
| 113 | 113 | $this->gravarLogDebug(InfraException::inspecionar($e), 0, true); |
| 114 | 114 | LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); |
| 115 | - $objProcessoEletronicoRN = new ProcessoEletronicoRN(); | |
| 116 | - $strMensagem = ($e instanceof InfraException) ? $e->__toString() : $e->getMessage(); | |
| 117 | - $objProcessoEletronicoRN->recusarTramite($numIdentificacaoTramite, $strMensagem, ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); | |
| 115 | + | |
| 116 | + //Não recusa trâmite caso o processo atual não possa ser desbloqueado, evitando que o processo fique aberto em dois sistemas ao mesmo tempo | |
| 117 | + if($e instanceof InfraException && $e->getObjException() != null && !($e->getObjException() instanceof ProcessoNaoPodeSerDesbloqueadoException)) { | |
| 118 | + $objProcessoEletronicoRN = new ProcessoEletronicoRN(); | |
| 119 | + $strMensagem = ($e instanceof InfraException) ? $e->__toString() : $e->getMessage(); | |
| 120 | + $objProcessoEletronicoRN->recusarTramite($numIdentificacaoTramite, $strMensagem, ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); | |
| 121 | + } | |
| 118 | 122 | } |
| 119 | 123 | }); |
| 120 | 124 | ... | ... |
rn/ProcessoEletronicoRN.php
| 1 | 1 | <?php |
| 2 | + | |
| 3 | + | |
| 4 | +class ProcessoNaoPodeSerDesbloqueadoException extends Exception {} | |
| 5 | + | |
| 2 | 6 | //@TODOJOIN: VERIFICAR SE NÃO EXISTEM TRY CATCH QUE OCULTAM ERROS. CASO EXISTAM CATCH COM EXEPTION DO PHP, RETIRALOS |
| 3 | 7 | class ProcessoEletronicoRN extends InfraRN { |
| 4 | 8 | |
| ... | ... | @@ -1254,15 +1258,8 @@ class ProcessoEletronicoRN extends InfraRN { |
| 1254 | 1258 | * @throws Exception|InfraException |
| 1255 | 1259 | * @return null |
| 1256 | 1260 | */ |
| 1257 | - public function cancelarTramite($idTramite) { | |
| 1258 | - | |
| 1259 | - //@TODOJOIN: Adicionar a seguinte linha abaixo dessa : $parametros->filtroDeConsultaDeTramites = new stdClass() | |
| 1260 | - //Faz a consulta do tramite | |
| 1261 | - //$paramConsultaTramite = new stdClass(); | |
| 1262 | - //$paramConsultaTramite->filtroDeConsultaDeTramites = new stdClass(); | |
| 1263 | - //$paramConsultaTramite->filtroDeConsultaDeTramites->IDT = $idTramite; | |
| 1264 | - //$dadosTramite = $this->getObjPenWs()->consultarTramites($paramConsultaTramite); | |
| 1265 | - | |
| 1261 | + public function cancelarTramite($idTramite) | |
| 1262 | + { | |
| 1266 | 1263 | //Requisita o cancelamento |
| 1267 | 1264 | $parametros = new stdClass(); |
| 1268 | 1265 | $parametros->IDT = $idTramite; |
| ... | ... | @@ -1288,7 +1285,6 @@ class ProcessoEletronicoRN extends InfraRN { |
| 1288 | 1285 | */ |
| 1289 | 1286 | public function recusarTramite($idTramite, $justificativa, $motivo) { |
| 1290 | 1287 | try { |
| 1291 | - | |
| 1292 | 1288 | //@TODOJOIN: Adicionar a seguinte linha abaixo dessa : $parametros->recusaDeTramite = new stdClass() |
| 1293 | 1289 | $parametros = new stdClass(); |
| 1294 | 1290 | $parametros->recusaDeTramite = new stdClass(); |
| ... | ... | @@ -1426,6 +1422,19 @@ class ProcessoEletronicoRN extends InfraRN { |
| 1426 | 1422 | throw new InfraException($mensagem, $e, $detalhes); |
| 1427 | 1423 | } |
| 1428 | 1424 | } |
| 1425 | + | |
| 1426 | + public static function desbloquearProcesso($parDblIdProcedimento) | |
| 1427 | + { | |
| 1428 | + try{ | |
| 1429 | + $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | |
| 1430 | + $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); | |
| 1431 | + | |
| 1432 | + $objSeiRN = new SeiRN(); | |
| 1433 | + $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | |
| 1434 | + } catch (InfraException $e) { | |
| 1435 | + throw new ProcessoNaoPodeSerDesbloqueadoException("Erro ao desbloquear processo", 1, $e); | |
| 1436 | + } | |
| 1437 | + } | |
| 1429 | 1438 | } |
| 1430 | 1439 | |
| 1431 | 1440 | ... | ... |
rn/ReceberProcedimentoRN.php
| ... | ... | @@ -30,7 +30,6 @@ class ReceberProcedimentoRN extends InfraRN |
| 30 | 30 | return $arrObjPendencias; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - | |
| 34 | 33 | protected function receberProcedimentoControlado($parNumIdentificacaoTramite) |
| 35 | 34 | { |
| 36 | 35 | try { |
| ... | ... | @@ -186,6 +185,8 @@ class ReceberProcedimentoRN extends InfraRN |
| 186 | 185 | throw new InfraException("Desconsiderando recebimento do processo devido a situação de trâmite inconsistente: " . $objTramite->situacaoAtual); |
| 187 | 186 | } |
| 188 | 187 | |
| 188 | +//return ; | |
| 189 | + | |
| 189 | 190 | if(count($arrayHashPendentes) > 0){ |
| 190 | 191 | //Obter dados dos componetes digitais |
| 191 | 192 | $this->gravarLogDebug("Iniciando o recebimento dos componentes digitais pendentes", 4); |
| ... | ... | @@ -553,14 +554,12 @@ class ReceberProcedimentoRN extends InfraRN |
| 553 | 554 | $objSeiRN->reabrirProcesso($objEntradaReabrirProcessoAPI); |
| 554 | 555 | } |
| 555 | 556 | |
| 556 | - //Cadastro das atividades para quando o destinatário é desviado pelo receptor (!3!) | |
| 557 | + //Cadastro das atividades para quando o destinatário é desviado pelo receptor (!3!) | |
| 557 | 558 | if ($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura) { |
| 558 | 559 | $this->gerarAndamentoUnidadeReceptora($parDblIdProcedimento); |
| 559 | 560 | } |
| 560 | 561 | |
| 561 | - $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | |
| 562 | - $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); | |
| 563 | - $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | |
| 562 | + ProcessoEletronicoRN::desbloquearProcesso($parDblIdProcedimento); | |
| 564 | 563 | |
| 565 | 564 | //TODO: Obter código da unidade através de mapeamento entre SEI e Barramento |
| 566 | 565 | $objUnidadeDTO = $this->atribuirDadosUnidade($objProcedimentoDTO, $objDestinatario); |
| ... | ... | @@ -616,8 +615,8 @@ class ReceberProcedimentoRN extends InfraRN |
| 616 | 615 | return $numIdUnidade; |
| 617 | 616 | } |
| 618 | 617 | |
| 619 | - private function gerarAndamentoUnidadeReceptora($parNumIdProcedimento) { | |
| 620 | - | |
| 618 | + private function gerarAndamentoUnidadeReceptora($parNumIdProcedimento) | |
| 619 | + { | |
| 621 | 620 | $objUnidadeDTO = new PenUnidadeDTO(); |
| 622 | 621 | $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura); |
| 623 | 622 | $objUnidadeDTO->setStrSinAtivo('S'); |
| ... | ... | @@ -647,8 +646,8 @@ class ReceberProcedimentoRN extends InfraRN |
| 647 | 646 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
| 648 | 647 | } |
| 649 | 648 | |
| 650 | - private function gerarProcedimento($objMetadadosProcedimento, $objProcesso){ | |
| 651 | - | |
| 649 | + private function gerarProcedimento($objMetadadosProcedimento, $objProcesso) | |
| 650 | + { | |
| 652 | 651 | if(!isset($objMetadadosProcedimento)){ |
| 653 | 652 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); |
| 654 | 653 | } |
| ... | ... | @@ -1022,12 +1021,10 @@ class ReceberProcedimentoRN extends InfraRN |
| 1022 | 1021 | return $objUnidadeDTOEnvio; |
| 1023 | 1022 | } |
| 1024 | 1023 | |
| 1025 | - | |
| 1026 | 1024 | //TODO: Grande parte da regra de negócio se baseou em SEIRN:199 - incluirDocumento. |
| 1027 | 1025 | //Avaliar a refatoração para impedir a duplicação de código |
| 1028 | 1026 | private function atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $parObjMetadadosProcedimento) |
| 1029 | 1027 | { |
| 1030 | - | |
| 1031 | 1028 | if(!isset($objProcesso)) { |
| 1032 | 1029 | throw new InfraException('Parâmetro $objProcesso não informado.'); |
| 1033 | 1030 | } |
| ... | ... | @@ -1067,397 +1064,358 @@ class ReceberProcedimentoRN extends InfraRN |
| 1067 | 1064 | $objSeiRN = new SeiRN(); |
| 1068 | 1065 | |
| 1069 | 1066 | $arrObjDocumentoDTO = array(); |
| 1070 | - | |
| 1071 | 1067 | foreach($arrObjDocumentos as $objDocumento){ |
| 1072 | 1068 | |
| 1073 | - // @join_tec US027 (#3498) | |
| 1074 | - if(isset($objDocumento->retirado) && $objDocumento->retirado === true) { | |
| 1075 | - //$strHashConteudo = ProcessoEletronicoRN::getHashFromMetaDados($objDocumento->componenteDigital->hash); | |
| 1076 | - // Caso já esteja cadastrado, de um reenvio anterior, então move para bloqueado | |
| 1077 | - if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)) { | |
| 1069 | + if(isset($objDocumento->retirado) && $objDocumento->retirado === true) { | |
| 1070 | + | |
| 1071 | + if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)) { | |
| 1078 | 1072 | |
| 1079 | 1073 | //Busca o ID do protocolo |
| 1080 | - //$dblIdProtocolo = $arrStrHashConteudo[$strHashConteudo]; | |
| 1081 | - $objComponenteIndexado = $arrObjComponenteDigitalDTOIndexado[$objDocumento->ordem]; | |
| 1082 | - $dblIdProtocolo = $objComponenteIndexado->getDblIdDocumento(); | |
| 1074 | + $objComponenteIndexado = $arrObjComponenteDigitalDTOIndexado[$objDocumento->ordem]; | |
| 1075 | + $dblIdProtocolo = $objComponenteIndexado->getDblIdDocumento(); | |
| 1083 | 1076 | |
| 1084 | 1077 | //Instancia o DTO do protocolo |
| 1085 | - $objProtocoloDTO = new ProtocoloDTO(); | |
| 1086 | - $objProtocoloDTO->setDblIdProtocolo($dblIdProtocolo); | |
| 1087 | - $objProtocoloDTO->retStrStaEstado(); | |
| 1078 | + $objProtocoloDTO = new ProtocoloDTO(); | |
| 1079 | + $objProtocoloDTO->setDblIdProtocolo($dblIdProtocolo); | |
| 1080 | + $objProtocoloDTO->retStrStaEstado(); | |
| 1088 | 1081 | |
| 1089 | - $objProtocoloDTO = $objProtocoloBD->consultar($objProtocoloDTO); | |
| 1082 | + $objProtocoloDTO = $objProtocoloBD->consultar($objProtocoloDTO); | |
| 1090 | 1083 | |
| 1091 | - if($objProtocoloDTO->getStrStaEstado() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | |
| 1092 | - //Instancia o DTO do protocolo | |
| 1093 | - $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI(); | |
| 1094 | - $objEntradaCancelarDocumentoAPI->setIdDocumento($dblIdProtocolo); | |
| 1095 | - $objEntradaCancelarDocumentoAPI->setMotivo('Cancelado pelo remetente'); | |
| 1096 | - | |
| 1097 | - $objSeiRN->cancelarDocumento($objEntradaCancelarDocumentoAPI); | |
| 1084 | + if($objProtocoloDTO->getStrStaEstado() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | |
| 1085 | + $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI(); | |
| 1086 | + $objEntradaCancelarDocumentoAPI->setIdDocumento($dblIdProtocolo); | |
| 1087 | + $objEntradaCancelarDocumentoAPI->setMotivo('Cancelado pelo remetente'); | |
| 1088 | + $objSeiRN->cancelarDocumento($objEntradaCancelarDocumentoAPI); | |
| 1089 | + } | |
| 1098 | 1090 | |
| 1099 | - } | |
| 1100 | - continue; | |
| 1101 | - } | |
| 1102 | - } | |
| 1091 | + continue; | |
| 1092 | + } | |
| 1093 | + } | |
| 1103 | 1094 | |
| 1104 | - if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)){ | |
| 1105 | - $objComponenteDigitalDTO = $arrObjComponenteDigitalDTOIndexado[$objDocumento->ordem]; | |
| 1106 | - $this->alterarMetadadosDocumento($objComponenteDigitalDTO->getDblIdDocumento(), $objDocumento); | |
| 1107 | - continue; | |
| 1108 | - } | |
| 1095 | + if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)){ | |
| 1096 | + $objComponenteDigitalDTO = $arrObjComponenteDigitalDTOIndexado[$objDocumento->ordem]; | |
| 1097 | + $this->alterarMetadadosDocumento($objComponenteDigitalDTO->getDblIdDocumento(), $objDocumento); | |
| 1098 | + $objDocumento->idDocumentoSEI = $objComponenteDigitalDTO->getDblIdDocumento(); | |
| 1099 | + continue; | |
| 1100 | + } | |
| 1109 | 1101 | |
| 1110 | 1102 | //Validação dos dados dos documentos |
| 1111 | - if(!isset($objDocumento->especie)){ | |
| 1112 | - throw new InfraException('Espécie do documento ['.$objDocumento->descricao.'] não informada.'); | |
| 1113 | -} | |
| 1103 | + if(!isset($objDocumento->especie)){ | |
| 1104 | + throw new InfraException('Espécie do documento ['.$objDocumento->descricao.'] não informada.'); | |
| 1105 | + } | |
| 1114 | 1106 | |
| 1115 | -//--------------------------------------------------------------------------------------------------- | |
| 1107 | + $objDocumentoDTO = new DocumentoDTO(); | |
| 1108 | + $objDocumentoDTO->setDblIdDocumento(null); | |
| 1109 | + $objDocumentoDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1116 | 1110 | |
| 1117 | -$objDocumentoDTO = new DocumentoDTO(); | |
| 1118 | -$objDocumentoDTO->setDblIdDocumento(null); | |
| 1119 | -$objDocumentoDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1111 | + $objSerieDTO = $this->obterSerieMapeada($objDocumento->especie->codigo); | |
| 1120 | 1112 | |
| 1121 | -$objSerieDTO = $this->obterSerieMapeada($objDocumento->especie->codigo); | |
| 1113 | + if ($objSerieDTO==null){ | |
| 1114 | + throw new InfraException('Tipo de documento [Espécie '.$objDocumento->especie->codigo.'] não encontrado.'); | |
| 1115 | + } | |
| 1122 | 1116 | |
| 1123 | -if ($objSerieDTO==null){ | |
| 1124 | - throw new InfraException('Tipo de documento [Espécie '.$objDocumento->especie->codigo.'] não encontrado.'); | |
| 1125 | -} | |
| 1117 | + if (InfraString::isBolVazia($objDocumento->dataHoraDeProducao)) { | |
| 1118 | + $objInfraException->lancarValidacao('Data do documento não informada.'); | |
| 1119 | + } | |
| 1126 | 1120 | |
| 1127 | -if (InfraString::isBolVazia($objDocumento->dataHoraDeProducao)) { | |
| 1128 | - $objInfraException->lancarValidacao('Data do documento não informada.'); | |
| 1129 | -} | |
| 1121 | + $objProcedimentoDTO2 = new ProcedimentoDTO(); | |
| 1122 | + $objProcedimentoDTO2->retDblIdProcedimento(); | |
| 1123 | + $objProcedimentoDTO2->retNumIdUsuarioGeradorProtocolo(); | |
| 1124 | + $objProcedimentoDTO2->retNumIdTipoProcedimento(); | |
| 1125 | + $objProcedimentoDTO2->retStrStaNivelAcessoGlobalProtocolo(); | |
| 1126 | + $objProcedimentoDTO2->retStrProtocoloProcedimentoFormatado(); | |
| 1127 | + $objProcedimentoDTO2->retNumIdTipoProcedimento(); | |
| 1128 | + $objProcedimentoDTO2->retStrNomeTipoProcedimento(); | |
| 1129 | + $objProcedimentoDTO2->adicionarCriterio(array('IdProcedimento','ProtocoloProcedimentoFormatado','ProtocoloProcedimentoFormatadoPesquisa'), | |
| 1130 | + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), | |
| 1131 | + array($objDocumentoDTO->getDblIdProcedimento(),$objDocumentoDTO->getDblIdProcedimento(),$objDocumentoDTO->getDblIdProcedimento()), | |
| 1132 | + array(InfraDTO::$OPER_LOGICO_OR,InfraDTO::$OPER_LOGICO_OR)); | |
| 1130 | 1133 | |
| 1131 | -$objProcedimentoDTO2 = new ProcedimentoDTO(); | |
| 1132 | -$objProcedimentoDTO2->retDblIdProcedimento(); | |
| 1133 | -$objProcedimentoDTO2->retNumIdUsuarioGeradorProtocolo(); | |
| 1134 | -$objProcedimentoDTO2->retNumIdTipoProcedimento(); | |
| 1135 | -$objProcedimentoDTO2->retStrStaNivelAcessoGlobalProtocolo(); | |
| 1136 | -$objProcedimentoDTO2->retStrProtocoloProcedimentoFormatado(); | |
| 1137 | -$objProcedimentoDTO2->retNumIdTipoProcedimento(); | |
| 1138 | -$objProcedimentoDTO2->retStrNomeTipoProcedimento(); | |
| 1139 | -$objProcedimentoDTO2->adicionarCriterio(array('IdProcedimento','ProtocoloProcedimentoFormatado','ProtocoloProcedimentoFormatadoPesquisa'), | |
| 1140 | - array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), | |
| 1141 | - array($objDocumentoDTO->getDblIdProcedimento(),$objDocumentoDTO->getDblIdProcedimento(),$objDocumentoDTO->getDblIdProcedimento()), | |
| 1142 | - array(InfraDTO::$OPER_LOGICO_OR,InfraDTO::$OPER_LOGICO_OR)); | |
| 1143 | - | |
| 1144 | -$objProcedimentoRN = new ProcedimentoRN(); | |
| 1145 | -$objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO2); | |
| 1146 | - | |
| 1147 | -if ($objProcedimentoDTO==null){ | |
| 1148 | - throw new InfraException('Processo ['.$objDocumentoDTO->getDblIdProcedimento().'] não encontrado.'); | |
| 1149 | -} | |
| 1134 | + $objProcedimentoRN = new ProcedimentoRN(); | |
| 1135 | + $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO2); | |
| 1150 | 1136 | |
| 1151 | -$objDocumentoDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1152 | -$objDocumentoDTO->setNumIdSerie($objSerieDTO->getNumIdSerie()); | |
| 1153 | -$objDocumentoDTO->setStrNomeSerie($objSerieDTO->getStrNome()); | |
| 1154 | - | |
| 1155 | -$objDocumentoDTO->setDblIdDocumentoEdoc(null); | |
| 1156 | -$objDocumentoDTO->setDblIdDocumentoEdocBase(null); | |
| 1157 | -$objDocumentoDTO->setNumIdUnidadeResponsavel($objUnidadeDTO->getNumIdUnidade()); | |
| 1158 | -$objDocumentoDTO->setNumIdTipoConferencia(null); | |
| 1159 | -$objDocumentoDTO->setStrConteudo(null); | |
| 1160 | -$objDocumentoDTO->setStrStaDocumento(DocumentoRN::$TD_EXTERNO); | |
| 1161 | - // $objDocumentoDTO->setNumVersaoLock(0); | |
| 1162 | - | |
| 1163 | -$objProtocoloDTO = new ProtocoloDTO(); | |
| 1164 | -$objDocumentoDTO->setObjProtocoloDTO($objProtocoloDTO); | |
| 1165 | -$objProtocoloDTO->setDblIdProtocolo(null); | |
| 1166 | -$objProtocoloDTO->setStrStaProtocolo(ProtocoloRN::$TP_DOCUMENTO_RECEBIDO); | |
| 1167 | - | |
| 1168 | -if($objDocumento->descricao != '***'){ | |
| 1169 | - $objProtocoloDTO->setStrDescricao(utf8_decode($objDocumento->descricao)); | |
| 1170 | - $objDocumentoDTO->setStrNumero(utf8_decode($objDocumento->descricao)); | |
| 1171 | -}else{ | |
| 1172 | - $objProtocoloDTO->setStrDescricao(""); | |
| 1173 | - $objDocumentoDTO->setStrNumero(""); | |
| 1174 | -} | |
| 1175 | - //TODO: Avaliar regra de formação do número do documento | |
| 1137 | + if ($objProcedimentoDTO==null){ | |
| 1138 | + throw new InfraException('Processo ['.$objDocumentoDTO->getDblIdProcedimento().'] não encontrado.'); | |
| 1139 | + } | |
| 1176 | 1140 | |
| 1177 | -$objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($objDocumento->nivelDeSigilo)); | |
| 1178 | -$objProtocoloDTO->setDtaGeracao($this->objProcessoEletronicoRN->converterDataSEI($objDocumento->dataHoraDeProducao)); | |
| 1179 | -$objProtocoloDTO->setArrObjAnexoDTO(array()); | |
| 1180 | -$objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO(array()); | |
| 1181 | -$objProtocoloDTO->setArrObjRelProtocoloProtocoloDTO(array()); | |
| 1182 | -$objProtocoloDTO->setArrObjParticipanteDTO(array()); | |
| 1141 | + $objDocumentoDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1142 | + $objDocumentoDTO->setNumIdSerie($objSerieDTO->getNumIdSerie()); | |
| 1143 | + $objDocumentoDTO->setStrNomeSerie($objSerieDTO->getStrNome()); | |
| 1144 | + | |
| 1145 | + $objDocumentoDTO->setDblIdDocumentoEdoc(null); | |
| 1146 | + $objDocumentoDTO->setDblIdDocumentoEdocBase(null); | |
| 1147 | + $objDocumentoDTO->setNumIdUnidadeResponsavel($objUnidadeDTO->getNumIdUnidade()); | |
| 1148 | + $objDocumentoDTO->setNumIdTipoConferencia(null); | |
| 1149 | + $objDocumentoDTO->setStrConteudo(null); | |
| 1150 | + $objDocumentoDTO->setStrStaDocumento(DocumentoRN::$TD_EXTERNO); | |
| 1151 | + | |
| 1152 | + $objProtocoloDTO = new ProtocoloDTO(); | |
| 1153 | + $objDocumentoDTO->setObjProtocoloDTO($objProtocoloDTO); | |
| 1154 | + $objProtocoloDTO->setDblIdProtocolo(null); | |
| 1155 | + $objProtocoloDTO->setStrStaProtocolo(ProtocoloRN::$TP_DOCUMENTO_RECEBIDO); | |
| 1156 | + | |
| 1157 | + if($objDocumento->descricao != '***'){ | |
| 1158 | + $objProtocoloDTO->setStrDescricao(utf8_decode($objDocumento->descricao)); | |
| 1159 | + $objDocumentoDTO->setStrNumero(utf8_decode($objDocumento->descricao)); | |
| 1160 | + }else{ | |
| 1161 | + $objProtocoloDTO->setStrDescricao(""); | |
| 1162 | + $objDocumentoDTO->setStrNumero(""); | |
| 1163 | + } | |
| 1164 | + | |
| 1165 | + //TODO: Avaliar regra de formação do número do documento | |
| 1166 | + $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($objDocumento->nivelDeSigilo)); | |
| 1167 | + $objProtocoloDTO->setDtaGeracao($this->objProcessoEletronicoRN->converterDataSEI($objDocumento->dataHoraDeProducao)); | |
| 1168 | + $objProtocoloDTO->setArrObjAnexoDTO(array()); | |
| 1169 | + $objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO(array()); | |
| 1170 | + $objProtocoloDTO->setArrObjRelProtocoloProtocoloDTO(array()); | |
| 1171 | + $objProtocoloDTO->setArrObjParticipanteDTO(array()); | |
| 1183 | 1172 | |
| 1184 | 1173 | //TODO: Analisar se o modelo de dados do PEN possui destinatários específicos para os documentos |
| 1185 | 1174 | //caso não possua, analisar o repasse de tais informações via parãmetros adicionais |
| 1175 | + $objObservacaoDTO = new ObservacaoDTO(); | |
| 1176 | + $objObservacaoDTO->setStrDescricao("Número SEI do Documento na Origem: ".$objDocumento->produtor->numeroDeIdentificacao); | |
| 1177 | + $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | |
| 1186 | 1178 | |
| 1187 | -$objObservacaoDTO = new ObservacaoDTO(); | |
| 1188 | -$objObservacaoDTO->setStrDescricao("Número SEI do Documento na Origem: ".$objDocumento->produtor->numeroDeIdentificacao); | |
| 1189 | -$objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | |
| 1190 | - | |
| 1191 | - | |
| 1192 | -$bolReabriuAutomaticamente = false; | |
| 1193 | -if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_PUBLICO || $objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_RESTRITO) { | |
| 1194 | - | |
| 1195 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1196 | - $objAtividadeDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); | |
| 1197 | - $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1179 | + $bolReabriuAutomaticamente = false; | |
| 1180 | + if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_PUBLICO || $objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_RESTRITO) { | |
| 1181 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1182 | + $objAtividadeDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); | |
| 1183 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1198 | 1184 | |
| 1199 | 1185 | //TODO: Possivelmente, essa regra é desnecessária já que o processo pode ser enviado para outra unidade do órgão através da expedição |
| 1200 | - $objAtividadeRN = new AtividadeRN(); | |
| 1201 | - if ($objAtividadeRN->contarRN0035($objAtividadeDTO) == 0) { | |
| 1202 | - throw new InfraException('Unidade '.$objUnidadeDTO->getStrSigla().' não possui acesso ao Procedimento '.$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado().'.'); | |
| 1203 | - } | |
| 1204 | - | |
| 1205 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1206 | - $objAtividadeDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); | |
| 1207 | - $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1208 | - $objAtividadeDTO->setDthConclusao(null); | |
| 1209 | - | |
| 1210 | - if ($objAtividadeRN->contarRN0035($objAtividadeDTO) == 0) { | |
| 1211 | - //reabertura automática | |
| 1212 | - $objReabrirProcessoDTO = new ReabrirProcessoDTO(); | |
| 1213 | - $objReabrirProcessoDTO->setDblIdProcedimento($objDocumentoDTO->getDblIdProcedimento()); | |
| 1214 | - $objReabrirProcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1215 | - $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1216 | - $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); | |
| 1217 | - $bolReabriuAutomaticamente = true; | |
| 1218 | - } | |
| 1219 | -} | |
| 1186 | + $objAtividadeRN = new AtividadeRN(); | |
| 1187 | + if ($objAtividadeRN->contarRN0035($objAtividadeDTO) == 0) { | |
| 1188 | + throw new InfraException('Unidade '.$objUnidadeDTO->getStrSigla().' não possui acesso ao Procedimento '.$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado().'.'); | |
| 1189 | + } | |
| 1220 | 1190 | |
| 1221 | - //$objOperacaoServicoDTO = new OperacaoServicoDTO(); | |
| 1222 | - //$this->adicionarCriteriosUnidadeProcessoDocumento ($objOperacaoServicoDTO,$objUnidadeDTO,$objProcedimentoDTO,$objDocumentoDTO); | |
| 1223 | - //$objOperacaoServicoDTO->setNumStaOperacaoServico(OperacaoServicoRN::$TS_INCLUIR_DOCUMENTO); | |
| 1224 | - //$objOperacaoServicoDTO->setNumIdServico($objServicoDTO->getNumIdServico()); | |
| 1225 | - | |
| 1226 | - //$objOperacaoServicoRN = new OperacaoServicoRN(); | |
| 1227 | - //if ($objOperacaoServicoRN->contar($objOperacaoServicoDTO)==0){ | |
| 1228 | - // $objInfraException->lancarValidacao('Nenhuma operação configurada para inclusão de documento do Tipo ['.$objSerieDTO->getStrNome().'] no Tipo de Processo ['.$objProcedimentoDTO->getStrNomeTipoProcedimento().'] na Unidade ['.$objUnidadeDTO->getStrSigla().'] pelo Serviço ['.$objServicoDTO->getStrIdentificacao().'] do Sistema ['.$objServicoDTO->getStrSiglaUsuario().'].'); | |
| 1229 | - //} | |
| 1230 | - | |
| 1231 | -$objTipoProcedimentoDTO = new TipoProcedimentoDTO(); | |
| 1232 | -$objTipoProcedimentoDTO->retStrStaNivelAcessoSugestao(); | |
| 1233 | -$objTipoProcedimentoDTO->retStrStaGrauSigiloSugestao(); | |
| 1234 | -$objTipoProcedimentoDTO->retNumIdHipoteseLegalSugestao(); | |
| 1235 | -$objTipoProcedimentoDTO->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); | |
| 1236 | - | |
| 1237 | -$objTipoProcedimentoRN = new TipoProcedimentoRN(); | |
| 1238 | -$objTipoProcedimentoDTO = $objTipoProcedimentoRN->consultarRN0267($objTipoProcedimentoDTO); | |
| 1239 | - | |
| 1240 | -if (InfraString::isBolVazia($objDocumentoDTO->getObjProtocoloDTO()->getStrStaNivelAcessoLocal()) || $objDocumentoDTO->getObjProtocoloDTO()->getStrStaNivelAcessoLocal()==$objTipoProcedimentoDTO->getStrStaNivelAcessoSugestao()) { | |
| 1241 | - $objDocumentoDTO->getObjProtocoloDTO()->setStrStaNivelAcessoLocal($objTipoProcedimentoDTO->getStrStaNivelAcessoSugestao()); | |
| 1242 | - $objDocumentoDTO->getObjProtocoloDTO()->setStrStaGrauSigilo($objTipoProcedimentoDTO->getStrStaGrauSigiloSugestao()); | |
| 1243 | - $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($objTipoProcedimentoDTO->getNumIdHipoteseLegalSugestao()); | |
| 1244 | -} | |
| 1191 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1192 | + $objAtividadeDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); | |
| 1193 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1194 | + $objAtividadeDTO->setDthConclusao(null); | |
| 1195 | + | |
| 1196 | + if ($objAtividadeRN->contarRN0035($objAtividadeDTO) == 0) { | |
| 1197 | + $objReabrirProcessoDTO = new ReabrirProcessoDTO(); | |
| 1198 | + $objReabrirProcessoDTO->setDblIdProcedimento($objDocumentoDTO->getDblIdProcedimento()); | |
| 1199 | + $objReabrirProcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1200 | + $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1201 | + $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); | |
| 1202 | + $bolReabriuAutomaticamente = true; | |
| 1203 | + } | |
| 1204 | + } | |
| 1245 | 1205 | |
| 1246 | -if ($this->obterNivelSigiloSEI($objDocumento->nivelDeSigilo) == ProtocoloRN::$NA_RESTRITO) { | |
| 1247 | - $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); | |
| 1248 | - $objPenParametroRN = new PenParametroRN(); | |
| 1249 | - $numIdHipoteseLegalPadrao = $objPenParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'); | |
| 1206 | + $objTipoProcedimentoDTO = new TipoProcedimentoDTO(); | |
| 1207 | + $objTipoProcedimentoDTO->retStrStaNivelAcessoSugestao(); | |
| 1208 | + $objTipoProcedimentoDTO->retStrStaGrauSigiloSugestao(); | |
| 1209 | + $objTipoProcedimentoDTO->retNumIdHipoteseLegalSugestao(); | |
| 1210 | + $objTipoProcedimentoDTO->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); | |
| 1250 | 1211 | |
| 1251 | - if (!isset($objDocumento->hipoteseLegal) || (isset($objDocumento->hipoteseLegal) && empty($objDocumento->hipoteseLegal->identificacao))) { | |
| 1252 | - $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); | |
| 1253 | - } else { | |
| 1212 | + $objTipoProcedimentoRN = new TipoProcedimentoRN(); | |
| 1213 | + $objTipoProcedimentoDTO = $objTipoProcedimentoRN->consultarRN0267($objTipoProcedimentoDTO); | |
| 1254 | 1214 | |
| 1255 | - $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($objDocumento->hipoteseLegal->identificacao); | |
| 1256 | - if (empty($numIdHipoteseLegal)) { | |
| 1257 | - $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); | |
| 1258 | - } else { | |
| 1259 | - $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegal); | |
| 1260 | - } | |
| 1261 | - } | |
| 1262 | -} | |
| 1215 | + if (InfraString::isBolVazia($objDocumentoDTO->getObjProtocoloDTO()->getStrStaNivelAcessoLocal()) || $objDocumentoDTO->getObjProtocoloDTO()->getStrStaNivelAcessoLocal()==$objTipoProcedimentoDTO->getStrStaNivelAcessoSugestao()) { | |
| 1216 | + $objDocumentoDTO->getObjProtocoloDTO()->setStrStaNivelAcessoLocal($objTipoProcedimentoDTO->getStrStaNivelAcessoSugestao()); | |
| 1217 | + $objDocumentoDTO->getObjProtocoloDTO()->setStrStaGrauSigilo($objTipoProcedimentoDTO->getStrStaGrauSigiloSugestao()); | |
| 1218 | + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($objTipoProcedimentoDTO->getNumIdHipoteseLegalSugestao()); | |
| 1219 | + } | |
| 1263 | 1220 | |
| 1264 | -$objDocumentoDTO->getObjProtocoloDTO()->setArrObjParticipanteDTO($this->prepararParticipantes($objDocumentoDTO->getObjProtocoloDTO()->getArrObjParticipanteDTO())); | |
| 1221 | + if ($this->obterNivelSigiloSEI($objDocumento->nivelDeSigilo) == ProtocoloRN::$NA_RESTRITO) { | |
| 1222 | + $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); | |
| 1223 | + $objPenParametroRN = new PenParametroRN(); | |
| 1224 | + $numIdHipoteseLegalPadrao = $objPenParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'); | |
| 1265 | 1225 | |
| 1266 | -$objDocumentoRN = new DocumentoRN(); | |
| 1226 | + if (!isset($objDocumento->hipoteseLegal) || (isset($objDocumento->hipoteseLegal) && empty($objDocumento->hipoteseLegal->identificacao))) { | |
| 1227 | + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); | |
| 1228 | + } else { | |
| 1267 | 1229 | |
| 1268 | -$strConteudoCodificado = $objDocumentoDTO->getStrConteudo(); | |
| 1269 | -$objDocumentoDTO->setStrConteudo(null); | |
| 1270 | - //$objDocumentoDTO->setStrSinFormulario('N'); | |
| 1230 | + $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($objDocumento->hipoteseLegal->identificacao); | |
| 1231 | + if (empty($numIdHipoteseLegal)) { | |
| 1232 | + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); | |
| 1233 | + } else { | |
| 1234 | + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegal); | |
| 1235 | + } | |
| 1236 | + } | |
| 1237 | + } | |
| 1271 | 1238 | |
| 1272 | -$objDocumentoDTO->getObjProtocoloDTO()->setNumIdUnidadeGeradora(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1273 | -$objDocumentoDTO->setStrSinBloqueado('S'); | |
| 1239 | + $objDocumentoDTO->getObjProtocoloDTO()->setArrObjParticipanteDTO($this->prepararParticipantes($objDocumentoDTO->getObjProtocoloDTO()->getArrObjParticipanteDTO())); | |
| 1274 | 1240 | |
| 1275 | - //TODO: Fazer a atribuição dos componentes digitais do processo a partir desse ponto | |
| 1276 | -$this->atribuirComponentesDigitais($objDocumentoDTO, $objDocumento->componenteDigital); | |
| 1277 | -$objDocumentoDTOGerado = $objDocumentoRN->cadastrarRN0003($objDocumentoDTO); | |
| 1241 | + $objDocumentoRN = new DocumentoRN(); | |
| 1242 | + $strConteudoCodificado = $objDocumentoDTO->getStrConteudo(); | |
| 1243 | + $objDocumentoDTO->setStrConteudo(null); | |
| 1244 | + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdUnidadeGeradora(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1245 | + $objDocumentoDTO->setStrSinBloqueado('S'); | |
| 1278 | 1246 | |
| 1279 | -$objAtividadeDTOVisualizacao = new AtividadeDTO(); | |
| 1280 | -$objAtividadeDTOVisualizacao->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); | |
| 1281 | -$objAtividadeDTOVisualizacao->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1247 | + //TODO: Fazer a atribuição dos componentes digitais do processo a partir desse ponto | |
| 1248 | + $this->atribuirComponentesDigitais($objDocumentoDTO, $objDocumento->componenteDigital); | |
| 1249 | + $objDocumentoDTOGerado = $objDocumentoRN->cadastrarRN0003($objDocumentoDTO); | |
| 1282 | 1250 | |
| 1283 | -if (!$bolReabriuAutomaticamente){ | |
| 1284 | - $objAtividadeDTOVisualizacao->setNumTipoVisualizacao(AtividadeRN::$TV_ATENCAO); | |
| 1285 | -}else{ | |
| 1286 | - $objAtividadeDTOVisualizacao->setNumTipoVisualizacao(AtividadeRN::$TV_NAO_VISUALIZADO | AtividadeRN::$TV_ATENCAO); | |
| 1287 | -} | |
| 1251 | + $objAtividadeDTOVisualizacao = new AtividadeDTO(); | |
| 1252 | + $objAtividadeDTOVisualizacao->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); | |
| 1253 | + $objAtividadeDTOVisualizacao->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1288 | 1254 | |
| 1289 | -$objAtividadeRN = new AtividadeRN(); | |
| 1290 | -$objAtividadeRN->atualizarVisualizacaoUnidade($objAtividadeDTOVisualizacao); | |
| 1255 | + if (!$bolReabriuAutomaticamente){ | |
| 1256 | + $objAtividadeDTOVisualizacao->setNumTipoVisualizacao(AtividadeRN::$TV_ATENCAO); | |
| 1257 | + }else{ | |
| 1258 | + $objAtividadeDTOVisualizacao->setNumTipoVisualizacao(AtividadeRN::$TV_NAO_VISUALIZADO | AtividadeRN::$TV_ATENCAO); | |
| 1259 | + } | |
| 1291 | 1260 | |
| 1292 | -$objDocumento->idDocumentoSEI = $objDocumentoDTO->getDblIdDocumento(); | |
| 1293 | -$arrObjDocumentoDTO[] = $objDocumentoDTO; | |
| 1261 | + $objAtividadeRN = new AtividadeRN(); | |
| 1262 | + $objAtividadeRN->atualizarVisualizacaoUnidade($objAtividadeDTOVisualizacao); | |
| 1294 | 1263 | |
| 1295 | -if(isset($objDocumento->retirado) && $objDocumento->retirado === true) { | |
| 1296 | - $this->documentosRetirados[] = $objDocumento->idDocumentoSEI; | |
| 1297 | -} | |
| 1264 | + $objDocumento->idDocumentoSEI = $objDocumentoDTO->getDblIdDocumento(); | |
| 1265 | + $arrObjDocumentoDTO[] = $objDocumentoDTO; | |
| 1298 | 1266 | |
| 1299 | -} | |
| 1267 | + if(isset($objDocumento->retirado) && $objDocumento->retirado === true) { | |
| 1268 | + $this->documentosRetirados[] = $objDocumento->idDocumentoSEI; | |
| 1269 | + } | |
| 1270 | + } | |
| 1300 | 1271 | |
| 1301 | -foreach($this->documentosRetirados as $documentoCancelado){ | |
| 1272 | + foreach($this->documentosRetirados as $documentoCancelado){ | |
| 1302 | 1273 | //Instancia o DTO do protocolo |
| 1303 | - $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI(); | |
| 1304 | - $objEntradaCancelarDocumentoAPI->setIdDocumento($documentoCancelado); | |
| 1305 | - $objEntradaCancelarDocumentoAPI->setMotivo('Cancelado pelo remetente'); | |
| 1306 | - $objSeiRN = new SeiRN(); | |
| 1307 | - $objSeiRN->cancelarDocumento($objEntradaCancelarDocumentoAPI); | |
| 1308 | -} | |
| 1309 | - | |
| 1310 | -$objProcedimentoDTO->setArrObjDocumentoDTO($arrObjDocumentoDTO); | |
| 1274 | + $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI(); | |
| 1275 | + $objEntradaCancelarDocumentoAPI->setIdDocumento($documentoCancelado); | |
| 1276 | + $objEntradaCancelarDocumentoAPI->setMotivo('Cancelado pelo remetente'); | |
| 1277 | + $objSeiRN = new SeiRN(); | |
| 1278 | + $objSeiRN->cancelarDocumento($objEntradaCancelarDocumentoAPI); | |
| 1279 | + } | |
| 1311 | 1280 | |
| 1312 | - /* if($numIdUnidadeAtual != $numIdUnidadeGeradora){ | |
| 1313 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $numIdUnidadeAtual); | |
| 1314 | - } */ | |
| 1281 | + $objProcedimentoDTO->setArrObjDocumentoDTO($arrObjDocumentoDTO); | |
| 1315 | 1282 | } |
| 1316 | 1283 | |
| 1317 | 1284 | //TODO: Método deverá poderá ser transferido para a classe responsável por fazer o recebimento dos componentes digitais |
| 1318 | 1285 | private function atribuirComponentesDigitais(DocumentoDTO $parObjDocumentoDTO, $parArrObjComponentesDigitais) |
| 1319 | 1286 | { |
| 1320 | 1287 | if(!isset($parArrObjComponentesDigitais)) { |
| 1321 | - throw new InfraException('Componentes digitais do documento não informado.'); | |
| 1322 | - } | |
| 1288 | + throw new InfraException('Componentes digitais do documento não informado.'); | |
| 1289 | + } | |
| 1323 | 1290 | |
| 1324 | 1291 | //TODO: Aplicar mesmas validações realizadas no momento do upload de um documento InfraPagina::processarUpload |
| 1325 | 1292 | //TODO: Avaliar a refatoração do código abaixo para impedir a duplicação de regras de negócios |
| 1326 | 1293 | |
| 1327 | 1294 | |
| 1328 | - $arrObjAnexoDTO = array(); | |
| 1329 | - if($parObjDocumentoDTO->getObjProtocoloDTO()->isSetArrObjAnexoDTO()) { | |
| 1330 | - $arrObjAnexoDTO = $parObjDocumentoDTO->getObjProtocoloDTO()->getArrObjAnexoDTO(); | |
| 1331 | - } | |
| 1295 | + $arrObjAnexoDTO = array(); | |
| 1296 | + if($parObjDocumentoDTO->getObjProtocoloDTO()->isSetArrObjAnexoDTO()) { | |
| 1297 | + $arrObjAnexoDTO = $parObjDocumentoDTO->getObjProtocoloDTO()->getArrObjAnexoDTO(); | |
| 1298 | + } | |
| 1332 | 1299 | |
| 1333 | - if (!is_array($parArrObjComponentesDigitais)) { | |
| 1334 | - $parArrObjComponentesDigitais = array($parArrObjComponentesDigitais); | |
| 1335 | - } | |
| 1300 | + if (!is_array($parArrObjComponentesDigitais)) { | |
| 1301 | + $parArrObjComponentesDigitais = array($parArrObjComponentesDigitais); | |
| 1302 | + } | |
| 1336 | 1303 | |
| 1337 | 1304 | //TODO: Tratar a ordem dos componentes digitais |
| 1338 | 1305 | //... |
| 1339 | 1306 | |
| 1307 | + $parObjDocumentoDTO->getObjProtocoloDTO()->setArrObjAnexoDTO($arrObjAnexoDTO); | |
| 1308 | + } | |
| 1340 | 1309 | |
| 1341 | - $parObjDocumentoDTO->getObjProtocoloDTO()->setArrObjAnexoDTO($arrObjAnexoDTO); | |
| 1342 | - } | |
| 1343 | - | |
| 1344 | - private function atribuirAssunto(ProtocoloDTO $objProtocoloDTO, $numIdAssunto) | |
| 1345 | - { | |
| 1346 | - //TODO: Removido. Serão utilizados os tipos de procedimento enviados atribuídos ao tipo de processo externo (PEN_TIPO_PROCESSO_EXTERNO) | |
| 1347 | - } | |
| 1348 | 1310 | |
| 1349 | - private function atribuirProcessosApensados(ProcedimentoDTO $objProtocoloDTO, $objProcedimento) | |
| 1350 | - { | |
| 1351 | - if(isset($objProcedimento->processoApensado)) { | |
| 1352 | - if(!is_array($objProcedimento->processoApensado)){ | |
| 1353 | - $objProcedimento->processoApensado = array($objProcedimento->processoApensado); | |
| 1354 | - } | |
| 1311 | + private function atribuirProcessosApensados(ProcedimentoDTO $objProtocoloDTO, $objProcedimento) | |
| 1312 | + { | |
| 1313 | + if(isset($objProcedimento->processoApensado)) { | |
| 1314 | + if(!is_array($objProcedimento->processoApensado)){ | |
| 1315 | + $objProcedimento->processoApensado = array($objProcedimento->processoApensado); | |
| 1316 | + } | |
| 1355 | 1317 | |
| 1356 | - $objProcedimentoDTOApensado = null; | |
| 1357 | - foreach ($objProcedimento->processoApensado as $processoApensado) { | |
| 1358 | - $objProcedimentoDTOApensado = $this->gerarProcedimento($objMetadadosProcedimento, $processoApensado); | |
| 1359 | - $this->relacionarProcedimentos($objProcedimentoDTOPrincipal, $objProcedimentoDTOApensado); | |
| 1360 | - $this->registrarProcedimentoNaoVisualizado($objProcedimentoDTOApensado); | |
| 1318 | + $objProcedimentoDTOApensado = null; | |
| 1319 | + foreach ($objProcedimento->processoApensado as $processoApensado) { | |
| 1320 | + $objProcedimentoDTOApensado = $this->gerarProcedimento($objMetadadosProcedimento, $processoApensado); | |
| 1321 | + $this->relacionarProcedimentos($objProcedimentoDTOPrincipal, $objProcedimentoDTOApensado); | |
| 1322 | + $this->registrarProcedimentoNaoVisualizado($objProcedimentoDTOApensado); | |
| 1323 | + } | |
| 1361 | 1324 | } |
| 1362 | 1325 | } |
| 1363 | -} | |
| 1364 | 1326 | |
| 1365 | 1327 | |
| 1366 | -private function validarDadosDestinatario(InfraException $objInfraException, $objMetadadosProcedimento) | |
| 1367 | -{ | |
| 1368 | - if(isset($objDestinatario)){ | |
| 1369 | - throw new InfraException("Parâmetro $objDestinatario não informado."); | |
| 1370 | - } | |
| 1328 | + private function validarDadosDestinatario(InfraException $objInfraException, $objMetadadosProcedimento) | |
| 1329 | + { | |
| 1330 | + if(isset($objDestinatario)){ | |
| 1331 | + throw new InfraException("Parâmetro $objDestinatario não informado."); | |
| 1332 | + } | |
| 1371 | 1333 | |
| 1372 | - $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; | |
| 1334 | + $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; | |
| 1373 | 1335 | |
| 1374 | - $objPenParametroRN = new PenParametroRN(); | |
| 1375 | - $numIdRepositorioOrigem = $objPenParametroRN->getParametro('PEN_ID_REPOSITORIO_ORIGEM'); | |
| 1376 | - $numIdRepositorioDestinoProcesso = $objDestinatario->identificacaoDoRepositorioDeEstruturas; | |
| 1377 | - $numeroDeIdentificacaoDaEstrutura = $objDestinatario->numeroDeIdentificacaoDaEstrutura; | |
| 1336 | + $objPenParametroRN = new PenParametroRN(); | |
| 1337 | + $numIdRepositorioOrigem = $objPenParametroRN->getParametro('PEN_ID_REPOSITORIO_ORIGEM'); | |
| 1338 | + $numIdRepositorioDestinoProcesso = $objDestinatario->identificacaoDoRepositorioDeEstruturas; | |
| 1339 | + $numeroDeIdentificacaoDaEstrutura = $objDestinatario->numeroDeIdentificacaoDaEstrutura; | |
| 1378 | 1340 | |
| 1379 | 1341 | //Validação do repositório de destino do processo |
| 1380 | - if($numIdRepositorioDestinoProcesso != $numIdRepositorioOrigem){ | |
| 1381 | - $objInfraException->adicionarValidacao("Identificação do repositório de origem do processo [$numIdRepositorioDestinoProcesso] não reconhecida."); | |
| 1382 | - } | |
| 1342 | + if($numIdRepositorioDestinoProcesso != $numIdRepositorioOrigem){ | |
| 1343 | + $objInfraException->adicionarValidacao("Identificação do repositório de origem do processo [$numIdRepositorioDestinoProcesso] não reconhecida."); | |
| 1344 | + } | |
| 1383 | 1345 | |
| 1384 | 1346 | //Validação do unidade de destino do processo |
| 1385 | - $objUnidadeDTO = new PenUnidadeDTO(); | |
| 1386 | - $objUnidadeDTO->setNumIdUnidadeRH($numeroDeIdentificacaoDaEstrutura); | |
| 1387 | - $objUnidadeDTO->setStrSinAtivo('S'); | |
| 1388 | - $objUnidadeDTO->retNumIdUnidade(); | |
| 1347 | + $objUnidadeDTO = new PenUnidadeDTO(); | |
| 1348 | + $objUnidadeDTO->setNumIdUnidadeRH($numeroDeIdentificacaoDaEstrutura); | |
| 1349 | + $objUnidadeDTO->setStrSinAtivo('S'); | |
| 1350 | + $objUnidadeDTO->retNumIdUnidade(); | |
| 1389 | 1351 | |
| 1390 | - $objUnidadeRN = new UnidadeRN(); | |
| 1391 | - $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 1352 | + $objUnidadeRN = new UnidadeRN(); | |
| 1353 | + $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 1392 | 1354 | |
| 1393 | - if(!isset($objUnidadeDTO)){ | |
| 1394 | - $objInfraException->adicionarValidacao("Unidade [Estrutura: {$numeroDeIdentificacaoDaEstrutura}] não configurada para receber processos externos no sistema de destino."); | |
| 1395 | - } | |
| 1396 | -} | |
| 1355 | + if(!isset($objUnidadeDTO)){ | |
| 1356 | + $objInfraException->adicionarValidacao("Unidade [Estrutura: {$numeroDeIdentificacaoDaEstrutura}] não configurada para receber processos externos no sistema de destino."); | |
| 1357 | + } | |
| 1358 | + } | |
| 1397 | 1359 | |
| 1398 | -private function validarDadosRemetente(InfraException $objInfraException, $objMetadadosProcedimento){ | |
| 1360 | + private function validarDadosRemetente(InfraException $objInfraException, $objMetadadosProcedimento){ | |
| 1399 | 1361 | |
| 1400 | -} | |
| 1362 | + } | |
| 1401 | 1363 | |
| 1402 | -private function validarDadosProcesso(InfraException $objInfraException, $objMetadadosProcedimento){ | |
| 1364 | + private function validarDadosProcesso(InfraException $objInfraException, $objMetadadosProcedimento){ | |
| 1403 | 1365 | |
| 1404 | -} | |
| 1366 | + } | |
| 1405 | 1367 | |
| 1406 | -private function validarDadosDocumentos(InfraException $objInfraException, $objMetadadosProcedimento){ | |
| 1368 | + private function validarDadosDocumentos(InfraException $objInfraException, $objMetadadosProcedimento){ | |
| 1407 | 1369 | |
| 1408 | -} | |
| 1370 | + } | |
| 1409 | 1371 | |
| 1410 | -private function obterNivelSigiloSEI($strNivelSigiloPEN) { | |
| 1411 | - switch ($strNivelSigiloPEN) { | |
| 1412 | - | |
| 1413 | - case ProcessoEletronicoRN::$STA_SIGILO_PUBLICO: return ProtocoloRN::$NA_PUBLICO; | |
| 1414 | - break; | |
| 1415 | - case ProcessoEletronicoRN::$STA_SIGILO_RESTRITO: return ProtocoloRN::$NA_RESTRITO; | |
| 1416 | - break; | |
| 1417 | - case ProcessoEletronicoRN::$STA_SIGILO_SIGILOSO: return ProtocoloRN::$NA_SIGILOSO; | |
| 1418 | - break; | |
| 1419 | - default: | |
| 1420 | - break; | |
| 1421 | - } | |
| 1422 | -} | |
| 1372 | + private function obterNivelSigiloSEI($strNivelSigiloPEN) { | |
| 1373 | + switch ($strNivelSigiloPEN) { | |
| 1374 | + | |
| 1375 | + case ProcessoEletronicoRN::$STA_SIGILO_PUBLICO: return ProtocoloRN::$NA_PUBLICO; | |
| 1376 | + break; | |
| 1377 | + case ProcessoEletronicoRN::$STA_SIGILO_RESTRITO: return ProtocoloRN::$NA_RESTRITO; | |
| 1378 | + break; | |
| 1379 | + case ProcessoEletronicoRN::$STA_SIGILO_SIGILOSO: return ProtocoloRN::$NA_SIGILOSO; | |
| 1380 | + break; | |
| 1381 | + default: | |
| 1382 | + break; | |
| 1383 | + } | |
| 1384 | + } | |
| 1423 | 1385 | |
| 1424 | -private function obterHipoteseLegalSEI($parNumIdHipoteseLegalPEN) { | |
| 1386 | + private function obterHipoteseLegalSEI($parNumIdHipoteseLegalPEN) { | |
| 1425 | 1387 | //Atribuí a hipótese legal |
| 1426 | - $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); | |
| 1427 | - $objPenParametroRN = new PenParametroRN(); | |
| 1428 | - $numIdHipoteseLegalPadrao = $objPenParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'); | |
| 1388 | + $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); | |
| 1389 | + $objPenParametroRN = new PenParametroRN(); | |
| 1390 | + $numIdHipoteseLegalPadrao = $objPenParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'); | |
| 1429 | 1391 | |
| 1430 | - $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($parNumIdHipoteseLegalPEN); | |
| 1392 | + $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($parNumIdHipoteseLegalPEN); | |
| 1431 | 1393 | |
| 1432 | - if (empty($numIdHipoteseLegal)) { | |
| 1433 | - return $numIdHipoteseLegalPadrao; | |
| 1434 | - } else { | |
| 1435 | - return $numIdHipoteseLegal; | |
| 1394 | + if (empty($numIdHipoteseLegal)) { | |
| 1395 | + return $numIdHipoteseLegalPadrao; | |
| 1396 | + } else { | |
| 1397 | + return $numIdHipoteseLegal; | |
| 1398 | + } | |
| 1436 | 1399 | } |
| 1437 | -} | |
| 1438 | 1400 | |
| 1439 | 1401 | //TODO: Implementar o mapeamento entre as unidade do SEI e Barramento de Serviços (Secretaria de Saúde: 218794) |
| 1440 | -private function obterUnidadeMapeada($numIdentificacaoDaEstrutura) | |
| 1441 | -{ | |
| 1442 | - $objUnidadeDTO = new PenUnidadeDTO(); | |
| 1443 | - $objUnidadeDTO->setNumIdUnidadeRH($numIdentificacaoDaEstrutura); | |
| 1444 | - $objUnidadeDTO->setStrSinAtivo('S'); | |
| 1445 | - $objUnidadeDTO->retNumIdUnidade(); | |
| 1446 | - $objUnidadeDTO->retNumIdOrgao(); | |
| 1447 | - $objUnidadeDTO->retStrSigla(); | |
| 1448 | - $objUnidadeDTO->retStrDescricao(); | |
| 1449 | - | |
| 1450 | - $objUnidadeRN = new UnidadeRN(); | |
| 1451 | - return $objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 1452 | -} | |
| 1402 | + private function obterUnidadeMapeada($numIdentificacaoDaEstrutura) | |
| 1403 | + { | |
| 1404 | + $objUnidadeDTO = new PenUnidadeDTO(); | |
| 1405 | + $objUnidadeDTO->setNumIdUnidadeRH($numIdentificacaoDaEstrutura); | |
| 1406 | + $objUnidadeDTO->setStrSinAtivo('S'); | |
| 1407 | + $objUnidadeDTO->retNumIdUnidade(); | |
| 1408 | + $objUnidadeDTO->retNumIdOrgao(); | |
| 1409 | + $objUnidadeDTO->retStrSigla(); | |
| 1410 | + $objUnidadeDTO->retStrDescricao(); | |
| 1411 | + | |
| 1412 | + $objUnidadeRN = new UnidadeRN(); | |
| 1413 | + return $objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 1414 | + } | |
| 1453 | 1415 | |
| 1454 | 1416 | |
| 1455 | - /** | |
| 1456 | - * | |
| 1457 | - * @return SerieDTO | |
| 1458 | - */ | |
| 1459 | - private function obterSerieMapeada($numCodigoEspecie) | |
| 1460 | - { | |
| 1417 | + private function obterSerieMapeada($numCodigoEspecie) | |
| 1418 | + { | |
| 1461 | 1419 | $objSerieDTO = null; |
| 1462 | 1420 | |
| 1463 | 1421 | $objMapDTO = new PenRelTipoDocMapRecebidoDTO(); |
| ... | ... | @@ -1468,377 +1426,368 @@ private function obterUnidadeMapeada($numIdentificacaoDaEstrutura) |
| 1468 | 1426 | $objMapDTO = $objGenericoBD->consultar($objMapDTO); |
| 1469 | 1427 | |
| 1470 | 1428 | if(empty($objMapDTO)) { |
| 1471 | - $objMapDTO = new PenRelTipoDocMapRecebidoDTO(); | |
| 1472 | - $objMapDTO->retNumIdSerie(); | |
| 1473 | - $objMapDTO->setStrPadrao('S'); | |
| 1474 | - $objMapDTO->setNumMaxRegistrosRetorno(1); | |
| 1475 | - $objMapDTO = $objGenericoBD->consultar($objMapDTO); | |
| 1476 | - } | |
| 1477 | - | |
| 1478 | - if(!empty($objMapDTO)) { | |
| 1479 | - $objSerieDTO = new SerieDTO(); | |
| 1480 | - $objSerieDTO->retStrNome(); | |
| 1481 | - $objSerieDTO->retNumIdSerie(); | |
| 1482 | - $objSerieDTO->setNumIdSerie($objMapDTO->getNumIdSerie()); | |
| 1483 | - | |
| 1484 | - $objSerieRN = new SerieRN(); | |
| 1485 | - $objSerieDTO = $objSerieRN->consultarRN0644($objSerieDTO); | |
| 1486 | - } | |
| 1487 | - | |
| 1488 | - return $objSerieDTO; | |
| 1489 | - } | |
| 1490 | - | |
| 1491 | - private function relacionarProcedimentos($objProcedimentoDTO1, $objProcedimentoDTO2) | |
| 1492 | - { | |
| 1493 | - if(!isset($objProcedimentoDTO1) || !isset($objProcedimentoDTO1)) { | |
| 1494 | - throw new InfraException('Parâmetro $objProcedimentoDTO não informado.'); | |
| 1495 | - } | |
| 1496 | - | |
| 1497 | - $objRelProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); | |
| 1498 | - $objRelProtocoloProtocoloDTO->setDblIdProtocolo1($objProcedimentoDTO2->getDblIdProcedimento()); | |
| 1499 | - $objRelProtocoloProtocoloDTO->setDblIdProtocolo2($objProcedimentoDTO1->getDblIdProcedimento()); | |
| 1500 | - $objRelProtocoloProtocoloDTO->setStrStaAssociacao(RelProtocoloProtocoloRN::$TA_PROCEDIMENTO_RELACIONADO); | |
| 1501 | - $objRelProtocoloProtocoloDTO->setStrMotivo(self::STR_APENSACAO_PROCEDIMENTOS); | |
| 1502 | - | |
| 1503 | - $objProcedimentoRN = new ProcedimentoRN(); | |
| 1504 | - $objProcedimentoRN->relacionarProcedimentoRN1020($objRelProtocoloProtocoloDTO); | |
| 1505 | -} | |
| 1429 | + $objMapDTO = new PenRelTipoDocMapRecebidoDTO(); | |
| 1430 | + $objMapDTO->retNumIdSerie(); | |
| 1431 | + $objMapDTO->setStrPadrao('S'); | |
| 1432 | + $objMapDTO->setNumMaxRegistrosRetorno(1); | |
| 1433 | + $objMapDTO = $objGenericoBD->consultar($objMapDTO); | |
| 1434 | + } | |
| 1435 | + | |
| 1436 | + if(!empty($objMapDTO)) { | |
| 1437 | + $objSerieDTO = new SerieDTO(); | |
| 1438 | + $objSerieDTO->retStrNome(); | |
| 1439 | + $objSerieDTO->retNumIdSerie(); | |
| 1440 | + $objSerieDTO->setNumIdSerie($objMapDTO->getNumIdSerie()); | |
| 1441 | + | |
| 1442 | + $objSerieRN = new SerieRN(); | |
| 1443 | + $objSerieDTO = $objSerieRN->consultarRN0644($objSerieDTO); | |
| 1444 | + } | |
| 1445 | + | |
| 1446 | + return $objSerieDTO; | |
| 1447 | + } | |
| 1448 | + | |
| 1449 | + private function relacionarProcedimentos($objProcedimentoDTO1, $objProcedimentoDTO2) | |
| 1450 | + { | |
| 1451 | + if(!isset($objProcedimentoDTO1) || !isset($objProcedimentoDTO1)) { | |
| 1452 | + throw new InfraException('Parâmetro $objProcedimentoDTO não informado.'); | |
| 1453 | + } | |
| 1454 | + | |
| 1455 | + $objRelProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); | |
| 1456 | + $objRelProtocoloProtocoloDTO->setDblIdProtocolo1($objProcedimentoDTO2->getDblIdProcedimento()); | |
| 1457 | + $objRelProtocoloProtocoloDTO->setDblIdProtocolo2($objProcedimentoDTO1->getDblIdProcedimento()); | |
| 1458 | + $objRelProtocoloProtocoloDTO->setStrStaAssociacao(RelProtocoloProtocoloRN::$TA_PROCEDIMENTO_RELACIONADO); | |
| 1459 | + $objRelProtocoloProtocoloDTO->setStrMotivo(self::STR_APENSACAO_PROCEDIMENTOS); | |
| 1460 | + | |
| 1461 | + $objProcedimentoRN = new ProcedimentoRN(); | |
| 1462 | + $objProcedimentoRN->relacionarProcedimentoRN1020($objRelProtocoloProtocoloDTO); | |
| 1463 | + } | |
| 1506 | 1464 | |
| 1507 | 1465 | //TODO: Método identico ao localizado na classe SeiRN:2214 |
| 1508 | 1466 | //Refatorar código para evitar problemas de manutenção |
| 1509 | -private function prepararParticipantes($arrObjParticipanteDTO) | |
| 1510 | -{ | |
| 1511 | - $objContatoRN = new ContatoRN(); | |
| 1512 | - $objUsuarioRN = new UsuarioRN(); | |
| 1467 | + private function prepararParticipantes($arrObjParticipanteDTO) | |
| 1468 | + { | |
| 1469 | + $objContatoRN = new ContatoRN(); | |
| 1470 | + $objUsuarioRN = new UsuarioRN(); | |
| 1471 | + | |
| 1472 | + foreach($arrObjParticipanteDTO as $objParticipanteDTO) { | |
| 1513 | 1473 | |
| 1514 | - foreach($arrObjParticipanteDTO as $objParticipanteDTO) { | |
| 1474 | + $objContatoDTO = new ContatoDTO(); | |
| 1475 | + $objContatoDTO->retNumIdContato(); | |
| 1515 | 1476 | |
| 1516 | - $objContatoDTO = new ContatoDTO(); | |
| 1517 | - $objContatoDTO->retNumIdContato(); | |
| 1477 | + if (!InfraString::isBolVazia($objParticipanteDTO->getStrSiglaContato()) && !InfraString::isBolVazia($objParticipanteDTO->getStrNomeContato())) { | |
| 1478 | + $objContatoDTO->setStrSigla($objParticipanteDTO->getStrSiglaContato()); | |
| 1479 | + $objContatoDTO->setStrNome($objParticipanteDTO->getStrNomeContato()); | |
| 1518 | 1480 | |
| 1519 | - if (!InfraString::isBolVazia($objParticipanteDTO->getStrSiglaContato()) && !InfraString::isBolVazia($objParticipanteDTO->getStrNomeContato())) { | |
| 1520 | - $objContatoDTO->setStrSigla($objParticipanteDTO->getStrSiglaContato()); | |
| 1521 | - $objContatoDTO->setStrNome($objParticipanteDTO->getStrNomeContato()); | |
| 1481 | + } else if (!InfraString::isBolVazia($objParticipanteDTO->getStrSiglaContato())) { | |
| 1482 | + $objContatoDTO->setStrSigla($objParticipanteDTO->getStrSiglaContato()); | |
| 1522 | 1483 | |
| 1523 | - } else if (!InfraString::isBolVazia($objParticipanteDTO->getStrSiglaContato())) { | |
| 1524 | - $objContatoDTO->setStrSigla($objParticipanteDTO->getStrSiglaContato()); | |
| 1484 | + } else if (!InfraString::isBolVazia($objParticipanteDTO->getStrNomeContato())) { | |
| 1485 | + $objContatoDTO->setStrNome($objParticipanteDTO->getStrNomeContato()); | |
| 1486 | + } else { | |
| 1487 | + if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_INTERESSADO) { | |
| 1488 | + throw new InfraException('Interessado vazio ou nulo.'); | |
| 1489 | + } | |
| 1490 | + else if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_REMETENTE) { | |
| 1491 | + throw new InfraException('Remetente vazio ou nulo.'); | |
| 1492 | + } | |
| 1493 | + else if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_DESTINATARIO) { | |
| 1494 | + throw new InfraException('Destinatário vazio ou nulo.'); | |
| 1495 | + } | |
| 1496 | + } | |
| 1525 | 1497 | |
| 1526 | - } else if (!InfraString::isBolVazia($objParticipanteDTO->getStrNomeContato())) { | |
| 1527 | - $objContatoDTO->setStrNome($objParticipanteDTO->getStrNomeContato()); | |
| 1528 | - } else { | |
| 1529 | - if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_INTERESSADO) { | |
| 1530 | - throw new InfraException('Interessado vazio ou nulo.'); | |
| 1531 | - } | |
| 1532 | - else if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_REMETENTE) { | |
| 1533 | - throw new InfraException('Remetente vazio ou nulo.'); | |
| 1534 | - } | |
| 1535 | - else if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_DESTINATARIO) { | |
| 1536 | - throw new InfraException('Destinatário vazio ou nulo.'); | |
| 1537 | - } | |
| 1538 | - } | |
| 1498 | + $arrObjContatoDTO = $objContatoRN->listarRN0325($objContatoDTO); | |
| 1499 | + if (count($arrObjContatoDTO)) { | |
| 1500 | + $objContatoDTO = null; | |
| 1539 | 1501 | |
| 1540 | - $arrObjContatoDTO = $objContatoRN->listarRN0325($objContatoDTO); | |
| 1502 | + //preferencia para contatos que representam usuarios | |
| 1503 | + foreach($arrObjContatoDTO as $dto) { | |
| 1504 | + $objUsuarioDTO = new UsuarioDTO(); | |
| 1505 | + $objUsuarioDTO->setBolExclusaoLogica(false); | |
| 1506 | + $objUsuarioDTO->setNumIdContato($dto->getNumIdContato()); | |
| 1507 | + | |
| 1508 | + if ($objUsuarioRN->contarRN0492($objUsuarioDTO)) { | |
| 1509 | + $objContatoDTO = $dto; | |
| 1510 | + break; | |
| 1511 | + } | |
| 1512 | + } | |
| 1541 | 1513 | |
| 1542 | - if (count($arrObjContatoDTO)) { | |
| 1514 | + //nao achou contato de usuario pega o primeiro retornado | |
| 1515 | + if ($objContatoDTO==null) { | |
| 1516 | + $objContatoDTO = $arrObjContatoDTO[0]; | |
| 1517 | + } | |
| 1518 | + } else { | |
| 1519 | + $objContatoDTO = $objContatoRN->cadastrarContextoTemporario($objContatoDTO); | |
| 1520 | + } | |
| 1543 | 1521 | |
| 1544 | - $objContatoDTO = null; | |
| 1522 | + $objParticipanteDTO->setNumIdContato($objContatoDTO->getNumIdContato()); | |
| 1523 | + } | |
| 1545 | 1524 | |
| 1546 | - //preferencia para contatos que representam usuarios | |
| 1547 | - foreach($arrObjContatoDTO as $dto) { | |
| 1525 | + return $arrObjParticipanteDTO; | |
| 1526 | + } | |
| 1548 | 1527 | |
| 1549 | - $objUsuarioDTO = new UsuarioDTO(); | |
| 1550 | - $objUsuarioDTO->setBolExclusaoLogica(false); | |
| 1551 | - $objUsuarioDTO->setNumIdContato($dto->getNumIdContato()); | |
| 1528 | + private function registrarProcedimentoNaoVisualizado(ProcedimentoDTO $parObjProcedimentoDTO) | |
| 1529 | + { | |
| 1530 | + $objAtividadeDTOVisualizacao = new AtividadeDTO(); | |
| 1531 | + $objAtividadeDTOVisualizacao->setDblIdProtocolo($parObjProcedimentoDTO->getDblIdProcedimento()); | |
| 1532 | + $objAtividadeDTOVisualizacao->setNumTipoVisualizacao(AtividadeRN::$TV_NAO_VISUALIZADO); | |
| 1552 | 1533 | |
| 1553 | - if ($objUsuarioRN->contarRN0492($objUsuarioDTO)) { | |
| 1554 | - $objContatoDTO = $dto; | |
| 1555 | - break; | |
| 1534 | + $objAtividadeRN = new AtividadeRN(); | |
| 1535 | + $objAtividadeRN->atualizarVisualizacao($objAtividadeDTOVisualizacao); | |
| 1556 | 1536 | } |
| 1557 | -} | |
| 1558 | 1537 | |
| 1559 | - //nao achou contato de usuario pega o primeiro retornado | |
| 1560 | -if ($objContatoDTO==null) { | |
| 1561 | - $objContatoDTO = $arrObjContatoDTO[0]; | |
| 1562 | -} | |
| 1563 | -} else { | |
| 1564 | - $objContatoDTO = $objContatoRN->cadastrarContextoTemporario($objContatoDTO); | |
| 1565 | -} | |
| 1538 | + private function enviarProcedimentoUnidade(ProcedimentoDTO $parObjProcedimentoDTO, $retransmissao = false) | |
| 1539 | + { | |
| 1540 | + $objAtividadeRN = new PenAtividadeRN(); | |
| 1541 | + $objInfraException = new InfraException(); | |
| 1566 | 1542 | |
| 1567 | -$objParticipanteDTO->setNumIdContato($objContatoDTO->getNumIdContato()); | |
| 1568 | -} | |
| 1543 | + if(!$parObjProcedimentoDTO->isSetArrObjUnidadeDTO() || count($parObjProcedimentoDTO->getArrObjUnidadeDTO()) == 0) { | |
| 1544 | + $objInfraException->lancarValidacao('Unidade de destino do processo não informada.'); | |
| 1545 | + } | |
| 1569 | 1546 | |
| 1570 | -return $arrObjParticipanteDTO; | |
| 1571 | -} | |
| 1547 | + $arrObjUnidadeDTO = $parObjProcedimentoDTO->getArrObjUnidadeDTO(); | |
| 1572 | 1548 | |
| 1573 | -private function registrarProcedimentoNaoVisualizado(ProcedimentoDTO $parObjProcedimentoDTO) | |
| 1574 | -{ | |
| 1575 | - $objAtividadeDTOVisualizacao = new AtividadeDTO(); | |
| 1576 | - $objAtividadeDTOVisualizacao->setDblIdProtocolo($parObjProcedimentoDTO->getDblIdProcedimento()); | |
| 1577 | - $objAtividadeDTOVisualizacao->setNumTipoVisualizacao(AtividadeRN::$TV_NAO_VISUALIZADO); | |
| 1549 | + if(count($parObjProcedimentoDTO->getArrObjUnidadeDTO()) > 1) { | |
| 1550 | + $objInfraException->lancarValidacao('Não permitido a indicação de múltiplas unidades de destino para um processo recebido externamente.'); | |
| 1551 | + } | |
| 1578 | 1552 | |
| 1579 | - $objAtividadeRN = new AtividadeRN(); | |
| 1580 | - $objAtividadeRN->atualizarVisualizacao($objAtividadeDTOVisualizacao); | |
| 1581 | -} | |
| 1553 | + $arrObjUnidadeDTO = array_values($parObjProcedimentoDTO->getArrObjUnidadeDTO()); | |
| 1554 | + $objUnidadeDTO = $arrObjUnidadeDTO[0]; | |
| 1582 | 1555 | |
| 1583 | -private function enviarProcedimentoUnidade(ProcedimentoDTO $parObjProcedimentoDTO, $retransmissao = false) | |
| 1584 | -{ | |
| 1585 | - $objAtividadeRN = new PenAtividadeRN(); | |
| 1586 | - $objInfraException = new InfraException(); | |
| 1587 | - | |
| 1588 | - if(!$parObjProcedimentoDTO->isSetArrObjUnidadeDTO() || count($parObjProcedimentoDTO->getArrObjUnidadeDTO()) == 0) { | |
| 1589 | - $objInfraException->lancarValidacao('Unidade de destino do processo não informada.'); | |
| 1590 | - } | |
| 1591 | - | |
| 1592 | - $arrObjUnidadeDTO = $parObjProcedimentoDTO->getArrObjUnidadeDTO(); | |
| 1593 | - | |
| 1594 | - if(count($parObjProcedimentoDTO->getArrObjUnidadeDTO()) > 1) { | |
| 1595 | - $objInfraException->lancarValidacao('Não permitido a indicação de múltiplas unidades de destino para um processo recebido externamente.'); | |
| 1596 | - } | |
| 1597 | - | |
| 1598 | - $arrObjUnidadeDTO = array_values($parObjProcedimentoDTO->getArrObjUnidadeDTO()); | |
| 1599 | - $objUnidadeDTO = $arrObjUnidadeDTO[0]; | |
| 1600 | - | |
| 1601 | - $objProcedimentoDTO = new ProcedimentoDTO(); | |
| 1602 | - $objProcedimentoDTO->retDblIdProcedimento(); | |
| 1603 | - $objProcedimentoDTO->retNumIdTipoProcedimento(); | |
| 1604 | - $objProcedimentoDTO->retStrProtocoloProcedimentoFormatado(); | |
| 1605 | - $objProcedimentoDTO->retNumIdTipoProcedimento(); | |
| 1606 | - $objProcedimentoDTO->retStrNomeTipoProcedimento(); | |
| 1607 | - $objProcedimentoDTO->retStrStaNivelAcessoGlobalProtocolo(); | |
| 1608 | -// $objProcedimentoDTO->retStrStaEstadoProtocolo(); | |
| 1609 | - $objProcedimentoDTO->setStrProtocoloProcedimentoFormatado($parObjProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); | |
| 1610 | - | |
| 1611 | - $objProcedimentoRN = new ProcedimentoRN(); | |
| 1612 | - $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO); | |
| 1613 | - | |
| 1614 | - if ($objProcedimentoDTO == null || $objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_SIGILOSO) { | |
| 1615 | - $objInfraException->lancarValidacao('Processo ['.$parObjProcedimentoDTO->getStrProtocoloProcedimentoFormatado().'] não encontrado.'); | |
| 1616 | - } | |
| 1617 | - | |
| 1618 | - if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_RESTRITO) { | |
| 1619 | - $objAcessoDTO = new AcessoDTO(); | |
| 1620 | - $objAcessoDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1621 | - $objAcessoDTO->setNumIdUnidade($objUnidadeDTO->getNumIdUnidade()); | |
| 1622 | - | |
| 1623 | - $objAcessoRN = new AcessoRN(); | |
| 1624 | - if ($objAcessoRN->contar($objAcessoDTO)==0) { | |
| 1625 | - // AVALIAR $objInfraException->adicionarValidacao('Unidade ['.$objUnidadeDTO->getStrSigla().'] não possui acesso ao processo ['.$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado().'].'); | |
| 1626 | - } | |
| 1627 | - } | |
| 1628 | - | |
| 1629 | - $objPesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | |
| 1630 | - $objPesquisaPendenciaDTO->setDblIdProtocolo(array($objProcedimentoDTO->getDblIdProcedimento())); | |
| 1631 | - $objPesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1632 | - $objPesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1633 | - | |
| 1634 | - if($retransmissao){ | |
| 1635 | - $objAtividadeRN->setStatusPesquisa(false); | |
| 1556 | + $objProcedimentoDTO = new ProcedimentoDTO(); | |
| 1557 | + $objProcedimentoDTO->retDblIdProcedimento(); | |
| 1558 | + $objProcedimentoDTO->retNumIdTipoProcedimento(); | |
| 1559 | + $objProcedimentoDTO->retStrProtocoloProcedimentoFormatado(); | |
| 1560 | + $objProcedimentoDTO->retNumIdTipoProcedimento(); | |
| 1561 | + $objProcedimentoDTO->retStrNomeTipoProcedimento(); | |
| 1562 | + $objProcedimentoDTO->retStrStaNivelAcessoGlobalProtocolo(); | |
| 1563 | + $objProcedimentoDTO->setStrProtocoloProcedimentoFormatado($parObjProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); | |
| 1636 | 1564 | |
| 1637 | -} | |
| 1565 | + $objProcedimentoRN = new ProcedimentoRN(); | |
| 1566 | + $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO); | |
| 1638 | 1567 | |
| 1639 | -$objAtividadeDTO2 = new AtividadeDTO(); | |
| 1640 | -$objAtividadeDTO2->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1641 | -$objAtividadeDTO2->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1642 | -$objAtividadeDTO2->setDthConclusao(null); | |
| 1568 | + if ($objProcedimentoDTO == null || $objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_SIGILOSO) { | |
| 1569 | + $objInfraException->lancarValidacao('Processo ['.$parObjProcedimentoDTO->getStrProtocoloProcedimentoFormatado().'] não encontrado.'); | |
| 1570 | + } | |
| 1643 | 1571 | |
| 1572 | + if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo()==ProtocoloRN::$NA_RESTRITO) { | |
| 1573 | + $objAcessoDTO = new AcessoDTO(); | |
| 1574 | + $objAcessoDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1575 | + $objAcessoDTO->setNumIdUnidade($objUnidadeDTO->getNumIdUnidade()); | |
| 1644 | 1576 | |
| 1645 | -if ($objAtividadeRN->contarRN0035($objAtividadeDTO2) == 0) { | |
| 1646 | - //reabertura automática | |
| 1647 | - $objReabrirProcessoDTO = new ReabrirProcessoDTO(); | |
| 1648 | - $objReabrirProcessoDTO->setDblIdProcedimento($objAtividadeDTO2->getDblIdProtocolo()); | |
| 1649 | - $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1650 | - $objReabrirProcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1651 | - $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); | |
| 1652 | -} | |
| 1577 | + $objAcessoRN = new AcessoRN(); | |
| 1578 | + if ($objAcessoRN->contar($objAcessoDTO)==0) { | |
| 1579 | + // AVALIAR $objInfraException->adicionarValidacao('Unidade ['.$objUnidadeDTO->getStrSigla().'] não possui acesso ao processo ['.$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado().'].'); | |
| 1580 | + } | |
| 1581 | + } | |
| 1582 | + | |
| 1583 | + $objPesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | |
| 1584 | + $objPesquisaPendenciaDTO->setDblIdProtocolo(array($objProcedimentoDTO->getDblIdProcedimento())); | |
| 1585 | + $objPesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1586 | + $objPesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1587 | + | |
| 1588 | + if($retransmissao){ | |
| 1589 | + $objAtividadeRN->setStatusPesquisa(false); | |
| 1590 | + } | |
| 1591 | + | |
| 1592 | + $objAtividadeDTO2 = new AtividadeDTO(); | |
| 1593 | + $objAtividadeDTO2->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1594 | + $objAtividadeDTO2->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1595 | + $objAtividadeDTO2->setDthConclusao(null); | |
| 1596 | + | |
| 1597 | + if ($objAtividadeRN->contarRN0035($objAtividadeDTO2) == 0) { | |
| 1598 | + //reabertura automática | |
| 1599 | + $objReabrirProcessoDTO = new ReabrirProcessoDTO(); | |
| 1600 | + $objReabrirProcessoDTO->setDblIdProcedimento($objAtividadeDTO2->getDblIdProtocolo()); | |
| 1601 | + $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1602 | + $objReabrirProcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1603 | + $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); | |
| 1604 | + } | |
| 1653 | 1605 | |
| 1654 | 1606 | //$objPenAtividadeRN = new PenAtividadeRN(); |
| 1655 | -$arrObjProcedimentoDTO = $objAtividadeRN->listarPendenciasRN0754($objPesquisaPendenciaDTO); | |
| 1607 | + $arrObjProcedimentoDTO = $objAtividadeRN->listarPendenciasRN0754($objPesquisaPendenciaDTO); | |
| 1656 | 1608 | |
| 1657 | -$objInfraException->lancarValidacoes(); | |
| 1609 | + $objInfraException->lancarValidacoes(); | |
| 1658 | 1610 | |
| 1659 | 1611 | |
| 1660 | -$objEnviarProcessoDTO = new EnviarProcessoDTO(); | |
| 1661 | -$objEnviarProcessoDTO->setArrAtividadesOrigem($arrObjProcedimentoDTO[0]->getArrObjAtividadeDTO()); | |
| 1612 | + $objEnviarProcessoDTO = new EnviarProcessoDTO(); | |
| 1613 | + $objEnviarProcessoDTO->setArrAtividadesOrigem($arrObjProcedimentoDTO[0]->getArrObjAtividadeDTO()); | |
| 1662 | 1614 | |
| 1663 | -$objAtividadeDTO = new AtividadeDTO(); | |
| 1664 | -$objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1665 | -$objAtividadeDTO->setNumIdUsuario(null); | |
| 1666 | -$objAtividadeDTO->setNumIdUsuarioOrigem(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1667 | -$objAtividadeDTO->setNumIdUnidade($objUnidadeDTO->getNumIdUnidade()); | |
| 1668 | -$objAtividadeDTO->setNumIdUnidadeOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1669 | -$objEnviarProcessoDTO->setArrAtividades(array($objAtividadeDTO)); | |
| 1615 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1616 | + $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1617 | + $objAtividadeDTO->setNumIdUsuario(null); | |
| 1618 | + $objAtividadeDTO->setNumIdUsuarioOrigem(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1619 | + $objAtividadeDTO->setNumIdUnidade($objUnidadeDTO->getNumIdUnidade()); | |
| 1620 | + $objAtividadeDTO->setNumIdUnidadeOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1621 | + $objEnviarProcessoDTO->setArrAtividades(array($objAtividadeDTO)); | |
| 1670 | 1622 | |
| 1671 | -$objPenParametroRN = new PenParametroRN(); | |
| 1623 | + $objPenParametroRN = new PenParametroRN(); | |
| 1672 | 1624 | |
| 1673 | -$objEnviarProcessoDTO->setStrSinManterAberto('N'); | |
| 1674 | -$strEnviaEmailNotificacao = $objPenParametroRN->getParametro('PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO'); | |
| 1675 | -$objEnviarProcessoDTO->setStrSinEnviarEmailNotificacao($strEnviaEmailNotificacao); | |
| 1676 | -$objEnviarProcessoDTO->setStrSinRemoverAnotacoes('S'); | |
| 1677 | -$objEnviarProcessoDTO->setDtaPrazo(null); | |
| 1678 | -$objEnviarProcessoDTO->setNumDias(null); | |
| 1679 | -$objEnviarProcessoDTO->setStrSinDiasUteis('N'); | |
| 1625 | + $objEnviarProcessoDTO->setStrSinManterAberto('N'); | |
| 1626 | + $strEnviaEmailNotificacao = $objPenParametroRN->getParametro('PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO'); | |
| 1627 | + $objEnviarProcessoDTO->setStrSinEnviarEmailNotificacao($strEnviaEmailNotificacao); | |
| 1628 | + $objEnviarProcessoDTO->setStrSinRemoverAnotacoes('S'); | |
| 1629 | + $objEnviarProcessoDTO->setDtaPrazo(null); | |
| 1630 | + $objEnviarProcessoDTO->setNumDias(null); | |
| 1631 | + $objEnviarProcessoDTO->setStrSinDiasUteis('N'); | |
| 1680 | 1632 | |
| 1681 | -$objAtividadeRN->enviarRN0023($objEnviarProcessoDTO); | |
| 1633 | + $objAtividadeRN->enviarRN0023($objEnviarProcessoDTO); | |
| 1682 | 1634 | |
| 1683 | -} | |
| 1635 | + } | |
| 1684 | 1636 | |
| 1685 | -/* Essa é a função estática de comparação */ | |
| 1686 | -static function comparacaoOrdemDocumentos($parDocumento1, $parDocumento2) | |
| 1687 | -{ | |
| 1688 | - $numOrdemDocumento1 = strtolower($parDocumento1->ordem); | |
| 1689 | - $numOrdemDocumento2 = strtolower($parDocumento2->ordem); | |
| 1690 | - return $numOrdemDocumento1 - $numOrdemDocumento2; | |
| 1691 | -} | |
| 1637 | + /* Essa é a função estática de comparação */ | |
| 1638 | + static function comparacaoOrdemDocumentos($parDocumento1, $parDocumento2) | |
| 1639 | + { | |
| 1640 | + $numOrdemDocumento1 = strtolower($parDocumento1->ordem); | |
| 1641 | + $numOrdemDocumento2 = strtolower($parDocumento2->ordem); | |
| 1642 | + return $numOrdemDocumento1 - $numOrdemDocumento2; | |
| 1643 | + } | |
| 1692 | 1644 | |
| 1693 | 1645 | |
| 1694 | -protected function receberTramitesRecusadosControlado($parNumIdentificacaoTramite) | |
| 1695 | -{ | |
| 1696 | - try { | |
| 1697 | - if (empty($parNumIdentificacaoTramite)) { | |
| 1698 | - throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); | |
| 1699 | - } | |
| 1646 | + protected function receberTramitesRecusadosControlado($parNumIdentificacaoTramite) | |
| 1647 | + { | |
| 1648 | + try { | |
| 1649 | + if (empty($parNumIdentificacaoTramite)) { | |
| 1650 | + throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); | |
| 1651 | + } | |
| 1700 | 1652 | |
| 1701 | 1653 | //Busca os dados do trâmite no barramento |
| 1702 | - $tramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 1654 | + $tramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 1703 | 1655 | |
| 1704 | - if(!isset($tramite[0])){ | |
| 1705 | - throw new InfraException("Não foi encontrado no PEN o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1706 | - } | |
| 1656 | + if(!isset($tramite[0])){ | |
| 1657 | + throw new InfraException("Não foi encontrado no PEN o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1658 | + } | |
| 1707 | 1659 | |
| 1708 | - $tramite = $tramite[0]; | |
| 1660 | + $tramite = $tramite[0]; | |
| 1661 | + | |
| 1662 | + $objTramiteDTO = new TramiteDTO(); | |
| 1663 | + $objTramiteDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1664 | + $objTramiteDTO->retNumIdUnidade(); | |
| 1665 | + | |
| 1666 | + $objTramiteBD = new TramiteBD(BancoSEI::getInstance()); | |
| 1667 | + $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); | |
| 1668 | + | |
| 1669 | + if(isset($objTramiteDTO)){ | |
| 1670 | + //throw new InfraException("Não foi encontrado no sistema o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1671 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objTramiteDTO->getNumIdUnidade()); | |
| 1672 | + | |
| 1673 | + //Busca os dados do procedimento | |
| 1674 | + $this->gravarLogDebug("Buscando os dados de procedimento com NRE " . $tramite->NRE, 2); | |
| 1675 | + $objProcessoEletronicoDTO = new ProcessoEletronicoDTO(); | |
| 1676 | + $objProcessoEletronicoDTO->setStrNumeroRegistro($tramite->NRE); | |
| 1677 | + $objProcessoEletronicoDTO->retDblIdProcedimento(); | |
| 1678 | + $objProcessoEletronicoBD = new ProcessoEletronicoBD($this->getObjInfraIBanco()); | |
| 1679 | + $objProcessoEletronicoDTO = $objProcessoEletronicoBD->consultar($objProcessoEletronicoDTO); | |
| 1680 | + | |
| 1681 | + //Busca a última atividade de trâmite externo | |
| 1682 | + $this->gravarLogDebug("Buscando última atividade de trâmite externo do processo " . $objProcessoEletronicoDTO->getDblIdProcedimento(), 2); | |
| 1683 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1684 | + $objAtividadeDTO->setDblIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1685 | + $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)); | |
| 1686 | + $objAtividadeDTO->setNumMaxRegistrosRetorno(1); | |
| 1687 | + $objAtividadeDTO->setOrdDthAbertura(InfraDTO::$TIPO_ORDENACAO_DESC); | |
| 1688 | + $objAtividadeDTO->retNumIdAtividade(); | |
| 1689 | + $objAtividadeBD = new AtividadeBD($this->getObjInfraIBanco()); | |
| 1690 | + $objAtividadeDTO = $objAtividadeBD->consultar($objAtividadeDTO); | |
| 1691 | + | |
| 1692 | + //Busca a unidade de destino | |
| 1693 | + $this->gravarLogDebug("Buscando informações sobre a unidade de destino", 2); | |
| 1694 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1695 | + $objAtributoAndamentoDTO->setNumIdAtividade($objAtividadeDTO->getNumIdAtividade()); | |
| 1696 | + $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 1697 | + $objAtributoAndamentoDTO->retStrValor(); | |
| 1698 | + $objAtributoAndamentoBD = new AtributoAndamentoBD($this->getObjInfraIBanco()); | |
| 1699 | + $objAtributoAndamentoDTO = $objAtributoAndamentoBD->consultar($objAtributoAndamentoDTO); | |
| 1700 | + | |
| 1701 | + //Monta o DTO de receber tramite recusado | |
| 1702 | + $this->gravarLogDebug("Preparando recebimento de trâmite " . $parNumIdentificacaoTramite . " recusado", 2); | |
| 1703 | + $objReceberTramiteRecusadoDTO = new ReceberTramiteRecusadoDTO(); | |
| 1704 | + $objReceberTramiteRecusadoDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1705 | + $objReceberTramiteRecusadoDTO->setNumIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1706 | + $objReceberTramiteRecusadoDTO->setNumIdUnidadeOrigem(null); | |
| 1707 | + $objReceberTramiteRecusadoDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO)); | |
| 1708 | + $objReceberTramiteRecusadoDTO->setStrMotivoRecusa(utf8_decode($tramite->justificativaDaRecusa)); | |
| 1709 | + $objReceberTramiteRecusadoDTO->setStrNomeUnidadeDestino($objAtributoAndamentoDTO->getStrValor()); | |
| 1710 | + | |
| 1711 | + //Faz o tratamento do processo e do trâmite recusado | |
| 1712 | + $this->gravarLogDebug("Atualizando dados do processo " . $objProcessoEletronicoDTO->getDblIdProcedimento() ." e do trâmite recusado " . $parNumIdentificacaoTramite, 2); | |
| 1713 | + $this->receberTramiteRecusadoInterno($objReceberTramiteRecusadoDTO); | |
| 1714 | + } | |
| 1709 | 1715 | |
| 1710 | - $objTramiteDTO = new TramiteDTO(); | |
| 1711 | - $objTramiteDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1712 | - $objTramiteDTO->retNumIdUnidade(); | |
| 1716 | + $this->gravarLogDebug("Notificando serviços do PEN sobre ciência da recusa do trâmite " . $parNumIdentificacaoTramite, 4); | |
| 1717 | + $this->objProcessoEletronicoRN->cienciaRecusa($parNumIdentificacaoTramite); | |
| 1713 | 1718 | |
| 1714 | - $objTramiteBD = new TramiteBD(BancoSEI::getInstance()); | |
| 1715 | - $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); | |
| 1719 | + } catch (Exception $e) { | |
| 1720 | + $mensagemErro = InfraException::inspecionar($e); | |
| 1721 | + $this->gravarLogDebug($mensagemErro); | |
| 1722 | + LogSEI::getInstance()->gravar($mensagemErro); | |
| 1723 | + throw $e; | |
| 1724 | + } | |
| 1725 | + } | |
| 1716 | 1726 | |
| 1717 | - if(isset($objTramiteDTO)){ | |
| 1718 | - //throw new InfraException("Não foi encontrado no sistema o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1719 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objTramiteDTO->getNumIdUnidade()); | |
| 1720 | 1727 | |
| 1721 | - //Busca os dados do procedimento | |
| 1722 | - $this->gravarLogDebug("Buscando os dados de procedimento com NRE " . $tramite->NRE, 2); | |
| 1723 | - $objProcessoEletronicoDTO = new ProcessoEletronicoDTO(); | |
| 1724 | - $objProcessoEletronicoDTO->setStrNumeroRegistro($tramite->NRE); | |
| 1725 | - $objProcessoEletronicoDTO->retDblIdProcedimento(); | |
| 1726 | - $objProcessoEletronicoBD = new ProcessoEletronicoBD($this->getObjInfraIBanco()); | |
| 1727 | - $objProcessoEletronicoDTO = $objProcessoEletronicoBD->consultar($objProcessoEletronicoDTO); | |
| 1728 | + protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusadoDTO $objReceberTramiteRecusadoDTO) | |
| 1729 | + { | |
| 1730 | + //Verifica se processo está fechado, reabrindo-o caso necessário | |
| 1731 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1732 | + $objAtividadeDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1733 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1734 | + $objAtividadeDTO->setDthConclusao(null); | |
| 1735 | + $objAtividadeRN = new AtividadeRN(); | |
| 1736 | + if ($objAtividadeRN->contarRN0035($objAtividadeDTO) == 0) { | |
| 1737 | + $this->gravarLogDebug("Reabrindo automaticamente o processo", 4); | |
| 1738 | + $objReabrirProcessoDTO = new ReabrirProcessoDTO(); | |
| 1739 | + $objReabrirProcessoDTO->setDblIdProcedimento($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1740 | + $objReabrirProcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1741 | + $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1742 | + $objProcedimentoRN = new ProcedimentoRN(); | |
| 1743 | + $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); | |
| 1744 | + } | |
| 1728 | 1745 | |
| 1729 | - //Busca a última atividade de trâmite externo | |
| 1730 | - $this->gravarLogDebug("Buscando última atividade de trâmite externo do processo " . $objProcessoEletronicoDTO->getDblIdProcedimento(), 2); | |
| 1731 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1732 | - $objAtividadeDTO->setDblIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1733 | - $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)); | |
| 1734 | - $objAtividadeDTO->setNumMaxRegistrosRetorno(1); | |
| 1735 | - $objAtividadeDTO->setOrdDthAbertura(InfraDTO::$TIPO_ORDENACAO_DESC); | |
| 1736 | - $objAtividadeDTO->retNumIdAtividade(); | |
| 1737 | - $objAtividadeBD = new AtividadeBD($this->getObjInfraIBanco()); | |
| 1738 | - $objAtividadeDTO = $objAtividadeBD->consultar($objAtividadeDTO); | |
| 1739 | - | |
| 1740 | - //Busca a unidade de destino | |
| 1741 | - $this->gravarLogDebug("Buscando informações sobre a unidade de destino", 2); | |
| 1742 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1743 | - $objAtributoAndamentoDTO->setNumIdAtividade($objAtividadeDTO->getNumIdAtividade()); | |
| 1744 | - $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 1745 | - $objAtributoAndamentoDTO->retStrValor(); | |
| 1746 | - $objAtributoAndamentoBD = new AtributoAndamentoBD($this->getObjInfraIBanco()); | |
| 1747 | - $objAtributoAndamentoDTO = $objAtributoAndamentoBD->consultar($objAtributoAndamentoDTO); | |
| 1748 | - | |
| 1749 | - //Monta o DTO de receber tramite recusado | |
| 1750 | - $this->gravarLogDebug("Preparando recebimento de trâmite " . $parNumIdentificacaoTramite . " recusado", 2); | |
| 1751 | - $objReceberTramiteRecusadoDTO = new ReceberTramiteRecusadoDTO(); | |
| 1752 | - $objReceberTramiteRecusadoDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1753 | - $objReceberTramiteRecusadoDTO->setNumIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1754 | - $objReceberTramiteRecusadoDTO->setNumIdUnidadeOrigem(null); | |
| 1755 | - $objReceberTramiteRecusadoDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO)); | |
| 1756 | - $objReceberTramiteRecusadoDTO->setStrMotivoRecusa(utf8_decode($tramite->justificativaDaRecusa)); | |
| 1757 | - $objReceberTramiteRecusadoDTO->setStrNomeUnidadeDestino($objAtributoAndamentoDTO->getStrValor()); | |
| 1758 | - | |
| 1759 | - //Faz o tratamento do processo e do trâmite recusado | |
| 1760 | - $this->gravarLogDebug("Atualizando dados do processo " . $objProcessoEletronicoDTO->getDblIdProcedimento() ." e do trâmite recusado " . $parNumIdentificacaoTramite, 2); | |
| 1761 | - $this->receberTramiteRecusadoInterno($objReceberTramiteRecusadoDTO); | |
| 1746 | + //Realiza o desbloqueio do processo | |
| 1747 | + $this->gravarLogDebug("Realizando o desbloqueio do processo", 4); | |
| 1748 | + $objProtocoloDTO = new ProtocoloDTO(); | |
| 1749 | + $objProtocoloDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1750 | + $objProtocoloDTO->setStrStaEstado(ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO); | |
| 1751 | + $objProtocoloRN = new ProtocoloRN(); | |
| 1752 | + if($objProtocoloRN->contarRN0667($objProtocoloDTO) != 0) { | |
| 1753 | + ProcessoEletronicoRN::desbloquearProcesso($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1754 | + } else { | |
| 1755 | + $this->gravarLogDebug("Processo " . $objReceberTramiteRecusadoDTO->getNumIdProtocolo() . " já se encontra desbloqueado!", 6); | |
| 1762 | 1756 | } |
| 1763 | 1757 | |
| 1764 | - $this->gravarLogDebug("Notificando serviços do PEN sobre ciência da recusa do trâmite " . $parNumIdentificacaoTramite, 4); | |
| 1765 | - $this->objProcessoEletronicoRN->cienciaRecusa($parNumIdentificacaoTramite); | |
| 1758 | + //Adiciona um andamento para o trâmite recusado | |
| 1759 | + $this->gravarLogDebug("Adicionando andamento para registro da recusa do trâmite", 4); | |
| 1760 | + $arrObjAtributoAndamentoDTO = array(); | |
| 1761 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1762 | + $objAtributoAndamentoDTO->setStrNome('MOTIVO'); | |
| 1763 | + $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrMotivoRecusa()); | |
| 1764 | + $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); | |
| 1765 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 1766 | 1766 | |
| 1767 | - } catch (Exception $e) { | |
| 1768 | - $mensagemErro = InfraException::inspecionar($e); | |
| 1769 | - $this->gravarLogDebug($mensagemErro); | |
| 1770 | - LogSEI::getInstance()->gravar($mensagemErro); | |
| 1771 | - throw $e; | |
| 1772 | - } | |
| 1773 | -} | |
| 1767 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1768 | + $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 1769 | + $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrNomeUnidadeDestino()); | |
| 1770 | + $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); | |
| 1771 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 1774 | 1772 | |
| 1773 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1774 | + $objAtividadeDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1775 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1776 | + $objAtividadeDTO->setNumIdTarefa($objReceberTramiteRecusadoDTO->getNumIdTarefa()); | |
| 1777 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | |
| 1775 | 1778 | |
| 1776 | -protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusadoDTO $objReceberTramiteRecusadoDTO) | |
| 1777 | -{ | |
| 1778 | - //Verifica se processo está fechado, reabrindo-o caso necessário | |
| 1779 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1780 | - $objAtividadeDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1781 | - $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1782 | - $objAtividadeDTO->setDthConclusao(null); | |
| 1783 | - $objAtividadeRN = new AtividadeRN(); | |
| 1784 | - if ($objAtividadeRN->contarRN0035($objAtividadeDTO) == 0) { | |
| 1785 | - $this->gravarLogDebug("Reabrindo automaticamente o processo", 4); | |
| 1786 | - $objReabrirProcessoDTO = new ReabrirProcessoDTO(); | |
| 1787 | - $objReabrirProcessoDTO->setDblIdProcedimento($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1788 | - $objReabrirProcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1789 | - $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 1790 | - $objProcedimentoRN = new ProcedimentoRN(); | |
| 1791 | - $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); | |
| 1792 | - } | |
| 1779 | + $objAtividadeRN = new AtividadeRN(); | |
| 1780 | + $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | |
| 1793 | 1781 | |
| 1794 | - //Realiza o desbloqueio do processo | |
| 1795 | - $this->gravarLogDebug("Realizando o desbloqueio do processo", 4); | |
| 1796 | - $objProtocoloDTO = new ProtocoloDTO(); | |
| 1797 | - $objProtocoloDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1798 | - $objProtocoloDTO->setStrStaEstado(ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO); | |
| 1799 | - $objProtocoloRN = new ProtocoloRN(); | |
| 1800 | - if($objProtocoloRN->contarRN0667($objProtocoloDTO) != 0) { | |
| 1801 | - $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | |
| 1802 | - $objEntradaDesbloquearProcessoAPI->setIdProcedimento($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1803 | - $objSeiRN = new SeiRN(); | |
| 1804 | - $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | |
| 1805 | - } else { | |
| 1806 | - $this->gravarLogDebug("Processo " . $objReceberTramiteRecusadoDTO->getNumIdProtocolo() . " já se encontra desbloqueado!", 6); | |
| 1782 | + //Sinaliza na PenProtocolo que o processo obteve recusa | |
| 1783 | + $this->gravarLogDebug("Atualizando protocolo sobre obtenção da ciência de recusa", 4); | |
| 1784 | + $objProtocolo = new PenProtocoloDTO(); | |
| 1785 | + $objProtocolo->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1786 | + $objProtocolo->setStrSinObteveRecusa('S'); | |
| 1787 | + $objProtocoloBD = new ProtocoloBD($this->getObjInfraIBanco()); | |
| 1788 | + $objProtocoloBD->alterar($objProtocolo); | |
| 1807 | 1789 | } |
| 1808 | 1790 | |
| 1809 | - //Adiciona um andamento para o trâmite recusado | |
| 1810 | - $this->gravarLogDebug("Adicionando andamento para registro da recusa do trâmite", 4); | |
| 1811 | - $arrObjAtributoAndamentoDTO = array(); | |
| 1812 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1813 | - $objAtributoAndamentoDTO->setStrNome('MOTIVO'); | |
| 1814 | - $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrMotivoRecusa()); | |
| 1815 | - $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); | |
| 1816 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 1817 | - | |
| 1818 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1819 | - $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 1820 | - $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrNomeUnidadeDestino()); | |
| 1821 | - $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); | |
| 1822 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 1823 | - | |
| 1824 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1825 | - $objAtividadeDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1826 | - $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1827 | - $objAtividadeDTO->setNumIdTarefa($objReceberTramiteRecusadoDTO->getNumIdTarefa()); | |
| 1828 | - $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | |
| 1829 | - | |
| 1830 | - $objAtividadeRN = new AtividadeRN(); | |
| 1831 | - $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | |
| 1832 | - | |
| 1833 | - //Sinaliza na PenProtocolo que o processo obteve recusa | |
| 1834 | - $this->gravarLogDebug("Atualizando protocolo sobre obtenção da ciência de recusa", 4); | |
| 1835 | - $objProtocolo = new PenProtocoloDTO(); | |
| 1836 | - $objProtocolo->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1837 | - $objProtocolo->setStrSinObteveRecusa('S'); | |
| 1838 | - $objProtocoloBD = new ProtocoloBD($this->getObjInfraIBanco()); | |
| 1839 | - $objProtocoloBD->alterar($objProtocolo); | |
| 1840 | -} | |
| 1841 | - | |
| 1842 | 1791 | |
| 1843 | 1792 | /** |
| 1844 | 1793 | * Método que realiza a validação da extensão dos componentes digitais a serem recebidos |
| ... | ... | @@ -1875,8 +1824,6 @@ protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusad |
| 1875 | 1824 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'Componentes digitais com formato inválido no destinatário. ', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_FORMATO); |
| 1876 | 1825 | throw new InfraException("Processo recusado devido a existência de documento em formato {$extDocumento} não permitido pelo sistema. "); |
| 1877 | 1826 | } |
| 1878 | - | |
| 1879 | - | |
| 1880 | 1827 | } |
| 1881 | 1828 | } |
| 1882 | 1829 | ... | ... |