Bug 8455 - Check ins processed through "Check Out" tab of the Patron Record ignore...
[koha.git] / reserve / renewscript.pl
index ad03d88..30d8256 100755 (executable)
@@ -25,6 +25,8 @@ use strict;
 use warnings;
 use CGI;
 use C4::Circulation;
+use C4::Context;
+use C4::Items;
 use C4::Auth;
 use URI::Escape;
 use Koha::DateUtils;
@@ -91,6 +93,26 @@ foreach my $itemno (@data) {
 my $failedreturn = q{};
 foreach my $barcode (@barcodes) {
     # check status before renewing issue
+
+    #System Preference Handling During Check-in In Patron Module
+    my $itemnumber;
+    $itemnumber = GetItemnumberFromBarcode($barcode);
+    if ($itemnumber) {
+        if ( C4::Context->preference("InProcessingToShelvingCart") ) {
+            my $item = GetItem( $itemnumber );
+            if ( $item->{'location'} eq 'PROC' ) {
+                $item->{'location'} = 'CART';
+                ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
+            }
+        }
+
+        if ( C4::Context->preference("ReturnToShelvingCart") ) {
+            my $item = GetItem( $itemnumber );
+            $item->{'location'} = 'CART';
+            ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
+        }
+    }
+
    my ( $returned, $messages, $issueinformation, $borrower ) = 
     AddReturn($barcode, $branch, $exemptfine);
    $failedreturn.="&failedreturn=$barcode" unless ($returned);