Lines 34-40
use t::lib::Mocks;
Link Here
|
34 |
use t::lib::TestBuilder; |
34 |
use t::lib::TestBuilder; |
35 |
|
35 |
|
36 |
use C4::Accounts; |
36 |
use C4::Accounts; |
37 |
use C4::Calendar qw( new insert_single_holiday insert_week_day_holiday delete_holiday ); |
37 |
use C4::Calendar; |
38 |
use C4::Circulation |
38 |
use C4::Circulation |
39 |
qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook ); |
39 |
qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook ); |
40 |
use C4::Biblio; |
40 |
use C4::Biblio; |
Lines 1183-1189
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
1183 |
); |
1183 |
); |
1184 |
|
1184 |
|
1185 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1185 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1186 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1186 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1187 |
my $issue = AddIssue( |
1187 |
my $issue = AddIssue( |
1188 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1188 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1189 |
undef, { auto_renew => 1 } |
1189 |
undef, { auto_renew => 1 } |
Lines 1333-1339
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
1333 |
); |
1333 |
); |
1334 |
|
1334 |
|
1335 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1335 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1336 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1336 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1337 |
my $issue = AddIssue( |
1337 |
my $issue = AddIssue( |
1338 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1338 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1339 |
undef, { auto_renew => 1 } |
1339 |
undef, { auto_renew => 1 } |
Lines 1443-1449
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
1443 |
); |
1443 |
); |
1444 |
|
1444 |
|
1445 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1445 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1446 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1446 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1447 |
|
1447 |
|
1448 |
# Patron is expired and BlockExpiredPatronOpacActions='' |
1448 |
# Patron is expired and BlockExpiredPatronOpacActions='' |
1449 |
# => auto renew is allowed |
1449 |
# => auto renew is allowed |
Lines 1495-1501
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
1495 |
); |
1495 |
); |
1496 |
|
1496 |
|
1497 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1497 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1498 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1498 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1499 |
my $issue = AddIssue( |
1499 |
my $issue = AddIssue( |
1500 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1500 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1501 |
undef, { auto_renew => 1 } |
1501 |
undef, { auto_renew => 1 } |
Lines 1616-1622
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
1616 |
); |
1616 |
); |
1617 |
|
1617 |
|
1618 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1618 |
my $ten_days_before = dt_from_string->add( days => -10 ); |
1619 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1619 |
my $ten_days_ahead = dt_from_string->add( days => 10 ); |
1620 |
my $issue = AddIssue( |
1620 |
my $issue = AddIssue( |
1621 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1621 |
$renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, |
1622 |
undef, { auto_renew => 1 } |
1622 |
undef, { auto_renew => 1 } |
Lines 1967-1973
subtest "GetUpcomingDueIssues" => sub {
Link Here
|
1967 |
my $a_borrower = Koha::Patrons->find($a_borrower_borrowernumber); |
1967 |
my $a_borrower = Koha::Patrons->find($a_borrower_borrowernumber); |
1968 |
|
1968 |
|
1969 |
my $yesterday = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 ); |
1969 |
my $yesterday = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 ); |
1970 |
my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); |
1970 |
my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); |
1971 |
my $today = DateTime->today( time_zone => C4::Context->tz() ); |
1971 |
my $today = DateTime->today( time_zone => C4::Context->tz() ); |
1972 |
|
1972 |
|
1973 |
my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday ); |
1973 |
my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday ); |
Lines 3879-3885
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
3879 |
is( $line->status, 'RETURNED', "Overdue fine is fixed" ); |
3879 |
is( $line->status, 'RETURNED', "Overdue fine is fixed" ); |
3880 |
$line = $lines->next; |
3880 |
$line = $lines->next; |
3881 |
is( $line->amount + 0, -2, "Original payment amount remains as 2" ); |
3881 |
is( $line->amount + 0, -2, "Original payment amount remains as 2" ); |
3882 |
is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); |
3882 |
is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); |
3883 |
$line = $lines->next; |
3883 |
$line = $lines->next; |
3884 |
is( $line->amount + 0, -1, "Refund amount correctly set to 1" ); |
3884 |
is( $line->amount + 0, -1, "Refund amount correctly set to 1" ); |
3885 |
is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" ); |
3885 |
is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" ); |
Lines 4833-4839
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
4833 |
my $credit = $offset->credit; |
4833 |
my $credit = $offset->credit; |
4834 |
is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); |
4834 |
is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); |
4835 |
is( $credit->amount + 0, -99, "Credit amount is set correctly" ); |
4835 |
is( $credit->amount + 0, -99, "Credit amount is set correctly" ); |
4836 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
4836 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
4837 |
|
4837 |
|
4838 |
# Bug 25417 - Only forgive fines where there is an amount outstanding to forgive |
4838 |
# Bug 25417 - Only forgive fines where there is an amount outstanding to forgive |
4839 |
$accountline->set( |
4839 |
$accountline->set( |
Lines 7584-7590
subtest 'NoRefundOnLostFinesPaidAge' => sub {
Link Here
|
7584 |
{ |
7584 |
{ |
7585 |
borrowernumber => $patron->id, |
7585 |
borrowernumber => $patron->id, |
7586 |
date => '1970-01-01 14:00:01', |
7586 |
date => '1970-01-01 14:00:01', |
7587 |
amountoutstanding => 0, |
7587 |
amountoutstanding => 0, |
7588 |
amount => -5, |
7588 |
amount => -5, |
7589 |
interface => 'commandline', |
7589 |
interface => 'commandline', |
7590 |
credit_type_code => 'PAYMENT' |
7590 |
credit_type_code => 'PAYMENT' |
Lines 7640-7646
subtest 'NoRefundOnLostFinesPaidAge' => sub {
Link Here
|
7640 |
borrowernumber => $patron2->id, |
7640 |
borrowernumber => $patron2->id, |
7641 |
date => '1970-01-01 14:00:01', |
7641 |
date => '1970-01-01 14:00:01', |
7642 |
amount => -5, |
7642 |
amount => -5, |
7643 |
amountoutstanding => 0, |
7643 |
amountoutstanding => 0, |
7644 |
interface => 'commandline', |
7644 |
interface => 'commandline', |
7645 |
credit_type_code => 'PAYMENT' |
7645 |
credit_type_code => 'PAYMENT' |
7646 |
} |
7646 |
} |