[Koha-cvs] CVS: koha/C4 Search.pm,1.30,1.31

Steve Tonnesen tonnesen at users.sourceforge.net
Thu Jul 11 07:48:03 CEST 2002


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

Modified Files:
	Search.pm 
Log Message:
Cleaned up contents of location information


Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** Search.pm	28 Jun 2002 08:53:51 -0000	1.30
--- Search.pm	11 Jul 2002 05:48:01 -0000	1.31
***************
*** 111,119 ****
        $subject2=~ s/ /%20/g;
        $data->{'itemcount'}=$counts->{'total'};
        foreach my $key (keys %$counts){
          if ($key ne 'total'){
!           $data->{'location'}.="$key $counts->{$key} ";
           }
        }
        $data->{'subject2'}=$subject2;
      }
--- 111,145 ----
        $subject2=~ s/ /%20/g;
        $data->{'itemcount'}=$counts->{'total'};
+       my $totalitemcounts=0;
        foreach my $key (keys %$counts){
          if ($key ne 'total'){
!           #$data->{'location'}.="$key $counts->{$key} ";
! 	  $totalitemcounts+=$counts->{$key};
!           $data->{'locationhash'}->{$key}=$counts->{$key};
           }
        }
+       my $locationtext='';
+       my $notavailabletext='';
+       foreach (sort keys %{$data->{'locationhash'}}) {
+ 	  if ($_ eq 'notavailable') {
+ 	      $notavailabletext="Not available";
+ 	      my $c=$data->{'locationhash'}->{$_};
+ 	      if ($totalitemcounts>1) {
+ 		  $notavailabletext.=" ($c)";
+ 	      }
+ 	  } else {
+ 	      $locationtext.="$_";
+ 	      my $c=$data->{'locationhash'}->{$_};
+ 	      if ($totalitemcounts>1) {
+ 		  $locationtext.=" ($c), ";
+ 	      }
+ 	  }
+       }
+       if ($notavailabletext) {
+ 	  $locationtext.=$notavailabletext;
+       } else {
+ 	  $locationtext=~s/, $//;
+       }
+       $data->{'location'}=$locationtext;
        $data->{'subject2'}=$subject2;
      }
***************
*** 762,766 ****
    }
    $query .= " order by items.dateaccessioned desc";
!     warn $query;
    my $sth=$dbh->prepare($query);
    $sth->execute;
--- 788,792 ----
    }
    $query .= " order by items.dateaccessioned desc";
!     #warn $query;
    my $sth=$dbh->prepare($query);
    $sth->execute;





More information about the Koha-cvs mailing list