X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=Koha%2FArticleRequests.pm;h=78b19255ee6f723a3cbd12e111f0630e01759e2b;hb=3fdc503ca78fd06d0c6dc3477812acc7799351b9;hp=662677af648c1abacc3f4f262ef63d3e628c9f51;hpb=3fc76156e29a345bd7e603b390c93303a11463d7;p=koha-ffzg.git diff --git a/Koha/ArticleRequests.pm b/Koha/ArticleRequests.pm index 662677af64..78b19255ee 100644 --- a/Koha/ArticleRequests.pm +++ b/Koha/ArticleRequests.pm @@ -33,7 +33,7 @@ Koha::ArticleRequests - Koha ArticleRequests Object class =head1 API -=head2 Class Methods +=head2 Class methods =cut @@ -60,6 +60,49 @@ sub search_limited { return $self->search( $params, $attributes ); } +=head3 filter_by_current + + my $current_article_requests = $article_requests->filter_by_current; + +Returns a new resultset, filtering out finished article requests. + +=cut + +sub filter_by_current { + my ($self) = @_; + + return $self->search( + { + status => [ + Koha::ArticleRequest::Status::Requested, + Koha::ArticleRequest::Status::Pending, + Koha::ArticleRequest::Status::Processing, + ] + } + ); +} + +=head3 filter_by_finished + + my $finished_article_requests = $article_requests->filter_by_finished; + +Returns a new resultset, filtering out current article requests. + +=cut + +sub filter_by_finished { + my ($self) = @_; + + return $self->search( + { + status => [ + Koha::ArticleRequest::Status::Completed, + Koha::ArticleRequest::Status::Canceled, + ] + } + ); +} + =head3 requested =cut