@@ -, +, @@ --- C4/Accounts.pm | 7 ++++++- circ/returns.pl | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) --- a/C4/Accounts.pm +++ a/C4/Accounts.pm @@ -70,7 +70,8 @@ FIXME : if no replacement price, borrower just doesn't get charged? sub chargelostitem { my $dbh = C4::Context->dbh(); my ($borrowernumber, $itemnumber, $amount, $description) = @_; - my $itype = Koha::ItemTypes->find({ itemtype => Koha::Items->find($itemnumber)->effective_itemtype() }); + my $item = Koha::Items->find($itemnumber); + my $itype = Koha::ItemTypes->find({ itemtype => $item->effective_itemtype() }); my $replacementprice = $amount; my $defaultreplacecost = $itype->defaultreplacecost; my $processfee = $itype->processfee; @@ -80,6 +81,10 @@ sub chargelostitem { $replacementprice = $defaultreplacecost; } my $checkout = Koha::Checkouts->find({ itemnumber => $itemnumber }); + if ( !$checkout && $item->in_bundle ) { + my $host = $item->bundle_host; + $checkout = $host->checkout; + } my $issue_id = $checkout ? $checkout->issue_id : undef; my $account = Koha::Account->new({ patron_id => $borrowernumber }); --- a/circ/returns.pl +++ a/circ/returns.pl @@ -386,6 +386,20 @@ if ($barcode) { $bundle_item->_result->update_or_create_related( 'items_lost_issue', { issue_id => $checkout->issue_id } ); push @missing_items, $bundle_item; + # NOTE: We cannot use C4::LostItem here because the item itself doesn't have a checkout + # and thus would not get charged.. it's checked out as part of the bundle. + if ( C4::Context->preference('WhenLostChargeReplacementFee') ) { + C4::Accounts::chargelostitem( + $checkout->borrowernumber, + $bundle_item->itemnumber, + $bundle_item->replacementprice, + sprintf( "%s %s %s", + $bundle_item->biblio->title || q{}, + $bundle_item->barcode || q{}, + $bundle_item->itemcallnumber || q{}, + ), + ); + } } $template->param( unexpected_items => \@unexpected_items, --