From 58b6e957638418fea8d5a25e21da3530574db3e1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 17 Oct 2017 10:55:09 -0300 Subject: [PATCH] Bug 12363: Add a switch to mark|do not mark items as returned when lost MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There are several ways to mark an item an lost: - item list view (catalogue/moredetail.pl, "Items" tab) - cataloguing (cataloguing/additem.pl) - Batch item modification tools (tools/batchMod.pl) - The long overdue cronjob (misc/cronjobs/longoverdue.pl) So far only the cronjob is configurable, the others mark the item as returned (does the checkin). This behaviour should be controlable using a syspref, to let libraries choose what fit best for them. Test plan: Use the 2 options of the pref, mark checked out items as lost using the different possibilities, and confirm that the behaviours make sense to you Signed-off-by: Séverine QUEUNE Signed-off-by: Séverine QUEUNE Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- C4/Circulation.pm | 2 ++ catalogue/updateitem.pl | 2 +- cataloguing/additem.pl | 2 +- misc/cronjobs/longoverdue.pl | 3 ++- tools/batchMod.pl | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9773f69b1b..ae1157ecbd 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3624,6 +3624,8 @@ sub ReturnLostItem{ sub LostItem{ my ($itemnumber, $mark_returned) = @_; + $mark_returned //= C4::Context->preference('MarkLostItemsAsReturned'); + my $dbh = C4::Context->dbh(); my $sth=$dbh->prepare("SELECT issues.*,items.*,biblio.title FROM issues diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index 90c6de604a..2e54eac595 100755 --- a/catalogue/updateitem.pl +++ b/catalogue/updateitem.pl @@ -81,6 +81,6 @@ elsif (defined $itemnotes) { # i.e., itemnotes parameter passed from form ModItem($item_changes, $biblionumber, $itemnumber); -LostItem($itemnumber, 'MARK RETURNED') if $itemlost; +LostItem($itemnumber) if $itemlost; print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber"); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 94b971f063..a0500a4189 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -700,7 +700,7 @@ if ($op eq "additem") { my $newitemlost = $itemtosave->subfield( $lost_tag, $lost_subfield ); if (($olditemlost eq '0' or $olditemlost eq '' ) and $newitemlost ge '1'){ - LostItem($itemnumber,'MARK RETURNED'); + LostItem($itemnumber); } $nextop="additem"; } elsif ($op eq "delinkitem"){ diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index a0907a2f2b..7ff88266d5 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -44,7 +44,7 @@ use Koha::Patrons; my $lost; # key=lost value, value=num days. my ($charge, $verbose, $confirm, $quiet); my $endrange = 366; -my $mark_returned = 0; +my $mark_returned; my $borrower_category = []; my $skip_borrower_category = []; my $help=0; @@ -142,6 +142,7 @@ Specifies the end of the range of overdue days to deal with (defaults to 366). =item B<--mark-returned> When an item is marked lost, remove it from the borrowers issued items. +If not provided, the value of the system preference 'MarkLostItemsAsReturned' will be used. =item B<--category> diff --git a/tools/batchMod.pl b/tools/batchMod.pl index b24ce2b329..0ab4db76d9 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -208,7 +208,7 @@ if ($op eq "action") { if ( $modified ) { eval { if ( my $item = ModItemFromMarc( $localmarcitem, $itemdata->{biblionumber}, $itemnumber ) ) { - LostItem($itemnumber, 'MARK RETURNED') if $item->{itemlost} and not $itemdata->{itemlost}; + LostItem($itemnumber) if $item->{itemlost} and not $itemdata->{itemlost}; } }; } -- 2.39.5