[Koha-cvs] CVS: koha/C4 Search.pm,1.34,1.35

Finlay Thompson finlayt at users.sourceforge.net
Thu Aug 22 04:32:01 CEST 2002


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

Modified Files:
	Search.pm 
Log Message:

Fixed up the display of bibitems, implemented some restrictions on which items can be reserved.


Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** Search.pm	15 Aug 2002 02:02:40 -0000	1.34
--- Search.pm	22 Aug 2002 02:31:58 -0000	1.35
***************
*** 1438,1457 ****
      my ($bibnum) = @_;
      my $dbh   = C4Connect;
!     my $query = "Select * from biblioitems, itemtypes, items
! where biblioitems.biblionumber = '$bibnum'
! and biblioitems.itemtype = itemtypes.itemtype
! and biblioitems.biblioitemnumber = items.biblioitemnumber
! group by items.biblioitemnumber";
      my $sth   = $dbh->prepare($query);
      my $count = 0;
      my @results;
! 
!     $sth->execute;
! 
      while (my $data = $sth->fetchrow_hashref) {
          $results[$count] = $data;
          $count++;
!     } # while
!     
      $sth->finish;
      $dbh->disconnect;
--- 1438,1455 ----
      my ($bibnum) = @_;
      my $dbh   = C4Connect;
!     my $query = "SELECT biblioitems.*, itemtypes.*, MIN(items.itemlost) as itemlost
!                           FROM biblioitems, itemtypes, items
!                          WHERE biblioitems.biblionumber     = ?
!                            AND biblioitems.itemtype         = itemtypes.itemtype
!                            AND biblioitems.biblioitemnumber = items.biblioitemnumber
!                       GROUP BY items.biblioitemnumber";
      my $sth   = $dbh->prepare($query);
      my $count = 0;
      my @results;
!     $sth->execute($bibnum);
      while (my $data = $sth->fetchrow_hashref) {
          $results[$count] = $data;
          $count++;
!     } # while    
      $sth->finish;
      $dbh->disconnect;
***************
*** 1459,1484 ****
  } # sub bibitems
  
- 
  sub barcodes{
!   #called from request.pl
!   my ($biblioitemnumber)=@_;
!   my $dbh=C4Connect;
!   my $query="Select barcode from items where
!    biblioitemnumber='$biblioitemnumber'
!    and ((itemlost <> 1 and itemlost <> 2) or itemlost is NULL) and
!    (wthdrawn <> 1 or wthdrawn is NULL)";
! 
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
!   my @barcodes;
!   my $i=0;
!   while (my $data=$sth->fetchrow_hashref){
!     $barcodes[$i]=$data->{'barcode'};
!     $i++;
!   }
!   $sth->finish;
!   $dbh->disconnect;
!   return(@barcodes);
!   
  }
  
--- 1457,1478 ----
  } # sub bibitems
  
  sub barcodes{
!     #called from request.pl
!     my ($biblioitemnumber)=@_;
!     my $dbh=C4Connect;
!     my $query="SELECT barcode, itemlost FROM items
!                            WHERE biblioitemnumber = ?
!                              AND (wthdrawn <> 1 OR wthdrawn IS NULL)";
!     my $sth=$dbh->prepare($query);
!     $sth->execute($biblioitemnumber);
!     my @barcodes;
!     my $i=0;
!     while (my $data=$sth->fetchrow_hashref){
! 	$barcodes[$i]=$data;
! 	$i++;
!     }
!     $sth->finish;
!     $dbh->disconnect;
!     return(@barcodes);
  }
  





More information about the Koha-cvs mailing list