|
Lines 972-989
sub can_request_article {
Link Here
|
| 972 |
|
972 |
|
| 973 |
return 1 if !$limit; |
973 |
return 1 if !$limit; |
| 974 |
|
974 |
|
| 975 |
my $date = dt_from_string; |
975 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
| 976 |
my $count = Koha::ArticleRequests->search({ |
976 |
my $compdate = dt_from_string->add( days => -1 ); |
| 977 |
borrowernumber => $self->borrowernumber, |
977 |
my $count = Koha::ArticleRequests->search([ |
| 978 |
status => {'!=' => 'CANCELED'}, |
978 |
{ borrowernumber => $self->borrowernumber, status => { '!=' => ['CANCELED','COMPLETED'] } }, |
| 979 |
created_on => { |
979 |
{ borrowernumber => $self->borrowernumber, status => 'COMPLETED', updated_on => { '>', $dtf->format_date($compdate) }}, |
| 980 |
'>=' => $date->date.' 00:00:00', |
980 |
])->count; |
| 981 |
'<=' => $date->date.' 23:59:59' |
|
|
| 982 |
} |
| 983 |
})->count; |
| 984 |
return $count < $limit ? 1 : 0; |
981 |
return $count < $limit ? 1 : 0; |
| 985 |
} |
982 |
} |
| 986 |
|
983 |
|
|
|
984 |
|
| 987 |
=head3 article_requests |
985 |
=head3 article_requests |
| 988 |
|
986 |
|
| 989 |
my @requests = $borrower->article_requests(); |
987 |
my @requests = $borrower->article_requests(); |