Lines 59-67
sub is_overdue {
Link Here
|
59 |
$dt ||= dt_from_string(); |
59 |
$dt ||= dt_from_string(); |
60 |
|
60 |
|
61 |
my $is_overdue = |
61 |
my $is_overdue = |
62 |
DateTime->compare( dt_from_string( $self->date_due, 'sql' ), $dt ) == -1 |
62 |
DateTime->compare( dt_from_string( $self->date_due, 'sql' ), $dt ) == -1 |
63 |
? 1 |
63 |
? 1 |
64 |
: 0; |
64 |
: 0; |
65 |
return $is_overdue; |
65 |
return $is_overdue; |
66 |
} |
66 |
} |
67 |
|
67 |
|
Lines 74-82
Return the checked out item
Link Here
|
74 |
=cut |
74 |
=cut |
75 |
|
75 |
|
76 |
sub item { |
76 |
sub item { |
77 |
my ( $self ) = @_; |
77 |
my ($self) = @_; |
78 |
my $item_rs = $self->_result->item; |
78 |
my $item_rs = $self->_result->item; |
79 |
return Koha::Item->_new_from_dbic( $item_rs ); |
79 |
return Koha::Item->_new_from_dbic($item_rs); |
80 |
} |
80 |
} |
81 |
|
81 |
|
82 |
=head3 account_lines |
82 |
=head3 account_lines |
Lines 88-96
Return the checked out account_lines
Link Here
|
88 |
=cut |
88 |
=cut |
89 |
|
89 |
|
90 |
sub account_lines { |
90 |
sub account_lines { |
91 |
my ( $self ) = @_; |
91 |
my ($self) = @_; |
92 |
my $account_lines_rs = $self->_result->account_lines; |
92 |
my $account_lines_rs = $self->_result->account_lines; |
93 |
return Koha::Account::Lines->_new_from_dbic( $account_lines_rs ); |
93 |
return Koha::Account::Lines->_new_from_dbic($account_lines_rs); |
94 |
} |
94 |
} |
95 |
|
95 |
|
96 |
=head3 overdue_fines |
96 |
=head3 overdue_fines |
Lines 102-110
Return the account lines for just the overdue fines
Link Here
|
102 |
=cut |
102 |
=cut |
103 |
|
103 |
|
104 |
sub overdue_fines { |
104 |
sub overdue_fines { |
105 |
my ( $self ) = @_; |
105 |
my ($self) = @_; |
106 |
my $account_lines_rs = $self->_result->account_lines->search( { debit_type_code => 'OVERDUE' } ); |
106 |
my $account_lines_rs = $self->_result->account_lines->search( { debit_type_code => 'OVERDUE' } ); |
107 |
return Koha::Account::Lines->_new_from_dbic( $account_lines_rs ); |
107 |
return Koha::Account::Lines->_new_from_dbic($account_lines_rs); |
108 |
} |
108 |
} |
109 |
|
109 |
|
110 |
=head3 library |
110 |
=head3 library |
Lines 116-124
Return the library in which the transaction took place
Link Here
|
116 |
=cut |
116 |
=cut |
117 |
|
117 |
|
118 |
sub library { |
118 |
sub library { |
119 |
my ( $self ) = @_; |
119 |
my ($self) = @_; |
120 |
my $library_rs = $self->_result->library; |
120 |
my $library_rs = $self->_result->library; |
121 |
return Koha::Library->_new_from_dbic( $library_rs ); |
121 |
return Koha::Library->_new_from_dbic($library_rs); |
122 |
} |
122 |
} |
123 |
|
123 |
|
124 |
=head3 patron |
124 |
=head3 patron |
Lines 130-138
Return the patron for who the checkout has been done
Link Here
|
130 |
=cut |
130 |
=cut |
131 |
|
131 |
|
132 |
sub patron { |
132 |
sub patron { |
133 |
my ( $self ) = @_; |
133 |
my ($self) = @_; |
134 |
my $patron_rs = $self->_result->patron; |
134 |
my $patron_rs = $self->_result->patron; |
135 |
return Koha::Patron->_new_from_dbic( $patron_rs ); |
135 |
return Koha::Patron->_new_from_dbic($patron_rs); |
136 |
} |
136 |
} |
137 |
|
137 |
|
138 |
=head3 issuer |
138 |
=head3 issuer |
Lines 144-153
Return the patron by whom the checkout was done
Link Here
|
144 |
=cut |
144 |
=cut |
145 |
|
145 |
|
146 |
sub issuer { |
146 |
sub issuer { |
147 |
my ( $self ) = @_; |
147 |
my ($self) = @_; |
148 |
my $issuer_rs = $self->_result->issuer; |
148 |
my $issuer_rs = $self->_result->issuer; |
149 |
return unless $issuer_rs; |
149 |
return unless $issuer_rs; |
150 |
return Koha::Patron->_new_from_dbic( $issuer_rs ); |
150 |
return Koha::Patron->_new_from_dbic($issuer_rs); |
151 |
} |
151 |
} |
152 |
|
152 |
|
153 |
=head3 renewals |
153 |
=head3 renewals |
Lines 159-168
Return a Koha::Checkouts::Renewals set attached to this checkout
Link Here
|
159 |
=cut |
159 |
=cut |
160 |
|
160 |
|
161 |
sub renewals { |
161 |
sub renewals { |
162 |
my ( $self ) = @_; |
162 |
my ($self) = @_; |
163 |
my $renewals_rs = $self->_result->renewals; |
163 |
my $renewals_rs = $self->_result->renewals; |
164 |
return unless $renewals_rs; |
164 |
return unless $renewals_rs; |
165 |
return Koha::Checkouts::Renewals->_new_from_dbic( $renewals_rs ); |
165 |
return Koha::Checkouts::Renewals->_new_from_dbic($renewals_rs); |
166 |
} |
166 |
} |
167 |
|
167 |
|
168 |
=head3 attempt_auto_renew |
168 |
=head3 attempt_auto_renew |
Lines 276-303
sub claim_returned {
Link Here
|
276 |
|
276 |
|
277 |
my $ClaimReturnedChargeFee = C4::Context->preference('ClaimReturnedChargeFee'); |
277 |
my $ClaimReturnedChargeFee = C4::Context->preference('ClaimReturnedChargeFee'); |
278 |
$charge_lost_fee = |
278 |
$charge_lost_fee = |
279 |
$ClaimReturnedChargeFee eq 'charge' ? 1 |
279 |
$ClaimReturnedChargeFee eq 'charge' ? 1 |
280 |
: $ClaimReturnedChargeFee eq 'no_charge' ? 0 |
280 |
: $ClaimReturnedChargeFee eq 'no_charge' ? 0 |
281 |
: $charge_lost_fee; # $ClaimReturnedChargeFee eq 'ask' |
281 |
: $charge_lost_fee; # $ClaimReturnedChargeFee eq 'ask' |
282 |
|
282 |
|
283 |
if ( $charge_lost_fee ) { |
283 |
if ($charge_lost_fee) { |
284 |
C4::Circulation::LostItem( $self->itemnumber, 'claim_returned' ); |
284 |
C4::Circulation::LostItem( $self->itemnumber, 'claim_returned' ); |
285 |
} |
285 |
} elsif ( C4::Context->preference('MarkLostItemsAsReturned') =~ m/claim_returned/ ) { |
286 |
elsif ( C4::Context->preference( 'MarkLostItemsAsReturned' ) =~ m/claim_returned/ ) { |
286 |
C4::Circulation::MarkIssueReturned( |
287 |
C4::Circulation::MarkIssueReturned( $self->borrowernumber, $self->itemnumber, undef, $self->patron->privacy ); |
287 |
$self->borrowernumber, $self->itemnumber, undef, |
|
|
288 |
$self->patron->privacy |
289 |
); |
288 |
} |
290 |
} |
289 |
|
291 |
|
290 |
return $claim; |
292 |
return $claim; |
291 |
} |
293 |
} |
292 |
); |
294 |
); |
293 |
} |
295 |
} catch { |
294 |
catch { |
|
|
295 |
if ( $_->isa('Koha::Exception') ) { |
296 |
if ( $_->isa('Koha::Exception') ) { |
296 |
$_->rethrow(); |
297 |
$_->rethrow(); |
297 |
} |
298 |
} else { |
298 |
else { |
299 |
|
299 |
# ? |
300 |
# ? |
300 |
Koha::Exception->throw( "Unhandled exception" ); |
301 |
Koha::Exception->throw("Unhandled exception"); |
301 |
} |
302 |
} |
302 |
}; |
303 |
}; |
303 |
} |
304 |
} |