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 <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4f77ec8387)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Martin Renvoize 2023-03-24 16:07:47 +00:00 committed by Fridolin Somers
parent 05f18896f7
commit bf1680c913
No known key found for this signature in database
GPG Key ID: 9A8E73E2A8B96537
1 changed files with 5 additions and 0 deletions

View File

@ -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 } );
}