From 6802f3cfa480121a60c38a9e6ba0a04403e1cbed Mon Sep 17 00:00:00 2001
From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Date: Mon, 29 Jul 2019 09:10:04 +0100
Subject: [PATCH] Bug 23112: Update request status on return
This patch updates a request's status to RET upon return
Sponsored-by: Loughborough University
---
C4/Circulation.pm | 10 ++++++++++
Koha/Illrequest.pm | 9 +++++++++
2 files changed, 19 insertions(+)
diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 014c018628..4dc72bf9b2 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -46,6 +46,7 @@ use Koha::Biblioitems;
use Koha::DateUtils;
use Koha::Calendar;
use Koha::Checkouts;
+use Koha::Illrequests;
use Koha::IssuingRules;
use Koha::Items;
use Koha::Patrons;
@@ -2105,6 +2106,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");
diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm
index 7b427fd28b..cad9a7b481 100644
--- a/Koha/Illrequest.pm
+++ b/Koha/Illrequest.pm
@@ -499,6 +499,15 @@ 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',
}
};
}
--
2.11.0