Bugzilla – Attachment 125726 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: Don't save rule if not defined
Bug-27945-Dont-save-rule-if-not-defined.patch (text/plain), 3.78 KB, created by
Jonathan Druart
on 2021-10-05 09:32:27 UTC
(
hide
)
Description:
Bug 27945: Don't save rule if not defined
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-10-05 09:32:27 UTC
Size:
3.78 KB
patch
obsolete
>From c0a077c96f25684bf9a2fd4bf7ef4836f4186817 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 5 Oct 2021 11:30:37 +0200 >Subject: [PATCH] Bug 27945: Don't save rule if not defined > >The DB rev added a row with NULL (unlimited), and the UI a row with '' >(unlimited as well) when saved without value. > >Better is to not have a row (still unlimited) >--- > 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 > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index cc4370a44f6..171653a3d4c 100755 >--- a/admin/smart-rules.pl >+++ b/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( >diff --git a/installer/data/mysql/atomicupdate/bug_27945.pl b/installer/data/mysql/atomicupdate/bug_27945.pl >deleted file mode 100755 >index 2be48d80c95..00000000000 >--- a/installer/data/mysql/atomicupdate/bug_27945.pl >+++ /dev/null >@@ -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); >- }); >- }, >- } >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 209d44f34b6..a7497229fde 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 >@@ -795,7 +795,7 @@ > <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"> >+ <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="branch" value="[% current_branch | html %]"/> > <table> >@@ -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; >+ }); > }); > </script> > [% END %] >-- >2.25.1
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