From 88918c3c2a7af267278bf0632baa36db5bb64876 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Fri, 24 Apr 2009 23:34:04 +0000 Subject: [PATCH] #18 by Eriksen: Corrigido bug que duplicava o cadastro do cliente de biblioteca quando era para atualizá-lo. --- ieducar/intranet/educar_cliente_cad.php | 376 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/include/pmieducar/clsPmieducarClienteTipoCliente.inc.php | 264 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------- 2 files changed, 325 insertions(+), 315 deletions(-) diff --git a/ieducar/intranet/educar_cliente_cad.php b/ieducar/intranet/educar_cliente_cad.php index db35a49..f641e60 100644 --- a/ieducar/intranet/educar_cliente_cad.php +++ b/ieducar/intranet/educar_cliente_cad.php @@ -1,36 +1,35 @@ login_ = $this->login; $this->senha_ = $this->senha; - + $obj_permissoes = new clsPermissoes(); if( $obj_permissoes->permissao_excluir( 603, $this->pessoa_logada, 11 ) ) { @@ -105,7 +104,8 @@ class indice extends clsCadastro } $this->url_cancelar = ($retorno == "Editar") ? "educar_cliente_det.php?cod_cliente={$registro["cod_cliente"]}&ref_cod_biblioteca={$this->ref_cod_biblioteca}" : "educar_cliente_lst.php"; $this->nome_url_cancelar = "Cancelar"; - return $retorno; + + return $retorno; } function Gerar() @@ -120,22 +120,24 @@ class indice extends clsCadastro $detalhe = $objTemp->detalhe(); $opcoes["{$detalhe["idpes"]}"] = $detalhe["nome"]; } - if ( !$this->cod_cliente ) { - $parametros = new clsParametrosPesquisas(); - $parametros->setSubmit( 0 ); - $parametros->adicionaCampoSelect( "ref_idpes", "idpes", "nome" ); - $parametros->setPessoa( 'F' ); - $parametros->setPessoaCPF( 'N' ); - $parametros->setCodSistema( 1 ); - $parametros->setPessoaNovo( 'S' ); - $parametros->setPessoaTela( 'frame' ); - - $this->campoListaPesq( "ref_idpes", "Cliente", $opcoes, $this->ref_idpes, "pesquisa_pessoa_lst.php", "", false, "", "", null, null, "", false, $parametros->serializaCampos() ); - } - else { - $this->campoOculto( "ref_idpes", $this->ref_idpes ); - $this->campoRotulo( "nm_cliente", "Cliente", $detalhe["nome"] ); + + // Caso o cliente não exista, exibe um campo de pesquisa, senão, mostra um rótulo + if (!$this->cod_cliente) { + $parametros = new clsParametrosPesquisas(); + $parametros->setSubmit(0); + $parametros->adicionaCampoSelect('ref_idpes', 'idpes', 'nome'); + $parametros->setPessoa('F'); + $parametros->setPessoaCPF('N'); + $parametros->setCodSistema(1); + $parametros->setPessoaNovo('S'); + $parametros->setPessoaTela('frame'); + + $this->campoListaPesq('ref_idpes', 'Cliente', $opcoes, $this->ref_idpes, 'pesquisa_pessoa_lst.php', '', FALSE, '', '', NULL, NULL, '', FALSE, $parametros->serializaCampos()); } + else { + $this->campoOculto('ref_idpes', $this->ref_idpes); + $this->campoRotulo('nm_cliente', 'Cliente', $detalhe['nome']); + } // text @@ -160,156 +162,178 @@ class indice extends clsCadastro if($this->cod_cliente && $this->ref_cod_biblioteca) { - //$instituicao_desabilitado = true; - //$escola_desabilitado = true; - //$biblioteca_desabilitado = false; - $db = new clsBanco(); + + // Cria campo oculto com o ID da biblioteca atual ao qual usuário está cadastrado + $this->ref_cod_biblioteca_atual = $this->ref_cod_biblioteca; + $this->campoOculto("ref_cod_biblioteca_atual", $this->ref_cod_biblioteca_atual); + $this->ref_cod_instituicao = $db->CampoUnico("SELECT ref_cod_instituicao FROM pmieducar.biblioteca, pmieducar.cliente_tipo_cliente ctc, pmieducar.cliente_tipo ct WHERE ref_cod_cliente = '$this->cod_cliente' AND ref_cod_cliente_tipo = cod_cliente_tipo AND ct.ref_cod_biblioteca = cod_biblioteca AND ctc.ref_cod_biblioteca = {$this->ref_cod_biblioteca}"); $this->ref_cod_escola = $db->CampoUnico("SELECT ref_cod_escola FROM pmieducar.biblioteca, pmieducar.cliente_tipo_cliente ctc, pmieducar.cliente_tipo ct WHERE ref_cod_cliente = '$this->cod_cliente' AND ref_cod_cliente_tipo = cod_cliente_tipo AND ct.ref_cod_biblioteca = cod_biblioteca AND ctc.ref_cod_biblioteca = {$this->ref_cod_biblioteca}"); $this->ref_cod_biblioteca = $db->CampoUnico("SELECT cod_biblioteca FROM pmieducar.biblioteca, pmieducar.cliente_tipo_cliente ctc, pmieducar.cliente_tipo ct WHERE ref_cod_cliente = '$this->cod_cliente' AND ref_cod_cliente_tipo = cod_cliente_tipo AND ct.ref_cod_biblioteca = cod_biblioteca AND ctc.ref_cod_biblioteca = {$this->ref_cod_biblioteca}"); $this->ref_cod_cliente_tipo = $db->CampoUnico("SELECT ref_cod_cliente_tipo FROM pmieducar.cliente_tipo_cliente WHERE ref_cod_cliente = '$this->cod_cliente'");// AND ref_cod_cliente_tipo IN (SELECT cod_cliente_tipo FROM pmieducar.cliente_tipo WHERE ref_cod_biblioteca = )");//IN (SELECT ref_cod_biblioteca FROM pmieducar.biblioteca_usuario WHERE ref_cod_usuario = '$this->pessoa_logada'))"); - $this->ref_cod_biblioteca_atual = $this->ref_cod_biblioteca; - $this->campoOculto("ref_cod_biblioteca_atual", $this->ref_cod_biblioteca_atual); } include( "include/pmieducar/educar_campo_lista.php" ); } - function Novo() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - $senha = md5( $this->senha_."asnk@#*&(23" ); - $obj_permissoes = new clsPermissoes(); - $obj_permissoes->permissao_cadastra( 603, $this->pessoa_logada, 11, "educar_cliente_lst.php" ); - $obj = new clsPmieducarCliente( null, null, null, $this->ref_idpes ); - $detalhe = $obj->detalhe(); - if ( !$detalhe ) - { - $obj_cliente = new clsPmieducarCliente(); - $lst_cliente = $obj_cliente->lista( null, null, null, null, $this->login_ ); - if ( $lst_cliente && $this->login_ != "") { - $this->mensagem = "Este login já está sendo utilizado por outra pessoa!
"; - echo ""; - } - else { - $obj = new clsPmieducarCliente( $this->cod_cliente, null, $this->pessoa_logada, $this->ref_idpes, $this->login_, $senha, $this->data_cadastro, $this->data_exclusao, 1 ); - $cadastrou = $obj->cadastra(); - if( $cadastrou ) - { - $this->cod_cliente = $cadastrou; - $obj_cliente_tipo = new clsPmieducarClienteTipoCliente( $this->ref_cod_cliente_tipo, $this->cod_cliente, null, null, $this->pessoa_logada, $this->pessoa_logada, 1 ); - if ( $obj_cliente_tipo->existeCliente() ) - { - if ( $obj_cliente_tipo->trocaTipo() ) - { - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header( "Location: educar_definir_cliente_tipo_lst.php" ); - die(); - return true; - } - } - else - { - $obj_cliente_tipo = new clsPmieducarClienteTipoCliente( $this->ref_cod_cliente_tipo, $this->cod_cliente, null, null, $this->pessoa_logada, null, 1 ); - if ( $obj_cliente_tipo->cadastra() ) - { - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header( "Location: educar_cliente_lst.php" ); - die(); - return true; + + + /** + * Sobrescrita do método clsCadastro::Novo. + * + * Insere novo registro nas tabelas pmieducar.cliente e pmieducar.cliente_tipo_cliente. + */ + public function Novo() { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $senha = md5($this->senha . 'asnk@#*&(23'); + + $obj_permissoes = new clsPermissoes(); + $obj_permissoes->permissao_cadastra(603, $this->pessoa_logada, 11, 'educar_cliente_lst.php'); + + $obj = new clsPmieducarCliente(NULL, NULL, NULL, $this->ref_idpes); + $detalhe = $obj->detalhe(); + + if (!$detalhe) { + $obj_cliente = new clsPmieducarCliente(); + $lst_cliente = $obj_cliente->lista(NULL, NULL, NULL, NULL, $this->login); + + if ($lst_cliente && $this->login != '') { + $this->mensagem = "Este login já está sendo utilizado por outra pessoa!
"; + } + else { + $obj = new clsPmieducarCliente($this->cod_cliente, NULL, $this->pessoa_logada, + $this->ref_idpes, $this->login, $senha, $this->data_cadastro, $this->data_exclusao, 1); + + $cadastrou = $obj->cadastra(); + if ($cadastrou) { + $this->cod_cliente = $cadastrou; + $obj_cliente_tipo = new clsPmieducarClienteTipoCliente($this->ref_cod_cliente_tipo, + $this->cod_cliente, NULL, NULL, $this->pessoa_logada, $this->pessoa_logada, 1); + + if ($obj_cliente_tipo->existeCliente()) { + if ($obj_cliente_tipo->trocaTipo()) { + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: educar_definir_cliente_tipo_lst.php'); + die(); + } + } + else { + $obj_cliente_tipo = new clsPmieducarClienteTipoCliente($this->ref_cod_cliente_tipo, + $this->cod_cliente, NULL, NULL, $this->pessoa_logada, NULL, 1, $this->ref_cod_biblioteca); + + if ($obj_cliente_tipo->cadastra()) { + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: educar_cliente_lst.php'); + die(); } + } + } - } + $this->mensagem = "Cadastro não realizado.
"; - } + return FALSE; + } + } + else { + $obj = new clsPmieducarCliente(NULL, NULL, NULL, $this->ref_idpes); + $registro = $obj->detalhe(); - $this->mensagem = "Cadastro não realizado.
"; - echo ""; - return false; - } - } - else { - $obj = new clsPmieducarCliente( null, null, null, $this->ref_idpes ); - $registro = $obj->detalhe(); + if ($registro) { + $this->cod_cliente = $registro['cod_cliente']; + } - if( $registro ) - $this->cod_cliente = $registro["cod_cliente"]; - $this->ativo = 1; + $this->ativo = 1; - $sql = "SELECT COUNT(0) FROM pmieducar.cliente_tipo_cliente WHERE ref_cod_cliente_tipo = {$this->cod_cliente} - AND ref_cod_biblioteca = {$this->ref_cod_biblioteca} AND ativo = 1"; - $db = new clsBanco(); - $possui_biblio = $db->CampoUnico($sql); - if ($possui_biblio == 0) - { - $obj_cliente_tipo_cliente = new clsPmieducarClienteTipoCliente($this->ref_cod_cliente_tipo, $this->cod_cliente, null, null, $this->pessoa_logada, null, null, $this->ref_cod_biblioteca); - if (!$obj_cliente_tipo_cliente->cadastra()) - { - $this->mensagem = "Não cadastrou"; - return false; - } - else - { - header( "Location: educar_cliente_lst.php" ); - return true; - die(); - } - } - else - { - $this->Editar(); - $this->mensagem = "O cliente já está cadastrado!
"; - echo ""; - } - } - } + $sql = "SELECT COUNT(0) FROM pmieducar.cliente_tipo_cliente WHERE ref_cod_cliente_tipo = {$this->cod_cliente} + AND ref_cod_biblioteca = {$this->ref_cod_biblioteca} AND ativo = 1"; - function Editar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); + $db = new clsBanco(); + $possui_biblio = $db->CampoUnico($sql); + if ($possui_biblio == 0) { + $obj_cliente_tipo_cliente = new clsPmieducarClienteTipoCliente($this->ref_cod_cliente_tipo, + $this->cod_cliente, NULL, NULL, $this->pessoa_logada, NULL, NULL, $this->ref_cod_biblioteca); - $senha = md5( $this->senha_."asnk@#*&(23" ); - $obj_permissoes = new clsPermissoes(); - $obj_permissoes->permissao_cadastra( 603, $this->pessoa_logada, 11, "educar_cliente_lst.php" ); + if (!$obj_cliente_tipo_cliente->cadastra()) { + $this->mensagem = "Não cadastrou"; - $obj = new clsPmieducarCliente( $this->cod_cliente, $this->pessoa_logada, $this->pessoa_logada, $this->ref_idpes, $this->login_, $senha, $this->data_cadastro, $this->data_exclusao, $this->ativo ); - $editou = $obj->edita(); - if( $editou ) - { - $obj_cliente_tipo = new clsPmieducarClienteTipoCliente( $this->ref_cod_cliente_tipo, $this->cod_cliente, null, null, $this->pessoa_logada, $this->pessoa_logada, 1, $this->ref_cod_biblioteca ); - if ( $obj_cliente_tipo->existeClienteBiblioteca($_POST['ref_cod_biblioteca_atual']) ) - { - if ( $obj_cliente_tipo->trocaTipoBiblioteca($_POST['ref_cod_biblioteca_atual']) ) - { - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header( "Location: educar_cliente_lst.php" ); - die(); - return true; - } - } - else - { - $obj_cliente_tipo = new clsPmieducarClienteTipoCliente( $this->ref_cod_cliente_tipo, $this->cod_cliente, null, null, $this->pessoa_logada, null, 1, $this->ref_cod_biblioteca ); - if ( $obj_cliente_tipo->cadastra() ) - { - $this->mensagem .= "Edição efetuada com sucesso.
"; - header( "Location: educar_cliente_lst.php" ); - die(); - return true; + return FALSE; } - } - } + else { + header('Location: educar_cliente_lst.php'); - $this->mensagem = "Edição não realizada.
"; - echo ""; + return TRUE; + die(); + } + } + else { + $this->Editar(); + $this->mensagem = "O cliente já está cadastrado!
"; + } + } + } + + + + /** + * Sobrescrita do método clsCadastro::Editar. + * + * Verifica: + * - Se usuário tem permissão de edição + * - Se usuário existe na biblioteca atual + * - Se existir, troca pela biblioteca escolhida na interface + * - Senão, cadastra como cliente da biblioteca + */ + public function Editar() { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $senha = md5($this->senha . 'asnk@#*&(23'); + $obj_permissoes = new clsPermissoes(); + $obj_permissoes->permissao_cadastra(603, $this->pessoa_logada, 11, 'educar_cliente_lst.php'); + + $obj = new clsPmieducarCliente($this->cod_cliente, $this->pessoa_logada, $this->pessoa_logada, + $this->ref_idpes, $this->login, $senha, $this->data_cadastro, $this->data_exclusao, $this->ativo); + + $editou = $obj->edita(); + + if ($editou) { + // Cria objeto clsPemieducarClienteTipoCliente configurando atributos usados nas queries + $obj_cliente_tipo = new clsPmieducarClienteTipoCliente( + $this->ref_cod_cliente_tipo, $this->cod_cliente, NULL, NULL, + $this->pessoa_logada, $this->pessoa_logada, 1, $this->ref_cod_biblioteca); + + // clsPmieducarClienteTipoCliente::trocaTipoBiblioteca recebe o valor antigo para usar + // na cláusula WHERE + if ($obj_cliente_tipo->existeClienteBiblioteca($_POST['ref_cod_biblioteca_atual'])) { + if ($obj_cliente_tipo->trocaTipoBiblioteca($_POST['ref_cod_biblioteca_atual'])) { + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: educar_cliente_lst.php'); + die(); + } + } + else { + $obj_cliente_tipo = new clsPmieducarClienteTipoCliente( + $this->ref_cod_cliente_tipo, $this->cod_cliente, NULL, NULL, + $this->pessoa_logada, NULL, 1, $this->ref_cod_biblioteca); + + if ($obj_cliente_tipo->cadastra()) { + $this->mensagem .= 'Edição efetuada com sucesso.
'; + header('Location: educar_cliente_lst.php'); + die(); + } + } + } + + $this->mensagem = 'Edição não realizada.
'; die(); - return false; } + + function Excluir() { @session_start(); diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarClienteTipoCliente.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarClienteTipoCliente.inc.php index d68ed05..f56adb9 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarClienteTipoCliente.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarClienteTipoCliente.inc.php @@ -1,47 +1,44 @@ _schema = "pmieducar."; - $this->_tabela = "{$this->_schema}cliente_tipo_cliente"; - - $this->_campos_lista = $this->_todos_campos = "ctc.ref_cod_cliente_tipo, ctc.ref_cod_cliente, ctc.data_cadastro, ctc.data_exclusao, ctc.ref_usuario_cad, ctc.ref_usuario_exc, ctc.ativo"; - - if( is_numeric( $ref_cod_cliente_tipo ) ) - { - if( class_exists( "clsPmieducarClienteTipo" ) ) - { - $tmp_obj = new clsPmieducarClienteTipo( $ref_cod_cliente_tipo ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_cod_cliente_tipo = $ref_cod_cliente_tipo; - } - } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_cod_cliente_tipo = $ref_cod_cliente_tipo; - } - } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.cliente_tipo WHERE cod_cliente_tipo = '{$ref_cod_cliente_tipo}'" ) ) - { - $this->ref_cod_cliente_tipo = $ref_cod_cliente_tipo; - } - } - } - if( is_numeric( $ref_cod_cliente ) ) - { - if( class_exists( "clsPmieducarCliente" ) ) - { - $tmp_obj = new clsPmieducarCliente( $ref_cod_cliente ); - if( method_exists( $tmp_obj, "existe") ) - { - if( $tmp_obj->existe() ) - { - $this->ref_cod_cliente = $ref_cod_cliente; + function clsPmieducarClienteTipoCliente($ref_cod_cliente_tipo = NULL, $ref_cod_cliente = NULL, + $data_cadastro = NULL, $data_exclusao = NULL, $ref_usuario_cad = NULL, $ref_usuario_exc = NULL, + $ativo = 1, $ref_cod_biblioteca = NULL) { + + $db = new clsBanco(); + $this->_schema = 'pmieducar.'; + $this->_tabela = "{$this->_schema}cliente_tipo_cliente"; + + $this->_campos_lista = $this->_todos_campos = 'ctc.ref_cod_cliente_tipo, ctc.ref_cod_cliente, ctc.data_cadastro, ctc.data_exclusao, ctc.ref_usuario_cad, ctc.ref_usuario_exc, ctc.ativo'; + + if (is_numeric( $ref_cod_cliente_tipo)) { + if (class_exists('clsPmieducarClienteTipo')) { + $tmp_obj = new clsPmieducarClienteTipo($ref_cod_cliente_tipo); + if (method_exists($tmp_obj, 'existe')) { + if ($tmp_obj->existe()) { + $this->ref_cod_cliente_tipo = $ref_cod_cliente_tipo; } } - else if( method_exists( $tmp_obj, "detalhe") ) - { - if( $tmp_obj->detalhe() ) - { - $this->ref_cod_cliente = $ref_cod_cliente; + elseif (method_exists($tmp_obj, 'detalhe')) { + if ($tmp_obj->detalhe()) { + $this->ref_cod_cliente_tipo = $ref_cod_cliente_tipo; } + } + } + else { + if ($db->CampoUnico("SELECT 1 FROM pmieducar.cliente_tipo WHERE cod_cliente_tipo = '{$ref_cod_cliente_tipo}'")) { + $this->ref_cod_cliente_tipo = $ref_cod_cliente_tipo; + } + } + } + + if (is_numeric($ref_cod_cliente)) { + if (class_exists('clsPmieducarCliente')) { + $tmp_obj = new clsPmieducarCliente($ref_cod_cliente); + if (method_exists($tmp_obj, 'existe')) { + if ($tmp_obj->existe()) { + $this->ref_cod_cliente = $ref_cod_cliente; + } } - } - else - { - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.cliente WHERE cod_cliente = '{$ref_cod_cliente}'" ) ) - { - $this->ref_cod_cliente = $ref_cod_cliente; - } - } - } + elseif (method_exists( $tmp_obj, 'detalhe')) { + if ($tmp_obj->detalhe()) { + $this->ref_cod_cliente = $ref_cod_cliente; + } + } + } + else { + if ($db->CampoUnico("SELECT 1 FROM pmieducar.cliente WHERE cod_cliente = '{$ref_cod_cliente}'")) { + $this->ref_cod_cliente = $ref_cod_cliente; + } + } + } + + if (is_string($data_cadastro)) { + $this->data_cadastro = $data_cadastro; + } + if (is_string($data_exclusao)) { + $this->data_exclusao = $data_exclusao; + } + if (is_numeric($ref_usuario_cad)) { + $this->ref_usuario_cad = $ref_usuario_cad; + } + if (is_numeric($ref_usuario_exc)) { + $this->ref_usuario_exc = $ref_usuario_exc; + } + if (is_numeric($ativo)) { + $this->ativo = $ativo; + } + if (is_numeric($ref_cod_biblioteca)) { + $this->ref_cod_biblioteca = $ref_cod_biblioteca; + } + } - if( is_string( $data_cadastro ) ) - { - $this->data_cadastro = $data_cadastro; - } - if( is_string( $data_exclusao ) ) - { - $this->data_exclusao = $data_exclusao; - } - if( is_numeric( $ref_usuario_cad ) ) - { - $this->ref_usuario_cad = $ref_usuario_cad; - } - if( is_numeric( $ref_usuario_exc ) ) - { - $this->ref_usuario_exc = $ref_usuario_exc; - } - if( is_numeric( $ativo ) ) - { - $this->ativo = $ativo; - } - if (is_numeric($ref_cod_biblioteca)) - { - $this->ref_cod_biblioteca = $ref_cod_biblioteca; - } - } /** * Cria um novo registro @@ -323,7 +302,13 @@ class clsPmieducarClienteTipoCliente } return false; } - + + + + /** + * Recebe valor antigo para utilizar na cláusula WHERE e atualiza o registro com os novos dados, + * vindos dos atributos. + */ function trocaTipoBiblioteca($ref_cod_biblioteca_atual) { if( is_numeric( $this->ref_cod_cliente_tipo ) && is_numeric( $this->ref_cod_cliente ) && is_numeric( $this->ref_usuario_exc ) && is_numeric( $this->ativo ) && is_numeric($this->ref_cod_biblioteca) && $ref_cod_biblioteca_atual ) @@ -362,7 +347,7 @@ class clsPmieducarClienteTipoCliente } return false; } - + /** * Retorna uma lista filtrados de acordo com os parametros * @@ -514,24 +499,26 @@ class clsPmieducarClienteTipoCliente } return false; } - + /** * Retorna um array com os dados de um registro * * @return array */ - function existeClienteBiblioteca($ref_cod_biblioteca_atual) - { - if( is_numeric( $this->ref_cod_cliente ) && is_numeric($ref_cod_biblioteca_atual) ) - { + function existeClienteBiblioteca($ref_cod_biblioteca_atual) { + if (is_numeric($this->ref_cod_cliente) && is_numeric($ref_cod_biblioteca_atual)) { + $db = new clsBanco(); + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE ref_cod_cliente = '{$this->ref_cod_cliente}' AND ref_cod_biblioteca = {$ref_cod_biblioteca_atual}"); + $db->ProximoRegistro(); - $db = new clsBanco(); - $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE ref_cod_cliente = '{$this->ref_cod_cliente}' AND ref_cod_biblioteca = {$ref_cod_biblioteca_atual}" ); - $db->ProximoRegistro(); - return $db->Tupla(); + return $db->Tupla(); } - return false; + + return FALSE; } + + + /** * Exclui um registro * @@ -628,5 +615,4 @@ class clsPmieducarClienteTipoCliente return ""; } -} -?> \ No newline at end of file +} \ No newline at end of file -- libgit2 0.21.2