View | Details | Raw Unified | Return to bug 27945
Collapse All | Expand All

(-)a/admin/smart-rules.pl (+5 lines)
Lines 22-27 use CGI qw ( -utf8 ); Link Here
22
use C4::Context;
22
use C4::Context;
23
use C4::Output qw( output_html_with_http_headers );
23
use C4::Output qw( output_html_with_http_headers );
24
use C4::Auth qw( get_template_and_user );
24
use C4::Auth qw( get_template_and_user );
25
use Koha::Exceptions::Exception;
25
use Koha::DateUtils qw( dt_from_string output_pref );
26
use Koha::DateUtils qw( dt_from_string output_pref );
26
use Koha::Database;
27
use Koha::Database;
27
use Koha::Logger;
28
use Koha::Logger;
Lines 461-466 elsif ( $op eq "add-max-daily-article-requests" ) { Link Here
461
    my $categorycode               = $input->param('categorycode');
462
    my $categorycode               = $input->param('categorycode');
462
    my $max_daily_article_requests = strip_non_numeric( scalar $input->param('max_daily_article_requests') );
463
    my $max_daily_article_requests = strip_non_numeric( scalar $input->param('max_daily_article_requests') );
463
464
465
    Koha::Exceptions::Exception->throw("No value passed for article request limit")
466
      if not defined $max_daily_article_requests # There is a JS check for that
467
      || $max_daily_article_requests eq '';
468
464
    if ( $branch eq "*" ) {
469
    if ( $branch eq "*" ) {
465
        if ( $categorycode eq "*" ) {
470
        if ( $categorycode eq "*" ) {
466
            Koha::CirculationRules->set_rules(
471
            Koha::CirculationRules->set_rules(
(-)a/installer/data/mysql/atomicupdate/bug_27945.pl (-16 lines)
Lines 1-16 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "27945",
5
    description => "Add max_daily_article_requests circulation rule",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ($dbh)  = @$args{qw(dbh)};
9
10
        # Do you stuffs here
11
        $dbh->do(q{
12
            INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value)
13
            VALUES (NULL, NULL, NULL, 'max_daily_article_requests', NULL);
14
        });
15
    },
16
  }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-2 / +9 lines)
Lines 795-801 Link Here
795
        <h3>Default article requests limits</h3>
795
        <h3>Default article requests limits</h3>
796
    [% END %]
796
    [% END %]
797
        <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p>
797
        <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p>
798
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
798
        <form id="set-article-requests-daily-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
799
            <input type="hidden" name="op" value="add-max-daily-article-requests" />
799
            <input type="hidden" name="op" value="add-max-daily-article-requests" />
800
            <input type="hidden" name="branch" value="[% current_branch | html %]"/>
800
            <input type="hidden" name="branch" value="[% current_branch | html %]"/>
801
            <table>
801
            <table>
Lines 1229-1234 Link Here
1229
                e.preventDefault();
1229
                e.preventDefault();
1230
                clear_edit();
1230
                clear_edit();
1231
            });
1231
            });
1232
1233
            $("#set-article-requests-daily-limit").on("submit", function(){
1234
                if (! $("input[name='max_daily_article_requests'").val().length){
1235
                    alert("Please set a daily limit for this patron's category");
1236
                    return false;
1237
                }
1238
                return true;
1239
            });
1232
        });
1240
        });
1233
    </script>
1241
    </script>
1234
[% END %]
1242
[% END %]
1235
- 

Return to bug 27945