@@ -, +, @@ --- admin/smart-rules.pl | 5 +++++ installer/data/mysql/atomicupdate/bug_27945.pl | 16 ---------------- .../prog/en/modules/admin/smart-rules.tt | 10 +++++++++- 3 files changed, 14 insertions(+), 17 deletions(-) delete mode 100755 installer/data/mysql/atomicupdate/bug_27945.pl --- a/admin/smart-rules.pl +++ a/admin/smart-rules.pl @@ -22,6 +22,7 @@ use CGI qw ( -utf8 ); use C4::Context; use C4::Output qw( output_html_with_http_headers ); use C4::Auth qw( get_template_and_user ); +use Koha::Exceptions::Exception; use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::Database; use Koha::Logger; @@ -461,6 +462,10 @@ 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') ); + 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 ( $branch eq "*" ) { if ( $categorycode eq "*" ) { Koha::CirculationRules->set_rules( --- a/installer/data/mysql/atomicupdate/bug_27945.pl +++ a/installer/data/mysql/atomicupdate/bug_27945.pl @@ -1,16 +0,0 @@ -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); - }); - }, - } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -795,7 +795,7 @@

Default article requests limits

[% END %]

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

-
+ @@ -1229,6 +1229,14 @@ e.preventDefault(); clear_edit(); }); + + $("#set-article-requests-daily-limit").on("submit", function(){ + if (! $("input[name='max_daily_article_requests'").val().length){ + alert("Please set a daily limit for this patron's category"); + return false; + } + return true; + }); }); [% END %] --