|
Lines 202-208
sub anonymise_issue_history {
Link Here
|
| 202 |
|
202 |
|
| 203 |
=head3 delete |
203 |
=head3 delete |
| 204 |
|
204 |
|
| 205 |
Koha::Patrons->search({ some filters here })->delete({ move => 1, verbose => 1 }); |
205 |
Koha::Patrons->search({ some filters here })->delete({ move => 1 }); |
| 206 |
|
206 |
|
| 207 |
Delete passed set of patron objects. |
207 |
Delete passed set of patron objects. |
| 208 |
Wrapper for Koha::Patron->delete. (We do not want to bypass Koha::Patron |
208 |
Wrapper for Koha::Patron->delete. (We do not want to bypass Koha::Patron |
|
Lines 225-231
sub delete {
Link Here
|
| 225 |
$patron->delete == 1 || Koha::Exceptions::Patron::FailedDelete->throw; |
225 |
$patron->delete == 1 || Koha::Exceptions::Patron::FailedDelete->throw; |
| 226 |
$patrons_deleted++; |
226 |
$patrons_deleted++; |
| 227 |
} |
227 |
} |
| 228 |
warn "Deleted $count patrons\n" if $params->{verbose}; |
|
|
| 229 |
}, $self, $params ); |
228 |
}, $self, $params ); |
| 230 |
return $patrons_deleted; |
229 |
return $patrons_deleted; |
| 231 |
} |
230 |
} |
|
Lines 322-331
sub search_anonymized {
Link Here
|
| 322 |
|
321 |
|
| 323 |
=head3 lock |
322 |
=head3 lock |
| 324 |
|
323 |
|
| 325 |
Koha::Patrons->search({ some filters })->lock({ expire => 1, remove => 1, verbose => 1 }) |
324 |
Koha::Patrons->search({ some filters })->lock({ expire => 1, remove => 1 }) |
| 326 |
|
325 |
|
| 327 |
Lock the passed set of patron objects. Optionally expire and remove holds. |
326 |
Lock the passed set of patron objects. Optionally expire and remove holds. |
| 328 |
Optional verbose flag is used in cron job. |
|
|
| 329 |
Wrapper around Koha::Patron->lock. |
327 |
Wrapper around Koha::Patron->lock. |
| 330 |
|
328 |
|
| 331 |
=cut |
329 |
=cut |
|
Lines 336-365
sub lock {
Link Here
|
| 336 |
while( my $patron = $self->next ) { |
334 |
while( my $patron = $self->next ) { |
| 337 |
$patron->lock($params); |
335 |
$patron->lock($params); |
| 338 |
} |
336 |
} |
| 339 |
if( $params->{verbose} ) { |
|
|
| 340 |
warn "Locked $count patrons\n"; |
| 341 |
} |
| 342 |
} |
337 |
} |
| 343 |
|
338 |
|
| 344 |
=head3 anonymize |
339 |
=head3 anonymize |
| 345 |
|
340 |
|
| 346 |
Koha::Patrons->search({ some filters })->anonymize({ verbose => 1 }); |
341 |
Koha::Patrons->search({ some filters })->anonymize(); |
| 347 |
|
342 |
|
| 348 |
Anonymize passed set of patron objects. |
343 |
Anonymize passed set of patron objects. |
| 349 |
Optional verbose flag is used in cron job. |
|
|
| 350 |
Wrapper around Koha::Patron->anonymize. |
344 |
Wrapper around Koha::Patron->anonymize. |
| 351 |
|
345 |
|
| 352 |
=cut |
346 |
=cut |
| 353 |
|
347 |
|
| 354 |
sub anonymize { |
348 |
sub anonymize { |
| 355 |
my ( $self, $params ) = @_; |
349 |
my ( $self ) = @_; |
| 356 |
my $count = $self->count; |
350 |
my $count = $self->count; |
| 357 |
while( my $patron = $self->next ) { |
351 |
while( my $patron = $self->next ) { |
| 358 |
$patron->anonymize; |
352 |
$patron->anonymize; |
| 359 |
} |
353 |
} |
| 360 |
if( $params->{verbose} ) { |
|
|
| 361 |
warn "Anonymized $count patrons\n"; |
| 362 |
} |
| 363 |
} |
354 |
} |
| 364 |
|
355 |
|
| 365 |
=head3 search_patrons_to_update_category |
356 |
=head3 search_patrons_to_update_category |