[Koha-devel] CVS: koha search.pl,1.6,1.7

Chris Cormack rangi at users.sourceforge.net
Mon May 6 17:10:01 CEST 2002


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

Modified Files:
	search.pl 
Log Message:
Now use the new hash based results returned from Search.pm



Index: search.pl
===================================================================
RCS file: /cvsroot/koha/koha/search.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** search.pl	8 Apr 2002 23:44:43 -0000	1.6
--- search.pl	7 May 2002 00:09:06 -0000	1.7
***************
*** 150,162 ****
  while ($i < $count2){
  #    print $results[$i]."\n";
!     my @stuff=split('\t',$results[$i]);
!     $stuff[1]=~ s/\`/\\\'/g;
!     my $title2=$stuff[1];
      $title2=~ s/ /%20/g;
      if ($subject eq ''){
! #      print $stuff[0];
!       $stuff[1]=mklink("/cgi-bin/koha/detail.pl?type=$type&bib=$stuff[2]&title=$title2",$stuff[1]);
!       my $word=$stuff[0];
! #      print $word;
        $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
        $word=~ s/  //g;
--- 150,163 ----
  while ($i < $count2){
  #    print $results[$i]."\n";
! #    my @stuff=split('\t',$results[$i]);
!     my $result=$results[$i];
!     $result->{'title'}=~ s/\`/\\\'/g;
!     my $title2=$result->{'title'};
      $title2=~ s/ /%20/g;
+     my $location='';
+     my $itemcount;
      if ($subject eq ''){
!       $result->{'title'}=mklink("/cgi-bin/koha/detail.pl?type=$type&bib=$result->{'biblionumber'}&title=$title2",$result->{'title'});
!       my $word=$result->{'author'};
        $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
        $word=~ s/  //g;
***************
*** 165,238 ****
        $word=~ s/\n//g;
        my $url="/cgi-bin/koha/search.pl?author=$word&type=$type";
!       $stuff[7]=$stuff[5];
!       $stuff[5]='';
!       $stuff[0]=mklink($url,$stuff[0]);
!       my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit,$ocount)=itemcount($env,$stuff[2],$type);
!       $stuff[4]=$count;
        if ($nacount > 0){
!         $stuff[5]=$stuff[5]."On Loan";
  	if ($nacount >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($nacount)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";
        }
        if ($lcount > 0){
!          $stuff[5]=$stuff[5]."Levin";
           if ($lcount >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($lcount)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";
        }
        if ($fcount > 0){
!         $stuff[5]=$stuff[5]."Foxton";
           if ($fcount >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($fcount)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";	
        }
        if ($scount > 0){
!         $stuff[5]=$stuff[5]."Shannon";
           if ($scount >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($scount)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";	
        }
        if ($lostcount > 0){
!         $stuff[5]=$stuff[5]."Lost";
           if ($lostcount >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($lostcount)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";	
        }
        if ($mending > 0){
!         $stuff[5]=$stuff[5]."Mending";
           if ($mending >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($mending)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";	
        }
        if ($transit > 0){
!         $stuff[5]=$stuff[5]."In Transiit";
           if ($transit >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($transit)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";	
        }
        if ($ocount > 0){
!         $stuff[5]=$stuff[5]."On Order";
           if ($ocount >1 ){                                                                                                         
! 	  $stuff[5]=$stuff[5]." ($ocount)";                                                                                            
           }                                                                                                                         
! 	 $stuff[5].=" ";	
        }
        
!       if ($type ne 'opac'){
!         $stuff[6]=mklink("/cgi-bin/koha/request.pl?bib=$stuff[2]","Request");
!       }
      } else {
!       my $word=$stuff[1];
        $word=~ s/ /%20/g;
        
!         $stuff[1]=mklink("/cgi-bin/koha/subjectsearch.pl?subject=$word&type=$type",$stuff[1]);
  
      }
--- 166,241 ----
        $word=~ s/\n//g;
        my $url="/cgi-bin/koha/search.pl?author=$word&type=$type";
!       $result->{'author'}=mklink($url,$result->{'author'});
!       my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit,$ocount)=itemcount($env,$result->{'biblionumber'},$type);
!       $itemcount=$count;
!       ####
!       # Fix this chunk below, remove all hardcoded branch references
!       # need to fix itemcount as well
!       ###
        if ($nacount > 0){
!         $location=$location."On Loan";
  	if ($nacount >1 ){                                                                                                         
! 	  $location=$location." ($nacount)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";
        }
        if ($lcount > 0){
!          $location=$location."Levin";
           if ($lcount >1 ){                                                                                                         
! 	  $location=$location." ($lcount)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";
        }
        if ($fcount > 0){
!         $location=$location."Foxton";
           if ($fcount >1 ){                                                                                                         
! 	  $location=$location." ($fcount)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";	
        }
        if ($scount > 0){
!         $location=$location."Shannon";
           if ($scount >1 ){                                                                                                         
! 	  $location=$location." ($scount)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";	
        }
        if ($lostcount > 0){
!         $location=$location."Lost";
           if ($lostcount >1 ){                                                                                                         
! 	  $location=$location." ($lostcount)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";	
        }
        if ($mending > 0){
!         $location=$location."Mending";
           if ($mending >1 ){                                                                                                         
! 	  $location=$location." ($mending)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";	
        }
        if ($transit > 0){
!         $location=$location."In Transiit";
           if ($transit >1 ){                                                                                                         
! 	  $location=$location." ($transit)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";	
        }
        if ($ocount > 0){
!         $location=$location."On Order";
           if ($ocount >1 ){                                                                                                         
! 	  $location=$location." ($ocount)";                                                                                            
           }                                                                                                                         
! 	 $location.=" ";	
        }
        
! #      if ($type ne 'opac'){
! #        $result->{'request'}=mklink("/cgi-bin/koha/request.pl?bib=$stuff[2]","Request");
! #      }
      } else {
!       my $word=$result->{'subject'};
        $word=~ s/ /%20/g;
        
!         $result->{'title'}=mklink("/cgi-bin/koha/subjectsearch.pl?subject=$word&type=$type",$result->{'subject'});
  
      }
***************
*** 240,253 ****
      if ($colour == 1){
        if ($illustrator) {
! 	  print mktablerow(7,$secondary,$stuff[1],$stuff[0],$stuff[7],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
        } else {
! 	  print mktablerow(6,$secondary,$stuff[1],$stuff[0],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
        }
        $colour=0;
      } else {
        if ($illustrator) {
! 	  print mktablerow(7,'white',$stuff[1],$stuff[0],$stuff[7],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
        } else {
! 	  print mktablerow(6,'white',$stuff[1],$stuff[0],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
        }
        $colour=1;
--- 243,256 ----
      if ($colour == 1){
        if ($illustrator) {
! 	  print mktablerow(7,$secondary,$result->{'title'},$result->{'author'},$result->{'illus'},$result->{'copyrightdate'},$itemcount,$location);
        } else {
! 	  print mktablerow(6,$secondary,$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
        }
        $colour=0;
      } else {
        if ($illustrator) {
! 	  print mktablerow(7,'white',$result->{'title'},$result->{'author'},$result->{'illus'},$result->{'copyrightdate'},$itemcount,$location);
        } else {
! 	  print mktablerow(6,'white',$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
        }
        $colour=1;





More information about the Koha-devel mailing list