Commit 55d2af29ba378733cc6c522911998ae38928bc5c

Authored by Lucas D'Avila
1 parent 1cfb9daa
Exists in master

Corrigido busca exemplares, para filtrar por titulo exemplar e/ou tombo

ieducar/intranet/educar_exemplar_lst.php
@@ -85,7 +85,7 @@ class indice extends clsListagem @@ -85,7 +85,7 @@ class indice extends clsListagem
85 var $ref_cod_biblioteca; 85 var $ref_cod_biblioteca;
86 var $ref_cod_instituicao; 86 var $ref_cod_instituicao;
87 var $ref_cod_escola; 87 var $ref_cod_escola;
88 - 88 +
89 var $ref_cod_acervo_colecao; 89 var $ref_cod_acervo_colecao;
90 var $ref_cod_acervo_editora; 90 var $ref_cod_acervo_editora;
91 91
@@ -157,7 +157,7 @@ class indice extends clsListagem @@ -157,7 +157,7 @@ class indice extends clsListagem
157 157
158 } 158 }
159 } 159 }
160 - 160 +
161 $obj_colecao = new clsPmieducarAcervoColecao(); 161 $obj_colecao = new clsPmieducarAcervoColecao();
162 $obj_colecao->setOrderby("nm_colecao ASC"); 162 $obj_colecao->setOrderby("nm_colecao ASC");
163 $obj_colecao->setCamposLista("cod_acervo_colecao, nm_colecao"); 163 $obj_colecao->setCamposLista("cod_acervo_colecao, nm_colecao");
@@ -169,7 +169,7 @@ class indice extends clsListagem @@ -169,7 +169,7 @@ class indice extends clsListagem
169 $opcoes_colecao[$colecao["cod_acervo_colecao"]] = $colecao["nm_colecao"]; 169 $opcoes_colecao[$colecao["cod_acervo_colecao"]] = $colecao["nm_colecao"];
170 } 170 }
171 } 171 }
172 - 172 +
173 $obj_editora = new clsPmieducarAcervoEditora(); 173 $obj_editora = new clsPmieducarAcervoEditora();
174 $obj_editora->setCamposLista("cod_acervo_editora, nm_editora"); 174 $obj_editora->setCamposLista("cod_acervo_editora, nm_editora");
175 $obj_editora->setOrderby("nm_editora ASC"); 175 $obj_editora->setOrderby("nm_editora ASC");
@@ -182,7 +182,7 @@ class indice extends clsListagem @@ -182,7 +182,7 @@ class indice extends clsListagem
182 $opcoes_editora[$editora["cod_acervo_editora"]] = $editora["nm_editora"]; 182 $opcoes_editora[$editora["cod_acervo_editora"]] = $editora["nm_editora"];
183 } 183 }
184 } 184 }
185 - 185 +
186 $obj_fonte = new clsPmieducarFonte(); 186 $obj_fonte = new clsPmieducarFonte();
187 $obj_fonte->setOrderby("nm_fonte ASC"); 187 $obj_fonte->setOrderby("nm_fonte ASC");
188 $obj_fonte->setCamposLista("cod_fonte, nm_fonte"); 188 $obj_fonte->setCamposLista("cod_fonte, nm_fonte");
@@ -197,12 +197,12 @@ class indice extends clsListagem @@ -197,12 +197,12 @@ class indice extends clsListagem
197 } 197 }
198 198
199 $this->campoLista( "ref_cod_exemplar_tipo", "Exemplar Tipo", $opcoes, $this->ref_cod_exemplar_tipo,null,null,null,null,null,false ); 199 $this->campoLista( "ref_cod_exemplar_tipo", "Exemplar Tipo", $opcoes, $this->ref_cod_exemplar_tipo,null,null,null,null,null,false );
200 - 200 +
201 $this->campoLista("ref_cod_acervo_colecao", "Acervo Coleção", $opcoes_colecao, $this->ref_cod_acervo_colecao, "", false, "", "", false, false); 201 $this->campoLista("ref_cod_acervo_colecao", "Acervo Coleção", $opcoes_colecao, $this->ref_cod_acervo_colecao, "", false, "", "", false, false);
202 $this->campoLista("ref_cod_acervo_editora", "Editora", $opcoes_editora, $this->ref_cod_acervo_editora, "", false, "", "", false, false); 202 $this->campoLista("ref_cod_acervo_editora", "Editora", $opcoes_editora, $this->ref_cod_acervo_editora, "", false, "", "", false, false);
203 $this->campoLista("ref_cod_fonte", "Fonte", $opcoes_fonte, $this->ref_cod_fonte, "", false, "", "", false, false); 203 $this->campoLista("ref_cod_fonte", "Fonte", $opcoes_fonte, $this->ref_cod_fonte, "", false, "", "", false, false);
204 -  
205 - 204 +
  205 +
