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 <m.de.rooy@rijksmuseum.nl> Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
88d1ad0c35
commit
cd2a99e456
|
|
@ -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 ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue