View | Details | Raw Unified | Return to bug 26704
Collapse All | Expand All

(-)a/C4/Circulation.pm (-22 / +27 lines)
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
    }
(-)a/Koha/Item.pm (-4 / +20 lines)
Lines 1158-1164 sub _set_found_trigger { Link Here
1158
                    );
1158
                    );
1159
1159
1160
                    $credit->apply( { debits => [$lost_charge] } );
1160
                    $credit->apply( { debits => [$lost_charge] } );
1161
                    $self->{_refunded} = 1;
1161
                    $self->add_message(
1162
                        {
1163
                            type    => 'info',
1164
                            message => 'lost_refunded',
1165
                            payload => { credit_id => $credit->id }
1166
                        }
1167
                    );
1162
                }
1168
                }
1163
1169
1164
                # Update the account status
1170
                # Update the account status
Lines 1208-1214 sub _set_found_trigger { Link Here
1208
                    if ( $refund ) {
1214
                    if ( $refund ) {
1209
                        # Revert the forgive credit
1215
                        # Revert the forgive credit
1210
                        $refund->void({ interface => 'trigger' });
1216
                        $refund->void({ interface => 'trigger' });
1211
                        $self->{_restored} = 1;
1217
                        $self->add_message(
1218
                            {
1219
                                type    => 'info',
1220
                                message => 'lost_restored',
1221
                                payload => { refund_id => $refund->id }
1222
                            }
1223
                        );
1212
                    }
1224
                    }
1213
1225
1214
                    # Reconcile balances if required
1226
                    # Reconcile balances if required
Lines 1218-1224 sub _set_found_trigger { Link Here
1218
                }
1230
                }
1219
            }
1231
            }
1220
        } elsif ( $lostreturn_policy eq 'charge' ) {
1232
        } elsif ( $lostreturn_policy eq 'charge' ) {
1221
            $self->{_charge} = 1;
1233
            $self->add_message(
1234
                {
1235
                    type    => 'info',
1236
                    message => 'lost_charge',
1237
                }
1238
            );
1222
        }
1239
        }
1223
    }
1240
    }
1224
1241
1225
- 

Return to bug 26704