[Koha-devel] CVS: koha/C4 Search.pm,1.8,1.9

Chris Cormack rangi at users.sourceforge.net
Sun Nov 25 20:34:02 CET 2001


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

Modified Files:
	Search.pm 
Log Message:
Fixing a bug in keyword search was duplicating results


Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Search.pm	2001/11/26 00:41:34	1.8
--- Search.pm	2001/11/26 04:33:42	1.9
***************
*** 317,321 ****
    $i=0;
    while (my $data=$sth->fetchrow_hashref){
!     my $sti=$dbh->prepare("select dewey,subclass from biblioitems where biblionumber=$data->{'biblionumber'}");
      $sti->execute;
      my ($dewey, $subclass) = $sti->fetchrow;
--- 317,322 ----
    $i=0;
    while (my $data=$sth->fetchrow_hashref){
!     my $sti=$dbh->prepare("select dewey,subclass from biblioitems where biblionumber=$data->{'biblionumber'}
!     ");
      $sti->execute;
      my ($dewey, $subclass) = $sti->fetchrow;
***************
*** 330,338 ****
    $sth->finish;
    $sth=$dbh->prepare("Select biblionumber from bibliosubject where subject
!   like '%$search->{'keyword'}%'");
    $sth->execute;
    while (my $data=$sth->fetchrow_hashref){
      $query="Select * from biblio,biblioitems where
!     biblio.biblionumber=$data->{'biblionumber'} and biblio.biblionumber=biblioitems.biblionumber";
      if ($search->{'class'} ne ''){
        my @temp=split(/\|/,$search->{'class'});
--- 331,340 ----
    $sth->finish;
    $sth=$dbh->prepare("Select biblionumber from bibliosubject where subject
!   like '%$search->{'keyword'}%' group by biblionumber");
    $sth->execute;
    while (my $data=$sth->fetchrow_hashref){
      $query="Select * from biblio,biblioitems where
!     biblio.biblionumber=$data->{'biblionumber'} and biblio.biblionumber=biblioitems.biblionumber
!     group by biblio.biblionumber";
      if ($search->{'class'} ne ''){
        my @temp=split(/\|/,$search->{'class'});
***************
*** 348,352 ****
  #    print $query;
      while (my $data2=$sth2->fetchrow_hashref){
!        $results[$i]="$data2->{'author'}\t$data2->{'title'}\t$data2->{'biblionumber'}\t$data2->{'copyrightdate'}";
  #      print $results[$i];
        $i++;   
--- 350,360 ----
  #    print $query;
      while (my $data2=$sth2->fetchrow_hashref){
!       my $dewey= $data2->{'dewey'};
!       my $subclass=$data2->{'subclass'};
!       $dewey=~s/\.*0*$//;          
!       ($dewey == 0) && ($dewey='');              
!       ($dewey) && ($dewey.=" $subclass") ;                  
! #      $sti->finish;              
!        $results[$i]="$data2->{'author'}\t$data2->{'title'}\t$data2->{'biblionumber'}\t$data2->{'copyrightdate'}\t$dewey";
  #      print $results[$i];
        $i++;   





More information about the Koha-devel mailing list