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

(-)a/Koha/Patron.pm (-35 / +8 lines)
Lines 1003-1028 sub can_request_article { Link Here
1003
1003
1004
=head3 article_requests
1004
=head3 article_requests
1005
1005
1006
my @requests = $borrower->article_requests();
1006
    my $article_requests = $patron->article_requests;
1007
my $requests = $borrower->article_requests();
1008
1007
1009
Returns either a list of ArticleRequests objects,
1008
Returns the patron article requests.
1010
or an ArtitleRequests object, depending on the
1011
calling context.
1012
1009
1013
=cut
1010
=cut
1014
1011
1015
sub article_requests {
1012
sub article_requests {
1016
    my ( $self ) = @_;
1013
    my ($self) = @_;
1017
1018
    $self->{_article_requests} ||= Koha::ArticleRequests->search({ borrowernumber => $self->borrowernumber() });
1019
1014
1020
    return $self->{_article_requests};
1015
    return Koha::ArticleRequests->_new_from_dbic( scalar $self->_result->article_requests );
1021
}
1016
}
1022
1017
1023
=head3 article_requests_current
1018
=head3 article_requests_current
1024
1019
1025
my @requests = $patron->article_requests_current
1020
    my $current_article_requests = $patron->article_requests_current
1026
1021
1027
Returns the article requests associated with this patron that are incomplete
1022
Returns the article requests associated with this patron that are incomplete
1028
1023
Lines 1031-1053 Returns the article requests associated with this patron that are incomplete Link Here
1031
sub article_requests_current {
1026
sub article_requests_current {
1032
    my ( $self ) = @_;
1027
    my ( $self ) = @_;
1033
1028
1034
    $self->{_article_requests_current} ||= Koha::ArticleRequests->search(
1029
    return $self->article_requests->filter_by_current;
1035
        {
1036
            borrowernumber => $self->id(),
1037
            -or          => [
1038
                { status => Koha::ArticleRequest::Status::Requested },
1039
                { status => Koha::ArticleRequest::Status::Pending },
1040
                { status => Koha::ArticleRequest::Status::Processing }
1041
            ]
1042
        }
1043
    );
1044
1045
    return $self->{_article_requests_current};
1046
}
1030
}
1047
1031
1048
=head3 article_requests_finished
1032
=head3 article_requests_finished
1049
1033
1050
my @requests = $biblio->article_requests_finished
1034
    my $finished_article_requests = $biblio->article_requests_finished
1051
1035
1052
Returns the article requests associated with this patron that are completed
1036
Returns the article requests associated with this patron that are completed
1053
1037
Lines 1056-1072 Returns the article requests associated with this patron that are completed Link Here
1056
sub article_requests_finished {
1040
sub article_requests_finished {
1057
    my ( $self, $borrower ) = @_;
1041
    my ( $self, $borrower ) = @_;
1058
1042
1059
    $self->{_article_requests_finished} ||= Koha::ArticleRequests->search(
1043
    return $self->article_requests->filter_by_finished;
1060
        {
1061
            borrowernumber => $self->id(),
1062
            -or          => [
1063
                { status => Koha::ArticleRequest::Status::Completed },
1064
                { status => Koha::ArticleRequest::Status::Canceled }
1065
            ]
1066
        }
1067
    );
1068
1069
    return $self->{_article_requests_finished};
1070
}
1044
}
1071
1045
1072
=head3 add_enrolment_fee_if_needed
1046
=head3 add_enrolment_fee_if_needed
1073
- 

Return to bug 29083