Bugzilla – Attachment 124679 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: (follow-up) fix limit check in Patron.pm, regexp in categories.pl and removed unwanted use Koha::ArticleRequests in ArticleRequest.pm
Bug-27945-follow-up-fix-limit-check-in-Patronpm-re.patch (text/plain), 2.58 KB, created by
Marcel de Rooy
on 2021-09-09 07:45:06 UTC
(
hide
)
Description:
Bug 27945: (follow-up) fix limit check in Patron.pm, regexp in categories.pl and removed unwanted use Koha::ArticleRequests in ArticleRequest.pm
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-09-09 07:45:06 UTC
Size:
2.58 KB
patch
obsolete
>From 68964c2e63c305dc724a5d75df10c582a8a9d80a Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 20 Aug 2021 09:45:48 +0000 >Subject: [PATCH] Bug 27945: (follow-up) fix limit check in Patron.pm, regexp > in categories.pl and removed unwanted use Koha::ArticleRequests in > ArticleRequest.pm >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/ArticleRequest.pm | 1 - > Koha/Patron.pm | 16 +++++++--------- > admin/categories.pl | 2 +- > 3 files changed, 8 insertions(+), 11 deletions(-) > >diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm >index ac531e8ea4..6c47483d95 100644 >--- a/Koha/ArticleRequest.pm >+++ b/Koha/ArticleRequest.pm >@@ -26,7 +26,6 @@ use Koha::Biblios; > use Koha::Items; > use Koha::Libraries; > use Koha::DateUtils qw( dt_from_string ); >-use Koha::ArticleRequests; > use Koha::Exceptions::ArticleRequest; > > use base qw(Koha::Object); >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index bbdb8d8ff1..e66fdf4247 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -972,18 +972,16 @@ sub can_request_article { > > return 1 if !$limit; > >- my $date = dt_from_string; >- my $count = Koha::ArticleRequests->search({ >- borrowernumber => $self->borrowernumber, >- status => {'!=' => 'CANCELED'}, >- created_on => { >- '>=' => $date->date.' 00:00:00', >- '<=' => $date->date.' 23:59:59' >- } >- })->count; >+ my $dtf = Koha::Database->new->schema->storage->datetime_parser; >+ my $compdate = dt_from_string->add( days => -1 ); >+ my $count = Koha::ArticleRequests->search([ >+ { borrowernumber => $self->borrowernumber, status => { '!=' => ['CANCELED','COMPLETED'] } }, >+ { borrowernumber => $self->borrowernumber, status => 'COMPLETED', updated_on => { '>', $dtf->format_date($compdate) }}, >+ ])->count; > return $count < $limit ? 1 : 0; > } > >+ > =head3 article_requests > > my @requests = $borrower->article_requests(); >diff --git a/admin/categories.pl b/admin/categories.pl >index 958bfd7c76..bd11fa96e9 100644 >--- a/admin/categories.pl >+++ b/admin/categories.pl >@@ -77,7 +77,7 @@ if ( $op eq 'add_validate' ) { > > my $is_a_modif = $input->param("is_a_modif"); > >- if ($article_request_limit ne '' && $article_request_limit !~ /\d+/) { >+ if ($article_request_limit ne '' && $article_request_limit !~ /^\d+$/) { > push @messages, {type => 'error', code => 'article_request_numeric_limit' }; > $op = 'add_form'; > } elsif ($article_request_limit ne '' && $article_request_limit < 0) { >-- >2.20.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