From 37cf73d665794a660cd7e95f41662248cc3615d4 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 30 Nov 2021 14:34:48 +0000 Subject: [PATCH] Bug 28854: Add modal after checkin to print missing items list This patch adds a further modal to the post checkin alert to allow the user to print a view and print a list of items that went missing at this checkin to allow for replacements to be picked. --- circ/returns.pl | 61 ++++++++++--------- .../prog/en/modules/circ/returns.tt | 43 ++++++++++++- 2 files changed, 75 insertions(+), 29 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 545de9b502..7399568cf5 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -444,34 +444,39 @@ if ($barcode) { } for my $missing_item ( keys %{$expected_items} ) { my $bundle_item = $expected_items->{$missing_item}; - $bundle_item->itemlost($BundleLostValue)->store(); - # Add return_claim record if this is an actual checkin - if ($issue) { - $bundle_item->_result->create_related( - 'return_claims', - { - issue_id => $issue->issue_id, - itemnumber => $bundle_item->itemnumber, - borrowernumber => $issue->borrowernumber, - created_by => C4::Context->userenv()->{number}, - created_on => dt_from_string - } - ); - } - 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') && $issue ) { - C4::Accounts::chargelostitem( - $issue->borrowernumber, - $bundle_item->itemnumber, - $bundle_item->replacementprice, - sprintf( "%s %s %s", - $bundle_item->biblio->title || q{}, - $bundle_item->barcode || q{}, - $bundle_item->itemcallnumber || q{}, - ), - ); + # Mark as lost if it's not already lost + if ( !$bundle_item->itemlost ) { + $bundle_item->itemlost($BundleLostValue)->store(); + + # Add return_claim record if this is an actual checkin + if ($issue) { + $bundle_item->_result->create_related( + 'return_claims', + { + issue_id => $issue->issue_id, + itemnumber => $bundle_item->itemnumber, + borrowernumber => $issue->borrowernumber, + created_by => C4::Context->userenv()->{number}, + created_on => dt_from_string + } + ); + } + 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') && $issue ) { + C4::Accounts::chargelostitem( + $issue->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( diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 5ef3ce53b9..8f1333189b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -223,7 +223,10 @@

Bundle had missing items

Bundle contents list updated

-

View updated contents list

+

+ View updated contents list + View list of missing items +

[% END %] @@ -1306,6 +1309,44 @@ [% INCLUDE 'modals/bundle_contents.inc' %] + [% IF ( missing_items ) %] + + + [% END %] + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] -- 2.20.1