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>
This commit is contained in:
parent
823b807ac9
commit
f84671dce9
2 changed files with 22 additions and 1 deletions
21
C4/Items.pm
21
C4/Items.pm
|
@ -70,6 +70,7 @@ BEGIN {
|
|||
GetItemsInfo
|
||||
GetItemsLocationInfo
|
||||
GetHostItemsInfo
|
||||
GetItemnumbersForBiblio
|
||||
get_itemnumbers_of
|
||||
get_hostitemnumbers_of
|
||||
GetItemnumberFromBarcode
|
||||
|
@ -1497,6 +1498,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);
|
||||
|
|
|
@ -383,7 +383,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){
|
||||
|
|
Loading…
Reference in a new issue