Lines 315-321
sub GetItemsAvailableToFillHoldRequestsForBib {
Link Here
|
315 |
|
315 |
|
316 |
my $dbh = C4::Context->dbh; |
316 |
my $dbh = C4::Context->dbh; |
317 |
my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype |
317 |
my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype |
318 |
FROM items "; |
318 |
FROM items |
|
|
319 |
LEFT JOIN branchtransfers USING (itemnumber)"; |
319 |
|
320 |
|
320 |
if (C4::Context->preference('item-level_itypes')) { |
321 |
if (C4::Context->preference('item-level_itypes')) { |
321 |
$items_query .= "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) "; |
322 |
$items_query .= "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) "; |
Lines 337-343
sub GetItemsAvailableToFillHoldRequestsForBib {
Link Here
|
337 |
AND itemnumber IS NOT NULL |
338 |
AND itemnumber IS NOT NULL |
338 |
AND (found IS NOT NULL OR priority = 0) |
339 |
AND (found IS NOT NULL OR priority = 0) |
339 |
) |
340 |
) |
340 |
AND items.biblionumber = ?"; |
341 |
AND items.biblionumber = ? |
|
|
342 |
AND branchtransfers.datearrived IS NULL |
343 |
AND branchtransfers.datecancelled IS NULL"; |
341 |
|
344 |
|
342 |
my @params = ($biblionumber, $biblionumber); |
345 |
my @params = ($biblionumber, $biblionumber); |
343 |
if ($branches_to_use && @$branches_to_use) { |
346 |
if ($branches_to_use && @$branches_to_use) { |
Lines 347-359
sub GetItemsAvailableToFillHoldRequestsForBib {
Link Here
|
347 |
my $sth = $dbh->prepare($items_query); |
350 |
my $sth = $dbh->prepare($items_query); |
348 |
$sth->execute(@params); |
351 |
$sth->execute(@params); |
349 |
|
352 |
|
350 |
my $itm = $sth->fetchall_arrayref({}); |
353 |
my $items = $sth->fetchall_arrayref({}); |
351 |
my @items = grep { ! scalar C4::Circulation::GetTransfers($_->{itemnumber}) } @$itm; |
|
|
352 |
return [ grep { |
354 |
return [ grep { |
353 |
my $rule = C4::Circulation::GetBranchItemRule($_->{homebranch}, $_->{itype}); |
355 |
my $rule = C4::Circulation::GetBranchItemRule($_->{homebranch}, $_->{itype}); |
354 |
$_->{holdallowed} = $rule->{holdallowed}; |
356 |
$_->{holdallowed} = $rule->{holdallowed}; |
355 |
$_->{hold_fulfillment_policy} = $rule->{hold_fulfillment_policy}; |
357 |
$_->{hold_fulfillment_policy} = $rule->{hold_fulfillment_policy}; |
356 |
} @items ]; |
358 |
} @$items ]; |
357 |
} |
359 |
} |
358 |
|
360 |
|
359 |
=head2 _checkHoldPolicy |
361 |
=head2 _checkHoldPolicy |
360 |
- |
|
|