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
_______________________________________________
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/