From a382534b63b4084a45fc9be61190ba121feec662 Mon Sep 17 00:00:00 2001 From: Michael de Oliveira Ferreira Date: Thu, 17 Aug 2023 09:19:54 -0300 Subject: [PATCH] feature: validar remocao hipotese legal --- src/PENIntegracao.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/PENIntegracao.php b/src/PENIntegracao.php index eff735d8b..1e59f1d55 100755 --- a/src/PENIntegracao.php +++ b/src/PENIntegracao.php @@ -79,6 +79,39 @@ public function montarBotaoControleProcessos() { return array($strAcoesProcedimento); } + public function excluirHipoteseLegal($arrObjHipoteseLegalDTO) { + $this->validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalDTO); + } + + public function desativarHipoteseLegal($arrObjHipoteseLegalDTO) { + $this->validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalDTO); + } + + public function validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalAPI) + { + $excecao = new InfraException(); + foreach ($arrObjHipoteseLegalAPI as $objHipoteseLegalAPI) { + $objPenHipoteseLegalDTO = new PenHipoteseLegalDTO(); + $objPenHipoteseLegalDTO->setNumIdHipoteseLegal($objHipoteseLegalAPI->getNumIdHipoteseLegal()); + $objPenHipoteseLegalDTO->retNumIdHipoteseLegal(); + $objPenHipoteseLegalDTO->retStrNome(); + + $objPenHipoteseLegalRN = new PenHipoteseLegalRN(); + $objPenHipoteseLegalDTO = $objPenHipoteseLegalRN->consultar($objPenHipoteseLegalDTO); + if (!is_null($objPenHipoteseLegalDTO)) { + $excecao->lancarValidacao('Não é permitido excluir ou desativar a hipotese legal "' . $objPenHipoteseLegalDTO->getStrNome() . '"'); + } + } + } + + public function desativarUnidade($arrObjUnidadeAPI) { + $this->validarExcluirDesativarUnidade($arrObjUnidadeAPI); + } + + public function excluirUnidade($arrObjUnidadeAPI) { + $this->validarExcluirDesativarUnidade($arrObjUnidadeAPI); + } + public function montarBotaoProcesso(ProcedimentoAPI $objSeiIntegracaoDTO) { $objProcedimentoDTO = new ProcedimentoDTO();