From 9a9c88c885a196c12e4b4023dc451721f8273da1 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 24 Mar 2023 16:07:47 +0000 Subject: [PATCH] Bug 33284: Set renewer_id for sets of checkouts This patch adds a trigger into the anonymize function of Koha::Old::Checkouts such that we pass along the anonymize action to the renewals record. Signed-off-by: Andrew Fuerste-Henry https://bugs.koha-community.org/show_bug.cgi?id=33285 --- Koha/Old/Checkouts.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Koha/Old/Checkouts.pm b/Koha/Old/Checkouts.pm index 8ee651645f..b94df1ef22 100644 --- a/Koha/Old/Checkouts.pm +++ b/Koha/Old/Checkouts.pm @@ -101,6 +101,11 @@ sub anonymize { Koha::Exceptions::SysPref::NotSet->throw( syspref => 'AnonymousPatron' ) unless $anonymous_id; + while ( my $checkout = $self->next ) { + my $self_renewals = $checkout->renewals->search( { renewer_id => $checkout->borrowernumber } ); + $self_renewals->update( { renewer_id => $anonymous_id } ); + } + return $self->update( { borrowernumber => $anonymous_id }, { no_triggers => 1 } ); } -- 2.30.2