View | Details | Raw Unified | Return to bug 29084
Collapse All | Expand All

(-)a/Koha/Biblio.pm (-35 / +11 lines)
Lines 341-407 sub article_request_type_for_items { Link Here
341
341
342
=head3 article_requests
342
=head3 article_requests
343
343
344
my @requests = $biblio->article_requests
344
    my $article_requests = $biblio->article_requests
345
345
346
Returns the article requests associated with this Biblio
346
Returns the article requests associated with this biblio
347
347
348
=cut
348
=cut
349
349
350
sub article_requests {
350
sub article_requests {
351
    my ( $self, $borrower ) = @_;
351
    my ( $self ) = @_;
352
353
    $self->{_article_requests} ||= Koha::ArticleRequests->search( { biblionumber => $self->biblionumber() } );
354
352
355
    return wantarray ? $self->{_article_requests}->as_list : $self->{_article_requests};
353
    return Koha::ArticleRequests->_new_from_dbic( scalar $self->_result->article_requests );
356
}
354
}
357
355
358
=head3 article_requests_current
356
=head3 article_requests_current
359
357
360
my @requests = $biblio->article_requests_current
358
    my $current_article_requests = $biblio->article_requests_current
361
359
362
Returns the article requests associated with this Biblio that are incomplete
360
Returns the article requests associated with this biblio that are incomplete
363
361
364
=cut
362
=cut
365
363
366
sub article_requests_current {
364
sub article_requests_current {
367
    my ( $self, $borrower ) = @_;
365
    my ( $self ) = @_;
368
369
    $self->{_article_requests_current} ||= Koha::ArticleRequests->search(
370
        {
371
            biblionumber => $self->biblionumber(),
372
            -or          => [
373
                { status => Koha::ArticleRequest::Status::Requested },
374
                { status => Koha::ArticleRequest::Status::Pending },
375
                { status => Koha::ArticleRequest::Status::Processing }
376
            ]
377
        }
378
    );
379
366
380
    return wantarray ? $self->{_article_requests_current}->as_list : $self->{_article_requests_current};
367
    return $self->article_requests->filter_by_current;
381
}
368
}
382
369
383
=head3 article_requests_finished
370
=head3 article_requests_finished
384
371
385
my @requests = $biblio->article_requests_finished
372
    my $finished_article_requests = $biblio->article_requests_finished
386
373
387
Returns the article requests associated with this Biblio that are completed
374
Returns the article requests associated with this biblio that are completed
388
375
389
=cut
376
=cut
390
377
391
sub article_requests_finished {
378
sub article_requests_finished {
392
    my ( $self, $borrower ) = @_;
379
    my ( $self, $borrower ) = @_;
393
380
394
    $self->{_article_requests_finished} ||= Koha::ArticleRequests->search(
381
    return $self->article_requests->filter_by_finished;
395
        {
396
            biblionumber => $self->biblionumber(),
397
            -or          => [
398
                { status => Koha::ArticleRequest::Status::Completed },
399
                { status => Koha::ArticleRequest::Status::Canceled }
400
            ]
401
        }
402
    );
403
404
    return wantarray ? $self->{_article_requests_finished}->as_list : $self->{_article_requests_finished};
405
}
382
}
406
383
407
=head3 items
384
=head3 items
408
- 

Return to bug 29084