View | Details | Raw Unified | Return to bug 21336
Collapse All | Expand All

(-)a/Koha/Patrons.pm (-3 / +13 lines)
Lines 332-365 sub search_anonymized { Link Here
332
332
333
=head3 lock
333
=head3 lock
334
334
335
    Koha::Patrons->search({ some filters })->lock({ expire => 1, remove => 1 })
335
    Koha::Patrons->search({ some filters })->lock({ expire => 1, remove => 1, verbose => 1 })
336
336
337
    Lock the passed set of patron objects. Optionally expire and remove holds.
337
    Lock the passed set of patron objects. Optionally expire and remove holds.
338
    Optional verbose flag is used in cron job.
338
    Wrapper around Koha::Patron->lock.
339
    Wrapper around Koha::Patron->lock.
339
340
340
=cut
341
=cut
341
342
342
sub lock {
343
sub lock {
343
    my ( $self, $params ) = @_;
344
    my ( $self, $params ) = @_;
345
    my $count = $self->count;
344
    while( my $patron = $self->next ) {
346
    while( my $patron = $self->next ) {
345
        $patron->lock($params);
347
        $patron->lock($params);
346
    }
348
    }
349
    if( $params->{verbose} ) {
350
        warn "Locked $count patrons\n";
351
    }
347
}
352
}
348
353
349
=head3 anonymize
354
=head3 anonymize
350
355
351
    Koha::Patrons->search({ some filters })->anonymize;
356
    Koha::Patrons->search({ some filters })->anonymize({ verbose => 1 });
352
357
353
    Anonymize passed set of patron objects.
358
    Anonymize passed set of patron objects.
359
    Optional verbose flag is used in cron job.
354
    Wrapper around Koha::Patron->anonymize.
360
    Wrapper around Koha::Patron->anonymize.
355
361
356
=cut
362
=cut
357
363
358
sub anonymize {
364
sub anonymize {
359
    my ( $self ) = @_;
365
    my ( $self, $params ) = @_;
366
    my $count = $self->count;
360
    while( my $patron = $self->next ) {
367
    while( my $patron = $self->next ) {
361
        $patron->anonymize;
368
        $patron->anonymize;
362
    }
369
    }
370
    if( $params->{verbose} ) {
371
        warn "Anonymized $count patrons\n";
372
    }
363
}
373
}
364
374
365
=head3 _type
375
=head3 _type
(-)a/misc/cronjobs/cleanup_database.pl (-1 / +13 lines)
Lines 304-309 if($allDebarments) { Link Here
304
    print "$count restrictions were deleted.\nDone with all restrictions purge.\n" if $verbose;
304
    print "$count restrictions were deleted.\nDone with all restrictions purge.\n" if $verbose;
305
}
305
}
306
306
307
# Handle unsubscribe requests from GDPR consent form, depends on UnsubscribeReflectionDelay preference
308
Koha::Patrons->search_unsubscribed->lock({ expire => 1, remove => 1, verbose => $verbose });
309
# Anonymize patron data, depending on PatronAnonymizeDelay
310
Koha::Patrons->search_anonymize_candidates({ locked => 1 })->anonymize({ verbose => $verbose });
311
# Remove patron data, depending on PatronRemovalDelay
312
{
313
    my $rs = Koha::Patrons->search_anonymized;
314
    my $count = $rs->count;
315
    my $rv = $rs->delete;
316
    print "Removed $count anonymized patrons\n" if $verbose && $rv==1;
317
    warn "Problem with removing anonymized patrons\n" if $rv<1 && $count;
318
}
319
307
if( $pExpSelfReg ) {
320
if( $pExpSelfReg ) {
308
    DeleteExpiredSelfRegs();
321
    DeleteExpiredSelfRegs();
309
}
322
}
310
- 

Return to bug 21336