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

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

Return to bug 29084