Bug 24413: Do not remove the restrictions from AddReturn
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 21 Feb 2020 11:37:44 +0000 (12:37 +0100)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Fri, 12 Jun 2020 19:16:39 +0000 (21:16 +0200)
As we are now removing them from MarkIssueReturned they should not be
removed from AddReturn as well.
Also I think this will fix a regression, if $doreturn is not set (in
case the item is withdrawn and BlockReturnOfWithdrawnItems or the item
is lost and BlockReturnOfLostItems, and other specific cases).

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 10af741387a75d29c6b7782c6ce3d2c07cad9517)
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

(cherry picked from commit b50c446f46c2ce987498baeed19c0af07a61fd42)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

C4/Circulation.pm

index 30e20c5..8b3f111 100644 (file)
@@ -2101,14 +2101,13 @@ sub AddReturn {
             if C4::Context->preference("ReturnLog");
         }
 
-    # Remove any OVERDUES related debarment if the borrower has no overdues
-    if ( $borrowernumber
-      && $patron->debarred
-      && C4::Context->preference('AutoRemoveOverduesRestrictions')
-      && !Koha::Patrons->find( $borrowernumber )->has_overdues
-      && @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) }
-    ) {
-        DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
+    # Check if this item belongs to a biblio record that is attached to an
+    # ILL request, if it is we need to update the ILL request's status
+    if (C4::Context->preference('CirculateILL')) {
+        my $request = Koha::Illrequests->find(
+            { biblio_id => $item->biblio->biblionumber }
+        );
+        $request->status('RET') if $request;
     }
 
     # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer