https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41410
--- Comment #19 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 200244 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200244&action=edit Bug 41410: Add local holds priority exclusivity period When LocalHoldsPriority is enabled, the holds queue picks a local-group item for eligible holds. Until now there was nothing to reserve that priority at checkin time: if a non-local item was returned first, it would happily fill the hold and the local-priority decision was lost. This patch adds a time-bounded exclusivity window so that, for a configurable number of days after a hold is placed, a hold whose queue target is a local-group item will not be filled by a non-local item. Changes: - C4/HoldsQueue.pm: in MapItemsToHoldRequests, flag %item_map entries that matched on local library (GiveLibrary/GiveLibraryAndGroup) or local hold group (GiveLibraryGroup/GiveLibraryAndGroup) with local_holdgroup_match => 1, and propagate that into both the tmp_holdsqueue and hold_fill_targets INSERTs. - C4/Reserves.pm: in the CheckReserves loop, when LocalHoldsPriorityExclusivityPeriod is set, the hold is still within that window, and the item being evaluated is not itself a local match, skip the reserve if its hold_fill_targets row has local_holdgroup_match = 1. Missing hold_fill_targets row means "no information" -- fall through so holds are never trapped between queue runs. - circulation.pref: expose the new LocalHoldsPriorityExclusivityPeriod preference next to the existing LocalHoldsPriority* entries. The feature is a no-op unless both LocalHoldsPriority is set to something other than "Don't give" AND LocalHoldsPriorityExclusivityPeriod is > 0. Test plan: 1) Apply the patches and run the atomicupdate. 2) Set up a library group flagged as a local hold group containing two libraries (call them A and B). Add a third library C that is NOT in the group. 3) Add one item to each library (itemA, itemB, itemC) on the same biblio. 4) Administration -> System preferences -> Circulation: - Set LocalHoldsPriority to "Give library group". - Set LocalHoldsPriorityPatronControl to "home library". - Set LocalHoldsPriorityItemControl to "home library". - Set LocalHoldsPriorityExclusivityPeriod to 7. 5) As a patron whose home library is A, place a title-level hold with pickup at A. 6) Run the holds queue (misc/cronjobs/holds/build_holds_queue.pl). -> The queue should target itemA (or itemB) for this hold. -> Confirm in the database: SELECT reserve_id, itemnumber, local_holdgroup_match FROM hold_fill_targets; The targeted row must have local_holdgroup_match = 1. -> Holds to pull / holds queue report should also show the flag (tmp_holdsqueue.local_holdgroup_match = 1). 7) At library C, check in itemC (the non-local item). -> The hold must NOT be captured -- itemC simply goes back on the shelf. 8) At library A, check in itemA (the local item). -> The hold IS captured for the patron. 9) Cancel and re-place the hold, run the queue again. Manually age the hold past the window: UPDATE reserves SET reservedate = DATE_SUB(CURRENT_DATE, INTERVAL 10 DAY) WHERE reserve_id = <id>; Now check in itemC again. -> The hold IS captured (exclusivity window has expired). 10) Re-place the hold but do NOT run the queue. With no hold_fill_targets row for the reserve, check in itemC. -> The hold IS captured (we never trap holds between queue runs). 11) Flip LocalHoldsPriorityExclusivityPeriod back to 0 and repeat step 7. -> The hold IS captured; the feature is fully disabled. 12) Run: prove t/db_dependent/Holds/LocalHoldsPriority.t \ t/db_dependent/HoldsQueue.t \ t/db_dependent/Reserves.t \ t/db_dependent/Koha/Hold.t -> All tests pass. Sponsored-by: Main Library Alliance <https://www.mainlib.org/> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
