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