This patch adds a check for the item-level_itypes preference
when building the SQL for the overdues report.
---
 circ/overdue.pl |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/circ/overdue.pl b/circ/overdue.pl
index 2bdafe1..7467874 100755
--- a/circ/overdue.pl
+++ b/circ/overdue.pl
@@ -265,7 +265,13 @@ if ($noreport) {
     $strsth.=" AND date_due               < '" . $todaysdate     . "' " unless 
($showall);
     $strsth.=" AND (borrowers.firstname like '".$bornamefilter."%' or 
borrowers.surname like '".$bornamefilter."%' or borrowers.cardnumber like 
'".$bornamefilter."%')" if($bornamefilter) ;
     $strsth.=" AND borrowers.categorycode = '" . $borcatfilter   . "' " if 
$borcatfilter;
-    $strsth.=" AND biblioitems.itemtype   = '" . $itemtypefilter . "' " if 
$itemtypefilter;
+    if( $itemtypefilter ){
+        if( C4::Context->preference('item-level_itypes') ){
+            $strsth.=" AND items.itype   = '" . $itemtypefilter . "' ";
+        } else {
+            $strsth.=" AND biblioitems.itemtype   = '" . $itemtypefilter . "' 
";
+        }
+    }
     $strsth.=" AND borrowers.flags        = '" . $borflagsfilter . "' " if 
$borflagsfilter;
     $strsth.=" AND borrowers.branchcode   = '" . $branchfilter   . "' " if 
$branchfilter;
     $strsth.=" AND date_due < '" . $datedueto . "' "  if $datedueto;
-- 
1.7.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to