Bug 23112: Update request status on return
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Mon, 29 Jul 2019 08:10:04 +0000 (09:10 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 10 Mar 2020 10:59:15 +0000 (10:59 +0000)
This patch updates a request's status to RET upon return

Sponsored-by: Loughborough University
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/Circulation.pm
Koha/Illrequest.pm

index 4055286..2046c3f 100644 (file)
@@ -44,6 +44,7 @@ use Koha::Biblioitems;
 use Koha::DateUtils;
 use Koha::Calendar;
 use Koha::Checkouts;
+use Koha::Illrequests;
 use Koha::Items;
 use Koha::Patrons;
 use Koha::Patron::Debarments;
@@ -2130,6 +2131,15 @@ sub AddReturn {
         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
     if (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'}){
         my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
index 998422a..a0c9402 100644 (file)
@@ -498,7 +498,16 @@ sub _core_status_graph {
             method         => 'check_out',
             next_actions   => [ ],
             ui_method_icon => 'fa-upload',
-        }
+        },
+               RET => {
+                       prev_actions   => [ 'CHK' ],
+                       id             => 'RET',
+                       name           => 'Returned to library',
+                       ui_method_name => 'Check in',
+                       method         => 'check_in',
+                       next_actions   => [ 'COMP' ],
+                       ui_method_icon => 'fa-download',
+               }
     };
 }