Bug 15062: Holds queue with Transport Cost Matrix will transfer item even if transfers disabled

If the transfer of an item from Library A to Library B is disabled in
the Transport Cost Matrix, but the only item on a record is from Library
A, the holds queue will request a transfer of that item from Library A
to Library B even though the rules state such a transfer is not allowed!

Test Plan:
1) Enable the transport cost matrix
2) For simplicity, leave all cells disabled on it, save this state.
   This state means that only items at each location should fill
   holds where the pickup library is that same location.
3) Create a record with one item, set its home and holding branch
   to Library A
4) Create a hold for pickup at Library B
5) Rebuild the holds queue
6) Note the transfer request for the item to Library B
7) Apply this patch
8) Rebuild the holds queue
9) Note the transfer request is gone

Signed-off-by: Andreas Hedström Mace <andreas.hedstrom.mace@sub.su.se>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle Hall 2015-10-26 08:30:57 -04:00 committed by Tomas Cohen Arazi
parent 5f19b24f86
commit 2036be0b87

View file

@ -446,7 +446,7 @@ sub MapItemsToHoldRequests {
}
}
else {
warn "No transport costs for $pickup_branch";
next;
}
}
@ -618,7 +618,7 @@ sub least_cost_branch {
# Nothing really spectacular: supply to branch, a list of potential from branches
# and find the minimum from - to value from the transport_cost_matrix
return $from->[0] if @$from == 1;
return $from->[0] if ( @$from == 1 && $transport_cost_matrix->{$to}{$from->[0]}->{disable_transfer} != 1 );
# If the pickup library is in the list of libraries to pull from,
# return that library right away, it is obviously the least costly