[Koha-cvs] CVS: koha/C4 Search.pm,1.18.2.14,1.18.2.15

Steve Tonnesen tonnesen at users.sourceforge.net
Tue Oct 29 17:48:54 CET 2002


Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv26323/C4

Modified Files:
      Tag: rel-1-2
	Search.pm 
Log Message:
Bug fixes... some found through new catalog.t test!


Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.18.2.14
retrieving revision 1.18.2.15
diff -C2 -r1.18.2.14 -r1.18.2.15
*** Search.pm	25 Oct 2002 16:36:32 -0000	1.18.2.14
--- Search.pm	29 Oct 2002 16:48:52 -0000	1.18.2.15
***************
*** 825,835 ****
    my $dbh = &C4Connect;
    my $query = '';
!     my @results;
!   # FIXME - Why not just
!   #	$search->{'title'} = quotemeta($search->{'title'})
!   # to escape all questionable characters, not just single-quotes?
!   $search->{'title'}=~ s/'/\\'/g;
!   $search->{'author'}=~ s/'/\\'/g;
!   $search->{'illustrator'}=~ s/'/\\'/g;
    my $title = lc($search->{'title'}); 
    
--- 825,832 ----
    my $dbh = &C4Connect;
    my $query = '';
!   my @results;
!   $search->{'title'} = quotemeta($search->{'title'});
!   $search->{'author'} = quotemeta($search->{'author'});
!   $search->{'illustrator'} = quotemeta($search->{'illustrator'});
    my $title = lc($search->{'title'}); 
    
***************
*** 960,964 ****
  	    $query.= "Select * from biblio where abstract like '%$search->{'abstract'}%'";
  	  }
!           $query .=" group by biblio.biblionumber";	 
        }
    } 
--- 957,961 ----
  	    $query.= "Select * from biblio where abstract like '%$search->{'abstract'}%'";
  	  }
!           ($query) && ($query .=" group by biblio.biblionumber");
        }
    } 
***************
*** 1038,1042 ****
        $query=$query." order by biblio.author,title";
    } else {
!       $query=$query." order by title";
    }
  } else {
--- 1035,1039 ----
        $query=$query." order by biblio.author,title";
    } else {
!       ($query) && ($query.=" order by title");
    }
  } else {
***************
*** 1046,1049 ****
--- 1043,1048 ----
  }
  #print STDERR "$query\n";
+ 
+ ($query) || (return);
  my $sth=$dbh->prepare($query);
  $sth->execute;
***************
*** 1245,1249 ****
      and (wthdrawn <> 1 or wthdrawn is NULL)";
    }
!   $query .= " order by items.dateaccessioned desc";
      #warn $query;
    my $sth=$dbh->prepare($query);
--- 1244,1248 ----
      and (wthdrawn <> 1 or wthdrawn is NULL)";
    }
!   ($query) && ($query .= " order by items.dateaccessioned desc");
      #warn $query;
    my $sth=$dbh->prepare($query);
***************
*** 1696,1700 ****
            || die $sth2->errstr;
  
!         for (my $i2 = 0; $i2 < 2; $i2++) {
              if (my $data2 = $sth2->fetchrow_hashref) {
                  $data->{"timestamp$i2"} = $data2->{'timestamp'};
--- 1695,1700 ----
            || die $sth2->errstr;
  
! 
!         for (my $i2 = 0; $i2 < (($sth2->rows<2) ? ($sth2->rows) : (2)); $i2++) {
              if (my $data2 = $sth2->fetchrow_hashref) {
                  $data->{"timestamp$i2"} = $data2->{'timestamp'};





More information about the Koha-cvs mailing list