[Koha-cvs] CVS: koha/C4 Search.pm,1.53,1.54

Ambrose Li acli at users.sourceforge.net
Sun Feb 2 09:47:04 CET 2003


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv22217/C4

Modified Files:
	Search.pm 
Log Message:
Distinguish between On Loan, Item Lost, and Withdrawn, instead of saying
just "not available".  Cf. Bug 112


Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** Search.pm	28 Jan 2003 14:46:50 -0000	1.53
--- Search.pm	2 Feb 2003 08:47:01 -0000	1.54
***************
*** 1,4 ****
  package C4::Search;
- #require '/u/acli/lib/cvs.pl'; # XXX
  
  # Copyright 2000-2002 Katipo Communications
--- 1,3 ----
***************
*** 2152,2174 ****
    while (my $data=$sth->fetchrow_hashref){
      $counts{'total'}++;
-     my $query2="select * from issues,items where issues.itemnumber=
-     '$data->{'itemnumber'}' and returndate is NULL
-     and items.itemnumber=issues.itemnumber and ((items.itemlost <>1 and
-     items.itemlost <> 2) or items.itemlost is NULL)
-     and (wthdrawn <> 1 or wthdrawn is NULL)";
  
!     my $sth2=$dbh->prepare($query2);
!     $sth2->execute;
!     # FIXME - fetchrow_hashref() can fail for any number of reasons
!     # (e.g., a database server crash). Perhaps use a left join of some
!     # sort for this?
!     if (my $data2=$sth2->fetchrow_hashref){
!        $counts{'not available'}++;
!        #my $x = "Not available, data2=" . (defined $data2? CGI::escapeHTML(cvs($data2)): "undef");
!        #$counts{$x}++; #XXX
!     } else {
!        $counts{$data->{'branchname'}}++;
      }
!     $sth2->finish;
    }
    my $query2="Select * from aqorders where biblionumber=$bibnum and
--- 2151,2187 ----
    while (my $data=$sth->fetchrow_hashref){
      $counts{'total'}++;
  
!     my $status;
!     for my $test (
!       [
! 	'Item Lost',
! 	'select * from items
! 	  where itemnumber=?
! 	    and not ((items.itemlost <>1 and items.itemlost <> 2)
! 		      or items.itemlost is NULL)'
!       ], [
! 	'Withdrawn',
! 	'select * from items
! 	  where itemnumber=? and not (wthdrawn <> 1 or wthdrawn is NULL)'
!       ], [
! 	'On Loan', "select * from issues,items
! 	  where issues.itemnumber=? and returndate is NULL
! 	    and items.itemnumber=issues.itemnumber"
!       ],
!     ) {
! 	my($testlabel, $query2) = @$test;
! 
! 	my $sth2=$dbh->prepare($query2);
! 	$sth2->execute($data->{'itemnumber'});
! 
! 	# FIXME - fetchrow_hashref() can fail for any number of reasons
! 	# (e.g., a database server crash). Perhaps use a left join of some
! 	# sort for this?
! 	$status = $testlabel if $sth2->fetchrow_hashref;
! 	$sth2->finish;
!     last if defined $status;
      }
!     $status = $data->{'branchname'} unless defined $status;
!     $counts{$status}++;
    }
    my $query2="Select * from aqorders where biblionumber=$bibnum and





More information about the Koha-cvs mailing list