diff --git a/src/pen_map_hipotese_legal_envio_listar.php b/src/pen_map_hipotese_legal_envio_listar.php index 5132e62ee..4ea0dade0 100755 --- a/src/pen_map_hipotese_legal_envio_listar.php +++ b/src/pen_map_hipotese_legal_envio_listar.php @@ -53,16 +53,20 @@ foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) { $objPenRelHipoteseLegalDTO->setDblIdMap($dblIdMap); - $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); + $resultado = $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); } } else { $objPenRelHipoteseLegalDTO->setDblIdMap($arrParam['hdnInfraItensSelecionados']); - $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); + $resultado = $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); } - - $objPagina->adicionarMensagem(sprintf('%s foi excluido com sucesso.', PEN_PAGINA_TITULO), InfraPagina::$TIPO_MSG_AVISO); + + $mensagem = sprintf('%s foi excluido com sucesso.', PEN_PAGINA_TITULO); + if (!$resultado) { + $mensagem = "Não é permitido excluir ou desativar essa hipotese legal"; + } + $objPagina->adicionarMensagem($mensagem, InfraPagina::$TIPO_MSG_AVISO); header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem'])); exit(0); diff --git a/src/pen_map_hipotese_legal_recebimento_listar.php b/src/pen_map_hipotese_legal_recebimento_listar.php index c6fe22638..7beddfd6b 100755 --- a/src/pen_map_hipotese_legal_recebimento_listar.php +++ b/src/pen_map_hipotese_legal_recebimento_listar.php @@ -57,16 +57,20 @@ foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) { $objPenRelHipoteseLegalDTO->setDblIdMap($dblIdMap); - $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); + $resultado = $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); } } else { $objPenRelHipoteseLegalDTO->setDblIdMap($arrParam['hdnInfraItensSelecionados']); - $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); + $resultado = $objPenRelHipoteseLegalRN->excluir($objPenRelHipoteseLegalDTO); } - - $objPagina->adicionarMensagem(sprintf('%s foi excluido com sucesso.', PEN_PAGINA_TITULO), InfraPagina::$TIPO_MSG_AVISO); + + $mensagem = sprintf('%s foi excluido com sucesso.', PEN_PAGINA_TITULO); + if (!$resultado) { + $mensagem = "Não é permitido excluir ou desativar essa hipotese legal"; + } + $objPagina->adicionarMensagem($mensagem, InfraPagina::$TIPO_MSG_AVISO); header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.htmlspecialchars($_GET['acao_retorno']).'&acao_origem='.htmlspecialchars($_GET['acao_origem']))); exit(0); diff --git a/src/rn/PenRelHipoteseLegalRN.php b/src/rn/PenRelHipoteseLegalRN.php index e3b9c08e9..04cf018cc 100755 --- a/src/rn/PenRelHipoteseLegalRN.php +++ b/src/rn/PenRelHipoteseLegalRN.php @@ -104,4 +104,8 @@ public function getIdHipoteseLegalEmUso(PenRelHipoteseLegalDTO $objFiltroDTO, $s } return $arrIdBarramento; } + + public function excluir(PenRelHipoteseLegalDTO $objDTO){ + return false; + } }