Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

348 criar críticas para impedir desativar ou excluir tipos de hipoteses legais #519

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/PENIntegracao.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,47 @@ public function montarBotaoProcesso(ProcedimentoAPI $objSeiIntegracaoDTO)
return array($strAcoesProcedimento);
}

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

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

public function validarExcluirDesativarHipoteseLegal($arrObjHipoteseLegalAPI, $strAcao)
{
$excecao = new InfraException();
foreach ($arrObjHipoteseLegalAPI as $objHipoteseLegalAPI) {
$objPenHipoteseLegalDTO = new PenRelHipoteseLegalDTO();
$objPenHipoteseLegalDTO->setNumIdHipoteseLegal($objHipoteseLegalAPI->getIdHipoteseLegal());
$objPenHipoteseLegalDTO->retNumIdHipoteseLegal();
$objPenHipoteseLegalDTO->setNumMaxRegistrosRetorno(1);

$objPenRelHipoteseLegalEnvioRN = new PenRelHipoteseLegalEnvioRN();
$objPenRelHipoteseLegalEnvioDTO = $objPenRelHipoteseLegalEnvioRN->consultar($objPenHipoteseLegalDTO);

$objPenRelHipoteseLegalRecebidoRN = new PenRelHipoteseLegalRecebidoRN();
$objPenRelHipoteseLegalRecebidoDTO = $objPenRelHipoteseLegalRecebidoRN->consultar($objPenHipoteseLegalDTO);

if (!is_null($objPenRelHipoteseLegalEnvioDTO) || !is_null($objPenRelHipoteseLegalRecebidoDTO)) {

$objPenHipoteseLegalDTO = new PenHipoteseLegalDTO();
$objPenHipoteseLegalDTO->setNumIdHipoteseLegal($objHipoteseLegalAPI->getIdHipoteseLegal());
$objPenHipoteseLegalDTO->retStrNome();

$objPenHipoteseLegalRN = new PenHipoteseLegalRN();
$objPenHipoteseLegalDTO = $objPenHipoteseLegalRN->consultar($objPenHipoteseLegalDTO);
$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."
);
}
}
}

public function montarIconeControleProcessos($arrObjProcedimentoAPI = array())
{
Expand Down
11 changes: 11 additions & 0 deletions src/rn/PenHipoteseLegalRN.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,15 @@ protected function consultarControlado(PenHipoteseLegalDTO $objDTO)
throw new InfraException('Erro consultando hipotese legal.', $e);
}
}

protected function consultarConectado(PenHipoteseLegalDTO $objDTO)
{
try {
//Valida Permissao
$objBD = new GenericoBD(BancoSEI::getInstance());
return $objBD->consultar($objDTO);
} catch (Exception $e) {
throw new InfraException('Erro ao consultar Hipotese Legal.', $e);
}
}
}
Loading