Bugzilla – Attachment 163347 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: Confirm run if pseudonymized transactions found and add verbose feedback
Bug-34611-Confirm-run-if-pseudonymized-transaction.patch (text/plain), 2.11 KB, created by
Nick Clemens (kidclamp)
on 2024-03-18 16:13:43 UTC
(
hide
)
Description:
Bug 34611: Confirm run if pseudonymized transactions found and add verbose feedback
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-18 16:13:43 UTC
Size:
2.11 KB
patch
obsolete
>From fc88df48a84fa64c14131d17c165cb61663e77ad Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 25 Oct 2023 19:08:00 +0000 >Subject: [PATCH] Bug 34611: Confirm run if pseudonymized transactions found > and add verbose feedback > >Signed-off-by: AFHDubCoLib <andrewfh@dubcolib.org> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > misc/maintenance/pseudonymize_statistics.pl | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > >diff --git a/misc/maintenance/pseudonymize_statistics.pl b/misc/maintenance/pseudonymize_statistics.pl >index 1c20fe6f33e..2f950b5c6de 100755 >--- a/misc/maintenance/pseudonymize_statistics.pl >+++ b/misc/maintenance/pseudonymize_statistics.pl >@@ -22,6 +22,7 @@ use Pod::Usage qw( pod2usage ); > use Koha::DateUtils qw( dt_from_string format_sqldatetime ); > use Koha::Script; > use Koha::Statistics; >+use Koha::PseudonymizedTransactions; > > use C4::Context; > >@@ -41,13 +42,31 @@ unless ( C4::Context->preference('Pseudonymization') ) { > } > > $before //= format_sqldatetime( dt_from_string(), 'sql', undef, 1 ); >+print "Searching for statistics before $before\n" if $verbose; > > my $statistics = Koha::Statistics->search( { datetime => { '<=' => $before } } ); >+print $statistics->count() . " statistics found\n" if $verbose; >+ >+ >+my $existing_pseudo_stats = Koha::PseudonymizedTransactions->search( { datetime => { '<=' => $before } } )->count; >+ >+if ( $statistics->count && $existing_pseudo_stats ) { >+ print "There are " >+ . $statistics->count() >+ . " statistics found, and $existing_pseudo_stats already in the database for the date provided.\n"; >+ print "You may have already run this script for the time period given.\n"; >+ print "Please enter 'Y' if you would like to continue:"; >+ chomp( my $continue = <> ); >+ exit unless uc($continue) eq 'Y'; >+} >+ > > while ( my $statistic = $statistics->next ) { > $statistic->pseudonymize(); > } > >+print $statistics->count() . " statistics pseudonymized\n" if $verbose; >+ > =head1 NAME > > pseudonymize_statistics - This script pseudonymizes statistics before a given date, or now if no date passed. >-- >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