[Koha-patches] [PATCH] Bug 7872 - C4::Items::GetItemsInfo marc_subfield_structure
Dobrica Pavlinusic
dpavlin at rot13.org
Mon Apr 2 16:05:56 CEST 2012
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.
---
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.2.5
More information about the Koha-patches
mailing list