Lines 30-36
use Koha::Database;
Link Here
|
30 |
use Koha::DateUtils qw(dt_from_string); |
30 |
use Koha::DateUtils qw(dt_from_string); |
31 |
use Koha::Old::Checkouts; |
31 |
use Koha::Old::Checkouts; |
32 |
use Koha::Patrons; |
32 |
use Koha::Patrons; |
33 |
use Koha::Patron::Debarments qw( GetDebarments AddUniqueDebarment ); |
33 |
use Koha::Patron::Debarments qw( AddUniqueDebarment ); |
34 |
|
34 |
|
35 |
my $schema = Koha::Database->schema; |
35 |
my $schema = Koha::Database->schema; |
36 |
my $builder = t::lib::TestBuilder->new; |
36 |
my $builder = t::lib::TestBuilder->new; |
Lines 199-211
subtest 'AutoRemoveOverduesRestrictions' => sub {
Link Here
|
199 |
|
199 |
|
200 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_1->itemnumber ); |
200 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_1->itemnumber ); |
201 |
|
201 |
|
202 |
my $debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); |
202 |
my $restrictions = $patron->restrictions; |
203 |
is( $debarments->[0]->{type}, 'OVERDUES', 'OVERDUES debarment is not removed if patron still has overdues' ); |
203 |
my $THE_restriction = $restrictions->next; |
|
|
204 |
is( $THE_restriction->type->code, 'OVERDUES', 'OVERDUES debarment is not removed if patron still has overdues' ); |
204 |
|
205 |
|
205 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); |
206 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); |
206 |
|
207 |
|
207 |
$debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); |
208 |
$restrictions = $patron->restrictions; |
208 |
is( scalar @$debarments, 0, 'OVERDUES debarment is removed if patron does not have overdues' ); |
209 |
is( $restrictions->count, 0, 'OVERDUES debarment is removed if patron does not have overdues' ); |
209 |
|
210 |
|
210 |
$schema->storage->txn_rollback; |
211 |
$schema->storage->txn_rollback; |
211 |
}; |
212 |
}; |
212 |
- |
|
|