From 27a5093ca59759c511dc4cde50ecc5e0a450ffa6 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 31 Jul 2024 17:23:50 +0000 Subject: [PATCH] Bug 37540: Ensure datetime is a string before enqueueing pseudonymization To test: 1 - Enable Pseudonymization in system preferences NOTE: See bug 28911 for bcrypt setup 2 - Issue an item to a patron 3 - View the patrons checkouts 4 - Check the box under 'Renew' 5 - Renew selected items 6 - Internal server error 7 - Apply patch 8 - Restart all 9 - Repeat 4&5 10 - Success! Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize --- Koha/Statistic.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Koha/Statistic.pm b/Koha/Statistic.pm index 14f299569f0..4e981c31c2e 100644 --- a/Koha/Statistic.pm +++ b/Koha/Statistic.pm @@ -150,7 +150,14 @@ sub pseudonymize { my ($self) = @_; return unless ( $self->borrowernumber && grep { $_ eq $self->type } qw(renew issue return onsite_checkout) ); - Koha::BackgroundJob::PseudonymizeStatistic->new->enqueue( { statistic => $self->unblessed } ); + + # FIXME When getting the object from svc/renewal we get a DateTime object + # normally we just fetch from DB to clear this, but statistics has no primary key + # so we just force it to string context + my $unblessed = $self->unblessed; + $unblessed->{datetime} = $unblessed->{datetime} . ""; + + Koha::BackgroundJob::PseudonymizeStatistic->new->enqueue( { statistic => $unblessed } ); } -- 2.45.2