From 000ba5cd318154d6daa71bc178d01d56b31bc13a Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Mon, 20 Apr 2020 12:16:34 +0000 Subject: [PATCH] Bug 25089: Change sorting order to branchcode, checkout_type, categorycode, itemtype Otherwise we need to duplicate a rule with renewalsallowed=0 every rule if we don't want on-site checkouts to be renewalable. To test: 1. prove t/db_dependent/Koha/CirculationRules.t --- Koha/CirculationRules.pm | 2 +- .../prog/en/modules/admin/smart-rules.tt | 46 +++++++++---------- t/db_dependent/Koha/CirculationRules.t | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm index 546d72fa56..7a951a84c8 100644 --- a/Koha/CirculationRules.pm +++ b/Koha/CirculationRules.pm @@ -190,7 +190,7 @@ sub get_effective_rule { } my $order_by = $params->{order_by} - // { -desc => [ 'branchcode', 'categorycode', 'itemtype', 'checkout_type' ] }; + // { -desc => [ 'branchcode', 'checkout_type', 'categorycode', 'itemtype', ] }; my $search_params; $search_params->{rule_name} = $rule_name; 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 d73e7e0f4c..358573a387 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 @@ -93,9 +93,9 @@ + - @@ -129,11 +129,11 @@ [% SET row_count = 0 %] - [% FOREACH c IN categorycodes %] - [% SET c = '' UNLESS c.defined %] - [% FOREACH i IN itemtypes %] + [% FOREACH ct IN checkout_types %] + [% FOREACH c IN categorycodes %] + [% SET c = '' UNLESS c.defined %] + [% FOREACH i IN itemtypes %] [% SET i = '' UNLESS i.defined %] - [% FOREACH ct IN checkout_types %] [% SET ct = '' UNLESS ct.defined %] [% SET note = all_rules.$c.$i.$ct.note %] [% SET maxissueqty = all_rules.$c.$i.$ct.maxissueqty %] @@ -168,28 +168,28 @@ [% SET row_count = row_count + 1 %] + - + - diff --git a/t/db_dependent/Koha/CirculationRules.t b/t/db_dependent/Koha/CirculationRules.t index 95e063a6da..ee8b342b6e 100644 --- a/t/db_dependent/Koha/CirculationRules.t +++ b/t/db_dependent/Koha/CirculationRules.t @@ -288,7 +288,7 @@ sub prepare_tests_for_rule_scope_combinations { # We must maintain the order in order to keep the test valid. This should be # equal to Koha/CirculationRules.pm "order_by" of C sub. # Let's explicitly define the order and fail test if we are missing a scope: - my $order = [ 'branchcode', 'categorycode', 'itemtype', 'checkout_type' ]; + my $order = [ 'branchcode', 'checkout_type', 'categorycode', 'itemtype' ]; is( join(", ", sort keys %$scope), join(", ", sort @$order), 'Missing a scope!' ) if keys %$scope ne scalar @$order; -- 2.17.1
Checkout type Patron category Item typeCheckout type Actions Note Current checkouts allowed
- [% IF c == undef %] + [% IF ct == undef %] All [% ELSE %] - [% Categories.GetName(c) | html %] + [% IF ct == 'CHECKOUT' %] + Normal checkout + [% ELSIF ct == 'ONSITE' %] + On-site checkout + [% END %] [% END %] - [% IF i == undef %] + [% IF c == undef %] All [% ELSE %] - [% ItemTypes.GetDescription(i) | html %] + [% Categories.GetName(c) | html %] [% END %] - [% IF ct == undef %] + [% IF i == undef %] All [% ELSE %] - [% IF ct == 'CHECKOUT' %] - Normal checkout - [% ELSIF ct == 'ONSITE' %] - On-site checkout - [% END %] + [% ItemTypes.GetDescription(i) | html %] [% END %] @@ -322,6 +322,13 @@ [% END %] [% END %]
+ + - - @@ -430,9 +430,9 @@
Checkout type Patron category Item typeCheckout type   Note Current checkouts allowed