|
Lines 281-292
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_
Link Here
|
| 281 |
is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date'); |
281 |
is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date'); |
| 282 |
|
282 |
|
| 283 |
# Test GetBorrowersToExpunge and TrackLastPatronActivity |
283 |
# Test GetBorrowersToExpunge and TrackLastPatronActivity |
| 284 |
$dbh->do(q|UPDATE borrowers SET lastseen=NULL|); |
284 |
my $new_category = $builder->build_object( |
|
|
285 |
{ |
| 286 |
class => 'Koha::Patron::Categories', |
| 287 |
value => { category_type => 'A' }, # should not be S for GetBorrowersToExpunge |
| 288 |
} |
| 289 |
); |
| 285 |
$builder->build({ |
290 |
$builder->build({ |
| 286 |
source => 'Borrower', |
291 |
source => 'Borrower', |
| 287 |
value => { |
292 |
value => { |
| 288 |
lastseen => '2016-01-01 01:01:01', |
293 |
lastseen => '2016-01-01 01:01:01', |
| 289 |
categorycode => 'CIVILIAN', |
294 |
categorycode => $new_category->categorycode, |
| 290 |
flags => undef, |
295 |
flags => undef, |
| 291 |
} |
296 |
} |
| 292 |
}); |
297 |
}); |
|
Lines 294-300
$builder->build({
Link Here
|
| 294 |
source => 'Borrower', |
299 |
source => 'Borrower', |
| 295 |
value => { |
300 |
value => { |
| 296 |
lastseen => '2016-02-02 02:02:02', |
301 |
lastseen => '2016-02-02 02:02:02', |
| 297 |
categorycode => 'CIVILIAN', |
302 |
categorycode => $new_category->categorycode, |
| 298 |
flags => undef, |
303 |
flags => undef, |
| 299 |
} |
304 |
} |
| 300 |
}); |
305 |
}); |
|
Lines 302-316
$builder->build({
Link Here
|
| 302 |
source => 'Borrower', |
307 |
source => 'Borrower', |
| 303 |
value => { |
308 |
value => { |
| 304 |
lastseen => '2016-03-03 03:03:03', |
309 |
lastseen => '2016-03-03 03:03:03', |
| 305 |
categorycode => 'CIVILIAN', |
310 |
categorycode => $new_category->categorycode, |
| 306 |
flags => undef, |
311 |
flags => undef, |
| 307 |
} |
312 |
} |
| 308 |
}); |
313 |
}); |
| 309 |
$patstodel = GetBorrowersToExpunge( { last_seen => '1999-12-12' }); |
314 |
$patstodel = GetBorrowersToExpunge( { category_code => $new_category->categorycode, last_seen => '1999-12-12' }); |
| 310 |
is( scalar @$patstodel, 0, 'TrackLastPatronActivity - 0 patrons must be deleted' ); |
315 |
is( scalar @$patstodel, 0, 'TrackLastPatronActivity - 0 patrons must be deleted' ); |
| 311 |
$patstodel = GetBorrowersToExpunge( { last_seen => '2016-02-15' }); |
316 |
$patstodel = GetBorrowersToExpunge( { category_code => $new_category->categorycode, last_seen => '2016-02-15' }); |
| 312 |
is( scalar @$patstodel, 2, 'TrackLastPatronActivity - 2 patrons must be deleted' ); |
317 |
is( scalar @$patstodel, 2, 'TrackLastPatronActivity - 2 patrons must be deleted' ); |
| 313 |
$patstodel = GetBorrowersToExpunge( { last_seen => '2016-04-04' }); |
318 |
$patstodel = GetBorrowersToExpunge( { category_code => $new_category->categorycode, last_seen => '2016-04-04' }); |
| 314 |
is( scalar @$patstodel, 3, 'TrackLastPatronActivity - 3 patrons must be deleted' ); |
319 |
is( scalar @$patstodel, 3, 'TrackLastPatronActivity - 3 patrons must be deleted' ); |
| 315 |
my $patron2 = $builder->build({ |
320 |
my $patron2 = $builder->build({ |
| 316 |
source => 'Borrower', |
321 |
source => 'Borrower', |
| 317 |
- |
|
|