Bugzilla – Attachment 125741 Details for
Bug 27945
Limit the number of active article requests per patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27945: Terminology: max daily => open requests limit
Bug-27945-Terminology-max-daily--open-requests-lim.patch (text/plain), 10.74 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-05 15:02:57 UTC
(
hide
)
Description:
Bug 27945: Terminology: max daily => open requests limit
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-05 15:02:57 UTC
Size:
10.74 KB
patch
obsolete
>From 1e29cf0c053fb5eb7c6dab5d54fab06ab131edd2 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >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 <tomascohen@theke.io> >--- > 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') %] >- <div id="max-daily-article-requests-patron-category" class="container"> >+ <div id="open-article-requests-limit-patron-category" class="container"> > [% IF humanbranch %] >- <h3>Article requests limits for [% Branches.GetName( humanbranch ) | html %]</h3> >+ <h3>Daily open article requests limit for [% Branches.GetName( humanbranch ) | html %]</h3> > [% ELSE %] >- <h3>Default article requests limits</h3> >+ <h3>Default open article requests limit</h3> > [% END %] > <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p> > <form id="set-article-requests-daily-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> >- <input type="hidden" name="op" value="add-max-daily-article-requests" /> >+ <input type="hidden" name="op" value="add-open-article-requests-limit" /> > <input type="hidden" name="branch" value="[% current_branch | html %]"/> > <table> > <tr> >@@ -806,23 +806,23 @@ > </tr> > [% 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 != '' ) %] > <tr> > <td> > [% Categories.GetName(c) | html %] > </td> > <td> >- [% 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 %] > <span>Unlimited</span> > [% END %] > </td> > > <td class="actions"> >- <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-max-daily-article-requests&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a> >+ <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-open-article-requests-limit&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a> > </td> > </tr> > [% END %] >@@ -835,7 +835,7 @@ > [% END %] > </select> > </td> >- <td><input name="max_daily_article_requests" size="3" type="text" /></td> >+ <td><input name="open_article_requests_limit" size="3" type="text" /></td> > <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td> > </tr> > </table> >@@ -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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27945
:
123217
|
123218
|
123219
|
123220
|
123714
|
123715
|
123774
|
123775
|
123776
|
123777
|
123778
|
123820
|
124066
|
124067
|
124068
|
124069
|
124070
|
124071
|
124072
|
124073
|
124074
|
124075
|
124076
|
124077
|
124078
|
124079
|
124284
|
124285
|
124633
|
124673
|
124674
|
124675
|
124676
|
124677
|
124678
|
124679
|
124680
|
124681
|
124682
|
125140
|
125142
|
125143
|
125144
|
125145
|
125146
|
125147
|
125148
|
125149
|
125150
|
125151
|
125152
|
125178
|
125179
|
125569
|
125571
|
125638
|
125690
|
125702
|
125703
|
125704
|
125705
|
125706
|
125707
|
125726
| 125741 |
125761