From fee2ddc086bb585eadf4651703621c6eb0126f55 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Wed, 18 Jun 2008 13:57:22 -0500 Subject: [PATCH] Fix for bug 2212: Searching with Itemtype limit doesn't work The issue was that the index for itemtype is different depending on whether you're using item-level or bib-level itemtypes. This patch detects the system choice and sets the index properly --- catalogue/search.pl | 4 +++- opac/opac-search.pl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 101fd68535..4d45f6f776 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -219,6 +219,8 @@ $template->param(branchloop => \@branch_loop, searchdomainloop => $categories); # load the Type stuff # load the Type stuff my $itemtypes = GetItemTypes; +# the index parameter is different for item-level itemtypes +my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; my @itemtypesloop; my $selected=1; my $cnt; @@ -228,7 +230,7 @@ my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { my %row =( number=>$cnt++, imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"", - ccl => 'itemtype', + ccl => $itype_or_itemtype, code => $thisitemtype, selected => $selected, description => $itemtypes->{$thisitemtype}->{'description'}, diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 45d03faed5..b0e0e50ab4 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -127,6 +127,8 @@ $template->param(branchloop => \@branch_loop, searchdomainloop => $categories); # load the Type stuff my $itemtypes = GetItemTypes; +# the index parameter is different for item-level itemtypes +my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; my @itemtypesloop; my $selected=1; my $cnt; @@ -137,7 +139,7 @@ if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { my %row =( number=>$cnt++, imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"", - ccl => 'itemtype', + ccl => $itype_or_itemtype, code => $thisitemtype, selected => $selected, description => $itemtypes->{$thisitemtype}->{'description'}, -- 2.39.5