Lines 18-25
package Koha::Old::Checkout;
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Koha::Database; |
20 |
use Koha::Database; |
|
|
21 |
use Koha::DateUtils qw(dt_from_string); |
21 |
|
22 |
|
22 |
use base qw(Koha::Checkout); |
23 |
use base qw(Koha::Object); |
23 |
|
24 |
|
24 |
=head1 NAME |
25 |
=head1 NAME |
25 |
|
26 |
|
Lines 54-60
Return the patron for who the checkout has been done
Link Here
|
54 |
sub patron { |
55 |
sub patron { |
55 |
my ( $self ) = @_; |
56 |
my ( $self ) = @_; |
56 |
my $patron_rs = $self->_result->borrower; |
57 |
my $patron_rs = $self->_result->borrower; |
57 |
return unless $patron_rs; |
|
|
58 |
return Koha::Patron->_new_from_dbic( $patron_rs ); |
58 |
return Koha::Patron->_new_from_dbic( $patron_rs ); |
59 |
} |
59 |
} |
60 |
|
60 |
|
Lines 79-84
sub to_api_mapping {
Link Here
|
79 |
}; |
79 |
}; |
80 |
} |
80 |
} |
81 |
|
81 |
|
|
|
82 |
=head3 claim_returned |
83 |
|
84 |
my $return_claim = $checkout->claim_returned(); |
85 |
|
86 |
=cut |
87 |
|
88 |
sub claim_returned { |
89 |
my ( $self, $params ) = @_; |
90 |
|
91 |
my $charge_lost_fee = $params->{charge_lost_fee}; |
92 |
|
93 |
try { |
94 |
$self->_result->result_source->schema->txn_do( |
95 |
sub { |
96 |
my $claim = Koha::Checkouts::ReturnClaim->new( |
97 |
{ |
98 |
issue_id => $self->id, |
99 |
itemnumber => $self->itemnumber, |
100 |
borrowernumber => $self->borrowernumber, |
101 |
notes => $params->{notes}, |
102 |
created_by => $params->{created_by}, |
103 |
created_on => dt_from_string, |
104 |
} |
105 |
)->store(); |
106 |
|
107 |
my $ClaimReturnedLostValue = C4::Context->preference('ClaimReturnedLostValue'); |
108 |
C4::Items::ModItem( { itemlost => $ClaimReturnedLostValue }, undef, $self->itemnumber ); |
109 |
|
110 |
my $ClaimReturnedChargeFee = C4::Context->preference('ClaimReturnedChargeFee'); |
111 |
$charge_lost_fee = |
112 |
$ClaimReturnedChargeFee eq 'charge' ? 1 |
113 |
: $ClaimReturnedChargeFee eq 'no_charge' ? 0 |
114 |
: $charge_lost_fee; # $ClaimReturnedChargeFee eq 'ask' |
115 |
C4::Circulation::LostItem( $self->itemnumber, 'claim_returned' ) if $charge_lost_fee; |
116 |
|
117 |
return $claim; |
118 |
} |
119 |
); |
120 |
} |
121 |
catch { |
122 |
if ( $_->isa('Koha::Exceptions::Exception') ) { |
123 |
$_->rethrow(); |
124 |
} |
125 |
else { |
126 |
# ? |
127 |
Koha::Exceptions::Exception->throw( "Unhandled exception" ); |
128 |
} |
129 |
}; |
130 |
} |
131 |
|
132 |
=head3 library |
133 |
|
134 |
my $library = $checkout->library; |
135 |
|
136 |
=cut |
137 |
|
138 |
sub library { |
139 |
my ($self) = @_; |
140 |
|
141 |
my $library_rs = $self->_result->branch; |
142 |
return Koha::Library->_new_from_dbic( $library_rs ); |
143 |
} |
82 |
=head2 Internal methods |
144 |
=head2 Internal methods |
83 |
|
145 |
|
84 |
=head3 _type |
146 |
=head3 _type |