Bugzilla – Attachment 125705 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: Add max_daily_article_requests circulation rule
Bug-27945-Add-maxdailyarticlerequests-circulation-.patch (text/plain), 8.19 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-04 15:15:44 UTC
(
hide
)
Description:
Bug 27945: Add max_daily_article_requests circulation rule
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-04 15:15:44 UTC
Size:
8.19 KB
patch
obsolete
>From 6e0795c168ee7ce792377e1b2cc8682c132a68b0 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 4 Oct 2021 09:14:16 -0300 >Subject: [PATCH] Bug 27945: Add max_daily_article_requests circulation rule > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/CirculationRules.pm | 4 ++ > admin/smart-rules.pl | 69 +++++++++++++++++++ > .../data/mysql/atomicupdate/bug_27945.pl | 16 +++++ > .../prog/en/modules/admin/smart-rules.tt | 56 +++++++++++++++ > 4 files changed, 145 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_27945.pl > >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 9e23449ac1..f614c6e5a7 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -76,6 +76,10 @@ our $RULE_KINDS = { > article_requests => { > scope => [ 'branchcode', 'categorycode', 'itemtype' ], > }, >+ max_daily_article_requests => { >+ scope => [ 'branchcode', 'categorycode' ], >+ }, >+ > auto_renew => { > scope => [ 'branchcode', 'categorycode', 'itemtype' ], > }, >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 7da7497d3a..cc4370a44f 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -457,6 +457,75 @@ 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') ); >+ >+ if ( $branch eq "*" ) { >+ if ( $categorycode eq "*" ) { >+ Koha::CirculationRules->set_rules( >+ { categorycode => undef, >+ branchcode => undef, >+ rules => { max_daily_article_requests => $max_daily_article_requests, } >+ } >+ ); >+ } else { >+ Koha::CirculationRules->set_rules( >+ { categorycode => $categorycode, >+ branchcode => undef, >+ rules => { max_daily_article_requests => $max_daily_article_requests, } >+ } >+ ); >+ } >+ } elsif ( $categorycode eq "*" ) { >+ Koha::CirculationRules->set_rules( >+ { categorycode => undef, >+ branchcode => $branch, >+ rules => { max_daily_article_requests => $max_daily_article_requests, } >+ } >+ ); >+ } else { >+ Koha::CirculationRules->set_rules( >+ { categorycode => $categorycode, >+ branchcode => $branch, >+ rules => { max_daily_article_requests => $max_daily_article_requests, } >+ } >+ ); >+ } >+} elsif ( $op eq 'del-max-daily-article-requests' ) { >+ 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, } >+ } >+ ); >+ } else { >+ Koha::CirculationRules->set_rules( >+ { categorycode => $categorycode, >+ branchcode => undef, >+ rules => { max_daily_article_requests => undef, } >+ } >+ ); >+ } >+ } elsif ( $categorycode eq "*" ) { >+ Koha::CirculationRules->set_rules( >+ { branchcode => $branch, >+ categorycode => undef, >+ rules => { max_daily_article_requests => undef, } >+ } >+ ); >+ } else { >+ Koha::CirculationRules->set_rules( >+ { categorycode => $categorycode, >+ branchcode => $branch, >+ rules => { max_daily_article_requests => undef, } >+ } >+ ); >+ } >+} > elsif ($op eq "add-branch-item") { > my $itemtype = $input->param('itemtype'); > my $holdallowed = $input->param('holdallowed'); >diff --git a/installer/data/mysql/atomicupdate/bug_27945.pl b/installer/data/mysql/atomicupdate/bug_27945.pl >new file mode 100755 >index 0000000000..2be48d80c9 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_27945.pl >@@ -0,0 +1,16 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "27945", >+ description => "Add max_daily_article_requests circulation rule", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh) = @$args{qw(dbh)}; >+ >+ # Do you stuffs here >+ $dbh->do(q{ >+ INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value) >+ VALUES (NULL, NULL, NULL, 'max_daily_article_requests', NULL); >+ }); >+ }, >+ } >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 172e546f8a..3e8a47e94b 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 >@@ -787,6 +787,62 @@ > </div> > [% END %] > >+ [% IF Koha.Preference('ArticleRequests') %] >+ <div id="max-daily-article-requests-patron-category" class="container"> >+ [% IF humanbranch %] >+ <h3>Article requests limits for [% Branches.GetName( humanbranch ) | html %]</h3> >+ [% ELSE %] >+ <h3>Default article requests limits</h3> >+ [% END %] >+ <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p> >+ <form 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="branch" value="[% current_branch | html %]"/> >+ <table> >+ <tr> >+ <th>Patron category</th> >+ <th>Total article requests</th> >+ <th> </th> >+ </tr> >+ [% FOREACH c IN categorycodes %] >+ [% NEXT UNLESS c %] >+ [% SET max_daily_article_requests = CirculationRules.Search( branchcode, c, undef, 'max_daily_article_requests' ) %] >+ >+ [% IF ( max_daily_article_requests.defined && max_daily_article_requests != '' ) %] >+ <tr> >+ <td> >+ [% Categories.GetName(c) | html %] >+ </td> >+ <td> >+ [% IF max_daily_article_requests.defined && max_daily_article_requests != '' %] >+ [% max_daily_article_requests | 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> >+ </td> >+ </tr> >+ [% END %] >+ [% END %] >+ <tr> >+ <td> >+ <select name="categorycode"> >+ [% FOREACH patron_category IN patron_categories %] >+ <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option> >+ [% END %] >+ </select> >+ </td> >+ <td><input name="max_daily_article_requests" 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> >+ </form> >+ </div> >+ [% END %] >+ > <div id="refund-lost-item-fee-on-return" class="container"> > [% IF current_branch == '*' %] > <h3>Default lost item fee refund on return policy</h3> >-- >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