Bugzilla – Attachment 192493 Details for
Bug 28530
Allow configuration of floating limits by item type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28530: (QA follow-up) Add POD documentation and database index
8311a7b.patch (text/plain), 3.92 KB, created by
Martin Renvoize (ashimema)
on 2026-02-04 18:38:55 UTC
(
hide
)
Description:
Bug 28530: (QA follow-up) Add POD documentation and database index
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-04 18:38:55 UTC
Size:
3.92 KB
patch
obsolete
>From 8311a7b3557a72338d23fd2e75913ccbfa9d0ca8 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Wed, 4 Feb 2026 17:52:04 +0000 >Subject: [PATCH] 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> >--- > Koha/Library/FloatLimits.pm | 29 +++++++++++++++++++ > .../data/mysql/atomicupdate/bug_28530.pl | 1 + > installer/data/mysql/kohastructure.sql | 1 + > 3 files changed, 31 insertions(+) > >diff --git a/Koha/Library/FloatLimits.pm b/Koha/Library/FloatLimits.pm >index df7c5c5f29b..2ed7efac98c 100644 >--- a/Koha/Library/FloatLimits.pm >+++ b/Koha/Library/FloatLimits.pm >@@ -37,6 +37,35 @@ Koha::Library::FloatLimits - Koha Library::FloatLimit object set class > > =head3 lowest_ratio_library > >+ my $library = Koha::Library::FloatLimits->lowest_ratio_library( >+ $item, $branchcode, $from_branch >+ ); >+ >+Determines the optimal library to transfer an item to based on float limit ratios. >+ >+This method calculates the ratio of current items to float limits for each library >+with configured float limits for the item's type. It considers items currently at >+the branch, items in transit to/from the branch, and respects library group >+restrictions if the item's return policy is set to 'returnbylibrarygroup'. >+ >+The method returns the library with the lowest ratio (most need for this item type), >+with preference given to the current branch in case of ties. Returns undef if no >+suitable transfer destination is found or if branch transfer limits prevent the >+transfer. >+ >+=over 4 >+ >+=item * $item - Koha::Item object to be transferred >+ >+=item * $branchcode - branchcode of the return/checkin location >+ >+=item * $from_branch - (optional) branchcode where item was previously held, used for >+adjusting item counts during the calculation >+ >+=back >+ >+Returns: Koha::Library object of the destination branch, or undef if no transfer needed >+ > =cut > > sub lowest_ratio_library { >diff --git a/installer/data/mysql/atomicupdate/bug_28530.pl b/installer/data/mysql/atomicupdate/bug_28530.pl >index 605d50f84fd..e45f6e57df0 100755 >--- a/installer/data/mysql/atomicupdate/bug_28530.pl >+++ b/installer/data/mysql/atomicupdate/bug_28530.pl >@@ -29,6 +29,7 @@ return { > `itemtype` varchar(10) NOT NULL, > `float_limit` int(11) NULL DEFAULT NULL, > PRIMARY KEY (`branchcode`,`itemtype`), >+ KEY `itemtype_idx` (`itemtype`), > CONSTRAINT `library_float_limits_ibfk_bc` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `library_float_limits_ibfk_it` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index c378c5fb7d1..480843aa7ea 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -6896,6 +6896,7 @@ CREATE TABLE `library_float_limits` ( > `itemtype` varchar(10) NOT NULL, > `float_limit` int(11) NULL DEFAULT NULL, > PRIMARY KEY (`branchcode`,`itemtype`), >+ KEY `itemtype_idx` (`itemtype`), > CONSTRAINT `library_float_limits_ibfk_bc` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `library_float_limits_ibfk_it` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >-- >2.52.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28530
:
160038
|
160039
|
160040
|
160041
|
160042
|
160043
|
160044
|
160045
|
160046
|
160047
|
160048
|
160049
|
160050
|
160053
|
160054
|
160055
|
160056
|
160057
|
160058
|
160061
|
160062
|
160063
|
160064
|
160065
|
160066
|
160067
|
160068
|
160071
|
160072
|
160073
|
160074
|
160075
|
160076
|
160077
|
160078
|
160079
|
160080
|
160081
|
160082
|
160083
|
160084
|
163919
|
168343
|
168344
|
168345
|
168346
|
168347
|
168348
|
168349
|
168350
|
178762
|
178763
|
178764
|
178765
|
178766
|
178767
|
178768
|
178769
|
178783
|
178784
|
178785
|
178934
|
178935
|
178936
|
178937
|
178938
|
178939
|
178940
|
178941
|
178942
|
178943
|
178944
|
178945
|
178946
|
179943
|
179944
|
179945
|
179946
|
179947
|
179948
|
179949
|
179950
|
179951
|
179952
|
179953
|
179954
|
179955
|
180028
|
182931
|
184754
|
184755
|
184917
|
184936
|
184951
|
184952
|
184953
|
184954
|
184955
|
184956
|
184957
|
184958
|
184959
|
184960
|
184961
|
184963
|
184965
|
184966
|
184967
|
185038
|
185836
|
185837
|
185838
|
185839
|
185840
|
185841
|
185842
|
185843
|
187525
|
187601
|
190501
|
190502
|
190503
|
190504
|
190505
|
190506
|
190507
|
190508
|
190509
|
190510
|
190511
|
190512
|
190513
|
190547
|
190594
|
190595
|
190596
|
190597
|
190598
|
190599
|
190600
|
190601
|
190602
|
190603
|
190604
|
190605
|
190606
|
190607
|
192476
|
192477
|
192478
|
192479
|
192480
|
192481
|
192482
|
192483
|
192484
|
192485
|
192486
|
192487
|
192488
|
192489
|
192490
|
192491
|
192492
| 192493 |
192494
|
192495
|
192918
|
192954