Bug 33761: Alter query to remove items with active transfers from available list
Current code removes all items without an active transfer, and any with completed transfers. This patch moves the conditionals for transfers into the join, then adds a new condition to remove items with active transfers. To test: 1 - Apply unit test patch only 2 - prove -v t/db_dependent/HoldsQueue.t 3 - It fails 4 - Apply second patch 5 - prove -v t/db_dependent/HoldsQueue.t 6 - Success! Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
67e9356dea
commit
d95312328d
1 changed files with 6 additions and 4 deletions
|
@ -326,13 +326,14 @@ sub GetItemsAvailableToFillHoldRequestsForBib {
|
|||
$items_query .= "JOIN biblioitems USING (biblioitemnumber)
|
||||
LEFT JOIN itemtypes USING (itemtype) ";
|
||||
}
|
||||
$items_query .= " LEFT JOIN branchtransfers ON (items.itemnumber = branchtransfers.itemnumber)";
|
||||
$items_query .= " LEFT JOIN branchtransfers ON (
|
||||
items.itemnumber = branchtransfers.itemnumber
|
||||
AND branchtransfers.datearrived IS NULL AND branchtransfers.datecancelled IS NULL
|
||||
)";
|
||||
$items_query .= " WHERE items.notforloan = 0
|
||||
AND holdingbranch IS NOT NULL
|
||||
AND itemlost = 0
|
||||
AND withdrawn = 0";
|
||||
$items_query .= " AND branchtransfers.datearrived IS NULL
|
||||
AND branchtransfers.datecancelled IS NULL";
|
||||
$items_query .= " AND damaged = 0" unless C4::Context->preference('AllowHoldsOnDamagedItems');
|
||||
$items_query .= " AND items.onloan IS NULL
|
||||
AND (itemtypes.notforloan IS NULL OR itemtypes.notforloan = 0)
|
||||
|
@ -343,7 +344,8 @@ sub GetItemsAvailableToFillHoldRequestsForBib {
|
|||
AND itemnumber IS NOT NULL
|
||||
AND (found IS NOT NULL OR priority = 0)
|
||||
)
|
||||
AND items.biblionumber = ?";
|
||||
AND items.biblionumber = ?
|
||||
AND branchtransfers.itemnumber IS NULL";
|
||||
|
||||
my @params = ($biblionumber, $biblionumber);
|
||||
if ($branches_to_use && @$branches_to_use) {
|
||||
|
|
Loading…
Reference in a new issue