include_once INTERNAL_ROOT_PORTAL . "/ged/DAO/DocumentoDAO.php"; include_once INTERNAL_ROOT_PORTAL . '/workflow/DAO/TipoDocumentoDAO.php'; include_once INTERNAL_ROOT_PORTAL . '/workflow/TipoDocumento.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once INTERNAL_ROOT_PORTAL . '/head.php'; if (!in_array(75, listarAcesso())) { echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/modulos.php";</script>'; } $DAO = new DocumentoDAO(); $DAO_WF = new TipoDocumentoDAO(); $tipoDocumento = new TipoDocumento(); if (!empty($_GET['cmd']) && $_GET['cmd'] == 'del') { $id = ValidateInteger(INPUT_GET, 'id'); $query = $DAO->Listar("SELECT nome FROM " . MYSQL_BASE_PRODUTOS . " WHERE id=" . $id); foreach ($query as $row) { $tipoDocumento->setNomeConsulta($row['nome']); } $retorno = $DAO_WF->DeletarPorNome($tipoDocumento); //deletar do workflow if ($retorno == 1) { $retorno = $DAO->DeletarProduto($id); if ($retorno == 1) { echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>'; echo '<script language= "JavaScript">location.href="index.php";</script>'; } else { print_r($retorno); } } else { print_r($retorno); } }