Skip to content

Commit

Permalink
Fix/processo em bloco bloqueado (#586)
Browse files Browse the repository at this point in the history
* fix: correção de atualização de estatus e processo incliudo no bloco bloqueado

* fix: correção de atualização de agendamentos

* fix: correções para bloco processo

* fix: correções para bloco processo

* fix: processo aberto em outras unidades

---------

Co-authored-by: Mauro Costa <[email protected]>
  • Loading branch information
Mauro1706 and Mauro Costa authored Aug 19, 2024
1 parent 12237b9 commit f6ea38e
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 16 deletions.
16 changes: 16 additions & 0 deletions src/pen_tramite_processo_em_bloco_cadastrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@
exit(0);
}

$objInfraException = new InfraException();
$objExpedirProcedimentosRN = new ExpedirProcedimentoRN();
$objExpedirProcedimentosRN->verificarProcessosAbertoNaUnidade($objInfraException, $arrProtocolosOrigemProtocolo);
$mensagemDeErro = $objExpedirProcedimentosRN->trazerTextoSeContemValidacoes($objInfraException);
if (!is_null($mensagemDeErro)) {
$objPaginaSEI->adicionarMensagem($mensagemDeErro, InfraPagina::$TIPO_MSG_ERRO);
break;
}

$objExpedirProcedimentosRN->validarProcessoAbertoEmOutraUnidade($objInfraException, $arrProtocolosOrigemProtocolo);
$mensagemDeErro = $objExpedirProcedimentosRN->trazerTextoSeContemValidacoes($objInfraException);
if (!is_null($mensagemDeErro)) {
$objPaginaSEI->adicionarMensagem($mensagemDeErro, InfraPagina::$TIPO_MSG_ERRO);
break;
}

foreach ($arrProtocolosOrigemProtocolo as $idItensSelecionados) {
$objPenBlocoProcessoDTO = new PenBlocoProcessoDTO();
$objPenBlocoProcessoDTO->setDblIdProtocolo($idItensSelecionados);
Expand Down
29 changes: 13 additions & 16 deletions src/pen_validar_expedir_lote.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@
$objInfraException->adicionarValidacao('Informe Unidade de destino', $strProtocoloFormatado);
}

if(!$objInfraException->contemValidacoes()) {
$objProcedimentoDTO->setArrObjDocumentoDTO($objExpedirProcedimentosRN->listarDocumentos($dblIdProcedimento));
$objProcedimentoDTO->setArrObjParticipanteDTO($objExpedirProcedimentosRN->listarInteressados($dblIdProcedimento));
$objExpedirProcedimentosRN->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO, $strProtocoloFormatado);
}
$objProcedimentoDTO->setArrObjDocumentoDTO($objExpedirProcedimentosRN->listarDocumentos($dblIdProcedimento));
$objProcedimentoDTO->setArrObjParticipanteDTO($objExpedirProcedimentosRN->listarInteressados($dblIdProcedimento));
$objExpedirProcedimentosRN->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO);
}
}
catch(\InfraException $e) {
Expand All @@ -71,21 +69,20 @@
LogSEI::getInstance()->gravar($strmensagemErro);
}

if($objInfraException->contemValidacoes()) {
if ($objInfraException->contemValidacoes()) {

$arrErros = array();
foreach($objInfraException->getArrObjInfraValidacao() as $objInfraValidacao) {
$strAtributo = $objInfraValidacao->getStrAtributo();
if(!array_key_exists($strAtributo, $arrErros)){
$arrErros[$strAtributo] = array();
$arrErros = array();
foreach ($objInfraException->getArrObjInfraValidacao() as $objInfraValidacao) {
$strAtributo = $objInfraValidacao->getStrAtributo();
if (!array_key_exists($strAtributo, $arrErros)) {
$arrErros[$strAtributo] = array();
}
$arrErros[$strAtributo][] = utf8_encode($objInfraValidacao->getStrDescricao());
$arrErros[$strAtributo][] = utf8_encode($objInfraValidacao->getStrDescricao());
}

$arrResponse['erros'] = $arrErros;
}
else {
$arrResponse['sucesso'] = true;
$arrResponse['erros'] = $arrErros;
} else {
$arrResponse['sucesso'] = true;
}

print json_encode($arrResponse);
Expand Down
39 changes: 39 additions & 0 deletions src/rn/ExpedirProcedimentoRN.php
Original file line number Diff line number Diff line change
Expand Up @@ -2646,6 +2646,45 @@ public function verificarProcessosAbertoNaUnidade(InfraException $objInfraExcept
}
}

public function validarProcessoAbertoEmOutraUnidade($objInfraException, $arrProtocolosOrigem)
{
foreach ($arrProtocolosOrigem as $dblIdProcedimento) {

$objExpedirProcedimentosRN = new ExpedirProcedimentoRN();
$objProcedimentoDTO = $objExpedirProcedimentosRN->consultarProcedimento($dblIdProcedimento);

$strProtocoloFormatado = $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado();

if (empty($objProcedimentoDTO)) {
throw new InfraException('Procedimento ' . $strProtocoloFormatado . ' não foi localizado', 'Desconhecido');
}

$objProcedimentoDTO->setArrObjDocumentoDTO($objExpedirProcedimentosRN->listarDocumentos($dblIdProcedimento));
$objProcedimentoDTO->setArrObjParticipanteDTO($objExpedirProcedimentosRN->listarInteressados($dblIdProcedimento));
$objExpedirProcedimentosRN->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO);
}
}

public function trazerTextoSeContemValidacoes($objInfraException)
{
if ($objInfraException->contemValidacoes()) {
$arrErros = array();
$message = "";
foreach ($objInfraException->getArrObjInfraValidacao() as $objInfraValidacao) {
$strAtributo = $objInfraValidacao->getStrAtributo();
if (!array_key_exists($strAtributo, $arrErros)) {
$arrErros[$strAtributo] = array();
}
$arrErros[$strAtributo][] = utf8_encode($objInfraValidacao->getStrDescricao());
$message .= $objInfraValidacao->getStrDescricao() . "\n";
}

return $message;
}

return null;
}

private function obterNivelSigiloPEN($strNivelSigilo)
{
switch ($strNivelSigilo) {
Expand Down

0 comments on commit f6ea38e

Please sign in to comment.