@@ -, +, @@
category' block
---
Koha/Template/Plugin/CirculationRules.pm | 20 ++++++++++++++++++++
.../prog/en/modules/admin/smart-rules.tt | 11 +++++------
2 files changed, 25 insertions(+), 6 deletions(-)
--- a/Koha/Template/Plugin/CirculationRules.pm
+++ a/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{};
+ $categorycode = undef if $categorycode eq q{};
+ $itemtype = undef if $itemtype 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;
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
@@ -533,9 +533,9 @@
|
[% FOREACH c IN categorycodes %]
- [% SET patron_maxissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxissueqty' ) %]
- [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
- [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
+ [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
+ [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
+ [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
[% IF patron_maxissueqty || patron_maxonsiteissueqty || max_holds %]
@@ -561,9 +561,8 @@
[% END %]
- [% SET rule_value = CirculationRules.Get( branch_cat_rule_loo.branchcode || '*', branch_cat_rule_loo.categorycode, branch_cat_rule_loo.itemtype, 'max_holds' ) %]
- [% IF rule_value.defined && rule_value != '' %]
- [% rule_value | html %]
+ [% IF max_holds.defined && max_holds != '' %]
+ [% max_holds | html %]
[% ELSE %]
Unlimited
[% END %]
--
|