@@ -, +, @@ confirmation * Note that the item not scanned is marked as lost lost the item is displayed * The item should be marked as found and the items_lost_issue table should no longer contain a link to the issue --- Koha/Item.pm | 22 ++++++++++++++++++- circ/returns.pl | 2 ++ .../prog/en/modules/catalogue/detail.tt | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -411,6 +411,23 @@ sub last_checkout { return Koha::Old::Checkout->_new_from_dbic( $checkout_rs ); } +=head3 loss_checkout + + my $loss_checkout = $item->loss_checkout; + +Return the old checkout from which this item was marked as lost + +=cut + +sub loss_checkout { + my ( $self ) = @_; + my $items_lost_issue_rs = $self->_result->items_lost_issue; + return unless $items_lost_issue_rs; + my $issue_rs = $items_lost_issue_rs->issue; + return unless $issue_rs; + return Koha::Old::Checkout->_new_from_dbic( $issue_rs ); +} + =head3 holds my $holds = $item->holds(); @@ -972,7 +989,10 @@ Internal function, not exported, called only by Koha::Item->store. sub _set_found_trigger { my ( $self, $pre_mod_item ) = @_; - ## If item was lost, it has now been found, reverse any list item charges if necessary. + # If item was lost, it has now been found + $self->_result->items_lost_issue->delete; + + # Reverse any lost item charges if necessary. my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); if ($no_refund_after_days) { --- a/circ/returns.pl +++ a/circ/returns.pl @@ -383,6 +383,8 @@ if ($barcode) { for my $missing_item ( keys %{$expected_items} ) { my $bundle_item = $expected_items->{$missing_item}; $bundle_item->itemlost($BundleLostValue)->store(); + $bundle_item->_result->update_or_create_related( + 'items_lost_issue', { issue_id => $checkout->issue_id } ); push @missing_items, $bundle_item; } $template->param( --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -455,6 +455,9 @@ Note that permanent location is a code, and location may be an authval. [% ELSE %] Unavailable (lost or missing) [% END %] + [% IF ( item.itemlost == Koha.Preference('BundleLostValue') AND item.loss_checkout ) %] + Lost by [% INCLUDE 'patron-title.inc' patron=item.loss_checkout.patron hide_patron_infos_if_needed=1 %] + [% END %] [% END %] [% IF ( item.withdrawn ) %] --