From 8d9330ea46a5033742da029b6c5c24f6dc7d4f15 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Fri, 11 Mar 2022 16:02:47 +0000
Subject: [PATCH] Bug 30275: Record renewals

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 C4/Circulation.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 457f9e5b5a..be0d0a04a2 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -3217,6 +3217,16 @@ sub AddRenewal {
             DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
         }
 
+        # Add renewal record
+        my $renewal = Koha::Checkouts::Renewal->new(
+            {
+                issue_id   => $issue->issue_id,
+                renewer_id => C4::Context->userenv->{'number'},
+                seen       => $seen,
+                interface  => C4::Context->interface
+            }
+        )->store();
+
         # Add the renewal to stats
         C4::Stats::UpdateStats(
             {
-- 
2.20.1