koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 SearchMarc.pm,1.13,1.14


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/C4 SearchMarc.pm,1.13,1.14
Date: Mon, 10 May 2004 02:24:16 -0700

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2695/C4

Modified Files:
        SearchMarc.pm 
Log Message:
Marc search ported to OPAC.
seems to work fine

Index: SearchMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** SearchMarc.pm       16 Apr 2004 07:28:22 -0000      1.13
--- SearchMarc.pm       10 May 2004 09:24:14 -0000      1.14
***************
*** 220,236 ****
        # we have bibid list. Now, loads title and author from [offset] to 
[offset]+[length]
        my $counter = $offset;
!       $sth = $dbh->prepare("select author,title from biblio,marc_biblio where 
biblio.biblionumber=marc_biblio.biblionumber and bibid=?");
        my @finalresult = ();
        while (($counter <= $#result) && ($counter <= ($offset + $length))) {
                $sth->execute($result[$counter]);
!               my ($author,$title) = $sth->fetchrow;
!               my %line;
!               $line{bibid}=$result[$counter];
!               $line{author}=$author;
!               $line{title}=$title;
!               push @finalresult, \%line;
                $counter++;
        }
! 
        my $nbresults = $#result + 1;
        return (address@hidden, $nbresults);
--- 220,275 ----
        # we have bibid list. Now, loads title and author from [offset] to 
[offset]+[length]
        my $counter = $offset;
!       $sth = $dbh->prepare("SELECT biblio.biblionumber,author, title, 
items.holdingbranch, items.itemcallnumber, bibid
!                                                       FROM biblio, 
marc_biblio left join items on items.biblionumber = biblio.biblionumber
!                                                       WHERE 
biblio.biblionumber = marc_biblio.biblionumber AND bibid = ?
!                                                       GROUP BY 
items.biblionumber, items.holdingbranch, items.itemcallnumber");
        my @finalresult = ();
+       my @CNresults=();
+       my $oldbiblionumber=0;
+       my $totalitems=0;
+       my ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, 
$bibid);
+       my ($oldbibid, $oldauthor, $oldtitle,$oldbiblionumber);
        while (($counter <= $#result) && ($counter <= ($offset + $length))) {
                $sth->execute($result[$counter]);
!               while (($biblionumber,$author,$title,$holdingbranch, 
$itemcallnumber, $bibid) = $sth->fetchrow) {
! #                     warn "bibid : $oldbiblionumber 
($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid)";
!                       # parse the result, putting holdingbranch & 
itemcallnumber in separate array
!                       # then author, title & 1st array in main array
!                       if ($oldbiblionumber && ($oldbiblionumber ne 
$biblionumber)) {
!                               my %line;
!                               $line{bibid}=$oldbibid;
!                               $line{author}=$oldauthor;
!                               $line{title}=$oldtitle;
!                               $line{totitem} = $totalitems;
!                               $line{biblionumber} = $oldbiblionumber;
!                               my @CNresults2= @CNresults;
!                               $line{CN} = address@hidden;
!                               @CNresults = ();
!                               push @finalresult, \%line;
!                               $totalitems=0;
!                       }
!                       $oldbibid = $bibid;
!                       $oldauthor = $author;
!                       $oldtitle = $title;
!                       $oldbiblionumber = $biblionumber;
!                       $totalitems++ if ($holdingbranch);
!                       my %lineCN;
!                       $lineCN{holdingbranch} = $holdingbranch;
!                       $lineCN{itemcallnumber} = $itemcallnumber;
!                       push @CNresults,\%lineCN;
!               }
                $counter++;
        }
! # add the last line, that is not reached byt the loop / if 
($oldbiblionumber...)
!       my %line;
!       $line{bibid}=$oldbibid;
!       $line{author}=$oldauthor;
!       $line{title}=$oldtitle;
!       $line{totitem} = $totalitems;
!       $line{biblionumber} = $oldbiblionumber;
!       my @CNresults2= @CNresults;
!       $line{CN} = address@hidden;
!       @CNresults = ();
!       push @finalresult, \%line;
        my $nbresults = $#result + 1;
        return (address@hidden, $nbresults);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]