https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41959 Bug ID: 41959 Summary: Holds queue builder doesn't always check all holds when using transport cost matrix Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Hold requests Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, lisette@bywatersolutions.com, tomascohen@gmail.com The scenario presented itself under a specific circumstance Library A ordered a copy of a book and left in 'on order' status Library B purchased a copy and made it available Each library can only fill holds on their own items The transport cost matrix only allows items to transfer to their own branch The transfer limits only allows items to transfer to their own branch A patron of Library A places a title level hold, it can't fill because library A's item is unavailable (on order) A patron of Library B places a title level hold, it should be queued for library B's item In C4::HoldsQueue::MapItemsToHoldRequests we call _allocateWithTransportCostMatrix In _allocateWithTranportCostMatrix we have this code: if ( $num_tasks > $num_agents ) { @remaining = @requests[ $num_agents .. $num_tasks - 1 ]; @requests = @requests[ 0 .. $num_agents - 1 ]; $num_tasks = $num_agents; } task = requests and agents = items In our scenario - 2 tasks/requests and 1 item/agent The code above drops the second request, and sets tasks to 1 We then loop tasks and agents: for ( my $i = 0 ; $i < $num_agents ; $i++ ) { for ( my $j = $r ; $j < $num_tasks ; $j++ ) { But since we have dcereased things above, we only check the first task/request - the second hold, which should be filled, is never checked -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.