Skip to content

Commit

Permalink
feat: critica para hipotese legal
Browse files Browse the repository at this point in the history
Criatica para não desativar ou excluir hipotese legal vinculada ao tramita
  • Loading branch information
Mauro Costa committed Jun 13, 2024
1 parent 3b76c5f commit d4f0877
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/PENIntegracao.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ public function montarBotaoProcesso(ProcedimentoAPI $objSeiIntegracaoDTO)

public function excluirHipoteseLegal($arrObjHipoteseLegalDTO)
{
$this->validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalDTO);
$this->validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalDTO, 'exclusão');
}

public function desativarHipoteseLegal($arrObjHipoteseLegalDTO)
{
$this->validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalDTO);
$this->validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalDTO, 'inativação');
}

public function validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalAPI)
public function validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalAPI, $strAcao)
{
$excecao = new InfraException();
foreach ($arrObjHipoteseLegalAPI as $objHipoteseLegalAPI) {
Expand All @@ -206,7 +206,11 @@ public function validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalAPI)

$objPenHipoteseLegalRN = new PenHipoteseLegalRN();
$objPenHipoteseLegalDTO = $objPenHipoteseLegalRN->consultar($objPenHipoteseLegalDTO);
$excecao->lancarValidacao('Não é permitido excluir ou desativar a hipotese legal "' . $objPenHipoteseLegalDTO->getStrNome() . '"');
$nome = $objPenHipoteseLegalDTO->getStrNome();
$excecao->lancarValidacao($this->getNome().":
A $strAcao da hipótese legal $nome não é permitida.
A referida hipótese legal está relacionada a uma hipótese legal do Tramita."
);
}
}
}
Expand Down

0 comments on commit d4f0877

Please sign in to comment.