Lines 209-231
sub anonymise_issue_history {
Link Here
|
209 |
|
209 |
|
210 |
=head3 delete |
210 |
=head3 delete |
211 |
|
211 |
|
212 |
Koha::Patrons->search({ some filters here })->delete; |
212 |
Koha::Patrons->search({ some filters here })->delete({ move => 1 }); |
213 |
|
213 |
|
214 |
Delete passed set of patron objects. |
214 |
Delete passed set of patron objects. |
215 |
Wrapper for Koha::Patron->delete. (We do not want to bypass Koha::Patron |
215 |
Wrapper for Koha::Patron->delete. (We do not want to bypass Koha::Patron |
216 |
and let DBIx do the job without further housekeeping.) |
216 |
and let DBIx do the job without further housekeeping.) |
217 |
NOTE: By default includes a move to deletedborrowers. |
217 |
Includes a move to deletedborrowers if move flag set. |
218 |
|
218 |
|
219 |
Return value (if relevant) is based on the individual return values. |
219 |
Return value (if relevant) is based on the individual return values. |
220 |
|
220 |
|
221 |
=cut |
221 |
=cut |
222 |
|
222 |
|
223 |
sub delete { |
223 |
sub delete { |
224 |
my ( $self ) = @_; |
224 |
my ( $self, $params ) = @_; |
225 |
my (@res, $rv); |
225 |
my (@res, $rv); |
226 |
$rv = 1; |
226 |
$rv = 1; |
227 |
while( my $patron = $self->next ) { |
227 |
while( my $patron = $self->next ) { |
228 |
$patron->move_to_deleted; # Needed here, since it is no default action.. |
228 |
$patron->move_to_deleted if $params->{move}; |
229 |
push @res, $patron->delete; |
229 |
push @res, $patron->delete; |
230 |
$rv=-1 if $res[-1]==-1; |
230 |
$rv=-1 if $res[-1]==-1; |
231 |
$rv=0 if $rv==1 && $res[-1]==0; |
231 |
$rv=0 if $rv==1 && $res[-1]==0; |