From 054bbc75bfb827a530f296c13c8dca9816b1ee9a 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 Content-Type: text/plain; charset=utf-8 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 Signed-off-by: Marcel de Rooy --- Koha/Old/Checkouts.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Koha/Old/Checkouts.pm b/Koha/Old/Checkouts.pm index 9a7037ace1..2a5f1d5c6f 100644 --- a/Koha/Old/Checkouts.pm +++ b/Koha/Old/Checkouts.pm @@ -103,6 +103,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.39.5