From 46984721c5cc1b971b406423fac73c3f8cbdb7e2 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 9 Oct 2007 16:46:29 -0500 Subject: [PATCH] One can search on only one limit (for instance : Get ALL Documents from ONE branch) Sorting branches for results. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Search.pm | 20 +++++++++----------- catalogue/search.pl | 6 +++--- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 16597c0c23..1c508c6482 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -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; diff --git a/catalogue/search.pl b/catalogue/search.pl index a236d57d9b..8240557bce 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -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"}, -- 2.39.5