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

(-)a/Koha/Patrons.pm (-68 lines)
Lines 115-187 sub guarantor { Link Here
115
    return Koha::Patrons->find( $self->guarantorid() );
115
    return Koha::Patrons->find( $self->guarantorid() );
116
}
116
}
117
117
118
=head3 article_requests
119
120
my @requests = $borrower->article_requests();
121
my $requests = $borrower->article_requests();
122
123
Returns either a list of ArticleRequests objects,
124
or an ArtitleRequests object, depending on the
125
calling context.
126
127
=cut
128
129
sub article_requests {
130
    my ( $self ) = @_;
131
132
    $self->{_article_requests} ||= Koha::ArticleRequests->search({ borrowernumber => $self->borrowernumber() });
133
134
    return $self->{_article_requests};
135
}
136
137
=head3 article_requests_current
138
139
my @requests = $patron->article_requests_current
140
141
Returns the article requests associated with this patron that are incomplete
142
143
=cut
144
145
sub article_requests_current {
146
    my ( $self ) = @_;
147
148
    $self->{_article_requests_current} ||= Koha::ArticleRequests->search(
149
        {
150
            borrowernumber => $self->id(),
151
            -or          => [
152
                { status => Koha::ArticleRequest::Status::Pending },
153
                { status => Koha::ArticleRequest::Status::Processing }
154
            ]
155
        }
156
    );
157
158
    return $self->{_article_requests_current};
159
}
160
161
=head3 article_requests_finished
162
163
my @requests = $biblio->article_requests_finished
164
165
Returns the article requests associated with this patron that are completed
166
167
=cut
168
169
sub article_requests_finished {
170
    my ( $self, $borrower ) = @_;
171
172
    $self->{_article_requests_finished} ||= Koha::ArticleRequests->search(
173
        {
174
            borrowernumber => $self->id(),
175
            -or          => [
176
                { status => Koha::ArticleRequest::Status::Completed },
177
                { status => Koha::ArticleRequest::Status::Canceled }
178
            ]
179
        }
180
    );
181
182
    return $self->{_article_requests_finished};
183
}
184
185
=head3 search_patrons_to_anonymise
118
=head3 search_patrons_to_anonymise
186
119
187
    my $patrons = Koha::Patrons->search_patrons_to_anonymise( { before => $older_than_date, [ library => $library ] } );
120
    my $patrons = Koha::Patrons->search_patrons_to_anonymise( { before => $older_than_date, [ library => $library ] } );
188
- 

Return to bug 18395