Bug 34611: Add a script to pseudonymize statistics from before a given date
authorNick Clemens <nick@bywatersolutions.com>
Fri, 25 Aug 2023 12:15:31 +0000 (12:15 +0000)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Tue, 19 Mar 2024 09:25:05 +0000 (10:25 +0100)
commit59368f5c9dc4087393215293e5d98c024c5db092
treea9b53c7266f3baf856c83ff341d5da8e2d2d2d8d
parent6fb75aa6fcbb61d952868333da08b459eecc0043
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>
misc/maintenance/pseudonymize_statistics.pl [new file with mode: 0755]