Lines 2134-2162
sub AddReturn {
Link Here
|
2134 |
if ($item_was_lost) { |
2134 |
if ($item_was_lost) { |
2135 |
$messages->{'WasLost'} = 1; |
2135 |
$messages->{'WasLost'} = 1; |
2136 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2136 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2137 |
$messages->{'LostItemFeeRefunded'} = $updated_item->{_refunded}; |
2137 |
my @object_messages = @{ $updated_item->messages }; |
2138 |
$messages->{'LostItemFeeRestored'} = $updated_item->{_restored}; |
2138 |
for my $message (@object_messages) { |
2139 |
|
2139 |
$messages->{'LostItemFeeRefunded'} = 1 |
2140 |
if ( $updated_item->{_charge} ) { |
2140 |
if $message->message eq 'lost_refunded'; |
2141 |
$issue //= Koha::Old::Checkouts->search( |
2141 |
$messages->{'LostItemFeeRestored'} = 1 |
2142 |
{ itemnumber => $item->itemnumber }, |
2142 |
if $message->message eq 'lost_restored'; |
2143 |
{ order_by => { '-desc' => 'returndate' }, rows => 1 } ) |
2143 |
|
2144 |
->single; |
2144 |
if ( $message->message eq 'lost_charge' ) { |
2145 |
unless ( exists( $patron_unblessed->{branchcode} ) ) { |
2145 |
$issue //= Koha::Old::Checkouts->search( |
2146 |
my $patron = $issue->patron; |
2146 |
{ itemnumber => $item->itemnumber }, |
2147 |
$patron_unblessed = $patron->unblessed; |
2147 |
{ order_by => { '-desc' => 'returndate' }, rows => 1 } |
2148 |
} |
2148 |
)->single; |
2149 |
_CalculateAndUpdateFine( |
2149 |
unless ( exists( $patron_unblessed->{branchcode} ) ) { |
2150 |
{ |
2150 |
my $patron = $issue->patron; |
2151 |
issue => $issue, |
2151 |
$patron_unblessed = $patron->unblessed; |
2152 |
item => $item->unblessed, |
|
|
2153 |
borrower => $patron_unblessed, |
2154 |
return_date => $return_date |
2155 |
} |
2152 |
} |
2156 |
); |
2153 |
_CalculateAndUpdateFine( |
2157 |
_FixOverduesOnReturn( $patron_unblessed->{borrowernumber}, |
2154 |
{ |
2158 |
$item->itemnumber, undef, 'RETURNED' ); |
2155 |
issue => $issue, |
2159 |
$messages->{'LostItemFeeCharged'} = 1; |
2156 |
item => $item->unblessed, |
|
|
2157 |
borrower => $patron_unblessed, |
2158 |
return_date => $return_date |
2159 |
} |
2160 |
); |
2161 |
_FixOverduesOnReturn( $patron_unblessed->{borrowernumber}, |
2162 |
$item->itemnumber, undef, 'RETURNED' ); |
2163 |
$messages->{'LostItemFeeCharged'} = 1; |
2164 |
} |
2160 |
} |
2165 |
} |
2161 |
} |
2166 |
} |
2162 |
} |
2167 |
} |