@@ -, +, @@ --- t/db_dependent/Circulation.t | 43 +++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) --- a/t/db_dependent/Circulation.t +++ a/t/db_dependent/Circulation.t @@ -2617,7 +2617,7 @@ subtest 'AddReturn + CumulativeRestrictionPeriods' => sub { }; subtest 'AddReturn + suspension_chargeperiod' => sub { - plan tests => 27; + plan tests => 29; my $library = $builder->build( { source => 'Branch' } ); my $patron = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } ); @@ -2847,6 +2847,47 @@ subtest 'AddReturn + suspension_chargeperiod' => sub { } ); + Koha::CirculationRules->search->delete; + Koha::CirculationRules->set_rules( + { + categorycode => undef, + itemtype => undef, + branchcode => undef, + rules => { + finedays => 0, + } + } + ); + + Koha::Patron::Debarments::AddDebarment( + { + borrowernumber => $patron->{borrowernumber}, + expiration => '9999-12-31', + type => 'MANUAL', + } + ); + + AddIssue( $patron, $item_1->barcode, $now->clone->subtract( days => 1 ) ); + my ( undef, $message ) = AddReturn( $item_1->barcode, $library->{branchcode}, undef, $now ); + is( $message->{WasReturned} && exists $message->{ForeverDebarred}, 1, 'Forever debarred message for Addreturn when overdue'); + + Koha::Patron::Debarments::DelUniqueDebarment( + { + borrowernumber => $patron->{borrowernumber}, + type => 'MANUAL', + } + ); + Koha::Patron::Debarments::AddDebarment( + { + borrowernumber => $patron->{borrowernumber}, + expiration => $now->clone->add( days => 10 ), + type => 'MANUAL', + } + ); + + AddIssue( $patron, $item_1->barcode, $now->clone->subtract( days => 1 ) ); + (undef, $message) = AddReturn( $item_1->barcode, $library->{branchcode}, undef, $now ); + is( $message->{WasReturned} && exists $message->{PrevDebarred}, 1, 'Previously debarred message for Addreturn when overdue'); }; subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { --