Commit 1c720a281aa5ec712f09a299f02012b2e9b1be9a

Authored by Eriksen Costa Paixão
1 parent 642a0906
Exists in master

by Eriksen: Atualizada classe clsDocumento para a validação corresponder com a m…

…udança do campo num_livro

ieducar/intranet/include/pessoa/clsDocumento.inc.php
1 <?php 1 <?php
2 -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
3 -* *  
4 -* @author Prefeitura Municipal de Itajaí *  
5 -* @updated 29/03/2007 *  
6 -* Pacote: i-PLB Software Público Livre e Brasileiro *  
7 -* *  
8 -* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *  
9 -* ctima@itajai.sc.gov.br *  
10 -* *  
11 -* Este programa é software livre, você pode redistribuí-lo e/ou *  
12 -* modificá-lo sob os termos da Licença Pública Geral GNU, conforme *  
13 -* publicada pela Free Software Foundation, tanto a versão 2 da *  
14 -* Licença como (a seu critério) qualquer versão mais nova. *  
15 -* *  
16 -* Este programa é distribuído na expectativa de ser útil, mas SEM *  
17 -* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *  
18 -* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *  
19 -* sulte a Licença Pública Geral GNU para obter mais detalhes. *  
20 -* *  
21 -* Você deve ter recebido uma cópia da Licença Pública Geral GNU *  
22 -* junto com este programa. Se não, escreva para a Free Software *  
23 -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *  
24 -* 02111-1307, USA. *  
25 -* *  
26 -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 +
  3 +/*
  4 + * i-Educar - Sistema de gestão escolar
  5 + *
  6 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  7 + * <ctima@itajai.sc.gov.br>
  8 + *
  9 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  10 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  11 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  12 + * qualquer versão posterior.
  13 + *
  14 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  15 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  16 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  17 + * do GNU para mais detalhes.
  18 + *
  19 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  20 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  21 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  22 + */
  23 +
27 require_once ("include/clsBanco.inc.php"); 24 require_once ("include/clsBanco.inc.php");
28 require_once ("include/Geral.inc.php"); 25 require_once ("include/Geral.inc.php");
29 26
  27 +
  28 +/**
  29 + * clsDocumento class.
  30 + *
  31 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  32 + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
  33 + * @package Core
  34 + * @subpackage pessoa
  35 + * @since Classe disponível desde a versão 1.0.0
  36 + * @version $Id$
  37 + */
