|
Lines 18-24
Link Here
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::NoWarnings; |
20 |
use Test::NoWarnings; |
| 21 |
use Test::More tests => 69; |
21 |
use Test::More tests => 71; |
| 22 |
use DateTime::Duration; |
22 |
use DateTime::Duration; |
| 23 |
|
23 |
|
| 24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
|
Lines 454-459
ok(
Link Here
|
| 454 |
q{AddRenewal with a defined but empty due date does not set the due date to today} |
454 |
q{AddRenewal with a defined but empty due date does not set the due date to today} |
| 455 |
); |
455 |
); |
| 456 |
|
456 |
|
|
|
457 |
# Bug 37966: Test AddIssue with empty string parameters |
| 458 |
# Update the default circulation rule to have a non-zero issuelength |
| 459 |
Koha::CirculationRules->set_rules( |
| 460 |
{ |
| 461 |
itemtype => '*', |
| 462 |
categorycode => '*', |
| 463 |
branchcode => '*', |
| 464 |
rules => { |
| 465 |
lengthunit => 'days', |
| 466 |
issuelength => 7, |
| 467 |
} |
| 468 |
} |
| 469 |
); |
| 470 |
$dbh->do("DELETE FROM old_issues"); |
| 471 |
AddReturn($barcode_1); |
| 472 |
my $issue_empty_datedue = C4::Circulation::AddIssue( $patron_1, $barcode_1, "", 0, undef ); |
| 473 |
my $expected_datedue = dt_from_string()->add( days => 7 ); |
| 474 |
my $expected_datedue_date = output_pref( |
| 475 |
{ |
| 476 |
dt => $expected_datedue, |
| 477 |
dateformat => 'iso', |
| 478 |
timeformat => '24hr', |
| 479 |
dateonly => 1 |
| 480 |
} |
| 481 |
); |
| 482 |
my $issue_empty_datedue_date = output_pref( |
| 483 |
{ |
| 484 |
dt => dt_from_string( $issue_empty_datedue->date_due ), |
| 485 |
dateformat => 'iso', |
| 486 |
timeformat => '24hr', |
| 487 |
dateonly => 1 |
| 488 |
} |
| 489 |
); |
| 490 |
is( |
| 491 |
$issue_empty_datedue_date, $expected_datedue_date, |
| 492 |
q{AddIssue with empty string datedue calculates due date based on circulation rules} |
| 493 |
); |
| 494 |
|
| 495 |
AddReturn($barcode_1); |
| 496 |
my $issue_empty_issuedate = C4::Circulation::AddIssue( $patron_1, $barcode_1, undef, 0, "" ); |
| 497 |
my $issue_check = Koha::Checkouts->find( { itemnumber => $item_id1 } ); |
| 498 |
my $issue_issuedate = output_pref( |
| 499 |
{ |
| 500 |
dt => dt_from_string( $issue_check->issuedate ), |
| 501 |
dateformat => 'iso', |
| 502 |
timeformat => '24hr', |
| 503 |
dateonly => 1 |
| 504 |
} |
| 505 |
); |
| 506 |
ok( |
| 507 |
$issue_issuedate eq $today, |
| 508 |
q{AddIssue with empty string issuedate defaults to today} |
| 509 |
); |
| 510 |
|
| 511 |
# Restore default circulation rule |
| 512 |
Koha::CirculationRules->set_rules( |
| 513 |
{ |
| 514 |
itemtype => '*', |
| 515 |
categorycode => '*', |
| 516 |
branchcode => '*', |
| 517 |
rules => { |
| 518 |
lengthunit => 'days', |
| 519 |
issuelength => 0, |
| 520 |
} |
| 521 |
} |
| 522 |
); |
| 523 |
|
| 457 |
$dbh->do("DELETE FROM old_issues"); |
524 |
$dbh->do("DELETE FROM old_issues"); |
| 458 |
AddReturn($barcode_1); |
525 |
AddReturn($barcode_1); |
| 459 |
my $return = |
526 |
my $return = |
| 460 |
- |
|
|