Bug 6947 : opac-topissues.pl wasn't respecting item live itemtypes
authorChris Cormack <chrisc@catalyst.net.nz>
Fri, 28 Oct 2011 19:49:20 +0000 (08:49 +1300)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 16 Jan 2012 13:53:43 +0000 (14:53 +0100)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
The search was only looking for bib level itypes independent
from the settings for item-level_itypes.

After patch the system preference setting is respected
and search works accordingly.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
opac/opac-topissues.pl

index 6899215..05b7a27 100755 (executable)
@@ -2,6 +2,7 @@
 
 
 # Copyright 2000-2002 Katipo Communications
+# Parts Copyright Catalyst IT 2011
 #
 # This file is part of Koha.
 #
@@ -83,7 +84,14 @@ if($advanced_search_types eq 'ccode'){
                     ";
     $template->param(ccodesearch => 1);
 }else{
-    $whereclause .= ' AND biblioitems.itemtype='.$dbh->quote($itemtype) if $itemtype;
+    if ($itemtype){
+       if (C4::Context->preference('item-level_itypes')){
+           $whereclause .= ' AND items.itype = ' . $dbh->quote($itemtype);
+       }
+       else {
+           $whereclause .= ' AND biblioitems.itemtype='.$dbh->quote($itemtype);
+        }
+    }
     $query = "SELECT datecreated, biblio.biblionumber, title,
                     author, sum( items.issues ) AS tot, biblioitems.itemtype,
                     biblioitems.publishercode,biblioitems.publicationyear,