Bug 12363: Add a switch to mark|do not mark items as returned when lost
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 17 Oct 2017 13:55:09 +0000 (10:55 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 27 Oct 2017 16:57:14 +0000 (13:57 -0300)
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 <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

C4/Circulation.pm
catalogue/updateitem.pl
cataloguing/additem.pl
misc/cronjobs/longoverdue.pl
tools/batchMod.pl

index 9773f69..ae1157e 100644 (file)
@@ -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 
index 90c6de6..2e54eac 100755 (executable)
@@ -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");
index 94b971f..a0500a4 100755 (executable)
@@ -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"){
index a0907a2..7ff8826 100755 (executable)
@@ -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>
 
index b24ce2b..0ab4db7 100755 (executable)
@@ -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};
                         }
                     };
                 }