View | Details | Raw Unified | Return to bug 30580
Collapse All | Expand All

(-)a/C4/HoldsQueue.pm (-6 / +7 lines)
Lines 322-328 sub GetItemsAvailableToFillHoldRequestsForBib { Link Here
322
322
323
    my $dbh = C4::Context->dbh;
323
    my $dbh = C4::Context->dbh;
324
    my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype
324
    my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype
325
                       FROM items ";
325
                       FROM items
326
                       LEFT JOIN branchtransfers USING (itemnumber)";
326
327
327
    if (C4::Context->preference('item-level_itypes')) {
328
    if (C4::Context->preference('item-level_itypes')) {
328
        $items_query .=   "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) ";
329
        $items_query .=   "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) ";
Lines 344-350 sub GetItemsAvailableToFillHoldRequestsForBib { Link Here
344
                           AND itemnumber IS NOT NULL
345
                           AND itemnumber IS NOT NULL
345
                           AND (found IS NOT NULL OR priority = 0)
346
                           AND (found IS NOT NULL OR priority = 0)
346
                        )
347
                        )
347
                       AND items.biblionumber = ?";
348
                       AND items.biblionumber = ?
349
                       AND branchtransfers.datearrived IS NULL
350
                       AND branchtransfers.datecancelled IS NULL";
348
351
349
    my @params = ($biblionumber, $biblionumber);
352
    my @params = ($biblionumber, $biblionumber);
350
    if ($branches_to_use && @$branches_to_use) {
353
    if ($branches_to_use && @$branches_to_use) {
Lines 354-366 sub GetItemsAvailableToFillHoldRequestsForBib { Link Here
354
    my $sth = $dbh->prepare($items_query);
357
    my $sth = $dbh->prepare($items_query);
355
    $sth->execute(@params);
358
    $sth->execute(@params);
356
359
357
    my $itm = $sth->fetchall_arrayref({});
360
    my $items = $sth->fetchall_arrayref({});
358
    my @items = grep { ! scalar GetTransfers($_->{itemnumber}) } @$itm;
359
    return [ grep {
361
    return [ grep {
360
        my $rule = GetBranchItemRule($_->{homebranch}, $_->{itype});
362
        my $rule = GetBranchItemRule($_->{homebranch}, $_->{itype});
361
        $_->{holdallowed} = $rule->{holdallowed};
363
        $_->{holdallowed} = $rule->{holdallowed};
362
        $_->{hold_fulfillment_policy} = $rule->{hold_fulfillment_policy};
364
        $_->{hold_fulfillment_policy} = $rule->{hold_fulfillment_policy};
363
    } @items ];
365
    } @$items ];
364
}
366
}
365
367
366
=head2 _checkHoldPolicy
368
=head2 _checkHoldPolicy
367
- 

Return to bug 30580