Bug 31095: (Rebase follow-up) Correct fine rules and AddIssue calls

This patch corrects the errant call to AddIssue that passes a patron
object instread of a patron hash to AddIssue in the tests and also adds
lengthunit to squash a pair of warnings.

However, it doesn't resolve the failing test.. still somthing going on
there.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Bug 31095: Fix Circulation.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-01-30 17:27:53 +00:00 committed by Tomas Cohen Arazi
parent ebb3eac6a1
commit 50f997a4b4
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -2856,39 +2856,40 @@ subtest 'AddReturn + suspension_chargeperiod' => sub {
categorycode => undef,
itemtype => undef,
branchcode => undef,
rules => {
finedays => 0,
}
rules => {
finedays => 0,
lengthunit => 'days',
}
}
);
Koha::Patron::Debarments::AddDebarment(
{
borrowernumber => $patron->{borrowernumber},
borrowernumber => $patron->borrowernumber,
expiration => '9999-12-31',
type => 'MANUAL',
}
);
AddIssue( $patron, $item_1->barcode, $now->clone->subtract( days => 1 ) );
AddIssue( $patron->unblessed, $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},
borrowernumber => $patron->borrowernumber,
type => 'MANUAL',
}
);
Koha::Patron::Debarments::AddDebarment(
{
borrowernumber => $patron->{borrowernumber},
borrowernumber => $patron->borrowernumber,
expiration => $now->clone->add( days => 10 ),
type => 'MANUAL',
}
);
AddIssue( $patron, $item_1->barcode, $now->clone->subtract( days => 1 ) );
AddIssue( $patron->unblessed, $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');
};