206 $this->campoTexto("titulo_livro","Título da Obra",$this->titulo_livro,25,255,false); 206 $this->campoTexto("titulo_livro","Título da Obra",$this->titulo_livro,25,255,false);
207 $this->campoNumero("cod_exemplar","Tombo",$this->cod_exemplar,10,50,false); 207 $this->campoNumero("cod_exemplar","Tombo",$this->cod_exemplar,10,50,false);
208 208
@@ -228,7 +228,7 @@ class indice extends clsListagem @@ -228,7 +228,7 @@ class indice extends clsListagem
228 $obj_exemplar->setLimite( $this->limite, $this->offset ); 228 $obj_exemplar->setLimite( $this->limite, $this->offset );
229 229
230 $lista = $obj_exemplar->lista_com_acervos( 230 $lista = $obj_exemplar->lista_com_acervos(
231 - $this->cod_exemplar, 231 + null,
232 $this->ref_cod_fonte, 232 $this->ref_cod_fonte,
233 null, 233 null,
234 null, 234 null,
@@ -247,11 +247,11 @@ class indice extends clsListagem @@ -247,11 +247,11 @@ class indice extends clsListagem
247 $this->ref_cod_exemplar_tipo, 247 $this->ref_cod_exemplar_tipo,
248 $this->titulo_livro, 248 $this->titulo_livro,
249 $this->ref_cod_biblioteca, 249 $this->ref_cod_biblioteca,
250 - null,  
251 $this->ref_cod_instituicao, 250 $this->ref_cod_instituicao,
252 $this->ref_cod_escola, 251 $this->ref_cod_escola,
253 $this->ref_cod_acervo_colecao, 252 $this->ref_cod_acervo_colecao,
254 - $this->ref_cod_acervo_editora 253 + $this->ref_cod_acervo_editora,
  254 + $this->cod_exemplar
255 ); 255 );
256 256
257 $total = $obj_exemplar->_total; 257 $total = $obj_exemplar->_total;
@@ -472,7 +472,7 @@ function getAcervoEditora(xml_acervo_editora) @@ -472,7 +472,7 @@ function getAcervoEditora(xml_acervo_editora)
472 } 472 }
473 } 473 }
474 else 474 else
475 - campoEditora.options[0].text = 'A biblioteca não possui nenhuma editora'; 475 + campoEditora.options[0].text = 'A biblioteca não possui nenhuma editora';
476 } 476 }
477 477
478 478
@@ -492,7 +492,7 @@ function getFonte(xml_fonte) @@ -492,7 +492,7 @@ function getFonte(xml_fonte)
492 } 492 }
493 } 493 }
494 else 494 else
495 - campoFonte.options[0].text = 'A biblioteca não possui nenhuma editora'; 495 + campoFonte.options[0].text = 'A biblioteca não possui nenhuma editora';
496 } 496 }
497 497
498 document.getElementById('ref_cod_biblioteca').onchange = function() 498 document.getElementById('ref_cod_biblioteca').onchange = function()
@@ -508,29 +508,29 @@ document.getElementById('ref_cod_biblioteca').onchange = function() @@ -508,29 +508,29 @@ document.getElementById('ref_cod_biblioteca').onchange = function()
508 508
509 var xml_exemplar_tipo = new ajax( getExemplarTipo ); 509 var xml_exemplar_tipo = new ajax( getExemplarTipo );
510 xml_exemplar_tipo.envia( "educar_exemplar_tipo_xml.php?bib="+campoBiblioteca ); 510 xml_exemplar_tipo.envia( "educar_exemplar_tipo_xml.php?bib="+campoBiblioteca );
511 -  
512 - 511 +
  512 +
