From 1a2774e1746bead1910d9a7841137af4eecc6a0c Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
Date: Mon, 27 Nov 2017 21:56:13 +0000
Subject: [PATCH] Bug 19532: Flagging recall as 'old' when expired or cancelled

Set 'old' flag to 1 if cancelling or expiring a recall

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
---
 circ/recalls_overdue.pl | 2 +-
 circ/recalls_queue.pl   | 2 +-
 circ/recalls_waiting.pl | 2 +-
 opac/opac-recall.pl     | 2 +-
 svc/recall              | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/circ/recalls_overdue.pl b/circ/recalls_overdue.pl
index 4ea5b85..2a9d36d 100755
--- a/circ/recalls_overdue.pl
+++ b/circ/recalls_overdue.pl
@@ -42,7 +42,7 @@ my @recall_ids = $query->multi_param('recall_ids');
 
 if ($op eq 'cancel_multiple_recalls') {
     foreach my $id (@recall_ids) {
-        Koha::Recalls->find($id)->update({ cancellationdate => dt_from_string(), status => 'C' });
+        Koha::Recalls->find($id)->update({ cancellationdate => dt_from_string(), status => 'C', old => 1 });
         $op = 'list'
     }
 }
diff --git a/circ/recalls_queue.pl b/circ/recalls_queue.pl
index 223dfe0..20bf95b 100755
--- a/circ/recalls_queue.pl
+++ b/circ/recalls_queue.pl
@@ -42,7 +42,7 @@ my @recall_ids = $query->multi_param('recall_ids');
 
 if ($op eq 'cancel_multiple_recalls') {
     foreach my $id (@recall_ids) {
-        Koha::Recalls->find($id)->update({ cancellationdate => dt_from_string(), status => 'C' });
+        Koha::Recalls->find($id)->update({ cancellationdate => dt_from_string(), status => 'C', old => 1 });
         $op = 'list'
     }
 }
diff --git a/circ/recalls_waiting.pl b/circ/recalls_waiting.pl
index 1eafdd8..5282e01 100755
--- a/circ/recalls_waiting.pl
+++ b/circ/recalls_waiting.pl
@@ -42,7 +42,7 @@ my $op = $query->param('op') || 'list';
 
 if ($op eq 'expire_recall') {
     my $recall_id = $query->param('recall_id');
-    Koha::Recalls->find($recall_id)->update({ expirationdate => dt_from_string(), status => 'E' });
+    Koha::Recalls->find($recall_id)->update({ expirationdate => dt_from_string(), status => 'E', old => 1 });
     $op = 'list';
 }
 
diff --git a/opac/opac-recall.pl b/opac/opac-recall.pl
index 8264506..c75b465 100755
--- a/opac/opac-recall.pl
+++ b/opac/opac-recall.pl
@@ -103,7 +103,7 @@ if ($op eq 'request'){
     }
 } elsif ($op eq 'cancel'){
     my $recall_id = $query->param('recall_id');
-    Koha::Recalls->find($recall_id)->update({ cancellationdate => dt_from_string(), status => 'C' });
+    Koha::Recalls->find($recall_id)->update({ cancellationdate => dt_from_string(), status => 'C', old => 1 });
     print $query->redirect('/cgi-bin/koha/opac-user.pl');
 }
 
diff --git a/svc/recall b/svc/recall
index 5a9c9a8..decdc0d 100755
--- a/svc/recall
+++ b/svc/recall
@@ -46,6 +46,6 @@ unless ($recall) {
     exit;
 }
 
-$recall->update({ cancellationdate => dt_from_string(), status => 'C' });
+$recall->update({ cancellationdate => dt_from_string(), status => 'C', old => 1 });
 my $json = encode_json( { success => 1 } );
 output_with_http_headers( $input, undef, $json, "json" );
-- 
2.1.4