Fix for bug 2212: Searching with Itemtype limit doesn't work
authorJoshua Ferraro <jmf@liblime.com>
Wed, 18 Jun 2008 18:57:22 +0000 (13:57 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Wed, 18 Jun 2008 18:57:22 +0000 (13:57 -0500)
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
opac/opac-search.pl

index 101fd68..4d45f6f 100755 (executable)
@@ -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'},
index 45d03fa..b0e0e50 100755 (executable)
@@ -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'},