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