Bug 41410

Summary: Allow definition of a period after hold creation during which the hold is only filled locally
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: Hold requestsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt, lisette, tomascohen
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:

Description Andrew Fuerste-Henry 2025-12-09 17:21:19 UTC
Currently, with local holds priority enabled the holds queue will always target an available local item if one exists; this preference is enforced before Koha consults the transport cost matrix or thinks about the Hungarian algorithm.

This dev will:
- add a new field to tmp_holdsqueue: local priority match
- add a new system preference to enable this option and set days value for local priority period
- local priority period is defined relative to when the hold was created
- when the queue targets an item, add the local priority match flag if the target item is within the local holds group of the hold pickup location
- at checkin, if the item could fill a hold Koha will check:
-- is this item within the hold pickup group? If yes, fill hold; if no, proceed to next check
-- is the hold within the local priority period? If no, fill hold; if yes, proceed to next check
-- does the queue's current target have the local priority match flag? If no, fill hold; if yes, do not fill hold (look for other holds this item could fill or check item in)