One can search on only one limit (for instance : Get ALL Documents from ONE branch)
authorHenri-Damien LAURENT <henridamien@koha-fr.org>
Tue, 9 Oct 2007 21:46:29 +0000 (16:46 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 9 Oct 2007 23:40:25 +0000 (18:40 -0500)
Sorting branches for results.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Search.pm
catalogue/search.pl

index 16597c0..1c508c6 100644 (file)
@@ -248,7 +248,7 @@ sub getRecords {
         $expanded_facet, $branches,         $query_type,
         $scan
     ) = @_;
-    warn "Query : $koha_query";
+    warn "Query : $koha_query";
     my @servers = @$servers_ref;
     my @sort_by = @$sort_by_ref;
 
@@ -790,9 +790,9 @@ sub buildQuery {
     $human_search_desc =~ s/^ //g;
     my $koha_query = $query;
 
-    #warn "QUERY:".$koha_query;
-    #warn "SEARCHDESC:".$human_search_desc;
-    #warn "FEDERATED QUERY:".$federated_query;
+#     warn "QUERY:".$koha_query;
+#     warn "SEARCHDESC:".$human_search_desc;
+#     warn "FEDERATED QUERY:".$federated_query;
     return ( undef, $human_search_desc, $koha_query, $federated_query );
 }
 
@@ -971,16 +971,14 @@ sub searchResults {
 
                 # Last resort
                 elsif ( $item->{'holdingbranch'} ) {
-                    $items->{ $item->{'homebranch'} }->{count}++;
+                    $items->{ $item->{'holdingbranch'} }->{count}++;
                 }
                 $items->{ $item->{'homebranch'}.'--'.$item->{'itemcallnumber'} }->{itemcallnumber} =                $item->{itemcallnumber};
                 $items->{ $item->{'homebranch'}.'--'.$item->{'itemcallnumber'} }->{location} =                $item->{location};
                 $items->{ $item->{'homebranch'}.'--'.$item->{'itemcallnumber'} }->{branchcode} =               $item->{homebranch};
             }
         }    # notforloan, item level and biblioitem level
-        for my $key ( keys %$items ) {
-
-            #warn "key: $key";
+        for my $key ( sort keys %$items ) {
             my $this_item = {
                 branchname     => $branches{$items->{$key}->{branchcode}},
                 branchcode     => $items->{$key}->{branchcode},
@@ -1058,9 +1056,9 @@ sub searchResults {
 }
 
 
-=head2 EditBiblios
+=head2 ModBiblios
 
-($countchanged,$listunchanged) = EditBiblios($listbiblios, $tagsubfield,$initvalue,$targetvalue,$test);
+($countchanged,$listunchanged) = ModBiblios($listbiblios, $tagsubfield,$initvalue,$targetvalue,$test);
 
 this function changes all the values $initvalue in subfield $tag$subfield in any record in $listbiblios
 test parameter if set donot perform change to records in database.
@@ -1089,7 +1087,7 @@ $template->param(countchanged => $countchanged, loopunchanged=>$listunchanged);
 
 =cut
 
-sub EditBiblios{
+sub ModBiblios{
   my ($listbiblios,$tagsubfield,$initvalue,$targetvalue,$test)=@_;
   my $countmatched;
   my @unmatched;
index a236d57..8240557 100755 (executable)
@@ -162,7 +162,7 @@ my ($template,$borrowernumber,$cookie);
 # decide which template to use
 my $template_name;
 my @params = $cgi->param("limit");
-if ((@params>1) || ($cgi->param("q")) ) {
+if ((@params>=1) || ($cgi->param("q")) ) {
     $template_name = 'catalogue/results.tmpl';
 }
 else {
@@ -215,7 +215,7 @@ query parser.
 my $branches = GetBranches();
 my @branch_loop;
 push @branch_loop, {value => "", branchname => "All Branches", };
-for my $branch_hash (keys %$branches) {
+for my $branch_hash (sort keys %$branches) {
     push @branch_loop, {value => "branch: $branch_hash", branchname => $branches->{$branch_hash}->{'branchname'}, };
 }
 $template->param(branchloop => \@branch_loop,);
@@ -397,7 +397,7 @@ if ($@ || $error) {
 my $op=$cgi->param("operation");
 if ($op eq "bulkedit"){
         my ($countchanged,$listunchanged)=
-          EditBiblios($results_hashref->{'biblioserver'}->{"RECORDS"},
+          ModBiblios($results_hashref->{'biblioserver'}->{"RECORDS"},
                       $params->{"tagsubfield"},
                       $params->{"inputvalue"},
                       $params->{"targetvalue"},