From 8242334b16f3f4107dc13fa82bf5792386341c31 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 May 2019 12:31:23 -0500 Subject: [PATCH] Bug 22847: [18.11] Correctly displayed circ rule values for max_holds --- Koha/Template/Plugin/CirculationRules.pm | 20 ++++++++++++++++++++ .../prog/en/modules/admin/smart-rules.tt | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Koha/Template/Plugin/CirculationRules.pm b/Koha/Template/Plugin/CirculationRules.pm index d6c79c8c00..5446fe1519 100644 --- a/Koha/Template/Plugin/CirculationRules.pm +++ b/Koha/Template/Plugin/CirculationRules.pm @@ -42,4 +42,24 @@ sub Get { return $rule->rule_value if $rule; } +sub Search { + my ( $self, $branchcode, $categorycode, $itemtype, $rule_name ) = @_; + + $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( + { + branchcode => $branchcode, + categorycode => $categorycode, + itemtype => $itemtype, + rule_name => $rule_name, + } + )->next; + + return $rule->rule_value if $rule; +} + + 1; 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 f42a63ba80..3b43f295f5 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 @@ -399,7 +399,7 @@ - [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %] + [% SET rule_value = CirculationRules.Search( current_branch, undef, undef, 'max_holds' ) %] -- 2.11.0