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 <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1213ad7af7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-07-31 17:23:50 +00:00 committed by Lucas Gass
parent 01e325f0f9
commit 183f6aac15
1 changed files with 8 additions and 1 deletions

View File

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