Bug 3351 - Limit Serials Search for Biblio to an item type
[koha.git] / serials / subscription-bib-search.pl
index fa203f3..01c341d 100755 (executable)
@@ -48,7 +48,7 @@ to multipage gestion.
 
 
 use strict;
-require Exporter;
+
 use CGI;
 use C4::Koha;
 use C4::Auth;
@@ -73,7 +73,10 @@ if ($op eq "do_search" && $query) {
 
     # add the itemtype limit if applicable
     my $itemtypelimit = $input->param('itemtypelimit');
-    $query .= " AND itype=$itemtypelimit" if $itemtypelimit;
+    if ( $itemtypelimit ) {
+        my $index = C4::Context->preference("item-level_itypes") ? 'itype' : 'itemtype';
+        $query .= " AND $index=$itemtypelimit";
+    }
     
     $resultsperpage= $input->param('resultsperpage');
     $resultsperpage = 19 if(!defined $resultsperpage);
@@ -180,7 +183,6 @@ if ($op eq "do_search" && $query) {
     my @itemtypesloop;
     my $selected=1;
     my $cnt;
-    my $imgdir = getitemtypeimagesrc('intranet');
     foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
         my %row =(
                     code => $thisitemtype,
@@ -207,7 +209,6 @@ if ($op eq "do_search" && $query) {
     my @itemtypesloop;
     my $selected=1;
     my $cnt;
-    my $imgdir = getitemtypeimagesrc('intranet');
     foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
         my %row =(
                     code => $thisitemtype,