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(); $item = new ListagemRelacionamento(); $DAO = new ListagemRelacionamentoDao(); //Verifica se a opcao de salvar foi iniciada if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') { $item->setIdPessoa($_POST['pessoa']); $item->setIdItem($_POST['item']); $item->setEmpresa($_POST['empresa']); $item->setUsuario(userId()); //Verifica se o item foi preenchido if ($item->getIdPessoa() != null || $item->getIdItem() != null) { echo $item->getEmpresa(); $retorno = $DAO->Gravar($item); if ($retorno == true) { echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>'; echo '<script language= "JavaScript">location.href="new.php";</script>'; } else { echo '<script language= "JavaScript">alert("Erro ao cadastrar Registro");</script>'; } } else { echo '<script language= "JavaScript">alert("Preenchas todos os campos.");</script>'; } } ?> <style type="text/css"> .carregando{
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'] == 'inserir') { $listagemRelacionamento->setdescricao($_POST['descricao']); $listagemRelacionamento->setUsuario(userId()); $listagemRelacionamento->setArquivos($_POST['arquivos']); //Verifica se o descricao foi preenchido if ($listagemRelacionamento->getdescricao() != null || $listagemRelacionamento->getArquivos() != null || $listagemRelacionamento->getdescricao() != ' ') { $retorno = $DAO->Gravar($listagemRelacionamento); if ($retorno > 0) { $listagemRelacionamento->setId($retorno); 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 { echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>'; echo '<script language= "JavaScript">location.href="new.php";</script>'; } } else {