Bugzilla – Attachment 160068 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) Fix QA issues
Bug-28530-QA-follow-up-Fix-QA-issues.patch (text/plain), 9.09 KB, created by
Kyle M Hall (khall)
on 2023-12-19 19:05:37 UTC
(
hide
)
Description:
Bug 28530: (QA follow-up) Fix QA issues
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-12-19 19:05:37 UTC
Size:
9.09 KB
patch
obsolete
>From 48c07489d0780d487b4d578c99707b86bd49e346 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 19 Dec 2023 19:03:35 +0000 >Subject: [PATCH] Bug 28530: (QA follow-up) Fix QA issues > >--- > C4/Circulation.pm | 2 +- > Koha/Library/FloatLimits.pm | 5 +++-- > admin/float_limits.pl | 10 ++++----- > .../data/mysql/atomicupdate/bug_28530.pl | 4 ++-- > installer/data/mysql/kohastructure.sql | 2 +- > .../prog/en/includes/admin-menu.inc | 1 + > t/db_dependent/Circulation/Returns.t | 18 +++++++-------- > t/db_dependent/Koha/Library/FloatLimits.t | 22 +++++++++---------- > 8 files changed, 33 insertions(+), 31 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 7beff85790d..ef4c81db36e 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2202,7 +2202,7 @@ sub AddReturn { > my $limit = Koha::Library::FloatLimits->find( { itemtype => $effective_itemtype, branchcode => $branch } ); > if ($limit) { > my $count = Koha::Items->count( { itype => $limit->itemtype } ); >- if ( $count >= $limit->limit ) { >+ if ( $count >= $limit->float_limit ) { > my $transfer_branchcode = Koha::Library::FloatLimits->lowest_ratio_library( $item, $branch ); > if ( $transfer_branchcode ne $branch ) { > $returnbranch = $transfer_branchcode; >diff --git a/Koha/Library/FloatLimits.pm b/Koha/Library/FloatLimits.pm >index ddeeb47afbe..5697b38b1c5 100644 >--- a/Koha/Library/FloatLimits.pm >+++ b/Koha/Library/FloatLimits.pm >@@ -50,9 +50,10 @@ sub lowest_ratio_library { > LEFT JOIN items ON ( items.itype = library_float_limits.itemtype AND items.holdingbranch = library_float_limits.branchcode ) > LEFT JOIN biblioitems ON ( items.biblioitemnumber = biblioitems.biblioitemnumber ) > WHERE library_float_limits.itemtype = ? >- AND $field = ? >+ AND ( $field = ? OR $field IS NULL ) >+ AND library_float_limits.float_limit != 0 > GROUP BY branchcode >- ORDER BY COUNT(items.holdingbranch)/library_float_limits.limit >+ ORDER BY COUNT(items.holdingbranch)/library_float_limits.float_limit ASC, library_float_limits.float_limit DESC; > }; > > my $results = C4::Context->dbh->selectall_arrayref( >diff --git a/admin/float_limits.pl b/admin/float_limits.pl >index c07b24227d6..92133412f8c 100755 >--- a/admin/float_limits.pl >+++ b/admin/float_limits.pl >@@ -60,12 +60,12 @@ if ( $op eq 'set_float_limits' ) { > my $limit = $input->param( "limit_" . $branchcode . "_" . $itype ); > Koha::Library::FloatLimit->new( > { >- branchcode => $branchcode, >- itemtype => $itype, >- limit => $limit >+ branchcode => $branchcode, >+ itemtype => $itype, >+ float_limit => $limit, > } > )->store() >- if $limit; # update or insert >+ if $limit ne q{}; # update or insert > } > } > $template->param( float_limits_updated => 1 ); >@@ -76,7 +76,7 @@ if ( $op eq 'set_float_limits' ) { > my $limits_hash = {}; > my $limits = Koha::Library::FloatLimits->search(); > while ( my $l = $limits->next ) { >- $limits_hash->{ $l->branchcode }->{ $l->itemtype } = $l->limit; >+ $limits_hash->{ $l->branchcode }->{ $l->itemtype } = $l->float_limit; > } > $template->param( limits => $limits_hash ); > >diff --git a/installer/data/mysql/atomicupdate/bug_28530.pl b/installer/data/mysql/atomicupdate/bug_28530.pl >index aaed5ca0a94..605d50f84fd 100755 >--- a/installer/data/mysql/atomicupdate/bug_28530.pl >+++ b/installer/data/mysql/atomicupdate/bug_28530.pl >@@ -21,13 +21,13 @@ return { > ); > say $out "Added new system preference 'UseLibraryFloatLimits'"; > >- unless ( TableExists('search_filters') ) { >+ unless ( TableExists('library_float_limits') ) { > $dbh->do( > q{ > CREATE TABLE `library_float_limits` ( > `branchcode` varchar(10) NOT NULL, > `itemtype` varchar(10) NOT NULL, >- `limit` int(11) NULL DEFAULT NULL, >+ `float_limit` int(11) NULL DEFAULT NULL, > PRIMARY KEY (`branchcode`,`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 >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index bc6d5a44398..4f216d42357 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -6363,7 +6363,7 @@ DROP TABLE IF EXISTS `library_float_limits`; > CREATE TABLE `library_float_limits` ( > `branchcode` varchar(10) NOT NULL, > `itemtype` varchar(10) NOT NULL, >- `limit` int(11) NULL DEFAULT NULL, >+ `float_limit` int(11) NULL DEFAULT NULL, > PRIMARY KEY (`branchcode`,`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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >index c7caffc0143..71ecf63c6ba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >@@ -41,6 +41,7 @@ > [% IF ( CAN_user_parameters_manage_transfers ) %] > <li><a href="/cgi-bin/koha/admin/branch_transfer_limits.pl">Library transfer limits</a></li> > <li><a href="/cgi-bin/koha/admin/transport-cost-matrix.pl">Transport cost matrix</a></li> >+ <li><a href="/cgi-bin/koha/admin/float_limits.pl">Library float limits</a></li> > [% END %] > [% IF ( CAN_user_parameters_manage_item_circ_alerts ) %] > <li><a href="/cgi-bin/koha/admin/item_circulation_alerts.pl">Item circulation alerts</a></li> >diff --git a/t/db_dependent/Circulation/Returns.t b/t/db_dependent/Circulation/Returns.t >index 48c19e9d9e8..e96d7c2f848 100755 >--- a/t/db_dependent/Circulation/Returns.t >+++ b/t/db_dependent/Circulation/Returns.t >@@ -429,25 +429,25 @@ subtest 'Test library float limits' => sub { > > my $limit1 = Koha::Library::FloatLimit->new( > { >- branchcode => $library1->{branchcode}, >- itemtype => $itemtype->itemtype, >- limit => 1, >+ branchcode => $library1->{branchcode}, >+ itemtype => $itemtype->itemtype, >+ float_limit => 1, > } > )->store(); > > my $limit2 = Koha::Library::FloatLimit->new( > { >- branchcode => $library2->{branchcode}, >- itemtype => $itemtype->itemtype, >- limit => 100, >+ branchcode => $library2->{branchcode}, >+ itemtype => $itemtype->itemtype, >+ float_limit => 100, > } > )->store(); > > my $limit3 = Koha::Library::FloatLimit->new( > { >- branchcode => $library3->{branchcode}, >- itemtype => $itemtype->itemtype, >- limit => 1000, >+ branchcode => $library3->{branchcode}, >+ itemtype => $itemtype->itemtype, >+ float_limit => 1000, > } > )->store(); > >diff --git a/t/db_dependent/Koha/Library/FloatLimits.t b/t/db_dependent/Koha/Library/FloatLimits.t >index fa8af003ae0..3d646abe69d 100755 >--- a/t/db_dependent/Koha/Library/FloatLimits.t >+++ b/t/db_dependent/Koha/Library/FloatLimits.t >@@ -87,25 +87,25 @@ my $item = $builder->build_sample_item( > > my $limit1 = Koha::Library::FloatLimit->new( > { >- branchcode => $library1->{branchcode}, >- itemtype => $itemtype->itemtype, >- limit => 1, >+ branchcode => $library1->{branchcode}, >+ itemtype => $itemtype->itemtype, >+ float_limit => 1, > } > )->store(); > >-my $limit2 = Koha::Library::FloatLimit->new( >+my $float_limit2 = Koha::Library::FloatLimit->new( > { >- branchcode => $library2->{branchcode}, >- itemtype => $itemtype->itemtype, >- limit => 100, >+ branchcode => $library2->{branchcode}, >+ itemtype => $itemtype->itemtype, >+ float_limit => 100, > } > )->store(); > >-my $limit3 = Koha::Library::FloatLimit->new( >+my $float_limit3 = Koha::Library::FloatLimit->new( > { >- branchcode => $library3->{branchcode}, >- itemtype => $itemtype->itemtype, >- limit => 1000, >+ branchcode => $library3->{branchcode}, >+ itemtype => $itemtype->itemtype, >+ float_limit => 1000, > } > )->store(); > >-- >2.30.2
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