Bugzilla – Attachment 8917 Details for
Bug 7872
C4::Items should use C4::Koha methods instead of duplicating SQL queries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7872 - C4::Items::GetItemsInfo should use C4::Koha instead of SQL queries directly
Bug-7872---C4ItemsGetItemsInfo-should-use-C4Koha-i.patch (text/plain), 3.98 KB, created by
Dobrica Pavlinusic
on 2012-04-05 13:48:18 UTC
(
hide
)
Description:
Bug 7872 - C4::Items::GetItemsInfo should use C4::Koha instead of SQL queries directly
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2012-04-05 13:48:18 UTC
Size:
3.98 KB
patch
obsolete
>From 2315921562919b926951b37e6762e2e9deb3455b Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Thu, 5 Apr 2012 15:41:29 +0200 >Subject: [PATCH] Bug 7872 - C4::Items::GetItemsInfo should use C4::Koha instead of SQL queries directly > >This simplifies code, and has nice side-effect that memoize of >C4::Koha functions will be more effective. >--- > C4/Items.pm | 68 ++++++---------------------------------------------------- > 1 files changed, 7 insertions(+), 61 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 0b2f99b..d7cc645 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1246,73 +1246,19 @@ sub GetItemsInfo { > $data->{'datedue'} = $datedue; > > # get notforloan complete status if applicable >- my $sthnflstatus = $dbh->prepare( >- 'SELECT authorised_value >- FROM marc_subfield_structure >- WHERE kohafield="items.notforloan" >- ' >- ); >- >- $sthnflstatus->execute; >- my ($authorised_valuecode) = $sthnflstatus->fetchrow; >- if ($authorised_valuecode) { >- $sthnflstatus = $dbh->prepare( >- "SELECT lib FROM authorised_values >- WHERE category=? >- AND authorised_value=?" >- ); >- $sthnflstatus->execute( $authorised_valuecode, >- $data->{itemnotforloan} ); >- my ($lib) = $sthnflstatus->fetchrow; >- $data->{notforloanvalue} = $lib; >+ if ( my $category = C4::Koha::GetAuthValCode( 'items.notforloan', $data->{frameworkcode} ) ) { >+ $data->{notforloanvalue} = C4::Koha::GetAuthorisedValueByCode( $category, $data->{itemnotforloan} ); > } > > # get restricted status and description if applicable >- my $restrictedstatus = $dbh->prepare( >- 'SELECT authorised_value >- FROM marc_subfield_structure >- WHERE kohafield="items.restricted" >- ' >- ); >- >- $restrictedstatus->execute; >- ($authorised_valuecode) = $restrictedstatus->fetchrow; >- if ($authorised_valuecode) { >- $restrictedstatus = $dbh->prepare( >- "SELECT lib,lib_opac FROM authorised_values >- WHERE category=? >- AND authorised_value=?" >- ); >- $restrictedstatus->execute( $authorised_valuecode, >- $data->{restricted} ); >- >- if ( my $rstdata = $restrictedstatus->fetchrow_hashref ) { >- $data->{restricted} = $rstdata->{'lib'}; >- $data->{restrictedopac} = $rstdata->{'lib_opac'}; >- } >+ if ( my $category = C4::Koha::GetAuthValCode( 'items.restricted', $data->{frameworkcode} ) ) { >+ $data->{restricted} = C4::Koha::GetKohaAuthorisedValueLib( $category, $data->{restricted} ); >+ $data->{restrictedopac} = C4::Koha::GetKohaAuthorisedValueLib( $category, $data->{restricted}, 'opac' ); > } > > # my stack procedures >- my $stackstatus = $dbh->prepare( >- 'SELECT authorised_value >- FROM marc_subfield_structure >- WHERE kohafield="items.stack" >- ' >- ); >- $stackstatus->execute; >- >- ($authorised_valuecode) = $stackstatus->fetchrow; >- if ($authorised_valuecode) { >- $stackstatus = $dbh->prepare( >- "SELECT lib >- FROM authorised_values >- WHERE category=? >- AND authorised_value=? >- " >- ); >- $stackstatus->execute( $authorised_valuecode, $data->{stack} ); >- my ($lib) = $stackstatus->fetchrow; >- $data->{stack} = $lib; >+ if ( my $category = C4::Koha::GetAuthValCode( 'items.stack', $data->{frameworkcode} ) ) { >+ $data->{stack} = C4::Koha::GetKohaAuthorisedValueLib( $category, $data->{stack} ); > } > # Find the last 3 people who borrowed this item. > my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7872
:
8774
|
8904
|
8917
|
8923
|
9993