Lines 26-31
use Koha::Database;
Link Here
|
26 |
use Koha::Patrons; |
26 |
use Koha::Patrons; |
27 |
use Koha::Libraries; |
27 |
use Koha::Libraries; |
28 |
|
28 |
|
|
|
29 |
use C4::Circulation qw( GetTransfers ); |
30 |
|
29 |
use base qw(Koha::Object); |
31 |
use base qw(Koha::Object); |
30 |
|
32 |
|
31 |
=head1 NAME |
33 |
=head1 NAME |
Lines 96-102
sub last_returned_by {
Link Here
|
96 |
{ borrowernumber => $borrower->borrowernumber, itemnumber => $self->id } ); |
98 |
{ borrowernumber => $borrower->borrowernumber, itemnumber => $self->id } ); |
97 |
} |
99 |
} |
98 |
else { |
100 |
else { |
99 |
unless ( $self->{_last_returned_by} ) { |
101 |
unless defined ( $self->{_last_returned_by} ) { |
100 |
my $result = $items_last_returned_by_rs->single( { itemnumber => $self->id } ); |
102 |
my $result = $items_last_returned_by_rs->single( { itemnumber => $self->id } ); |
101 |
if ($result) { |
103 |
if ($result) { |
102 |
$self->{_last_returned_by} = Koha::Patrons->find( $result->get_column('borrowernumber') ); |
104 |
$self->{_last_returned_by} = Koha::Patrons->find( $result->get_column('borrowernumber') ); |
Lines 107-113
sub last_returned_by {
Link Here
|
107 |
} |
109 |
} |
108 |
} |
110 |
} |
109 |
|
111 |
|
110 |
=head3 type |
112 |
=head3 _get_transit_data |
|
|
113 |
|
114 |
=cut |
115 |
|
116 |
sub _get_transit_data { |
117 |
my ($self) = @_; |
118 |
|
119 |
return $self->{_transit_data} if defined $self->{_transit_data}; |
120 |
|
121 |
$self->{_transit_data} = {}; |
122 |
|
123 |
my ( $date, $from, $to ) = GetTransfers( $self->id ); |
124 |
|
125 |
$self->{_transit_data}->{date} = $date; |
126 |
$self->{_transit_data}->{from} = $from; |
127 |
$self->{_transit_data}->{to} = $to; |
128 |
|
129 |
return $self->{_transit_data}; |
130 |
} |
131 |
|
132 |
=head3 is_in_transit |
133 |
|
134 |
$item->is_in_transit(); |
135 |
|
136 |
=cut |
137 |
|
138 |
sub is_in_transit { |
139 |
my ($self) = @_; |
140 |
|
141 |
my $data = $self->_get_transit_data(); |
142 |
|
143 |
return $data->{date} ? 1 : 0; |
144 |
} |
145 |
|
146 |
=head3 in_transit_date |
147 |
|
148 |
my $transfer_date = $item->in_transit_date(); |
149 |
|
150 |
=cut |
151 |
|
152 |
sub in_transit_date { |
153 |
my ($self) = @_; |
154 |
|
155 |
my $data = $self->_get_transit_data(); |
156 |
|
157 |
return $data->{date}; |
158 |
} |
159 |
|
160 |
=head3 in_transit_to |
161 |
|
162 |
my $library_id = $item->in_transit_to(); |
163 |
|
164 |
=cut |
165 |
|
166 |
sub in_transit_to { |
167 |
my ($self) = @_; |
168 |
|
169 |
my $data = $self->_get_transit_data(); |
170 |
|
171 |
return $data->{to}; |
172 |
} |
173 |
|
174 |
=head3 in_transit_from |
175 |
|
176 |
my $library_id = $item->in_transit_from(); |
177 |
|
178 |
=cut |
179 |
|
180 |
sub in_transit_from { |
181 |
my ($self) = @_; |
182 |
|
183 |
my $data = $self->_get_transit_data(); |
184 |
|
185 |
return $date->{from}; |
186 |
} |
187 |
|
188 |
=head3 _type |
111 |
|
189 |
|
112 |
=cut |
190 |
=cut |
113 |
|
191 |
|