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

(-)a/C4/Circulation.pm (-22 / +27 lines)
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
    }
(-)a/Koha/Item.pm (-4 / +20 lines)
Lines 1151-1157 sub _set_found_trigger { Link Here
1151
                    );
1151
                    );
1152
1152
1153
                    $credit->apply( { debits => [$lost_charge] } );
1153
                    $credit->apply( { debits => [$lost_charge] } );
1154
                    $self->{_refunded} = 1;
1154
                    $self->add_message(
1155
                        {
1156
                            type    => 'info',
1157
                            message => 'lost_refunded',
1158
                            payload => { credit_id => $credit->id }
1159
                        }
1160
                    );
1155
                }
1161
                }
1156
1162
1157
                # Update the account status
1163
                # Update the account status
Lines 1201-1207 sub _set_found_trigger { Link Here
1201
                    if ( $refund ) {
1207
                    if ( $refund ) {
1202
                        # Revert the forgive credit
1208
                        # Revert the forgive credit
1203
                        $refund->void({ interface => 'trigger' });
1209
                        $refund->void({ interface => 'trigger' });
1204
                        $self->{_restored} = 1;
1210
                        $self->add_message(
1211
                            {
1212
                                type    => 'info',
1213
                                message => 'lost_restored',
1214
                                payload => { refund_id => $refund->id }
1215
                            }
1216
                        );
1205
                    }
1217
                    }
1206
1218
1207
                    # Reconcile balances if required
1219
                    # Reconcile balances if required
Lines 1211-1217 sub _set_found_trigger { Link Here
1211
                }
1223
                }
1212
            }
1224
            }
1213
        } elsif ( $lostreturn_policy eq 'charge' ) {
1225
        } elsif ( $lostreturn_policy eq 'charge' ) {
1214
            $self->{_charge} = 1;
1226
            $self->add_message(
1227
                {
1228
                    type    => 'info',
1229
                    message => 'lost_charge',
1230
                }
1231
            );
1215
        }
1232
        }
1216
    }
1233
    }
1217
1234
1218
- 

Return to bug 26704