From c0ce2a5b279c6d642c45282f6e44db4ee64eead9 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 2 Apr 2012 16:03:38 +0200 Subject: [PATCH] [Signed-off] Bug 7872 - C4::Items::GetItemsInfo marc_subfield_structure SQL queries fetch all results and use first row. Adding frameworkcode to SQL queries will help returning just one (correct) row, improve performance and allow caching of values in future. Signed-off-by: Alex Arnaud --- C4/Items.pm | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 0b2f99b..de808e5 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1250,10 +1250,11 @@ sub GetItemsInfo { 'SELECT authorised_value FROM marc_subfield_structure WHERE kohafield="items.notforloan" + AND frameworkcode = ? ' ); - $sthnflstatus->execute; + $sthnflstatus->execute( $data->{frameworkcode} ); my ($authorised_valuecode) = $sthnflstatus->fetchrow; if ($authorised_valuecode) { $sthnflstatus = $dbh->prepare( @@ -1272,10 +1273,11 @@ sub GetItemsInfo { 'SELECT authorised_value FROM marc_subfield_structure WHERE kohafield="items.restricted" + AND frameworkcode = ? ' ); - $restrictedstatus->execute; + $restrictedstatus->execute( $data->{frameworkcode} ); ($authorised_valuecode) = $restrictedstatus->fetchrow; if ($authorised_valuecode) { $restrictedstatus = $dbh->prepare( @@ -1297,9 +1299,10 @@ sub GetItemsInfo { 'SELECT authorised_value FROM marc_subfield_structure WHERE kohafield="items.stack" + AND frameworkcode = ? ' ); - $stackstatus->execute; + $stackstatus->execute( $data->{frameworkcode} ); ($authorised_valuecode) = $stackstatus->fetchrow; if ($authorised_valuecode) { -- 1.7.0.4