513 var campoColecao = document.getElementById('ref_cod_acervo_colecao'); 513 var campoColecao = document.getElementById('ref_cod_acervo_colecao');
514 campoColecao.length = 1; 514 campoColecao.length = 1;
515 campoColecao.disabled = true; 515 campoColecao.disabled = true;
516 campoColecao.options[0].text = 'Carregando coleção'; 516 campoColecao.options[0].text = 'Carregando coleção';
517 var xml_acervo_colecao = new ajax(getAcervoColecao); 517 var xml_acervo_colecao = new ajax(getAcervoColecao);
518 xml_acervo_colecao.envia("educar_acervo_colecao_xml.php?bib="+campoBiblioteca); 518 xml_acervo_colecao.envia("educar_acervo_colecao_xml.php?bib="+campoBiblioteca);
519 - 519 +
520 var campoEditora = document.getElementById('ref_cod_acervo_editora'); 520 var campoEditora = document.getElementById('ref_cod_acervo_editora');
521 campoEditora.length = 1; 521 campoEditora.length = 1;
522 campoEditora.disabled = true; 522 campoEditora.disabled = true;
523 campoEditora.options[0].text = 'Carregando editora'; 523 campoEditora.options[0].text = 'Carregando editora';
524 var xml_acervo_editora = new ajax(getAcervoEditora); 524 var xml_acervo_editora = new ajax(getAcervoEditora);
525 xml_acervo_editora.envia("educar_acervo_editora_xml.php?bib="+campoBiblioteca); 525 xml_acervo_editora.envia("educar_acervo_editora_xml.php?bib="+campoBiblioteca);
526 - 526 +
527 var campoFonte = document.getElementById('ref_cod_fonte'); 527 var campoFonte = document.getElementById('ref_cod_fonte');
528 campoFonte.length = 1; 528 campoFonte.length = 1;
529 campoFonte.disabled = true; 529 campoFonte.disabled = true;
530 campoFonte.options[0].text = 'Carregando fonte'; 530 campoFonte.options[0].text = 'Carregando fonte';
531 var xml_acervo_fonte = new ajax(getFonte); 531 var xml_acervo_fonte = new ajax(getFonte);
532 xml_acervo_fonte.envia("educar_fonte_xml.php?bib="+campoBiblioteca); 532 xml_acervo_fonte.envia("educar_fonte_xml.php?bib="+campoBiblioteca);
533 - 533 +
534 }; 534 };
535 535
536 function pesquisa() 536 function pesquisa()
ieducar/intranet/include/pmieducar/clsPmieducarExemplar.inc.php
@@ -700,7 +700,7 @@ class clsPmieducarExemplar @@ -700,7 +700,7 @@ class clsPmieducarExemplar
700 * 700 *
701 * @return array 701 * @return array
702 */ 702 */
703 - function lista_com_acervos( $int_cod_exemplar = null, $int_ref_cod_fonte = null, $int_ref_cod_motivo_baixa = null, $int_ref_cod_acervo = null, $int_ref_cod_situacao = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_permite_emprestimo = null, $int_preco = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $date_data_aquisicao_ini = null, $date_data_aquisicao_fim = null, $int_ref_exemplar_tipo = null, $str_titulo_livro = null,$int_ref_cod_biblioteca = null, $str_titulo = null, $int_ref_cod_instituicao = null, $int_ref_cod_escola = null, $int_ref_cod_acervo_colecao = null, $int_ref_cod_acervo_editora = null) { 703 + function lista_com_acervos( $int_cod_exemplar = null, $int_ref_cod_fonte = null, $int_ref_cod_motivo_baixa = null, $int_ref_cod_acervo = null, $int_ref_cod_situacao = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_permite_emprestimo = null, $int_preco = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $date_data_aquisicao_ini = null, $date_data_aquisicao_fim = null, $int_ref_exemplar_tipo = null, $str_titulo_livro = null,$int_ref_cod_biblioteca = null, $int_ref_cod_instituicao = null, $int_ref_cod_escola = null, $int_ref_cod_acervo_colecao = null, $int_ref_cod_acervo_editora = null, $tombo) {
704 $sql = "SELECT {$this->_campos_lista}, a.ref_cod_biblioteca, a.titulo FROM {$this->_tabela} e, {$this->_schema}acervo a, {$this->_schema}biblioteca b"; 704 $sql = "SELECT {$this->_campos_lista}, a.ref_cod_biblioteca, a.titulo FROM {$this->_tabela} e, {$this->_schema}acervo a, {$this->_schema}biblioteca b";
705 705
706 $whereAnd = " AND"; 706 $whereAnd = " AND";
@@ -791,12 +791,16 @@ class clsPmieducarExemplar @@ -791,12 +791,16 @@ class clsPmieducarExemplar
791 $filtros .= "{$whereAnd} e.data_aquisicao <= '{$date_data_aquisicao_fim}'"; 791 $filtros .= "{$whereAnd} e.data_aquisicao <= '{$date_data_aquisicao_fim}'";
792 $whereAnd = " AND "; 792 $whereAnd = " AND ";
793 } 793 }
794 - if( is_string( $str_titulo ) ) 794 + if( is_string( $str_titulo_livro ) )
795 { 795 {
796 - $filtros .= "{$whereAnd} a.titulo LIKE '%{$str_titulo}%'"; 796 + $filtros .= "{$whereAnd} to_ascii(a.titulo) LIKE to_ascii('%{$str_titulo_livro}%')";
797 $whereAnd = " AND "; 797 $whereAnd = " AND ";
798 } 798 }
799 799
  800 + if (is_numeric($tombo)) {
  801 + $filtros .= "{$whereAnd} e.tombo = $tombo";
  802 + $whereAnd = " AND ";
  803 + }
800 804
801 /** 805 /**
802 * INICIO - PESQUISAS EXTRAS 806 * INICIO - PESQUISAS EXTRAS
@@ -804,12 +808,6 @@ class clsPmieducarExemplar @@ -804,12 +808,6 @@ class clsPmieducarExemplar
804 $whereAnd2 = " AND "; 808 $whereAnd2 = " AND ";
805 $filtros_extra = null; 809 $filtros_extra = null;
806 810
807 - if( is_string( $str_titulo_livro ) )  
808 - {  
809 - $filtros_extra .= "{$whereAnd2} to_ascii(a.titulo) ilike to_ascii('%{$date_data_aquisicao_fim}%') ";  
810 - $whereAnd2 = " AND ";  
811 - }  
812 -  
813 if( is_numeric( $int_ref_exemplar_tipo ) ) 811 if( is_numeric( $int_ref_exemplar_tipo ) )
814 { 812 {
815 $filtros_extra .= "{$whereAnd} a.ref_cod_exemplar_tipo = $int_ref_exemplar_tipo"; 813 $filtros_extra .= "{$whereAnd} a.ref_cod_exemplar_tipo = $int_ref_exemplar_tipo";