Bug 28530 - Allow configuration of floating limits by item type
Summary: Allow configuration of floating limits by item type
Status: Failed QA
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: 2025-06-05 19:27 UTC (History)
10 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
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

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
Created attachment 160038 [details] [review]
Bug 28530: Update database, add new schema file
Comment 4 Kyle M Hall (khall) 2023-12-19 16:51:05 UTC
Created attachment 160039 [details] [review]
Bug 28530: Update database, add new schema file
Comment 5 Kyle M Hall (khall) 2023-12-19 16:51:11 UTC
Created attachment 160040 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits
Comment 6 Kyle M Hall (khall) 2023-12-19 16:51:13 UTC
Created attachment 160041 [details] [review]
Bug 28530: Update existing schema files
Comment 7 Kyle M Hall (khall) 2023-12-19 16:51:15 UTC
Created attachment 160042 [details] [review]
Bug 28530: Add float limits editor
Comment 8 Kyle M Hall (khall) 2023-12-19 16:51:17 UTC
Created attachment 160043 [details] [review]
Bug 28530: Implement float limits

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
Comment 9 Kyle M Hall (khall) 2023-12-19 16:51:20 UTC
Created attachment 160044 [details] [review]
Bug 28530: Add unit tests
Comment 10 Kyle M Hall (khall) 2023-12-19 16:57:11 UTC
Created attachment 160045 [details] [review]
Bug 28530: Update database, add new schema file
Comment 11 Kyle M Hall (khall) 2023-12-19 16:57:19 UTC
Created attachment 160046 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits
Comment 12 Kyle M Hall (khall) 2023-12-19 16:57:21 UTC
Created attachment 160047 [details] [review]
Bug 28530: Update existing schema files
Comment 13 Kyle M Hall (khall) 2023-12-19 16:57:23 UTC
Created attachment 160048 [details] [review]
Bug 28530: Add float limits editor
Comment 14 Kyle M Hall (khall) 2023-12-19 16:57:25 UTC
Created attachment 160049 [details] [review]
Bug 28530: Implement float limits

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
Comment 15 Kyle M Hall (khall) 2023-12-19 16:57:27 UTC
Created attachment 160050 [details] [review]
Bug 28530: Add unit tests
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
Created attachment 160053 [details] [review]
Bug 28530: Update database, add new schema file
Comment 18 Kyle M Hall (khall) 2023-12-19 17:28:59 UTC
Created attachment 160054 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits
Comment 19 Kyle M Hall (khall) 2023-12-19 17:29:02 UTC
Created attachment 160055 [details] [review]
Bug 28530: Update existing schema files
Comment 20 Kyle M Hall (khall) 2023-12-19 17:29:04 UTC
Created attachment 160056 [details] [review]
Bug 28530: Add float limits editor
Comment 21 Kyle M Hall (khall) 2023-12-19 17:29:06 UTC
Created attachment 160057 [details] [review]
Bug 28530: Implement float limits

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
Comment 22 Kyle M Hall (khall) 2023-12-19 17:29:09 UTC
Created attachment 160058 [details] [review]
Bug 28530: Add unit tests
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
Created attachment 160061 [details] [review]
Bug 28530: (QA follow-up): Fix qa issues
Comment 26 Kyle M Hall (khall) 2023-12-19 19:05:19 UTC
Created attachment 160062 [details] [review]
Bug 28530: Update database, add new schema file
Comment 27 Kyle M Hall (khall) 2023-12-19 19:05:25 UTC
Created attachment 160063 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits
Comment 28 Kyle M Hall (khall) 2023-12-19 19:05:28 UTC
Created attachment 160064 [details] [review]
Bug 28530: Update existing schema files
Comment 29 Kyle M Hall (khall) 2023-12-19 19:05:30 UTC
Created attachment 160065 [details] [review]
Bug 28530: Add float limits editor
Comment 30 Kyle M Hall (khall) 2023-12-19 19:05:32 UTC
Created attachment 160066 [details] [review]
Bug 28530: Implement float limits

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
Comment 31 Kyle M Hall (khall) 2023-12-19 19:05:35 UTC
Created attachment 160067 [details] [review]
Bug 28530: Add unit tests
Comment 32 Kyle M Hall (khall) 2023-12-19 19:05:37 UTC
Created attachment 160068 [details] [review]
Bug 28530: (QA follow-up) Fix QA issues
Comment 33 Kyle M Hall (khall) 2023-12-19 19:10:49 UTC
Created attachment 160071 [details] [review]
Bug 28530: Update database, add new schema file
Comment 34 Kyle M Hall (khall) 2023-12-19 19:10:55 UTC
Created attachment 160072 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits
Comment 35 Kyle M Hall (khall) 2023-12-19 19:10:57 UTC
Created attachment 160073 [details] [review]
Bug 28530: Update existing schema files
Comment 36 Kyle M Hall (khall) 2023-12-19 19:11:00 UTC
Created attachment 160074 [details] [review]
Bug 28530: Add float limits editor
Comment 37 Kyle M Hall (khall) 2023-12-19 19:11:02 UTC
Created attachment 160075 [details] [review]
Bug 28530: Implement float limits

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
Comment 38 Kyle M Hall (khall) 2023-12-19 19:11:05 UTC
Created attachment 160076 [details] [review]
Bug 28530: Add unit tests
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
Created attachment 160077 [details] [review]
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit
Comment 42 ByWater Sandboxes 2023-12-19 19:38:31 UTC
Created attachment 160078 [details] [review]
Bug 28530: Update database, add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 43 ByWater Sandboxes 2023-12-19 19:38:33 UTC
Created attachment 160079 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 44 ByWater Sandboxes 2023-12-19 19:38:35 UTC
Created attachment 160080 [details] [review]
Bug 28530: Update existing schema files

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 45 ByWater Sandboxes 2023-12-19 19:38:38 UTC
Created attachment 160081 [details] [review]
Bug 28530: Add float limits editor

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 46 ByWater Sandboxes 2023-12-19 19:38:40 UTC
Created attachment 160082 [details] [review]
Bug 28530: Implement float limits

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

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 47 ByWater Sandboxes 2023-12-19 19:38:42 UTC
Created attachment 160083 [details] [review]
Bug 28530: Add unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 48 ByWater Sandboxes 2023-12-19 19:38:44 UTC
Created attachment 160084 [details] [review]
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
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
Created attachment 163919 [details] [review]
Bug 28530: (QA follow-up): Implement CSRF cud op
Comment 51 Kyle M Hall (khall) 2024-07-02 11:23:11 UTC
Created attachment 168343 [details] [review]
Bug 28530: Update database, add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 52 Kyle M Hall (khall) 2024-07-02 11:23:20 UTC
Created attachment 168344 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 53 Kyle M Hall (khall) 2024-07-02 11:23:22 UTC
Created attachment 168345 [details] [review]
Bug 28530: Add float limits editor

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 54 Kyle M Hall (khall) 2024-07-02 11:23:25 UTC
Created attachment 168346 [details] [review]
Bug 28530: Implement float limits

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

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 55 Kyle M Hall (khall) 2024-07-02 11:23:28 UTC
Created attachment 168347 [details] [review]
Bug 28530: Add unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 56 Kyle M Hall (khall) 2024-07-02 11:23:30 UTC
Created attachment 168348 [details] [review]
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 57 Kyle M Hall (khall) 2024-07-02 11:23:33 UTC
Created attachment 168349 [details] [review]
Bug 28530: (QA follow-up): Implement CSRF cud op
Comment 58 Kyle M Hall (khall) 2024-07-02 11:23:35 UTC
Created attachment 168350 [details] [review]
Bug 28530: Update existing schema files

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
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
Created attachment 178762 [details] [review]
Bug 28530: Update database, add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 61 Lucas Gass (lukeg) 2025-02-26 18:14:19 UTC
Created attachment 178763 [details] [review]
Bug 28530: Add Koha Object(s) for Float Limits

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 62 Lucas Gass (lukeg) 2025-02-26 18:14:22 UTC
Created attachment 178764 [details] [review]
Bug 28530: Add float limits editor

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 63 Lucas Gass (lukeg) 2025-02-26 18:14:25 UTC
Created attachment 178765 [details] [review]
Bug 28530: Implement float limits

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

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 64 Lucas Gass (lukeg) 2025-02-26 18:14:27 UTC
Created attachment 178766 [details] [review]
Bug 28530: Add unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 65 Lucas Gass (lukeg) 2025-02-26 18:14:30 UTC
Created attachment 178767 [details] [review]
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 66 Lucas Gass (lukeg) 2025-02-26 18:14:32 UTC
Created attachment 178768 [details] [review]
Bug 28530: (QA follow-up): Implement CSRF cud op
Comment 67 Lucas Gass (lukeg) 2025-02-26 18:14:34 UTC
Created attachment 178769 [details] [review]
Bug 28530: Update existing schema files

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
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
Created attachment 178783 [details] [review]
Bug 28530: Template adjustmentts for CSRF and Bootstrap 5
Comment 70 Lucas Gass (lukeg) 2025-02-27 14:55:08 UTC
Created attachment 178784 [details] [review]
Bug 28530: Tidy admin-menu.inc
Comment 71 Lucas Gass (lukeg) 2025-02-27 15:36:01 UTC
Created attachment 178785 [details] [review]
Bug 28530: Fix remaining QA script failures
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
Created attachment 178934 [details] [review]
Bug 28530: (QA follow-up) correct item count and limit enforcement

