Lines 242-249
subtest 'AutoRemoveOverduesRestrictions' => sub {
Link Here
|
242 |
|
242 |
|
243 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_1->itemnumber ); |
243 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_1->itemnumber ); |
244 |
|
244 |
|
245 |
$debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); |
245 |
$restrictions = $patron->restrictions; |
246 |
is( scalar @$debarments, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); |
246 |
is($restrictions->count, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); |
247 |
|
247 |
|
248 |
$checkout_1 = AddIssue( $patron->unblessed, $item_1->barcode, $ten_days_ago ); # overdue and would trigger debarment |
248 |
$checkout_1 = AddIssue( $patron->unblessed, $item_1->barcode, $ten_days_ago ); # overdue and would trigger debarment |
249 |
|
249 |
|
Lines 257-264
subtest 'AutoRemoveOverduesRestrictions' => sub {
Link Here
|
257 |
|
257 |
|
258 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); |
258 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); |
259 |
|
259 |
|
260 |
$debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); |
260 |
$restrictions = $patron->restrictions->search({ type => 'OVERDUES' }); |
261 |
is( $debarments->[0]->{type}, 'OVERDUES', 'OVERDUES debarment is not removed if patron still has overdues that would trigger debarment' ); |
261 |
is( $restrictions->count, 1, 'OVERDUES debarment is not removed if patron still has overdues that would trigger debarment' ); |
262 |
|
262 |
|
263 |
my $eleven_days_ago = dt_from_string->subtract( days => 11 ); |
263 |
my $eleven_days_ago = dt_from_string->subtract( days => 11 ); |
264 |
|
264 |
|
Lines 282-289
subtest 'AutoRemoveOverduesRestrictions' => sub {
Link Here
|
282 |
|
282 |
|
283 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); |
283 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); |
284 |
|
284 |
|
285 |
$debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); |
285 |
$restrictions = $patron->restrictions; |
286 |
is( scalar @$debarments, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); |
286 |
is( $restrictions->count, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); |
287 |
|
287 |
|
288 |
$schema->storage->txn_rollback; |
288 |
$schema->storage->txn_rollback; |
289 |
}; |
289 |
}; |
290 |
- |
|
|