Bug 40771

Summary: Wrong transfer breaking check in for holds when using library transfer limits
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: CirculationAssignee: Nick Clemens (kidclamp) <nick>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aspencatteam, gmcharlt, kyle, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 39750    
Bug Blocks:    
Attachments: Bug 40771: Fix error in the case of AutoFill
Bug 40771: Fix transfer error when not auto filling hold
Bug 40771: Fix error in the case of AutoFill
Bug 40771: Fix transfer error when not auto filling hold

Description Nick Clemens (kidclamp) 2025-09-08 21:33:17 UTC
Bug 39750 fixed the case of a transfer with no hold - it seems the same problem can occur when the transfer is for a hold:


Line 178 of returns.pl
        my $hold = Koha::Holds->find($reserve_id);
        if ($diffBranchSend) {
            my $tobranch = $hold->pickup_library();

            # Add transfer, enqueue if one is already in the queue, and immediately set to in transit
            my $transfer = $item->request_transfer( { to => $tobranch, reason => 'Reserve', enqueue => 1 } );
            $transfer->transit;
        }
Comment 1 Nick Clemens (kidclamp) 2025-12-17 14:35:14 UTC
Created attachment 190585 [details] [review]
Bug 40771: Fix error in the case of AutoFill

Similar to previous patches we need to ignore limits to return a reserve where it belongs

To test:
 1 - Set sysprefs:
     UseBranchTransferLimits/BranchTransferLimitsType:
         To Enforce based on collection
     HoldsAutoFill: Do
 2 - Administration->Library Transfer limits click (Advanced editor)
 3 - Uncheck Centerville->Fairfield for 'Fiction'
 4 - Find or create a Fiction item at centerville
 5 - Place a hold on the item for a patron to pickup at Centerville
 6 - Check the item in at Centerville
 7 - Switch branch to Fairfield
 8 - Check in the item
 9 - Boom!
     Exception 'Koha::Exceptions::Item::Transfer::Limit' thrown 'Transfer not allowed'
10 - Apply patch, restart all
11 - Check in the item at Fairfield
12 - Correctly transferred to Centerville
Comment 2 Nick Clemens (kidclamp) 2025-12-17 14:35:17 UTC
Created attachment 190586 [details] [review]
Bug 40771: Fix transfer error when not auto filling hold

This patch is another occurence where correcting a reserve transfer requires ignoring limits

To test:
1 - Follow previous test plan
2 - Disable HoldsAutoFill
3 - Set library to Centerville
4 - Check the item in and confirm hold
5 - Set library to Fairfield
6 - Check the item in and confirm transfer
7 - Boom! Same error as before
8 - Apply this patch, restart all
9 - Check item in
10 - Correctly transferred to Centerville
Comment 3 Nick Clemens (kidclamp) 2025-12-17 14:35:37 UTC
Created attachment 190587 [details] [review]
Bug 40771: Fix error in the case of AutoFill

Similar to previous patches we need to ignore limits to return a reserve where it belongs

To test:
 1 - Set sysprefs:
     UseBranchTransferLimits/BranchTransferLimitsType:
         To Enforce based on collection
     HoldsAutoFill: Do
 2 - Administration->Library Transfer limits click (Advanced editor)
 3 - Uncheck Centerville->Fairfield for 'Fiction'
 4 - Find or create a Fiction item at centerville
 5 - Place a hold on the item for a patron to pickup at Centerville
 6 - Check the item in at Centerville
 7 - Switch branch to Fairfield
 8 - Check in the item
 9 - Boom!
     Exception 'Koha::Exceptions::Item::Transfer::Limit' thrown 'Transfer not allowed'
10 - Apply patch, restart all
11 - Check in the item at Fairfield
12 - Correctly transferred to Centerville

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Nick Clemens (kidclamp) 2025-12-17 14:35:39 UTC
Created attachment 190588 [details] [review]
Bug 40771: Fix transfer error when not auto filling hold

This patch is another occurence where correcting a reserve transfer requires ignoring limits

To test:
1 - Follow previous test plan
2 - Disable HoldsAutoFill
3 - Set library to Centerville
4 - Check the item in and confirm hold
5 - Set library to Fairfield
6 - Check the item in and confirm transfer
7 - Boom! Same error as before
8 - Apply this patch, restart all
9 - Check item in
10 - Correctly transferred to Centerville

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Nick Clemens (kidclamp) 2025-12-17 14:35:54 UTC
Trivial, self SO