Bugzilla – Attachment 9127 Details for
Bug 7016
CanBookBeReserved uses GetItemsInfo unnecessarily
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7016 Followup: Add new GetItemnumberForBiblio subroutine
Bug-7016-Followup-Add-new-GetItemnumberForBiblio-s.patch (text/plain), 2.25 KB, created by
Galen Charlton
on 2012-04-11 20:16:20 UTC
(
hide
)
Description:
Bug 7016 Followup: Add new GetItemnumberForBiblio subroutine
Filename:
MIME Type:
Creator:
Galen Charlton
Created:
2012-04-11 20:16:20 UTC
Size:
2.25 KB
patch
obsolete
>From afb3f4fa8c8862b7369bfbecffc263bc68843b1a Mon Sep 17 00:00:00 2001 >From: Ian Walls <ian.walls@bywatersolutions.com> >Date: Fri, 6 Jan 2012 09:53:49 -0500 >Subject: [PATCH] Bug 7016 Followup: Add new GetItemnumberForBiblio subroutine > >Adds a new subroutine in C4::Items, GetItemnumbersForBiblio, which takes a >single biblionumber, and returns an array of all the corresponding itemnumbers. > >This patch also replaces the usage of get_itemnumbers_of in C4::Reserves::CanBookBeReserved >with this new subroutine, as the output is more consistent with what we were >lookng for (this is what fixes the bug issue). > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >--- > C4/Items.pm | 21 +++++++++++++++++++++ > C4/Reserves.pm | 2 +- > 2 files changed, 22 insertions(+), 1 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 4790091..3d6a9f4 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -66,6 +66,7 @@ BEGIN { > GetItemsInfo > GetItemsLocationInfo > GetHostItemsInfo >+ GetItemnumbersForBiblio > get_itemnumbers_of > get_hostitemnumbers_of > GetItemnumberFromBarcode >@@ -1495,6 +1496,26 @@ sub GetLastAcquisitions { > return @results; > } > >+=head2 GetItemnumberForBiblio >+ >+ my @itemnumbers = GetItemnumbersForBiblio($biblionumber); >+ >+Given a single biblionumber, return an array of all the corresponding itemnumbers >+ >+=cut >+ >+sub GetItemnumbersForBiblio { >+ my $biblionumber = shift; >+ my @items; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ?"); >+ $sth->execute($biblionumber); >+ while (my $result = $sth->fetchrow_hashref) { >+ push @items, $result->{'itemnumber'}; >+ } >+ return \@items; >+} >+ > =head2 get_itemnumbers_of > > my @itemnumbers_of = get_itemnumbers_of(@biblionumbers); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 930d524..53db80d 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -391,7 +391,7 @@ sub GetReservesFromBorrowernumber { > sub CanBookBeReserved{ > my ($borrowernumber, $biblionumber) = @_; > >- my @items = get_itemnumbers_of($biblionumber); >+ my @items = GetItemnumbersForBiblio($biblionumber); > #get items linked via host records > my @hostitems = get_hostitemnumbers_of($biblionumber); > if (@hostitems){ >-- >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 7016
:
5861
|
5998
|
5999
|
7071
| 9127 |
9128