Lines 45-51
unless ( C4::Context->preference('Pseudonymization') ) {
Link Here
|
45 |
$before //= format_sqldatetime( dt_from_string(), 'sql', undef, 1 ); |
45 |
$before //= format_sqldatetime( dt_from_string(), 'sql', undef, 1 ); |
46 |
print "Searching for statistics before $before\n" if $verbose; |
46 |
print "Searching for statistics before $before\n" if $verbose; |
47 |
|
47 |
|
48 |
my $statistics = Koha::Statistics->search( { datetime => { '<=' => $before } } ); |
48 |
my $statistics = Koha::Statistics->search( |
|
|
49 |
{ |
50 |
datetime => { '<=' => $before }, |
51 |
type => { '-in' => \@Koha::Statistic::pseudonymization_types }, |
52 |
borrowernumber => { '!=' => undef } |
53 |
} |
54 |
); |
49 |
print $statistics->count() . " statistics found\n" if $verbose; |
55 |
print $statistics->count() . " statistics found\n" if $verbose; |
50 |
|
56 |
|
51 |
my $existing_pseudo_stats = Koha::PseudonymizedTransactions->search( { datetime => { '<=' => $before } } )->count; |
57 |
my $existing_pseudo_stats = Koha::PseudonymizedTransactions->search( { datetime => { '<=' => $before } } )->count; |
Lines 66-72
if ( !$confirm ) {
Link Here
|
66 |
} |
72 |
} |
67 |
|
73 |
|
68 |
while ( my $statistic = $statistics->next ) { |
74 |
while ( my $statistic = $statistics->next ) { |
69 |
$statistic->pseudonymize(); |
75 |
Koha::PseudonymizedTransaction->new_from_statistic($statistic)->store(); |
70 |
} |
76 |
} |
71 |
|
77 |
|
72 |
print $statistics->count() . " statistics pseudonymized\n" if $verbose; |
78 |
print $statistics->count() . " statistics pseudonymized\n" if $verbose; |
73 |
- |
|
|