From e28ef43417a0b72887e975ee2f1f92e9a3476bee Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 16 Aug 2018 07:11:17 -0400 Subject: [PATCH] Bug 21231: BlockReturnofLostItems does not prevent lost items being found When the syspref BlockReturnOfLostItems is set to Block, the item is blocked from being returned, but is still considered found -- it's set to lost=0 and a refund is applied to the patron (if circ rules allow). The item can then be checked in a second time and returned as it is no longer lost. Test Plan: 1) Set an item to lost 2) Set BlockReturnOfLostItems to Block 3) Check the lost item in 4) Checkin message should say item is lost and cannot be returned 5) Check lost status of item, it should remain unchanged Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit ca2430480eaa4338b3e4aed766589b1406565d69) Signed-off-by: Martin Renvoize (cherry picked from commit 3af501884e136454bca1c5a78c1a6b56e876f6be) Signed-off-by: Fridolin Somers --- C4/Circulation.pm | 4 +++- C4/Items.pm | 16 +++++++++++----- .../prog/en/modules/circ/returns.tt | 7 ++++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d7c3088b7c..0da90779b7 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1958,7 +1958,9 @@ sub AddReturn { UpdateHoldingbranch($branch, $item->{'itemnumber'}); $item->{'holdingbranch'} = $branch; # update item data holdingbranch too } - ModDateLastSeen( $item->{'itemnumber'} ); + + my $leave_item_lost = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0; + ModDateLastSeen( $item->{itemnumber}, $leave_item_lost ); # check if we have a transfer for this document my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} ); diff --git a/C4/Items.pm b/C4/Items.pm index e9c9fc4946..845d63595c 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -638,18 +638,24 @@ sub ModItemTransfer { =head2 ModDateLastSeen - ModDateLastSeen($itemnum); +ModDateLastSeen( $itemnumber, $leave_item_lost ); Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking. -C<$itemnum> is the item number +C<$itemnumber> is the item number +C<$leave_item_lost> determines if a lost item will be found or remain lost =cut sub ModDateLastSeen { - my ($itemnumber) = @_; - + my ( $itemnumber, $leave_item_lost ) = @_; + my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); - ModItem({ itemlost => 0, datelastseen => $today }, undef, $itemnumber); + + my $params; + $params->{datelastseen} = $today; + $params->{itemlost} = 0 unless $leave_item_lost; + + ModItem( $params, undef, $itemnumber ); } =head2 DelItem 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 bd5393c119..f3daa0e064 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -616,7 +616,12 @@ $(document).ready(function () {

Local use recorded

[% END %] [% IF ( errmsgloo.waslost ) %] -

Item was lost, now found.

+ [% IF Koha.Preference('BlockReturnOfLostItems') %] +

Item is lost, cannot be checked in.

+ [% ELSE %] +

Item was lost, now found.

+ [% END %] + [% IF LostItemFeeRefunded and not Koha.Preference('BlockReturnOfLostItems') %]

A refund has been applied to the borrowing patron's account.

[% ELSIF Koha.Preference('BlockReturnOfLostItems') %] -- 2.39.5