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

(-)a/C4/Circulation.pm (-22 / +27 lines)
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
    }
(-)a/Koha/Item.pm (-4 / +20 lines)
Lines 1007-1013 sub _set_found_trigger { Link Here
1007
                    );
1007
                    );
1008
1008
1009
                    $credit->apply( { debits => [$lost_charge] } );
1009
                    $credit->apply( { debits => [$lost_charge] } );
1010
                    $self->{_refunded} = 1;
1010
                    $self->add_message(
1011
                        {
1012
                            type    => 'info',
1013
                            message => 'lost_refunded',
1014
                            payload => { credit_id => $credit->id }
1015
                        }
1016
                    );
1011
                }
1017
                }
1012
1018
1013
                # Update the account status
1019
                # Update the account status
Lines 1057-1063 sub _set_found_trigger { Link Here
1057
                    if ( $refund ) {
1063
                    if ( $refund ) {
1058
                        # Revert the forgive credit
1064
                        # Revert the forgive credit
1059
                        $refund->void();
1065
                        $refund->void();
1060
                        $self->{_restored} = 1;
1066
                        $self->add_message(
1067
                            {
1068
                                type    => 'info',
1069
                                message => 'lost_restored',
1070
                                payload => { refund_id => $refund->id }
1071
                            }
1072
                        );
1061
                    }
1073
                    }
1062
1074
1063
                    # Reconcile balances if required
1075
                    # Reconcile balances if required
Lines 1067-1073 sub _set_found_trigger { Link Here
1067
                }
1079
                }
1068
            }
1080
            }
1069
        } elsif ( $lostreturn_policy eq 'charge' ) {
1081
        } elsif ( $lostreturn_policy eq 'charge' ) {
1070
            $self->{_charge} = 1;
1082
            $self->add_message(
1083
                {
1084
                    type    => 'info',
1085
                    message => 'lost_charge',
1086
                }
1087
            );
1071
        }
1088
        }
1072
    }
1089
    }
1073
1090
1074
- 

Return to bug 26704