Lines 165-173
sub search_patrons_to_anonymise {
Link Here
|
165 |
|
165 |
|
166 |
Koha::Patrons->search->anonymise_issue_history( { [ before => $older_than_date ] } ); |
166 |
Koha::Patrons->search->anonymise_issue_history( { [ before => $older_than_date ] } ); |
167 |
|
167 |
|
168 |
Anonymise issue history (old_issues) for all patrons older than the given date (optional). |
168 |
Anonymise issue history (old_issues and items_last_borrowers) for all issues older |
|
|
169 |
than the given date (optional). |
170 |
|
169 |
To make sure all the conditions are met, the caller has the responsibility to |
171 |
To make sure all the conditions are met, the caller has the responsibility to |
170 |
call search_patrons_to_anonymise to filter the Koha::Patrons set |
172 |
call search_patrons_to_anonymise to filter the Koha::Patrons set. |
171 |
|
173 |
|
172 |
=cut |
174 |
=cut |
173 |
|
175 |
|
Lines 194-201
sub anonymise_issue_history {
Link Here
|
194 |
) |
196 |
) |
195 |
} |
197 |
} |
196 |
); |
198 |
); |
|
|
199 |
|
200 |
my $last_borrowers_to_anonymise = |
201 |
$patron->_resultset->items_last_borrowers->search( |
202 |
{ |
203 |
( |
204 |
$older_than_date |
205 |
? ( created_on => |
206 |
{ '<' => $dtf->format_datetime($older_than_date) } ) |
207 |
: () |
208 |
) |
209 |
} |
210 |
); |
211 |
|
197 |
my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; |
212 |
my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; |
198 |
$nb_rows += $old_issues_to_anonymise->update( { 'old_issues.borrowernumber' => $anonymous_patron } ); |
213 |
$nb_rows += $old_issues_to_anonymise->update( { 'old_issues.borrowernumber' => $anonymous_patron } ); |
|
|
214 |
$nb_rows += $last_borrowers_to_anonymise->update( { 'items_last_borrowers.borrowernumber' => $anonymous_patron } ); |
199 |
} |
215 |
} |
200 |
return $nb_rows; |
216 |
return $nb_rows; |
201 |
} |
217 |
} |
202 |
- |
|
|