@@ -, +, @@ in categories.pl and removed unwanted use Koha::ArticleRequests in ArticleRequest.pm --- Koha/ArticleRequest.pm | 1 - Koha/Patron.pm | 16 +++++++--------- admin/categories.pl | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) --- a/Koha/ArticleRequest.pm +++ a/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); --- a/Koha/Patron.pm +++ a/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(); --- a/admin/categories.pl +++ a/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) { --