koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 Search.pm,1.86,1.87


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/C4 Search.pm,1.86,1.87
Date: Wed, 24 Mar 2004 02:44:50 -0800

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

Modified Files:
        Search.pm 
Log Message:
bugfixes for newsearches

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -r1.86 -r1.87
*** Search.pm   11 Feb 2004 08:40:10 -0000      1.86
--- Search.pm   24 Mar 2004 10:44:48 -0000      1.87
***************
*** 86,96 ****
        my $i=0;
        my @result;
!       while (my $line = $sth->fetchrow_hashref) {
!               if ($i>=$offset && $i+$offset<$num) {
!                       push @result,$line;
                }
                $i++
        }
!       return(@result);
  
  }
--- 86,155 ----
        my $i=0;
        my @result;
!       while (my $data = $sth->fetchrow_hashref) {
!               if ($i>=$offset && $i<$num+$offset) {
!                       my ($counts) = itemcount2("", $data->{'biblionumber'}, 
'intra');
!                       my $subject2=$data->{'subject'};
!                       $subject2=~ s/ /%20/g;
!                       $data->{'itemcount'}=$counts->{'total'};
!                       my $totalitemcounts=0;
!                       foreach my $key (keys %$counts){
!                               if ($key ne 'total'){   # FIXME - Should ignore 
'order', too.
!                                       #$data->{'location'}.="$key 
$counts->{$key} ";
!                                       $totalitemcounts+=$counts->{$key};
!                                       
$data->{'locationhash'}->{$key}=$counts->{$key};
!                               }
!                       }
!                       my $locationtext='';
!                       my $locationtextonly='';
!                       my $notavailabletext='';
!                       foreach (sort keys %{$data->{'locationhash'}}) {
!                               if ($_ eq 'notavailable') {
!                                       $notavailabletext="Not available";
!                                       my $c=$data->{'locationhash'}->{$_};
!                                       
$data->{'not-available-p'}=$totalitemcounts;
!                                       if ($totalitemcounts>1) {
!                                       $notavailabletext.=" ($c)";
!                                       $data->{'not-available-plural-p'}=1;
!                                       }
!                               } else {
!                                       $locationtext.="$_ ";
!                                       my $c=$data->{'locationhash'}->{$_};
!                                       if ($_ eq 'Item Lost') {
!                                       $data->{'lost-p'}=$totalitemcounts;
!                                       $data->{'lost-plural-p'}=1
!                                                       if $totalitemcounts > 1;
!                                       } elsif ($_ eq 'Withdrawn') {
!                                       $data->{'withdrawn-p'}=$totalitemcounts;
!                                       $data->{'withdrawn-plural-p'}=1
!                                                       if $totalitemcounts > 1;
!                                       } elsif ($_ eq 'On Loan') {
!                                       $data->{'on-loan-p'}=$totalitemcounts;
!                                       $data->{'on-loan-plural-p'}=1
!                                                       if $totalitemcounts > 1;
!                                       } else {
!                                       $locationtextonly.=$_;
!                                       $locationtextonly.=" ($c), "
!                                                       if $totalitemcounts>1;
!                                       }
!                                       if ($totalitemcounts>1) {
!                                       $locationtext.=" ($c), ";
!                                       }
!                               }
!                       }
!                       if ($notavailabletext) {
!                               $locationtext.=$notavailabletext;
!                       } else {
!                               $locationtext=~s/, $//;
!                       }
!                       $data->{'location'}=$locationtext;
!                       $data->{'location-only'}=$locationtextonly;
!                       $data->{'subject2'}=$subject2;
!                       $data->{'use-location-flags-p'}=1; # XXX
! 
!                       push @result,$data;
                }
                $i++
        }
!       return($i,@result);
  
  }
***************
*** 252,255 ****
--- 311,315 ----
                        }
                        my $locationtext='';
+                       my $locationtextonly='';
                        my $notavailabletext='';
                        foreach (sort keys %{$data->{'locationhash'}}) {
***************
*** 257,266 ****
--- 317,345 ----
                                        $notavailabletext="Not available";
                                        my $c=$data->{'locationhash'}->{$_};
+                                       
$data->{'not-available-p'}=$totalitemcounts;
                                        if ($totalitemcounts>1) {
                                        $notavailabletext.=" ($c)";
+                                       $data->{'not-available-plural-p'}=1;
                                        }
                                } else {
                                        $locationtext.="$_";
                                        my $c=$data->{'locationhash'}->{$_};
+                                       if ($_ eq 'Item Lost') {
+                                       $data->{'lost-p'}=$totalitemcounts;
+                                       $data->{'lost-plural-p'}=1
+                                                       if $totalitemcounts > 1;
+                                       } elsif ($_ eq 'Withdrawn') {
+                                       $data->{'withdrawn-p'}=$totalitemcounts;
+                                       $data->{'withdrawn-plural-p'}=1
+                                                       if $totalitemcounts > 1;
+                                       } elsif ($_ eq 'On Loan') {
+                                       $data->{'on-loan-p'}=$totalitemcounts;
+                                       $data->{'on-loan-plural-p'}=1
+                                                       if $totalitemcounts > 1;
+                                       } else {
+                                       $locationtextonly.=$_;
+                                       $locationtextonly.=" ($c), "
+                                                       if $totalitemcounts>1;
+                                       }
                                        if ($totalitemcounts>1) {
                                        $locationtext.=" ($c), ";
***************
*** 274,278 ****
--- 353,359 ----
                        }
                        $data->{'location'}=$locationtext;
+                       $data->{'location-only'}=$locationtextonly;
                        $data->{'subject2'}=$subject2;
+                       $data->{'use-location-flags-p'}=1; # XXX
                }
        }
***************
*** 1336,1340 ****
      if ($datedue eq ''){
  #     $datedue="Available";
!       my ($restype,$reserves)=CheckReserves($data->{'itemnumber'});
        if ($restype){
            $datedue=$restype;
--- 1417,1421 ----
      if ($datedue eq ''){
  #     $datedue="Available";
!       my 
($restype,$reserves)=C4::Reserves2::CheckReserves($data->{'itemnumber'});
        if ($restype){
            $datedue=$restype;




reply via email to

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