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