Bugzilla – Attachment 178938 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: Implement float limits
Bug-28530-Implement-float-limits.patch (text/plain), 6.45 KB, created by
Andrew Fuerste-Henry
on 2025-03-04 21:23:30 UTC
(
hide
)
Description:
Bug 28530: Implement float limits
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2025-03-04 21:23:30 UTC
Size:
6.45 KB
patch
obsolete
>From a3269889d4f2bd3051cfefb00b4766be8e936ac1 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 18 Dec 2023 14:21:57 -0500 >Subject: [PATCH] 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> >--- > C4/Circulation.pm | 17 +++++++++++++++++ > circ/returns.pl | 17 +++++++++++++++-- > .../prog/en/modules/admin/admin-home.tt | 2 ++ > .../prog/en/modules/circ/returns.tt | 2 ++ > 4 files changed, 36 insertions(+), 2 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index d546bc04f3..c43e9b4e01 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -51,6 +51,7 @@ use Koha::Patrons; > use Koha::Patron::Debarments qw( DelUniqueDebarment AddUniqueDebarment ); > use Koha::Database; > use Koha::Libraries; >+use Koha::Library::FloatLimits; > use Koha::Account::Lines; > use Koha::Holds; > use Koha::Account::Lines; >@@ -2244,6 +2245,22 @@ sub AddReturn { > # if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch) > my $transfer_trigger = $hbr eq 'homebranch' ? 'ReturnToHome' : $hbr eq 'holdingbranch' ? 'ReturnToHolding' : undef; > >+ # check library float limits if enabled if the item isn't being transferred away >+ if ( ( $returnbranch eq $branch ) && C4::Context->preference('UseLibraryFloatLimits') ) { >+ my $effective_itemtype = $item->effective_itemtype; >+ my $limit = Koha::Library::FloatLimits->find( { itemtype => $effective_itemtype, branchcode => $branch } ); >+ if ($limit) { >+ my $count = Koha::Items->count( { itype => $limit->itemtype } ); >+ if ( $count >= $limit->float_limit ) { >+ my $transfer_branchcode = Koha::Library::FloatLimits->lowest_ratio_library( $item, $branch ); >+ if ( $transfer_branchcode ne $branch ) { >+ $returnbranch = $transfer_branchcode; >+ $transfer_trigger = 'LibraryFloatLimit'; >+ } >+ } >+ } >+ } >+ > my $borrowernumber = $patron ? $patron->borrowernumber : undef; # we don't know if we had a borrower or not > my $patron_unblessed = $patron ? $patron->unblessed : {}; > >diff --git a/circ/returns.pl b/circ/returns.pl >index 11b0795ad7..1a8bb7c2f5 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -332,7 +332,6 @@ if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) { > my $biblio = $item->biblio; > $template->param( > title => $biblio->title, >- returnbranch => $returnbranch, > author => $biblio->author, > itembiblionumber => $biblio->biblionumber, > biblionumber => $biblio->biblionumber, >@@ -457,6 +456,8 @@ if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) { > ); > } > >+ $returnbranch = $messages->{NeedsTransfer} if $messages->{NeedsTransfer}; >+ > # Mark missing bundle items as lost and report unexpected items > if ( $item > && $item->is_bundle >@@ -553,6 +554,13 @@ my $recalled = 0; > # new op dev : we check if the document must be returned to his homebranch directly, > # if the document is transferred, we have warning message . > >+if ( $messages->{'LibraryFloatLimitTransferRequest'} ) { >+ $template->param( >+ LibraryFloatLimitTransferRequest => 1, >+ itemnumber => $itemnumber, >+ ); >+} >+ > if ( $messages->{'WasTransfered'} ) { > $template->param( > found => 1, >@@ -776,6 +784,8 @@ foreach my $code ( keys %$messages ) { > ; > } elsif ( $code eq 'TransferredRecall' ) { > ; >+ } elsif ( $code eq 'LibraryFloatLimitTransferRequest' ) { >+ ; > } elsif ( $code eq 'InBundle' ) { > $template->param( InBundle => $messages->{InBundle} ); > } else { >@@ -890,7 +900,10 @@ if ($barcode) { > } > } > >-$template->param( itemnumber => $itemnumber ); >+$template->param( >+ itemnumber => $itemnumber, >+ returnbranch => $returnbranch, >+); > > # Checking if there is a Fast Cataloging Framework > $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find('FA'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >index a8813575fa..993178cd29 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >@@ -108,6 +108,8 @@ > > > <dt><a href="/cgi-bin/koha/admin/transport-cost-matrix.pl">Transport cost matrix</a></dt> > <dd>Define transport costs between branches</dd> >+ <dt><a href="/cgi-bin/koha/admin/float_limits.pl">Library float limits</a></dt> >+ <dd>Define when items should be transferred to other libraries on checkin to balance floating collections</dd> > [% END %] > [% IF ( CAN_user_parameters_manage_item_circ_alerts ) %] > <dt><a href="/cgi-bin/koha/admin/item_circulation_alerts.pl">Item circulation alerts</a></dt> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 2571d3e394..0054ff9814 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -119,6 +119,8 @@ > <p> > [%- SWITCH trigger -%] > >+ [%- CASE 'LibraryFloatLimit' -%] >+ <span>Library has exceeded float limit for this item type</span> > [%- CASE 'Manual' -%] > <span>Manual</span> > [%- CASE 'StockrotationAdvance' -%] >-- >2.39.5
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