Bug 34611: Add a script to pseudonymize statistics from before a given date
This script takes a date parameter in SQL format and pseudonymizes all statistics
found before this date.
Only values that can be found will be added, i.e. no deleted patron or item info
will be present.
Additionally - the values stored will be the current values from patrons and items, so
some info will be approximate, much as it is when joining from the statistics table for reporting.
To test:
1 - Perform some issues/returns/renewals/on-site checkouts
2 - Make sure Pseudonymization is disabled
3 - perl misc/maintenance/pseudonymize_statistics.pl
4 - Script ends and reports that preference is not active
5 - Enable the pref, and choose some borrower and item fields
NOTE: See bug 28911 if you need a bcrypt key for your koha-conf.xml
6 - perl misc/maintenance/pseudonymize_statistics.pl
7 - sudo koha-mysql kohadev
8 - SELECT * FROM pseudonymized_transactions
9 - Confirm data is correctly stored
10 - DELETE FROM pseudonymized_transactions;
11 - UPDATE statistics SET datetime = '2023-01-01 00:00:00';
12 - perl misc/maintenance/pseudonymize_statistics.pl -b "2022-12-31 23:59:59";
13 - SELECT * FROM pseudonymized_transactions;
14 - Confirm no entries were made
15 - Select different options in Pseudonmyization prefs, including borrower attributes
This wil require defining an attribute that can be kept for pseudonymization
16 - Confirm options are correctly pseudonymized
Signed-off-by: AFHDubCoLib <andrewfh@dubcolib.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>