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

(-)a/C4/HoldsQueue.pm (-6 / +7 lines)
Lines 320-326 sub GetItemsAvailableToFillHoldRequestsForBib { Link Here
320
    my ($biblionumber, $branches_to_use) = @_;
320
    my ($biblionumber, $branches_to_use) = @_;
321
321
322
    my $dbh = C4::Context->dbh;
322
    my $dbh = C4::Context->dbh;
323
    my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype
323
    my $items_query = "SELECT items.itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype
324
                       FROM items ";
324
                       FROM items ";
325
325
326
    if (C4::Context->preference('item-level_itypes')) {
326
    if (C4::Context->preference('item-level_itypes')) {
Lines 329-342 sub GetItemsAvailableToFillHoldRequestsForBib { Link Here
329
        $items_query .=   "JOIN biblioitems USING (biblioitemnumber)
329
        $items_query .=   "JOIN biblioitems USING (biblioitemnumber)
330
                           LEFT JOIN itemtypes USING (itemtype) ";
330
                           LEFT JOIN itemtypes USING (itemtype) ";
331
    }
331
    }
332
    $items_query .=   "WHERE items.notforloan = 0
332
    $items_query .=  " LEFT JOIN branchtransfers ON (items.itemnumber = branchtransfers.itemnumber)";
333
    $items_query .=  " WHERE items.notforloan = 0
333
                       AND holdingbranch IS NOT NULL
334
                       AND holdingbranch IS NOT NULL
334
                       AND itemlost = 0
335
                       AND itemlost = 0
335
                       AND withdrawn = 0";
336
                       AND withdrawn = 0";
337
    $items_query .= "  AND branchtransfers.datearrived IS NULL
338
                       AND branchtransfers.datecancelled IS NULL";
336
    $items_query .= "  AND damaged = 0" unless C4::Context->preference('AllowHoldsOnDamagedItems');
339
    $items_query .= "  AND damaged = 0" unless C4::Context->preference('AllowHoldsOnDamagedItems');
337
    $items_query .= "  AND items.onloan IS NULL
340
    $items_query .= "  AND items.onloan IS NULL
338
                       AND (itemtypes.notforloan IS NULL OR itemtypes.notforloan = 0)
341
                       AND (itemtypes.notforloan IS NULL OR itemtypes.notforloan = 0)
339
                       AND itemnumber NOT IN (
342
                       AND items.itemnumber NOT IN (
340
                           SELECT itemnumber
343
                           SELECT itemnumber
341
                           FROM reserves
344
                           FROM reserves
342
                           WHERE biblionumber = ?
345
                           WHERE biblionumber = ?
Lines 354-365 sub GetItemsAvailableToFillHoldRequestsForBib { Link Here
354
    $sth->execute(@params);
357
    $sth->execute(@params);
355
358
356
    my $itm = $sth->fetchall_arrayref({});
359
    my $itm = $sth->fetchall_arrayref({});
357
    my @items = grep { ! scalar GetTransfers($_->{itemnumber}) } @$itm;
358
    return [ grep {
360
    return [ grep {
359
        my $rule = GetBranchItemRule($_->{homebranch}, $_->{itype});
361
        my $rule = GetBranchItemRule($_->{homebranch}, $_->{itype});
360
        $_->{holdallowed} = $rule->{holdallowed};
362
        $_->{holdallowed} = $rule->{holdallowed};
361
        $_->{hold_fulfillment_policy} = $rule->{hold_fulfillment_policy};
363
        $_->{hold_fulfillment_policy} = $rule->{hold_fulfillment_policy};
362
    } @items ];
364
    } @{$itm} ];
363
}
365
}
364
366
365
=head2 _checkHoldPolicy
367
=head2 _checkHoldPolicy
366
- 

Return to bug 24295