Bugzilla – Attachment 163757 Details for
Bug 34611
Add a script for pseudonymizing existing data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34611: (follow-up) Preserve statistic date if passed or null if not
Bug-34611-follow-up-Preserve-statistic-date-if-pas.patch (text/plain), 2.13 KB, created by
Nick Clemens (kidclamp)
on 2024-03-23 16:31:40 UTC
(
hide
)
Description:
Bug 34611: (follow-up) Preserve statistic date if passed or null if not
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-23 16:31:40 UTC
Size:
2.13 KB
patch
obsolete
>From 6cde7af8af76677d3a5a9ee4335fccf7499e24e4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Sat, 23 Mar 2024 16:26:44 +0000 >Subject: [PATCH] Bug 34611: (follow-up) Preserve statistic date if passed or > null if not > >When testing the confirm option, I found that I was not warned on repeated runs. >It turns out creating a new statistic object was setting the datetime to current >timestamp > >This patch reset the object from the values passed > >To test: >1 - Disable Pseudonymization >2 - Perform some transactions, update datetimein DB to set them to yesterday >3 - Enable pseudonymization, ensure 'Date and time of transaction' is checked >4 - perl misc/maintenance/pseudonymize_statistics.pl -v >5 - Check the DB, note the new pseudonymized transactions have todays date >6 - DELETE FROM pseudonymized_transactions >7 - Apply patch >8 - perl misc/maintenance/pseudonymize_statistics.pl -v >9 - Check DB and confirm the transactoins have the original date >10 - DELETE FROM pseudonymized_transactions >11 - Unset date and time from pseudonymization pref >12 - perl misc/maintenance/pseudonymize_statistics.pl -v >13 - Confirm the transactions have a null date >--- > Koha/BackgroundJob/PseudonymizeStatistic.pm | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/Koha/BackgroundJob/PseudonymizeStatistic.pm b/Koha/BackgroundJob/PseudonymizeStatistic.pm >index a1dd525b941..1d2bcd311cb 100644 >--- a/Koha/BackgroundJob/PseudonymizeStatistic.pm >+++ b/Koha/BackgroundJob/PseudonymizeStatistic.pm >@@ -52,7 +52,12 @@ sub process { > $self->start; > my $statistic = $args->{statistic}; > my $stat_object = Koha::Statistic->new($statistic); >- Koha::PseudonymizedTransaction->new_from_statistic($stat_object)->store(); >+ # creating new object updates the timestamp to the current time >+ # we need to preserve the original transaction time >+ # if it was passed >+ $stat_object->datetime( $statistic->{datetime} ); >+ my $ps= Koha::PseudonymizedTransaction->new_from_statistic($stat_object); >+ $ps->store(); > $self->finish( { data => "" } ); # We want to clear the job data to avoid storing patron information > > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34611
:
154808
|
154809
|
157753
|
157754
|
157755
|
157763
|
157764
|
157765
|
157869
|
157870
|
157871
|
157872
|
157877
|
157878
|
157879
|
157880
|
159909
|
159910
|
159911
|
159912
|
163344
|
163345
|
163346
|
163347
|
163756
|
163757