Merge remote-tracking branch 'origin/new/bug_7016'
This commit is contained in:
commit
367c4fb881
21
C4/Items.pm
21
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 GetItemnumbersForBiblio
|
||||
|
||||
my $itemnumbers = GetItemnumbersForBiblio($biblionumber);
|
||||
|
||||
Given a single biblionumber, return an arrayref 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);
|
||||
|
|
|
|||
|
|
@ -391,14 +391,14 @@ 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){
|
||||
push (@items,@hostitems);
|
||||
push (@$items,@hostitems);
|
||||
}
|
||||
|
||||
foreach my $item (@items){
|
||||
foreach my $item (@$items){
|
||||
return 1 if CanItemBeReserved($borrowernumber, $item);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue