From 1e29cf0c053fb5eb7c6dab5d54fab06ab131edd2 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 5 Oct 2021 12:02:12 -0300 Subject: [PATCH] Bug 27945: Terminology: max daily => open requests limit Signed-off-by: Tomas Cohen Arazi --- Koha/CirculationRules.pm | 2 +- Koha/Patron.pm | 2 +- admin/smart-rules.pl | 28 +++++++++---------- .../prog/en/modules/admin/smart-rules.tt | 22 +++++++-------- t/db_dependent/Koha/Patron.t | 4 +-- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm index f614c6e5a7..eb66f5f1a0 100644 --- a/Koha/CirculationRules.pm +++ b/Koha/CirculationRules.pm @@ -76,7 +76,7 @@ our $RULE_KINDS = { article_requests => { scope => [ 'branchcode', 'categorycode', 'itemtype' ], }, - max_daily_article_requests => { + open_article_requests_limit => { scope => [ 'branchcode', 'categorycode' ], }, diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 7616f17a56..c24f74ac71 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -979,7 +979,7 @@ sub can_request_article { { branchcode => $library_id, categorycode => $self->categorycode, - rule_name => 'max_daily_article_requests' + rule_name => 'open_article_requests_limit' } ); diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 171653a3d4..31ed87a83a 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -458,27 +458,27 @@ elsif ($op eq "add-branch-cat") { ); } } -elsif ( $op eq "add-max-daily-article-requests" ) { - my $categorycode = $input->param('categorycode'); - my $max_daily_article_requests = strip_non_numeric( scalar $input->param('max_daily_article_requests') ); +elsif ( $op eq "add-open-article-requests-limit" ) { + my $categorycode = $input->param('categorycode'); + my $open_article_requests_limit = strip_non_numeric( scalar $input->param('open_article_requests_limit') ); Koha::Exceptions::Exception->throw("No value passed for article request limit") - if not defined $max_daily_article_requests # There is a JS check for that - || $max_daily_article_requests eq ''; + if not defined $open_article_requests_limit # There is a JS check for that + || $open_article_requests_limit eq ''; if ( $branch eq "*" ) { if ( $categorycode eq "*" ) { Koha::CirculationRules->set_rules( { categorycode => undef, branchcode => undef, - rules => { max_daily_article_requests => $max_daily_article_requests, } + rules => { open_article_requests_limit => $open_article_requests_limit, } } ); } else { Koha::CirculationRules->set_rules( { categorycode => $categorycode, branchcode => undef, - rules => { max_daily_article_requests => $max_daily_article_requests, } + rules => { open_article_requests_limit => $open_article_requests_limit, } } ); } @@ -486,32 +486,32 @@ elsif ( $op eq "add-max-daily-article-requests" ) { Koha::CirculationRules->set_rules( { categorycode => undef, branchcode => $branch, - rules => { max_daily_article_requests => $max_daily_article_requests, } + rules => { open_article_requests_limit => $open_article_requests_limit, } } ); } else { Koha::CirculationRules->set_rules( { categorycode => $categorycode, branchcode => $branch, - rules => { max_daily_article_requests => $max_daily_article_requests, } + rules => { open_article_requests_limit => $open_article_requests_limit, } } ); } -} elsif ( $op eq 'del-max-daily-article-requests' ) { +} elsif ( $op eq 'del-open-article-requests-limit' ) { my $categorycode = $input->param('categorycode'); if ( $branch eq "*" ) { if ( $categorycode eq "*" ) { Koha::CirculationRules->set_rules( { branchcode => undef, categorycode => undef, - rules => { max_daily_article_requests => undef, } + rules => { open_article_requests_limit => undef, } } ); } else { Koha::CirculationRules->set_rules( { categorycode => $categorycode, branchcode => undef, - rules => { max_daily_article_requests => undef, } + rules => { open_article_requests_limit => undef, } } ); } @@ -519,14 +519,14 @@ elsif ( $op eq "add-max-daily-article-requests" ) { Koha::CirculationRules->set_rules( { branchcode => $branch, categorycode => undef, - rules => { max_daily_article_requests => undef, } + rules => { open_article_requests_limit => undef, } } ); } else { Koha::CirculationRules->set_rules( { categorycode => $categorycode, branchcode => $branch, - rules => { max_daily_article_requests => undef, } + rules => { open_article_requests_limit => undef, } } ); } 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 9aa35981fa..10f6542c28 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 @@ -788,15 +788,15 @@ [% END %] [% IF Koha.Preference('ArticleRequests') %] -
+
[% IF humanbranch %] -

Article requests limits for [% Branches.GetName( humanbranch ) | html %]

+

Daily open article requests limit for [% Branches.GetName( humanbranch ) | html %]

[% ELSE %] -

Default article requests limits

+

Default open article requests limit

[% END %]

Specify the maximum number simultaneous current article requests a patron of a given category can have.

- + @@ -806,23 +806,23 @@ [% FOREACH c IN categorycodes %] [% NEXT UNLESS c %] - [% SET max_daily_article_requests = CirculationRules.Search( branchcode, c, undef, 'max_daily_article_requests' ) %] + [% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %] - [% IF ( max_daily_article_requests.defined && max_daily_article_requests != '' ) %] + [% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %] [% END %] @@ -835,7 +835,7 @@ [% END %] - +
[% Categories.GetName(c) | html %] - [% IF max_daily_article_requests.defined && max_daily_article_requests != '' %] - [% max_daily_article_requests | html %] + [% IF open_article_requests_limit.defined && open_article_requests_limit != '' %] + [% open_article_requests_limit | html %] [% ELSE %] Unlimited [% END %] - Delete + Delete
@@ -1231,7 +1231,7 @@ }); $("#set-article-requests-daily-limit").on("submit", function(){ - if (! $("input[name='max_daily_article_requests'").val().length){ + if (! $("input[name='open_article_requests_limit'").val().length){ alert("Please set a daily limit for this patron's category"); return false; } diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index 04237fa143..dc6a949436 100755 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -738,7 +738,7 @@ subtest 'can_request_article() tests' => sub { { categorycode => undef, branchcode => $library_1->id, - rule_name => 'max_daily_article_requests', + rule_name => 'open_article_requests_limit', rule_value => 4, } ); @@ -802,7 +802,7 @@ subtest 'can_request_article() tests' => sub { { categorycode => undef, branchcode => $library_2->id, - rule_name => 'max_daily_article_requests', + rule_name => 'open_article_requests_limit', rule_value => 3, } ); -- 2.32.0