30 class clsDocumento 38 class clsDocumento
31 { 39 {
32 var $idpes; 40 var $idpes;
@@ -59,7 +67,6 @@ class clsDocumento @@ -59,7 +67,6 @@ class clsDocumento
59 */ 67 */
60 function clsDocumento( $int_idpes = false, $int_rg = false, $str_data_exp_rg = false, $str_sigla_uf_exp_rg = false, $int_tipo_cert_civil = false, $int_num_termo = false, $int_num_livro = false, $int_num_folha = false, $str_data_emissao_cert_civil = false, $str_sigla_uf_cert_civil = false, $str_cartorio_cert_civil = false, $int_num_cart_trabalho = false, $int_serie_cart_trabalho = false, $str_data_emissao_cart_trabalho = false, $str_sigla_uf_cart_trabalho = false, $int_num_tit_eleitor = false, $int_zona_tit_eleitor = false, $int_secao_tit_eleitor = false, $int_idorg_exp_rg = false ) 68 function clsDocumento( $int_idpes = false, $int_rg = false, $str_data_exp_rg = false, $str_sigla_uf_exp_rg = false, $int_tipo_cert_civil = false, $int_num_termo = false, $int_num_livro = false, $int_num_folha = false, $str_data_emissao_cert_civil = false, $str_sigla_uf_cert_civil = false, $str_cartorio_cert_civil = false, $int_num_cart_trabalho = false, $int_serie_cart_trabalho = false, $str_data_emissao_cart_trabalho = false, $str_sigla_uf_cart_trabalho = false, $int_num_tit_eleitor = false, $int_zona_tit_eleitor = false, $int_secao_tit_eleitor = false, $int_idorg_exp_rg = false )
61 { 69 {
62 -  
63 $objPessoa = new clsFisica($int_idpes); 70 $objPessoa = new clsFisica($int_idpes);
64 if($objPessoa->detalhe()) 71 if($objPessoa->detalhe())
65 { 72 {
@@ -147,7 +154,7 @@ class clsDocumento @@ -147,7 +154,7 @@ class clsDocumento
147 $campos .= ", num_termo"; 154 $campos .= ", num_termo";
148 $values .= ", '{$this->num_termo}'"; 155 $values .= ", '{$this->num_termo}'";
149 } 156 }
150 - if( is_numeric( $this->num_livro ) and (!empty($this->num_livro))) 157 + if( is_string( $this->num_livro ) and (!empty($this->num_livro)))
151 { 158 {
152 $campos .= ", num_livro"; 159 $campos .= ", num_livro";
153 $values .= ", '{$this->num_livro}'"; 160 $values .= ", '{$this->num_livro}'";
@@ -212,6 +219,7 @@ class clsDocumento @@ -212,6 +219,7 @@ class clsDocumento
212 $campos .= ", idorg_exp_rg"; 219 $campos .= ", idorg_exp_rg";
213 $values .= ", '{$this->idorg_exp_rg}'"; 220 $values .= ", '{$this->idorg_exp_rg}'";
214 } 221 }
  222 +
215 $db->Consulta( "INSERT INTO {$this->schema}.{$this->tabela} ( idpes , origem_gravacao, idsis_cad, data_cad, operacao $campos ) VALUES ( '{$this->idpes}', 'M', 17, NOW(), 'I' $values )" ); 223 $db->Consulta( "INSERT INTO {$this->schema}.{$this->tabela} ( idpes , origem_gravacao, idsis_cad, data_cad, operacao $campos ) VALUES ( '{$this->idpes}', 'M', 17, NOW(), 'I' $values )" );
216 224
217 return true; 225 return true;
@@ -283,7 +291,7 @@ class clsDocumento @@ -283,7 +291,7 @@ class clsDocumento
283 $gruda = ", "; 291 $gruda = ", ";
284 } 292 }
285 293
286 - if( is_numeric( $this->num_livro ) and (!empty($this->num_livro))) 294 + if( is_string( $this->num_livro ) and (!empty($this->num_livro)))
287 { 295 {
288 $set .= $gruda."num_livro = '{$this->num_livro}'"; 296 $set .= $gruda."num_livro = '{$this->num_livro}'";
289 $gruda = ", "; 297 $gruda = ", ";
@@ -494,7 +502,7 @@ class clsDocumento @@ -494,7 +502,7 @@ class clsDocumento
494 $where .= "{$whereAnd}num_termo = '$int_num_termo'"; 502 $where .= "{$whereAnd}num_termo = '$int_num_termo'";
495 $whereAnd = " AND "; 503 $whereAnd = " AND ";
496 } 504 }
497 - if( is_numeric( $this->num_livro ) ) 505 + if( is_string( $this->num_livro ) )
498 { 506 {
499 $where .= "{$whereAnd}num_livro = '$int_num_livro'"; 507 $where .= "{$whereAnd}num_livro = '$int_num_livro'";
500 $whereAnd = " AND "; 508 $whereAnd = " AND ";
@@ -604,7 +612,7 @@ class clsDocumento @@ -604,7 +612,7 @@ class clsDocumento
604 */ 612 */
605 function detalhe() 613 function detalhe()
606 { 614 {
607 - 615 +
608 $objPessoa = new clsFisica($this->idpes); 616 $objPessoa = new clsFisica($this->idpes);
609 if($objPessoa->detalhe()) 617 if($objPessoa->detalhe())
610 { 618 {