Bug 28966: Prefetch patron data for holds queue viewer
[koha.git] / Koha / Hold / HoldsQueueItem.pm
1 package Koha::Hold::HoldsQueueItem;
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18 use Modern::Perl;
19
20 use Koha::Database;
21
22 use Koha::Items;
23 use Koha::Biblios;
24 use Koha::Patrons;
25
26 use base qw(Koha::Object);
27
28 =head1 NAME
29
30 Koha::Hold::HoldsQueueItem - Koha hold cancellation request Object class
31
32 =head1 API
33
34 =head2 Class methods
35
36 =head3 patron
37
38 =cut
39
40 sub patron {
41     my ( $self ) = @_;
42     my $rs = $self->_result->borrowernumber;
43     return unless $rs;
44     return Koha::Patron->_new_from_dbic( $rs );
45 }
46
47 =head3 biblio
48
49 =cut
50
51 sub biblio {
52     my ( $self ) = @_;
53     my $rs = $self->_result->biblionumber;
54     return unless $rs;
55     return Koha::Biblio->_new_from_dbic( $rs );
56 }
57
58 =head3 item
59
60 =cut
61
62 sub item {
63     my ( $self ) = @_;
64     my $rs = $self->_result->itemnumber;
65     return unless $rs;
66     return Koha::Item->_new_from_dbic( $rs );
67 }
68
69 =head2 Internal methods
70
71 =head3 _type
72
73 =cut
74
75 sub _type {
76     return 'TmpHoldsqueue';
77 }
78
79 =head1 AUTHORS
80
81 Kyle Hall <kyle@bywatersolutions.com>
82
83 =cut
84
85 1;