|
Lines 180-185
sub anonymise_issue_history {
Link Here
|
| 180 |
|
180 |
|
| 181 |
$older_than_date = dt_from_string $older_than_date if $older_than_date; |
181 |
$older_than_date = dt_from_string $older_than_date if $older_than_date; |
| 182 |
|
182 |
|
|
|
183 |
my $filter_damaged = |
| 184 |
C4::Context->preference("KeepDamagedCheckouts") || 0; |
| 185 |
my $filter_lost = |
| 186 |
C4::Context->preference("KeepLostCheckouts") || 0; |
| 187 |
my $filter_withdrawn = |
| 188 |
C4::Context->preference("KeepWithdrawnCheckouts") || 0; |
| 189 |
|
| 183 |
# The default of 0 does not work due to foreign key constraints |
190 |
# The default of 0 does not work due to foreign key constraints |
| 184 |
# The anonymisation should not fail quietly if AnonymousPatron is not a valid entry |
191 |
# The anonymisation should not fail quietly if AnonymousPatron is not a valid entry |
| 185 |
# Set it to undef (NULL) |
192 |
# Set it to undef (NULL) |
|
Lines 187-200
sub anonymise_issue_history {
Link Here
|
| 187 |
my $nb_rows = 0; |
194 |
my $nb_rows = 0; |
| 188 |
while ( my $patron = $self->next ) { |
195 |
while ( my $patron = $self->next ) { |
| 189 |
my $old_issues_to_anonymise = $patron->old_checkouts->search( |
196 |
my $old_issues_to_anonymise = $patron->old_checkouts->search( |
| 190 |
{ |
197 |
{ |
| 191 |
( |
198 |
( |
| 192 |
$older_than_date |
199 |
$older_than_date |
| 193 |
? ( returndate => |
200 |
? ( returndate => |
| 194 |
{ '<' => $dtf->format_datetime($older_than_date) } ) |
201 |
{ '<' => $dtf->format_datetime($older_than_date) } ) |
| 195 |
: () |
202 |
: () |
| 196 |
) |
203 |
), |
| 197 |
} |
204 |
( $filter_damaged ? ( "itemnumber.damaged" => 0 ) : () ), |
|
|
205 |
( $filter_lost ? ( "itemnumber.itemlost" => 0 ) : () ), |
| 206 |
( $filter_withdrawn ? ( "itemnumber.withdrawn" => 0 ) : () ) |
| 207 |
}, |
| 208 |
{ |
| 209 |
join => ['itemnumber'] |
| 210 |
} |
| 198 |
); |
211 |
); |
| 199 |
|
212 |
|
| 200 |
my $last_borrowers_to_anonymise = |
213 |
my $last_borrowers_to_anonymise = |
|
Lines 205-214
sub anonymise_issue_history {
Link Here
|
| 205 |
? ( created_on => |
218 |
? ( created_on => |
| 206 |
{ '<' => $dtf->format_datetime($older_than_date) } ) |
219 |
{ '<' => $dtf->format_datetime($older_than_date) } ) |
| 207 |
: (), |
220 |
: (), |
| 208 |
"itemnumber.damaged" => 0, |
221 |
), |
| 209 |
"itemnumber.itemlost" => 0, |
222 |
( $filter_damaged ? ( "itemnumber.damaged" => 0 ) : () ), |
| 210 |
"itemnumber.withdrawn" => 0, |
223 |
( $filter_lost ? ( "itemnumber.itemlost" => 0 ) : () ), |
| 211 |
) |
224 |
( $filter_withdrawn ? ( "itemnumber.withdrawn" => 0 ) : () ) |
| 212 |
}, |
225 |
}, |
| 213 |
{ |
226 |
{ |
| 214 |
join => ['itemnumber'] |
227 |
join => ['itemnumber'] |
| 215 |
- |
|
|