Corrected the count of items to limit to the current branch. Also set the limit to trigger when the count of items at the branch is currently at the limit before the item to be checked in.
Comment 75 Andrew Fuerste-Henry 2025-03-04 21:23:22 UTC
Created attachment 178935 [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>
Comment 76 Andrew Fuerste-Henry 2025-03-04 21:23:25 UTC
Created attachment 178936 [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>
Comment 77 Andrew Fuerste-Henry 2025-03-04 21:23:27 UTC
Created attachment 178937 [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>
Comment 78 Andrew Fuerste-Henry 2025-03-04 21:23:30 UTC
Created attachment 178938 [details] [review]
Bug 28530: Implement float limits

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

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 79 Andrew Fuerste-Henry 2025-03-04 21:23:32 UTC
Created attachment 178939 [details] [review]
Bug 28530: Add unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 80 Andrew Fuerste-Henry 2025-03-04 21:23:35 UTC
Created attachment 178940 [details] [review]
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 81 Andrew Fuerste-Henry 2025-03-04 21:23:37 UTC
Created attachment 178941 [details] [review]
Bug 28530: (QA follow-up): Implement CSRF cud op

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 82 Andrew Fuerste-Henry 2025-03-04 21:23:40 UTC
Created attachment 178942 [details] [review]
Bug 28530: Update existing schema files

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 83 Andrew Fuerste-Henry 2025-03-04 21:23:43 UTC
Created attachment 178943 [details] [review]
Bug 28530: Template adjustmentts for CSRF and Bootstrap 5

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 84 Andrew Fuerste-Henry 2025-03-04 21:23:45 UTC
Created attachment 178944 [details] [review]
Bug 28530: Tidy admin-menu.inc

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 85 Andrew Fuerste-Henry 2025-03-04 21:23:48 UTC
Created attachment 178945 [details] [review]
Bug 28530: Fix remaining QA script failures

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 86 Andrew Fuerste-Henry 2025-03-04 21:23:50 UTC
Created attachment 178946 [details] [review]
Bug 28530: (QA follow-up) correct item count and limit enforcement

Corrected the count of items to limit to the current branch. Also set the limit to trigger when the count of items at the branch is currently at the limit before the item to be checked in.

Signed-off-by: Kris Becker <kbecker@jcls.org>
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
Created attachment 179943 [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>
Comment 89 Lucas Gass (lukeg) 2025-03-31 09:44:46 UTC
Created attachment 179944 [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>
Comment 90 Lucas Gass (lukeg) 2025-03-31 09:44:50 UTC
Created attachment 179945 [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>
Comment 91 Lucas Gass (lukeg) 2025-03-31 09:44:53 UTC
Created attachment 179946 [details] [review]
Bug 28530: Implement float limits

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

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 92 Lucas Gass (lukeg) 2025-03-31 09:44:57 UTC
Created attachment 179947 [details] [review]
Bug 28530: Add unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 93 Lucas Gass (lukeg) 2025-03-31 09:45:01 UTC
Created attachment 179948 [details] [review]
Bug 28530: (QA follow-up) Require the item checkin to exceed the limit, rather than meet the limit

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 94 Lucas Gass (lukeg) 2025-03-31 09:45:05 UTC
Created attachment 179949 [details] [review]
Bug 28530: (QA follow-up): Implement CSRF cud op

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 95 Lucas Gass (lukeg) 2025-03-31 09:45:09 UTC
Created attachment 179950 [details] [review]
Bug 28530: Update existing schema files

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 96 Lucas Gass (lukeg) 2025-03-31 09:45:13 UTC
Created attachment 179951 [details] [review]
Bug 28530: Template adjustmentts for CSRF and Bootstrap 5

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 97 Lucas Gass (lukeg) 2025-03-31 09:45:16 UTC
Created attachment 179952 [details] [review]
Bug 28530: Tidy admin-menu.inc

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 98 Lucas Gass (lukeg) 2025-03-31 09:45:20 UTC
Created attachment 179953 [details] [review]
Bug 28530: Fix remaining QA script failures

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 99 Lucas Gass (lukeg) 2025-03-31 09:45:24 UTC
Created attachment 179954 [details] [review]
Bug 28530: (QA follow-up) correct item count and limit enforcement

Corrected the count of items to limit to the current branch. Also set the limit to trigger when the count of items at the branch is currently at the limit before the item to be checked in.

Signed-off-by: Kris Becker <kbecker@jcls.org>
Comment 100 Lucas Gass (lukeg) 2025-03-31 09:45:27 UTC
Created attachment 179955 [details] [review]
Bug 28530: Adjust number of tests
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
Created attachment 180028 [details] [review]
Bug 28530: Adjust number of tests

Signed-off-by: Kris Becker <kbecker@jcls.org>
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
Created attachment 182931 [details] [review]
Bug 28530: Use DBIC query and return library object
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.