From 79da9442463e655016e1c9c8b12083c72e4b93ba Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 10 Aug 2020 16:51:11 +0200 Subject: [PATCH] Bug 18501: Auto refund if mark as found from cataloguing If an item is marked as found (ie. not itemlost) we need to refund the patron. Test plan: Mark an item as lost to create a fee for the patron Mark it as found from the cataloguing module and confirm that the patron is refunded Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart --- catalogue/updateitem.pl | 3 +++ cataloguing/additem.pl | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index f8295a0314..43f076c3d2 100755 --- a/catalogue/updateitem.pl +++ b/catalogue/updateitem.pl @@ -68,6 +68,9 @@ elsif ( $op eq "set_public_note" ) { # i.e., itemnotes parameter passed from for $item->itemnotes($itemnotes); } } elsif ( $op eq "set_lost" && $itemlost ne $item_data_hashref->{'itemlost'}) { + $item->set_found + if !$itemlost && $item->itemlost && $item->itemlost ge '1'; + $item->itemlost($itemlost); } elsif ( $op eq "set_withdrawn" && $withdrawn ne $item_data_hashref->{'withdrawn'}) { $item->withdrawn($withdrawn); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index bbdedf6d1d..9e15c436be 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -749,8 +749,11 @@ if ($op eq "additem") { $itemnumber = q{}; my $olditemlost = $item->itemlost; my $newitemlost = $newitem->{itemlost}; - LostItem( $item->itemnumber, 'additem' ) - if $newitemlost && $newitemlost ge '1' && !$olditemlost; + if ( $newitemlost && $newitemlost ge '1' && !$olditemlost ) { + LostItem( $item->itemnumber, 'additem' ) + } elsif ( !$newitemlost && $olditemlost && $olditemlost ge '1' ) { + $item->set_found; + } } $nextop="additem"; } elsif ($op eq "delinkitem"){ -- 2.39.5