From 371757735afa648989b3fe32d68b9ec5ba7f6a69 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 3 May 2019 17:34:22 -0400 Subject: [PATCH] Bug 22847: Correctly displayed circ rule values for max_holds and maxissue* There are several things going wrong on the circulation rules screen. The global rule is displayed for specific libraries (even if the rule does not exist for the library), and max_holds is always blank. I have trouble finding the root of the issue, but I will propose a patch to fix both problem. Certainly a mismatch between bug 18887 and bug 18925. Test plan: 0. Do not apply the patch 1. Notice the issue on the circulation rules screen 2. Apply the patch 3. Confirm that the value you set are correctly displayed (and not the propagated ones!) --- Koha/Template/Plugin/CirculationRules.pm | 12 ++++++------ koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Koha/Template/Plugin/CirculationRules.pm b/Koha/Template/Plugin/CirculationRules.pm index 004ba92736..04587d4d51 100644 --- a/Koha/Template/Plugin/CirculationRules.pm +++ b/Koha/Template/Plugin/CirculationRules.pm @@ -26,9 +26,9 @@ use Koha::CirculationRules; sub Get { my ( $self, $branchcode, $categorycode, $itemtype, $rule_name ) = @_; - $branchcode = undef if $branchcode eq q{}; - $categorycode = undef if $categorycode eq q{}; - $itemtype = undef if $itemtype eq q{}; + $branchcode = undef if $branchcode eq q{} or $branchcode eq q{*}; + $categorycode = undef if $categorycode eq q{} or $branchcode eq q{*}; + $itemtype = undef if $itemtype eq q{} or $branchcode eq q{*}; my $rule = Koha::CirculationRules->get_effective_rule( { @@ -45,9 +45,9 @@ sub Get { sub Search { my ( $self, $branchcode, $categorycode, $itemtype, $rule_name ) = @_; - $branchcode = undef if $branchcode eq q{}; - $categorycode = undef if $categorycode eq q{}; - $itemtype = undef if $itemtype eq q{}; + $branchcode = undef if $branchcode eq q{} or $branchcode eq q{*}; + $categorycode = undef if $categorycode eq q{} or $branchcode eq q{*}; + $itemtype = undef if $itemtype eq q{} or $branchcode eq q{*}; my $rule = Koha::CirculationRules->search( { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index bca8b25940..0f26380c9b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -411,15 +411,15 @@ Defaults[% UNLESS ( default_rules ) %] (not set)[% END %] - [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %] + [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %] - [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxonsiteissueqty' ) %] + [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %] - [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %] + [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %] -- 2.11.0