function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, 'educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); $sql = 'SELECT MAX(cod_dispensa) + 1 FROM pmieducar.dispensa_disciplina'; $db = new clsBanco(); $max_cod_dispensa = $db->CampoUnico($sql); // Caso não exista nenhuma dispensa, atribui o código 1, tabela não utiliza sequences $max_cod_dispensa = $max_cod_dispensa > 0 ? $max_cod_dispensa : 1; $obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, NULL, $this->pessoa_logada, $this->ref_cod_tipo_dispensa, NULL, NULL, 1, $this->observacao, $max_cod_dispensa); if ($obj->existe()) { $obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, $this->pessoa_logada, NULL, $this->ref_cod_tipo_dispensa, NULL, NULL, 1, $this->observacao); $obj->edita(); header('Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); die; } $cadastrou = $obj->cadastra(); if ($cadastrou) { $this->mensagem .= 'Cadastro efetuado com sucesso.<br />'; header('Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); die; } $this->mensagem = 'Cadastro não realizado.<br />'; echo "<!--\nErro ao cadastrar clsPmieducarDispensaDisciplina\nvalores obrigatorios\n is_numeric( {$this->ref_cod_matricula} ) && is_numeric( {$this->ref_cod_serie} ) && is_numeric( {$this->ref_cod_escola} ) && is_numeric( {$this->ref_cod_disciplina} ) && is_numeric( {$this->pessoa_logada} ) && is_numeric( {$this->ref_cod_tipo_dispensa} )\n-->"; return FALSE; }