Bug 28530 - Allow configuration of floating limits by item type
Summary: Allow configuration of floating limits by item type
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Lucas Gass (lukeg)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-08 17:23 UTC by Andrew Fuerste-Henry
Modified: 2026-02-10 22:48 UTC (History)
9 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement adds the ability to define and enforce a maximum number of items per item type to be held at each library when items are allowed to float. This feature is enabled with the UseLibraryFloatLimits system preference. Float limits are defined within Administration. Items checked in at a library that has met its float limit for that item type will be transferred to the branch with the lowest ratio of held items to allowed items.
Version(s) released in:
26.05.00
Circulation function:


Attachments
Bug 28530: Update database, add new schema file (9.43 KB, patch)
2023-12-19 16:47 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.43 KB, patch)
2023-12-19 16:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.67 KB, patch)
2023-12-19 16:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.92 KB, patch)
2023-12-19 16:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (8.98 KB, patch)
2023-12-19 16:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (8.42 KB, patch)
2023-12-19 16:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.11 KB, patch)
2023-12-19 16:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.43 KB, patch)
2023-12-19 16:57 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.67 KB, patch)
2023-12-19 16:57 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.92 KB, patch)
2023-12-19 16:57 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (8.98 KB, patch)
2023-12-19 16:57 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (8.43 KB, patch)
2023-12-19 16:57 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.11 KB, patch)
2023-12-19 16:57 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.43 KB, patch)
2023-12-19 17:28 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.67 KB, patch)
2023-12-19 17:28 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.92 KB, patch)
2023-12-19 17:29 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (8.98 KB, patch)
2023-12-19 17:29 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (8.43 KB, patch)
2023-12-19 17:29 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.11 KB, patch)
2023-12-19 17:29 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up): Fix qa issues (2.57 KB, patch)
2023-12-19 18:41 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.44 KB, patch)
2023-12-19 19:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.67 KB, patch)
2023-12-19 19:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.92 KB, patch)
2023-12-19 19:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (8.98 KB, patch)
2023-12-19 19:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (8.43 KB, patch)
2023-12-19 19:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.11 KB, patch)
2023-12-19 19:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Fix QA issues (9.09 KB, patch)
2023-12-19 19:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.46 KB, patch)
2023-12-19 19:10 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.80 KB, patch)
2023-12-19 19:10 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.92 KB, patch)
2023-12-19 19:10 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (9.92 KB, patch)
2023-12-19 19:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (8.43 KB, patch)
2023-12-19 19:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.14 KB, patch)
2023-12-19 19:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit (1.06 KB, patch)
2023-12-19 19:16 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.50 KB, patch)
2023-12-19 19:38 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.85 KB, patch)
2023-12-19 19:38 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.97 KB, patch)
2023-12-19 19:38 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (9.97 KB, patch)
2023-12-19 19:38 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 28530: Implement float limits (8.48 KB, patch)
2023-12-19 19:38 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.19 KB, patch)
2023-12-19 19:38 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit (1.12 KB, patch)
2023-12-19 19:38 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 28530: (QA follow-up): Implement CSRF cud op (1.75 KB, patch)
2024-03-26 12:48 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.51 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.86 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (9.98 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (8.54 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.20 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit (1.12 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up): Implement CSRF cud op (1.75 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.98 KB, patch)
2024-07-02 11:23 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (10.30 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.86 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.24 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (6.41 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.20 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit (1.12 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up): Implement CSRF cud op (1.75 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.89 KB, patch)
2025-02-26 18:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Template adjustmentts for CSRF and Bootstrap 5 (1.30 KB, patch)
2025-02-27 14:49 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Tidy admin-menu.inc (5.64 KB, patch)
2025-02-27 14:55 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Fix remaining QA script failures (2.03 KB, patch)
2025-02-27 15:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) correct item count and limit enforcement (1.39 KB, patch)
2025-03-04 20:50 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (10.33 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.90 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.28 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Implement float limits (6.45 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.24 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit (1.17 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: (QA follow-up): Implement CSRF cud op (1.79 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.93 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Template adjustmentts for CSRF and Bootstrap 5 (1.35 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Tidy admin-menu.inc (5.69 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Fix remaining QA script failures (2.07 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) correct item count and limit enforcement (1.44 KB, patch)
2025-03-04 21:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (10.34 KB, patch)
2025-03-31 09:44 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.90 KB, patch)
2025-03-31 09:44 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.29 KB, patch)
2025-03-31 09:44 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (6.46 KB, patch)
2025-03-31 09:44 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (8.09 KB, patch)
2025-03-31 09:44 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit (1.17 KB, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up): Implement CSRF cud op (1.79 KB, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Update existing schema files (3.92 KB, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Template adjustmentts for CSRF and Bootstrap 5 (1.35 KB, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Tidy admin-menu.inc (5.69 KB, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Fix remaining QA script failures (2.08 KB, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) correct item count and limit enforcement (1.44 KB, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Adjust number of tests (687 bytes, patch)
2025-03-31 09:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Adjust number of tests (731 bytes, patch)
2025-03-31 12:56 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Use DBIC query and return library object (5.08 KB, patch)
2025-06-03 23:21 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Do not count onloan items towards the float limit (5.16 KB, patch)
2025-07-28 16:58 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Count incoming transfers against the float limit (7.16 KB, patch)
2025-07-28 17:49 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Subtract outgoing transfers from the branches float limit (4.29 KB, patch)
2025-07-30 22:05 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Fix sorting and pick a random branch in the event of a tie (5.51 KB, patch)
2025-07-31 16:39 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.61 KB, patch)
2025-07-31 20:54 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.90 KB, patch)
2025-07-31 20:54 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.29 KB, patch)
2025-07-31 20:54 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (14.11 KB, patch)
2025-07-31 20:54 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (24.92 KB, patch)
2025-07-31 20:54 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.61 KB, patch)
2025-07-31 21:13 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.84 KB, patch)
2025-07-31 21:13 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.16 KB, patch)
2025-07-31 21:13 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (13.89 KB, patch)
2025-07-31 21:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (19.59 KB, patch)
2025-07-31 21:14 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: DBIC changes DO NOT PUSH (3.87 KB, patch)
2025-07-31 21:16 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (2.62 KB, patch)
2025-07-31 22:47 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (2.14 KB, patch)
2025-08-01 00:06 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (2.87 KB, patch)
2025-08-01 00:20 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (2.99 KB, patch)
2025-08-01 00:22 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add more tests (8.57 KB, patch)
2025-08-01 15:26 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.61 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.84 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.16 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (13.89 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (19.59 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: DBIC changes DO NOT PUSH (3.87 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (2.99 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add more tests (8.57 KB, patch)
2025-08-27 17:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Increment and decrement item count before calculation (3.17 KB, patch)
2025-10-07 13:53 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Adjust tests (2.38 KB, patch)
2025-10-08 21:08 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.61 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.84 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.32 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (13.89 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (19.29 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: DBIC changes DO NOT PUSH (3.87 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (2.99 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add more tests (8.57 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Increment and decrement item count before calculation (3.17 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Adjust tests (2.38 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Fix tests (1.17 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Fix forbidden http pattern (1.80 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Fix spelling mistakes (2.70 KB, patch)
2025-12-15 16:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Add missing use statement for Koha::Library::FloatLimits (722 bytes, patch)
2025-12-16 14:55 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.66 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.88 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.36 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add unit tests (13.94 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Implement float limits (19.34 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: DBIC changes DO NOT PUSH (3.92 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (3.03 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add more tests (8.61 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Increment and decrement item count before calculation (3.22 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Adjust tests (2.42 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Fix tests (1.21 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Fix forbidden http pattern (1.84 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Fix spelling mistakes (2.75 KB, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Add missing use statement for Koha::Library::FloatLimits (768 bytes, patch)
2025-12-17 20:04 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28530: Update database, add new schema file (9.72 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Add Koha Object(s) for Float Limits (4.95 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Add float limits editor (14.42 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Add unit tests (14.00 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Implement float limits (19.41 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: DBIC changes DO NOT PUSH (3.98 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: If return policy is set to float in library group, remove non group branches (3.10 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Add more tests (8.68 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Increment and decrement item count before calculation (3.28 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Adjust tests (2.49 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Fix tests (1.28 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Fix forbidden http pattern (1.91 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Fix spelling mistakes (2.81 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: Add missing use statement for Koha::Library::FloatLimits (835 bytes, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Remove unused LibraryFloatLimitTransferRequest message handling (1.63 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Guard against divide by zero (974 bytes, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Use DBIC in controller (2.08 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Add POD documentation and database index (3.92 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Fix N+1 query performance issue (10.48 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: (QA follow-up) Fix branch transfer limits not checking alternate libraries (1.96 KB, patch)
2026-02-04 18:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 28530: (RM follow-up) Move kohastructure update to right place alphabetically (2.70 KB, patch)
2026-02-10 17:08 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 28530: (follow-up) Place system pref in corret order (1.60 KB, patch)
2026-02-10 22:45 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2021-06-08 17:23:55 UTC
When return policy is set to Item Floats, it's possible for patron usage patterns to result in an imbalance in the collection -- more DVDs end up at Branch A and more books at Branch B. This can be especially troublesome when a given branch has limited shelving for a specific item type.

I'd like to see a mechanism by which libraries can define a maximum count of items per item type to be allowed to float at a given branch. So, following my example above, Branch A could say that DVDs float when checked in but only up to 1000 items. If a DVD is checked in at Branch A and would be the 1001st DVD there, it instead transfers away. When some DVDs get checked out or transferred away, new returns will again be allowed to remain at Branch A.

Setting the float limit to zero for a given item type and branch would make that item type always transfer away from that branch.
Comment 1 Christofer Zorn 2023-03-16 13:40:40 UTC
+1

We also would like to see this functionality added in. As we move to a more floating based system, we are going to rely on CollectionsHQ to tell us how to shift. It would be a great option to see this built into the ILS.
Comment 2 carthur@slolibrary.org 2023-12-13 00:05:44 UTC
We would also like this as a feature, it would be very helpful to have this as we are also using CollectionHQ to tell us how to shift our collections.

-Charlie
Comment 3 Kyle M Hall (khall) 2023-12-19 16:47:04 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall (khall) 2023-12-19 16:51:05 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall (khall) 2023-12-19 16:51:11 UTC Comment hidden (obsolete)
Comment 6 Kyle M Hall (khall) 2023-12-19 16:51:13 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall (khall) 2023-12-19 16:51:15 UTC Comment hidden (obsolete)
Comment 8 Kyle M Hall (khall) 2023-12-19 16:51:17 UTC Comment hidden (obsolete)
Comment 9 Kyle M Hall (khall) 2023-12-19 16:51:20 UTC Comment hidden (obsolete)
Comment 10 Kyle M Hall (khall) 2023-12-19 16:57:11 UTC Comment hidden (obsolete)
Comment 11 Kyle M Hall (khall) 2023-12-19 16:57:19 UTC Comment hidden (obsolete)
Comment 12 Kyle M Hall (khall) 2023-12-19 16:57:21 UTC Comment hidden (obsolete)
Comment 13 Kyle M Hall (khall) 2023-12-19 16:57:23 UTC Comment hidden (obsolete)
Comment 14 Kyle M Hall (khall) 2023-12-19 16:57:25 UTC Comment hidden (obsolete)
Comment 15 Kyle M Hall (khall) 2023-12-19 16:57:27 UTC Comment hidden (obsolete)
Comment 16 Andrew Fuerste-Henry 2023-12-19 17:22:07 UTC
I created a sandbox with these patches, but it doesn't seem to have the new table. I get the following error when I go to /cgi-bin/koha/admin/float_limits.pl: 

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Table 'koha_floatie.library_float_limits' doesn't exist at /kohadevbox/koha/Koha/Objects.pm line 317
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
Comment 17 Kyle M Hall (khall) 2023-12-19 17:28:53 UTC Comment hidden (obsolete)
Comment 18 Kyle M Hall (khall) 2023-12-19 17:28:59 UTC Comment hidden (obsolete)
Comment 19 Kyle M Hall (khall) 2023-12-19 17:29:02 UTC Comment hidden (obsolete)
Comment 20 Kyle M Hall (khall) 2023-12-19 17:29:04 UTC Comment hidden (obsolete)
Comment 21 Kyle M Hall (khall) 2023-12-19 17:29:06 UTC Comment hidden (obsolete)
Comment 22 Kyle M Hall (khall) 2023-12-19 17:29:09 UTC Comment hidden (obsolete)
Comment 23 Andrew Fuerste-Henry 2023-12-19 18:14:30 UTC
Note for testing: I confirmed that AutomaticItemReturn does control whether or not one can decline the transfers initiated by this feature.

Issues:
 - Library float limits needs to be included in the admin nav sidebar
 - Allow value of zero -- currently, if you enter a zero it gets treated as a blank and no limit is saved. As described on the screen, a blank should mean float is not limited while a limit of zero would mean items of that type should always transfer away
 - rename "limit" field as it causes errors in writing reports unless you refer to the field with its full name (library_floating_limits.limit). Maybe "item_limit"?

Transfer triggered for checkin that *meets* limit rather than exceeding it:
- have a float limit set to 1 for Branch A
- have 1 item of that item type at Branch A, giving ratio of 1
- check that item in at Branch A, get notified that this would put the library over its limit and the item will be transferred

Ratio not correctly calculated for branches with zero items of type:
- Have defined float limits for Branches: A = 1, B = 10, C = 100
- Have 1 item of limited type at Branch A, 1 at Branch B, zero at Branch C
- Check 1 item in at Branch A
- Koha directs the item to transfer to Branch B (ratio of .1) rather than Branch C (ratio of zero)
Seems like we're only calculating a ratio where there is at least 1 item already.
Comment 24 Andrew Fuerste-Henry 2023-12-19 18:17:38 UTC
> Transfer triggered for checkin that *meets* limit rather than exceeding it:
> - have a float limit set to 1 for Branch A
> - have 1 item of that item type at Branch A, giving ratio of 1
> - check that item in at Branch A, get notified that this would put the
> library over its limit and the item will be transferred

Clarifying a little -- currently the patch *does* generate a transfer when a checked in item *meets* the floating limit. And I suppose that's what the text on screen says: "if the checkin library has reached its' limit for that type of item." That said, I feel like users may expect transfers to be generated only when the limits are *exceeded*.
Comment 25 Kyle M Hall (khall) 2023-12-19 18:41:21 UTC Comment hidden (obsolete)
Comment 26 Kyle M Hall (khall) 2023-12-19 19:05:19 UTC Comment hidden (obsolete)
Comment 27 Kyle M Hall (khall) 2023-12-19 19:05:25 UTC Comment hidden (obsolete)
Comment 28 Kyle M Hall (khall) 2023-12-19 19:05:28 UTC Comment hidden (obsolete)
Comment 29 Kyle M Hall (khall) 2023-12-19 19:05:30 UTC Comment hidden (obsolete)
Comment 30 Kyle M Hall (khall) 2023-12-19 19:05:32 UTC Comment hidden (obsolete)
Comment 31 Kyle M Hall (khall) 2023-12-19 19:05:35 UTC Comment hidden (obsolete)
Comment 32 Kyle M Hall (khall) 2023-12-19 19:05:37 UTC Comment hidden (obsolete)
Comment 33 Kyle M Hall (khall) 2023-12-19 19:10:49 UTC Comment hidden (obsolete)
Comment 34 Kyle M Hall (khall) 2023-12-19 19:10:55 UTC Comment hidden (obsolete)
Comment 35 Kyle M Hall (khall) 2023-12-19 19:10:57 UTC Comment hidden (obsolete)
Comment 36 Kyle M Hall (khall) 2023-12-19 19:11:00 UTC Comment hidden (obsolete)
Comment 37 Kyle M Hall (khall) 2023-12-19 19:11:02 UTC Comment hidden (obsolete)
Comment 38 Kyle M Hall (khall) 2023-12-19 19:11:05 UTC Comment hidden (obsolete)
Comment 39 Kyle M Hall (khall) 2023-12-19 19:15:50 UTC
(In reply to Andrew Fuerste-Henry from comment #24)

All issues should be fixed. All fixes merged into original patchset!
Comment 40 Kyle M Hall (khall) 2023-12-19 19:16:24 UTC
(In reply to Andrew Fuerste-Henry from comment #24)
> > Transfer triggered for checkin that *meets* limit rather than exceeding it:
> > - have a float limit set to 1 for Branch A
> > - have 1 item of that item type at Branch A, giving ratio of 1
> > - check that item in at Branch A, get notified that this would put the
> > library over its limit and the item will be transferred
> 
> Clarifying a little -- currently the patch *does* generate a transfer when a
> checked in item *meets* the floating limit. And I suppose that's what the
> text on screen says: "if the checkin library has reached its' limit for that
> type of item." That said, I feel like users may expect transfers to be
> generated only when the limits are *exceeded*.

I'll change to exceeding the limit. I think that's more natural and expected.
Comment 41 Kyle M Hall (khall) 2023-12-19 19:16:40 UTC Comment hidden (obsolete)
Comment 42 ByWater Sandboxes 2023-12-19 19:38:31 UTC Comment hidden (obsolete)
Comment 43 ByWater Sandboxes 2023-12-19 19:38:33 UTC Comment hidden (obsolete)
Comment 44 ByWater Sandboxes 2023-12-19 19:38:35 UTC Comment hidden (obsolete)
Comment 45 ByWater Sandboxes 2023-12-19 19:38:38 UTC Comment hidden (obsolete)
Comment 46 ByWater Sandboxes 2023-12-19 19:38:40 UTC Comment hidden (obsolete)
Comment 47 ByWater Sandboxes 2023-12-19 19:38:42 UTC Comment hidden (obsolete)
Comment 48 ByWater Sandboxes 2023-12-19 19:38:44 UTC Comment hidden (obsolete)
Comment 49 Lisette Scheer 2024-03-20 13:57:43 UTC
Programming error - op 'set_float_limits' must start with 'cud-' for POST http://localhost:8081/intranet/admin/float_limits.pl
Comment 50 Kyle M Hall (khall) 2024-03-26 12:48:51 UTC Comment hidden (obsolete)
Comment 51 Kyle M Hall (khall) 2024-07-02 11:23:11 UTC Comment hidden (obsolete)
Comment 52 Kyle M Hall (khall) 2024-07-02 11:23:20 UTC Comment hidden (obsolete)
Comment 53 Kyle M Hall (khall) 2024-07-02 11:23:22 UTC Comment hidden (obsolete)
Comment 54 Kyle M Hall (khall) 2024-07-02 11:23:25 UTC Comment hidden (obsolete)
Comment 55 Kyle M Hall (khall) 2024-07-02 11:23:28 UTC Comment hidden (obsolete)
Comment 56 Kyle M Hall (khall) 2024-07-02 11:23:30 UTC Comment hidden (obsolete)
Comment 57 Kyle M Hall (khall) 2024-07-02 11:23:33 UTC Comment hidden (obsolete)
Comment 58 Kyle M Hall (khall) 2024-07-02 11:23:35 UTC Comment hidden (obsolete)
Comment 59 Martin Renvoize (ashimema) 2024-10-28 09:24:33 UTC
Sorry Kyle, this no longer applies
Comment 60 Lucas Gass (lukeg) 2025-02-26 18:14:17 UTC Comment hidden (obsolete)
Comment 61 Lucas Gass (lukeg) 2025-02-26 18:14:19 UTC Comment hidden (obsolete)
Comment 62 Lucas Gass (lukeg) 2025-02-26 18:14:22 UTC Comment hidden (obsolete)
Comment 63 Lucas Gass (lukeg) 2025-02-26 18:14:25 UTC Comment hidden (obsolete)
Comment 64 Lucas Gass (lukeg) 2025-02-26 18:14:27 UTC Comment hidden (obsolete)
Comment 65 Lucas Gass (lukeg) 2025-02-26 18:14:30 UTC Comment hidden (obsolete)
Comment 66 Lucas Gass (lukeg) 2025-02-26 18:14:32 UTC Comment hidden (obsolete)
Comment 67 Lucas Gass (lukeg) 2025-02-26 18:14:34 UTC Comment hidden (obsolete)
Comment 68 Lucas Gass (lukeg) 2025-02-26 18:16:36 UTC
Rebased for current main, still some noticeable problems with both CSRF and Bootstrap 5 things. Setting to FQA for now.
Comment 69 Lucas Gass (lukeg) 2025-02-27 14:49:28 UTC Comment hidden (obsolete)
Comment 70 Lucas Gass (lukeg) 2025-02-27 14:55:08 UTC Comment hidden (obsolete)
Comment 71 Lucas Gass (lukeg) 2025-02-27 15:36:01 UTC Comment hidden (obsolete)
Comment 72 Lucas Gass (lukeg) 2025-02-27 15:36:46 UTC
I think this is again ready for testing, resetting to NSO.
Comment 73 Andrew Fuerste-Henry 2025-03-04 20:30:06 UTC
This doesn't seem to be enforcing limits correctly. I think it's checking the float limit against the total number of items of that item type in the whole system (rather than just at the current branch) and then prompting a transfer to the branch with the lowest items/limit ratio (unless that's your current branch, in which case no transfer is generated).

To recreate:
- set circ rules to everything floats
- create 4 items of itemtype CF / Computer Files (this itype exists in the default data without any items, so it's easy to test with)
- set float limit of 3 for CF items at Centerville and Fairfield branches, leave other branches without limits
- play around checking your 4 items in at Centerville and Fairfield

Koha should only generate a transfer when all 4 items end up at either Centerville or Fairfield. Instead, it seems to be generating a transfer whenever the branch at which you're checking in does not have the lowest ratio of items/limit.
Comment 74 Andrew Fuerste-Henry 2025-03-04 20:50:45 UTC Comment hidden (obsolete)
Comment 75 Andrew Fuerste-Henry 2025-03-04 21:23:22 UTC Comment hidden (obsolete)
Comment 76 Andrew Fuerste-Henry 2025-03-04 21:23:25 UTC Comment hidden (obsolete)
Comment 77 Andrew Fuerste-Henry 2025-03-04 21:23:27 UTC Comment hidden (obsolete)
Comment 78 Andrew Fuerste-Henry 2025-03-04 21:23:30 UTC Comment hidden (obsolete)
Comment 79 Andrew Fuerste-Henry 2025-03-04 21:23:32 UTC Comment hidden (obsolete)
Comment 80 Andrew Fuerste-Henry 2025-03-04 21:23:35 UTC Comment hidden (obsolete)
Comment 81 Andrew Fuerste-Henry 2025-03-04 21:23:37 UTC Comment hidden (obsolete)
Comment 82 Andrew Fuerste-Henry 2025-03-04 21:23:40 UTC Comment hidden (obsolete)
Comment 83 Andrew Fuerste-Henry 2025-03-04 21:23:43 UTC Comment hidden (obsolete)
Comment 84 Andrew Fuerste-Henry 2025-03-04 21:23:45 UTC Comment hidden (obsolete)
Comment 85 Andrew Fuerste-Henry 2025-03-04 21:23:48 UTC Comment hidden (obsolete)
Comment 86 Andrew Fuerste-Henry 2025-03-04 21:23:50 UTC Comment hidden (obsolete)
Comment 87 Martin Renvoize (ashimema) 2025-03-14 15:28:49 UTC
Unit tests are failing here I'm afraid.
Comment 88 Lucas Gass (lukeg) 2025-03-31 09:44:42 UTC Comment hidden (obsolete)
Comment 89 Lucas Gass (lukeg) 2025-03-31 09:44:46 UTC Comment hidden (obsolete)
Comment 90 Lucas Gass (lukeg) 2025-03-31 09:44:50 UTC Comment hidden (obsolete)
Comment 91 Lucas Gass (lukeg) 2025-03-31 09:44:53 UTC Comment hidden (obsolete)
Comment 92 Lucas Gass (lukeg) 2025-03-31 09:44:57 UTC Comment hidden (obsolete)
Comment 93 Lucas Gass (lukeg) 2025-03-31 09:45:01 UTC Comment hidden (obsolete)
Comment 94 Lucas Gass (lukeg) 2025-03-31 09:45:05 UTC Comment hidden (obsolete)
Comment 95 Lucas Gass (lukeg) 2025-03-31 09:45:09 UTC Comment hidden (obsolete)
Comment 96 Lucas Gass (lukeg) 2025-03-31 09:45:13 UTC Comment hidden (obsolete)
Comment 97 Lucas Gass (lukeg) 2025-03-31 09:45:16 UTC Comment hidden (obsolete)
Comment 98 Lucas Gass (lukeg) 2025-03-31 09:45:20 UTC Comment hidden (obsolete)
Comment 99 Lucas Gass (lukeg) 2025-03-31 09:45:24 UTC Comment hidden (obsolete)
Comment 100 Lucas Gass (lukeg) 2025-03-31 09:45:27 UTC Comment hidden (obsolete)
Comment 101 Lucas Gass (lukeg) 2025-03-31 09:46:27 UTC
(In reply to Martin Renvoize (ashimema) from comment #87)
> Unit tests are failing here I'm afraid.

It seems like it was only the number of test, I have adjusted that. Nothing else was failing for me.
Comment 102 Andrew Fuerste-Henry 2025-03-31 12:56:52 UTC Comment hidden (obsolete)
Comment 103 Martin Renvoize (ashimema) 2025-05-14 09:49:12 UTC
I'm afraid I'm seeing unit test failures still here.. I've reset_all etc and the tests still fail I'm afraid.
Comment 104 Martin Renvoize (ashimema) 2025-05-14 09:51:01 UTC
Comment on attachment 179944 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits

Review of attachment 179944 [details] [review]:
-----------------------------------------------------------------

::: Koha/Library/FloatLimits.pm
@@ +43,5 @@
> +sub lowest_ratio_library {
> +    my ( $self, $item, $branchcode ) = @_;
> +
> +    my $field = C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype';
> +    my $query = qq{

Is it deliverate to continue using plain SQL here rather than constructing a DBIC query.. and should we perhaps be returning a Koha::Library object rather than a branchcode given this is a Koha:: object method?
Comment 105 Martin Renvoize (ashimema) 2025-05-14 09:53:29 UTC
In fact.. I'd kinda be tempted to shift that filter method into Koha::Libraries... you're basically looking for the library with the lowest_ratio.. that feels like a `Koha::Libraries->find_library_with_lowest_float_ratio` method to me...
Comment 106 Lucas Gass (lukeg) 2025-06-03 22:49:45 UTC
> Is it deliverate to continue using plain SQL here rather than constructing a
> DBIC query.. and should we perhaps be returning a Koha::Library object
> rather than a branchcode given this is a Koha:: object method?

I'm not the original author but I tend to agree, let's use a DBIC query and return a library object.
Comment 107 Lucas Gass (lukeg) 2025-06-03 23:21:32 UTC Comment hidden (obsolete)
Comment 108 Andrew Fuerste-Henry 2025-06-05 19:24:56 UTC
In testing this, I've run into some shortcomings in its logic. I suspect these are things that were not considered to begin with, rather than things introduced in the recent change to use DBIC and a library object.

As these float limits are enforced, we count items based purely on their holdingbranch, regardless of other values. Most pointedly, we don't consider whether  or not those items are either checked out or in transit to another library. The goal here is to govern floating based on how many items are actually on the shelf, so this isn't ideal.

My pretend library has a branch with a floating limit of 10 for the itemtype DVD, because they're small. At this small branch:
- there are 10 DVDs available -- they're at their float limit
- a patron checks out 5 DVDs, leaving 5 available
Per the current logic, this library is *still* at their float limit because those 5 checked-out DVDs haven't changed their holding branch, even though we have no expectation that those DVDs will come back to the same branch they were checked out from.

** When an item is checked out, it should not count toward the float limit at *any* branch.

A new scenario at my pretend library, again at the small branch with the float limit of 10 DVDs:
- there are 10 DVDs available -- they're at their float limit
- take one of those 10 available DVDs and check it in for a local use
- Koha tells you to transfer that item away to keep under your float limit. Accept that transfer
- Check in one of your 9 remaining available DVDs for another local use. Koha tells you to transfer this one away, too. Because the holding branch on the previous one hasn't changed yet and we're not looking at whether or not it's in transit.

** When an item is in transit, it should count toward the float limit at the branch it is transferring to, even when it hasn't been received yet.
Comment 109 Andrew Fuerste-Henry 2025-06-05 19:27:19 UTC
(In reply to Andrew Fuerste-Henry from comment #108)
> A new scenario at my pretend library, again at the small branch with the
> float limit of 10 DVDs:
> - there are 10 DVDs available -- they're at their float limit
> - take one of those 10 available DVDs and check it in for a local use
> - Koha tells you to transfer that item away to keep under your float limit.

This is another issue. Checkin an item in for a local use prompts that item to transfer away if the library is *at* its float limit. Seems like it's not considering that the item being checked in is already here and therefore will not push the library to *exceed* its limit, which is when a transfer should happen.
Comment 110 Lucas Gass (lukeg) 2025-07-28 16:58:51 UTC Comment hidden (obsolete)
Comment 111 Lucas Gass (lukeg) 2025-07-28 17:49:56 UTC Comment hidden (obsolete)
Comment 112 Andrew Fuerste-Henry 2025-07-28 19:49:11 UTC
Test Plan:
1) Apply this patch set
2) Run updatedatabase.pl
3) Restart all the things!
4) Enable UseLibraryFloatLimits
5) Verify items float correctly as per your circulation rules
6) Set some float limits from the Library Float Limits configuration
   page in the Administration section
   The simplest solution is to set the float limit from one branch
   to 1 item, a second to 100 items, and a third to 300 items for
   a single itemtype
7) Verify checked in items that should have floated at this branch
   are now transfered to the branch with the best float ratio

8) Confirm checked-out items are not counted for either float limits or float ratios
9) Confirm in-transit items are not counted for either float limits or float ratios
Comment 113 Andrew Fuerste-Henry 2025-07-28 20:21:51 UTC
I found it helpful to have a query to count items per branch, taking into account how many are checked out or in transit. I've been resting using the Ref item type as there aren't any in the base KTD data so it's easy to set up tests.

SELECT item_counts.*, transfer_incoming
FROM 
(
SELECT i.holdingbranch,
count(i.itemnumber) as count_by_holdingbranch_only,
sum(if(t.branchtransfer_id is null and i.onloan is null,1,0)) as available,
sum(if(i.onloan is not null,1,0)) as checked_out,
sum(if(t.branchtransfer_id is not null,1,0)) as transfered_away
FROM items i
LEFT JOIN branchtransfers t ON (i.itemnumber=t.itemnumber and t.datesent is not null and t.datecancelled is null and t.datearrived is null)
WHERE itype='ref'
GROUP BY holdingbranch
) item_counts
LEFT JOIN
(
SELECT b.tobranch, count(b.branchtransfer_id) as transfer_incoming
FROM branchtransfers b
WHERE b.datesent is not null and b.datearrived is null and b.datecancelled is null
GROUP BY tobranch
) incoming ON (item_counts.holdingbranch = incoming.tobranch)
Comment 114 Lucas Gass (lukeg) 2025-07-30 22:05:15 UTC Comment hidden (obsolete)
Comment 115 Lucas Gass (lukeg) 2025-07-31 16:39:51 UTC Comment hidden (obsolete)
Comment 116 Lucas Gass (lukeg) 2025-07-31 16:40:31 UTC
New test plan:

Test Plan:
1) Apply this patch set
2) Run updatedatabase.pl
3) Restart all the things!
4) Enable UseLibraryFloatLimits
5) Verify items float correctly as per your circulation rules
6) Set some float limits from the Library Float Limits configuration
   page in the Administration section, for example:

7) Create some float limits for a single itemtype, we are testing with REF itemtypes in k-t-d as there are none by default, so add these float limits for the REF itemtype:
	-CPL: 2 
	-FFL: 2 
	-FPL: 2
	-FRL: 2 
	-ITP:  2

The rest should be set 0 or remain empty.

8) Create or have the following items: 
	-CPL: 2 REF items
	-FFL: 2 REF items
	-FPL: 2 REF items
	-FRL: 2 REF items
	-ITP: 2 REF items
9) In Circulation rules set ‘Default checkout, hold and return policy’ to ‘item floats’.
	
10) Ensure you are logged in as CPL.
11) Check in a CPL REF item at CPL. It checks in normally. 
12) Check in a FFL item at CPL, get a pop-up modal telling you that you have exceeded float limits, this item should return to FFL.
13). Login as FFL, they should have 1 REF item in-transit and 1 REF item on the shelves. 
14) Check in a ITP item, since you have exceeded float limits you should get a pop-up telling to return this item to CPL. CPL has 1 on shelf REF item, 1 in transit away. CPL is the best option for this item.
15) Check out both items from FPL at FPL. Still logged in as FFL check in one of your own items. You should be told to return it to FPL, they have the lowest float limit now.
16) Reset all of your items transfers and holding branch data:
	-delete from branchtransfers;
	-update items set holdingbranch = homebranch;
17) Set the float limits to each branch to:
	-CPL: 1
	-FFL: 1
	-FPL: 1
	-FRL: 1 
	-ITP:  1

18) Every library is now at its float limit. Checkin one of the checked out items for step 15. It should be send back to FPL, since it has the lowest ratio now.
19) Check all items in and reset transfers and holding branch data:
	-delete from branchtransfers;
	-update items set holdingbranch = homebranch;
20) Now as FFL, checkin an FFL item. Everyone is over their limit and the ratio is a tie. The item should go to a random branch among the tied candidates.
Comment 117 Lucas Gass (lukeg) 2025-07-31 17:57:27 UTC
Im setting this to FQA because this needs to follow the 'Floats by library group' return policy. If that policy is active we should only do float limit transfers to branches within the group.
Comment 118 Lucas Gass (lukeg) 2025-07-31 20:54:29 UTC Comment hidden (obsolete)
Comment 119 Lucas Gass (lukeg) 2025-07-31 20:54:34 UTC Comment hidden (obsolete)
Comment 120 Lucas Gass (lukeg) 2025-07-31 20:54:38 UTC Comment hidden (obsolete)
Comment 121 Lucas Gass (lukeg) 2025-07-31 20:54:42 UTC Comment hidden (obsolete)
Comment 122 Lucas Gass (lukeg) 2025-07-31 20:54:46 UTC Comment hidden (obsolete)
Comment 123 Lucas Gass (lukeg) 2025-07-31 21:13:48 UTC Comment hidden (obsolete)
Comment 124 Lucas Gass (lukeg) 2025-07-31 21:13:52 UTC Comment hidden (obsolete)
Comment 125 Lucas Gass (lukeg) 2025-07-31 21:13:56 UTC Comment hidden (obsolete)
Comment 126 Lucas Gass (lukeg) 2025-07-31 21:14:00 UTC Comment hidden (obsolete)
Comment 127 Lucas Gass (lukeg) 2025-07-31 21:14:04 UTC Comment hidden (obsolete)
Comment 128 Lucas Gass (lukeg) 2025-07-31 21:16:29 UTC Comment hidden (obsolete)
Comment 129 Lucas Gass (lukeg) 2025-07-31 22:47:22 UTC Comment hidden (obsolete)
Comment 130 Lucas Gass (lukeg) 2025-08-01 00:06:45 UTC Comment hidden (obsolete)
Comment 131 Lucas Gass (lukeg) 2025-08-01 00:20:04 UTC Comment hidden (obsolete)
Comment 132 Lucas Gass (lukeg) 2025-08-01 00:22:39 UTC Comment hidden (obsolete)
Comment 133 Lucas Gass (lukeg) 2025-08-01 15:26:09 UTC Comment hidden (obsolete)
Comment 134 Andrew Fuerste-Henry 2025-08-01 19:15:11 UTC
Still running into an issue here when all branches are *at* their float limit and an item moves from Branch A to Branch B. So, at step 12 of the test plan in comment 116, we've got 2 REF items at each branch and take one of the FFL items and check it in ay CPL. With these patches, Koha sees that moving this item would put CPL over its limit of 2, but declines to transfer the item because at that point in the transaction the item's holdingbranch hasn't yet changed and so Koha views all branches as being tied on their limit/item ratio.

We should update the item's holdingbranch to the branch at which the checkin is happening *before* we check the float limits to see if it's acceptable for that item to stay at its new branch.
Comment 135 Lucas Gass (lukeg) 2025-08-27 17:36:01 UTC Comment hidden (obsolete)
Comment 136 Lucas Gass (lukeg) 2025-08-27 17:36:06 UTC Comment hidden (obsolete)
Comment 137 Lucas Gass (lukeg) 2025-08-27 17:36:10 UTC Comment hidden (obsolete)
Comment 138 Lucas Gass (lukeg) 2025-08-27 17:36:14 UTC Comment hidden (obsolete)
Comment 139 Lucas Gass (lukeg) 2025-08-27 17:36:18 UTC Comment hidden (obsolete)
Comment 140 Lucas Gass (lukeg) 2025-08-27 17:36:22 UTC Comment hidden (obsolete)
Comment 141 Lucas Gass (lukeg) 2025-08-27 17:36:27 UTC Comment hidden (obsolete)
Comment 142 Lucas Gass (lukeg) 2025-08-27 17:36:31 UTC Comment hidden (obsolete)
Comment 143 Lucas Gass (lukeg) 2025-10-07 13:53:23 UTC Comment hidden (obsolete)
Comment 144 Lucas Gass (lukeg) 2025-10-07 17:17:26 UTC
I still need to adjust unit tests and make a few small QA fixes but I want to set this back to "Needs signoff" to get some people testing the float limits.
Comment 145 Lucas Gass (lukeg) 2025-10-08 21:08:49 UTC Comment hidden (obsolete)
Comment 146 Andrew Fuerste-Henry 2025-12-10 20:35:55 UTC
Please rebase for testing. Thank you!
Comment 147 Lucas Gass (lukeg) 2025-12-15 16:02:01 UTC Comment hidden (obsolete)
Comment 148 Lucas Gass (lukeg) 2025-12-15 16:02:05 UTC Comment hidden (obsolete)
Comment 149 Lucas Gass (lukeg) 2025-12-15 16:02:08 UTC Comment hidden (obsolete)
Comment 150 Lucas Gass (lukeg) 2025-12-15 16:02:11 UTC Comment hidden (obsolete)
Comment 151 Lucas Gass (lukeg) 2025-12-15 16:02:15 UTC Comment hidden (obsolete)
Comment 152 Lucas Gass (lukeg) 2025-12-15 16:02:18 UTC Comment hidden (obsolete)
Comment 153 Lucas Gass (lukeg) 2025-12-15 16:02:22 UTC Comment hidden (obsolete)
Comment 154 Lucas Gass (lukeg) 2025-12-15 16:02:25 UTC Comment hidden (obsolete)
Comment 155 Lucas Gass (lukeg) 2025-12-15 16:02:28 UTC Comment hidden (obsolete)
Comment 156 Lucas Gass (lukeg) 2025-12-15 16:02:32 UTC Comment hidden (obsolete)
Comment 157 Lucas Gass (lukeg) 2025-12-15 16:02:35 UTC Comment hidden (obsolete)
Comment 158 Lucas Gass (lukeg) 2025-12-15 16:02:39 UTC Comment hidden (obsolete)
Comment 159 Lucas Gass (lukeg) 2025-12-15 16:02:42 UTC Comment hidden (obsolete)
Comment 160 Andrew Fuerste-Henry 2025-12-16 13:53:44 UTC
"Can't locate object method "find" via package "Koha::Library::FloatLimits" (perhaps you forgot to load "Koha::Library::FloatLimits"?) at /kohadevbox/koha/C4/Circulation.pm line 2337"

I get this error when performing a checkin if my system contains items of an itemtype for which there are some float limits defined at a branch that does not have float limits for that item type.

Phrased differently, test plan all worked while my float limits were set for CPL, FFL, FPL, FRL, and IPT and my only REF items were at those 5 branches. However, when I created a new item at LPL I started getting this error on every checkin.
Comment 161 Lucas Gass (lukeg) 2025-12-16 14:55:45 UTC Comment hidden (obsolete)
Comment 162 Andrew Fuerste-Henry 2025-12-17 20:04:05 UTC Comment hidden (obsolete)
Comment 163 Andrew Fuerste-Henry 2025-12-17 20:04:09 UTC Comment hidden (obsolete)
Comment 164 Andrew Fuerste-Henry 2025-12-17 20:04:13 UTC Comment hidden (obsolete)
Comment 165 Andrew Fuerste-Henry 2025-12-17 20:04:17 UTC Comment hidden (obsolete)
Comment 166 Andrew Fuerste-Henry 2025-12-17 20:04:21 UTC Comment hidden (obsolete)
Comment 167 Andrew Fuerste-Henry 2025-12-17 20:04:25 UTC Comment hidden (obsolete)
Comment 168 Andrew Fuerste-Henry 2025-12-17 20:04:29 UTC Comment hidden (obsolete)
Comment 169 Andrew Fuerste-Henry 2025-12-17 20:04:33 UTC Comment hidden (obsolete)
Comment 170 Andrew Fuerste-Henry 2025-12-17 20:04:37 UTC Comment hidden (obsolete)
Comment 171 Andrew Fuerste-Henry 2025-12-17 20:04:41 UTC Comment hidden (obsolete)
Comment 172 Andrew Fuerste-Henry 2025-12-17 20:04:45 UTC Comment hidden (obsolete)
Comment 173 Andrew Fuerste-Henry 2025-12-17 20:04:49 UTC Comment hidden (obsolete)
Comment 174 Andrew Fuerste-Henry 2025-12-17 20:04:53 UTC Comment hidden (obsolete)
Comment 175 Andrew Fuerste-Henry 2025-12-17 20:04:57 UTC Comment hidden (obsolete)
Comment 176 Martin Renvoize (ashimema) 2026-02-04 18:38:30 UTC
Created attachment 192476 [details] [review]
Bug 28530: Update database, add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 177 Martin Renvoize (ashimema) 2026-02-04 18:38:32 UTC
Created attachment 192477 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 178 Martin Renvoize (ashimema) 2026-02-04 18:38:33 UTC
Created attachment 192478 [details] [review]
Bug 28530: Add float limits editor

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 179 Martin Renvoize (ashimema) 2026-02-04 18:38:35 UTC
Created attachment 192479 [details] [review]
Bug 28530: Add unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 180 Martin Renvoize (ashimema) 2026-02-04 18:38:36 UTC
Created attachment 192480 [details] [review]
Bug 28530: Implement float limits

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 181 Martin Renvoize (ashimema) 2026-02-04 18:38:37 UTC
Created attachment 192481 [details] [review]
Bug 28530: DBIC changes DO NOT PUSH

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 182 Martin Renvoize (ashimema) 2026-02-04 18:38:39 UTC
Created attachment 192482 [details] [review]
Bug 28530: If return policy is set to float in library group, remove non group branches

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 183 Martin Renvoize (ashimema) 2026-02-04 18:38:40 UTC
Created attachment 192483 [details] [review]
Bug 28530: Add more tests

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 184 Martin Renvoize (ashimema) 2026-02-04 18:38:42 UTC
Created attachment 192484 [details] [review]
Bug 28530: Increment and decrement item count before calculation

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 185 Martin Renvoize (ashimema) 2026-02-04 18:38:43 UTC
Created attachment 192485 [details] [review]
Bug 28530: Adjust tests

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 186 Martin Renvoize (ashimema) 2026-02-04 18:38:45 UTC
Created attachment 192486 [details] [review]
Bug 28530: Fix tests

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 187 Martin Renvoize (ashimema) 2026-02-04 18:38:46 UTC
Created attachment 192487 [details] [review]
Bug 28530: Fix forbidden http pattern

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 188 Martin Renvoize (ashimema) 2026-02-04 18:38:48 UTC
Created attachment 192488 [details] [review]
Bug 28530: Fix spelling mistakes

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 189 Martin Renvoize (ashimema) 2026-02-04 18:38:49 UTC
Created attachment 192489 [details] [review]
Bug 28530: Add missing use statement for Koha::Library::FloatLimits

Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 190 Martin Renvoize (ashimema) 2026-02-04 18:38:51 UTC
Created attachment 192490 [details] [review]
Bug 28530: (QA follow-up) Remove unused LibraryFloatLimitTransferRequest message handling

The LibraryFloatLimitTransferRequest message was never set in C4::Circulation,
making this code unreachable. Float limit transfers are already properly handled
through the existing transfer message system (WasTransfered/NeedsTransfer) with
TransferTrigger set to 'LibraryFloatLimit'.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 191 Martin Renvoize (ashimema) 2026-02-04 18:38:52 UTC
Created attachment 192491 [details] [review]
Bug 28530: (QA follow-up) Guard against divide by zero

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 192 Martin Renvoize (ashimema) 2026-02-04 18:38:54 UTC
Created attachment 192492 [details] [review]
Bug 28530: (QA follow-up) Use DBIC in controller

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 193 Martin Renvoize (ashimema) 2026-02-04 18:38:55 UTC
Created attachment 192493 [details] [review]
Bug 28530: (QA follow-up) Add POD documentation and database index

- Add comprehensive POD documentation for lowest_ratio_library() method
  including parameter descriptions, return values, and algorithm explanation
- Add database index on itemtype column in library_float_limits table
  to improve query performance when searching by itemtype

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 194 Martin Renvoize (ashimema) 2026-02-04 18:38:57 UTC
Created attachment 192494 [details] [review]
Bug 28530: (QA follow-up) Fix N+1 query performance issue

Refactored lowest_ratio_library() to eliminate the N+1 query problem
by using aggregated queries with GROUP BY instead of per-branch queries.

Performance improvement:
- Before: O(3n) queries where n = number of branches with float limits
  Example: 20 branches = 60 database queries
- After: O(3) queries regardless of number of branches
  Example: 20 branches = 3 database queries

The optimization uses three aggregated queries:
1. Single query with GROUP BY to get item counts at all branches
2. Single query with GROUP BY to get in-transit-to counts for all branches
3. Single query with GROUP BY to get in-transit-from counts for all branches

Results are combined in memory to calculate ratios, maintaining identical
logic and behavior while dramatically improving database efficiency.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 195 Martin Renvoize (ashimema) 2026-02-04 18:38:58 UTC
Created attachment 192495 [details] [review]
Bug 28530: (QA follow-up) Fix branch transfer limits not checking alternate libraries

Fixed a pre-existing bug where branch transfer limits would prevent ANY
transfer if the optimal library was blocked, instead of trying the next
best candidate.

Original behavior:
- Sort candidates by best ratio
- Check if transfer to best candidate is allowed
- If not allowed: exit loop immediately (bug!) and return undef
- Result: No transfer created even if other valid candidates exist

Fixed behavior:
- Sort candidates by best ratio
- Check if transfer to best candidate is allowed
- If allowed: use that library and exit loop
- If not allowed: continue to next candidate
- Result: Uses the best ALLOWED candidate

This fix ensures that when branch transfer limits block the optimal
destination, the system will try the next-best option instead of
giving up entirely.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 196 Lucas Gass (lukeg) 2026-02-10 17:08:56 UTC
Created attachment 192918 [details] [review]
Bug 28530: (RM follow-up) Move kohastructure update to right place alphabetically
Comment 197 Lucas Gass (lukeg) 2026-02-10 17:53:46 UTC
Nice work everyone!

Pushed to main for 26.05
Comment 198 Lucas Gass (lukeg) 2026-02-10 22:45:23 UTC
Created attachment 192954 [details] [review]
Bug 28530: (follow-up) Place system pref in corret order
Comment 199 Lucas Gass (lukeg) 2026-02-10 22:48:56 UTC
follow-up pushed to main