<?php include_once '../../includes.sys/ini.php'; include_once INTERNAL_ROOT_PORTAL . '/includes.sys/metodos.php'; include_once INTERNAL_ROOT_PORTAL . '/ged/DAO/ListagemRelacionamentoDAO.php'; include_once INTERNAL_ROOT_PORTAL . '/ged/ListagemRelacionamento.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once INTERNAL_ROOT_PORTAL . '/head.php'; $ListagemRelacionamento = new ListagemRelacionamento(); $DAO = new ListagemRelacionamentoDao(); //Verifica se a opcao de salvar foi iniciada if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') { $ListagemRelacionamento->setDescricao($_POST['descricao']); $ListagemRelacionamento->setArquivos($_POST['arquivos']); $ListagemRelacionamento->setId($_POST['id']); //Verifica se o descricao foi preenchido if ($ListagemRelacionamento->getDescricao() != null || $ListagemRelacionamento->getArquivos() != null) { $retorno = $DAO->Atualizar($ListagemRelacionamento); if ($retorno == true) { $retorno = $DAO->DesativarRelacionamento($ListagemRelacionamento); //Verifica se todos os itens foram desativados if ($retorno == true) { foreach ($ListagemRelacionamento->getArquivos() as $arquivo) { $retorno = $DAO->GravarArquivos($arquivo, userId(), $ListagemRelacionamento->getId()); if ($retorno == false) { break; } } if ($retorno == false) { echo '<script language= "JavaScript">alert("Erro ao cadastrar os documentos");</script>'; } else {
<?php include_once '../../includes.sys/ini.php'; include_once INTERNAL_ROOT_PORTAL . '/includes.sys/metodos.php'; include_once INTERNAL_ROOT_PORTAL . '/medicao/DAO/ListagemRelacionamentoDAO.php'; include_once INTERNAL_ROOT_PORTAL . '/cadastros/Usuario.class.php'; include_once INTERNAL_ROOT_PORTAL . '/medicao/ListagemRelacionamento.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once INTERNAL_ROOT_PORTAL . '/head.php'; $usuario = new Usuario(); $Listar = new ListagemRelacionamento(); $DAO = new ListagemRelacionamentoDao(); $Listar->setId(limpaTexto($_GET['id'])); //Verifica se foi executado a acao de salvar if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') { $Listar->setIdPessoa($_POST['id_pessoa']); $Listar->setIdItem($_POST['id_item']); $Listar->setUsuario(userId()); $Listar->setId($_POST['id']); $Listar->setEmpresa($_POST['empresa']); // Verifica os campos obrigatorios if ($Listar->getIdPessoa() != null || $Listar->getIdItem() != null) { //Atualiza os dados do Usu�rio e Pessoa $retorno = $DAO->Atualizar($Listar); if ($retorno == true) { echo '<script language= "JavaScript">alert("Registro alterado com sucesso");</script>'; echo '<script language= "JavaScript">location.href="index.php";</script>'; } else { echo $retorno . 'erro'; } } else {