From cd2a99e456efd4ea7e92be2fd33e4683ad6205c7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 29 Nov 2019 09:45:48 +0000 Subject: [PATCH] Bug 24114: (QA follow-up) Fix counts for lock, anonymize and delete Since these operations impact on the resultset, the counts should be saved before. Signed-off-by: Marcel de Rooy Signed-off-by: Bouzid Fergani Signed-off-by: Martin Renvoize --- misc/cronjobs/cleanup_database.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 7ca7b33177..a1a9cae442 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -332,22 +332,25 @@ if($allDebarments) { # Handle unsubscribe requests from GDPR consent form, depends on UnsubscribeReflectionDelay preference my $unsubscribed_patrons = Koha::Patrons->search_unsubscribed; +$count = $unsubscribed_patrons->count; $unsubscribed_patrons->lock( { expire => 1, remove => 1 } ); -say sprintf "Locked %d patrons", $unsubscribed_patrons->count if $verbose; +say sprintf "Locked %d patrons", $count if $verbose; # Anonymize patron data, depending on PatronAnonymizeDelay my $anonymize_candidates = Koha::Patrons->search_anonymize_candidates( { locked => 1 } ); +$count = $anonymize_candidates->count; $anonymize_candidates->anonymize; -say sprintf "Anonymized %s patrons", $anonymize_candidates->count if $verbose; +say sprintf "Anonymized %s patrons", $count if $verbose; # Remove patron data, depending on PatronRemovalDelay (will raise an exception if problem encountered my $anonymized_patrons = Koha::Patrons->search_anonymized; +$count = $anonymized_patrons->count; $anonymized_patrons->delete( { move => 1 } ); if ($@) { warn $@; } elsif ($verbose) { - say sprintf "Deleted %d patrons", $anonymized_patrons->count; + say sprintf "Deleted %d patrons", $count; } if( $pExpSelfReg ) { -- 2.39.5