[Koha-patches] [PATCH] reintroducing the limit on itemtype when searching a biblio in subscription add

paul.poulain at biblibre.com paul.poulain at biblibre.com
Fri Apr 4 11:16:01 CEST 2008


From: Paul POULAIN <paul.poulain at biblibre.com>

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tmpl
index 548ef9b..933c0a6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tmpl
@@ -17,7 +17,21 @@
     <input type="hidden" name="type" value="intranet" />
     <label for="q">Keyword</label>
     <input type="text" id="q"  name="q" />
+    
+    <!-- ITEMTYPE LIMITS -->
+        <p>Limit type to: 
+        <select name="itemtypelimit">
+        <!--TMPL_LOOP Name="itemtypeloop"-->
+            <option value="<!--TMPL_VAR Name="code" -->" />
+            <!--TMPL_VAR Name="description" -->
+        <!--/TMPL_LOOP-->
+        </select>
+        </p>
+    <!-- /ITEMTYPE LIMITS -->
+
     <input type="submit" value="Search" />
+
+
 </form>
 
 </div>
diff --git a/serials/subscription-bib-search.pl b/serials/subscription-bib-search.pl
index bda92dd..3e8d7a9 100755
--- a/serials/subscription-bib-search.pl
+++ b/serials/subscription-bib-search.pl
@@ -71,6 +71,10 @@ my $query = $input->param('q');
 # don't run the search if no search term !
 if ($op eq "do_search" && $query) {
 
+    # add the itemtype limit if applicable
+    my $itemtypelimit = $input->param('itemtypelimit');
+    $query .= " AND itype=$itemtypelimit" if $itemtypelimit;
+    
     $resultsperpage= $input->param('resultsperpage');
     $resultsperpage = 19 if(!defined $resultsperpage);
 
@@ -172,6 +176,22 @@ if ($op eq "do_search" && $query) {
                 flagsrequired => {catalogue => 1, serials=>1},
                 debug => 1,
                 });
+    # load the itemtypes
+    my $itemtypes = GetItemTypes;
+    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,
+                    selected => $selected,
+                    description => $itemtypes->{$thisitemtype}->{'description'},
+                );
+        $selected = 0 if ($selected) ;
+        push @itemtypesloop, \%row;
+    }
+    $template->param(itemtypeloop => \@itemtypesloop);
     $template->param("no_query" => 1);
 }
  else {
@@ -183,7 +203,22 @@ if ($op eq "do_search" && $query) {
                 flagsrequired => {catalogue => 1, serials=>1},
                 debug => 1,
                 });
-
+    # load the itemtypes
+    my $itemtypes = GetItemTypes;
+    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,
+                    selected => $selected,
+                    description => $itemtypes->{$thisitemtype}->{'description'},
+                );
+        $selected = 0 if ($selected) ;
+        push @itemtypesloop, \%row;
+    }
+    $template->param(itemtypeloop => \@itemtypesloop);
     $template->param("no_query" => 0);
 }
 
-- 
1.5.3.2




More information about the Koha-patches mailing list