|
Lines 469-520
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 469 |
); |
469 |
); |
| 470 |
|
470 |
|
| 471 |
# Create borrowers |
471 |
# Create borrowers |
| 472 |
my %renewing_borrower_data = ( |
|
|
| 473 |
firstname => 'John', |
| 474 |
surname => 'Renewal', |
| 475 |
categorycode => $patron_category->{categorycode}, |
| 476 |
branchcode => $branch, |
| 477 |
autorenew_checkouts => 1, |
| 478 |
); |
| 479 |
|
| 480 |
my %reserving_borrower_data = ( |
| 481 |
firstname => 'Katrin', |
| 482 |
surname => 'Reservation', |
| 483 |
categorycode => $patron_category->{categorycode}, |
| 484 |
branchcode => $branch, |
| 485 |
); |
| 486 |
|
472 |
|
| 487 |
my %hold_waiting_borrower_data = ( |
473 |
my $renewing_borrower_obj = $builder->build_object( |
| 488 |
firstname => 'Kyle', |
474 |
{ |
| 489 |
surname => 'Reservation', |
475 |
class => 'Koha::Patrons', |
| 490 |
categorycode => $patron_category->{categorycode}, |
476 |
value => { |
| 491 |
branchcode => $branch, |
477 |
firstname => 'John', |
| 492 |
); |
478 |
surname => 'Renewal', |
|
|
479 |
categorycode => $patron_category->{categorycode}, |
| 480 |
branchcode => $branch, |
| 481 |
autorenew_checkouts => 1, |
| 482 |
} |
| 483 |
} |
| 484 |
)->store; |
| 485 |
my $renewing_borrowernumber = $renewing_borrower_obj->borrowernumber; |
| 493 |
|
486 |
|
| 494 |
my %restricted_borrower_data = ( |
487 |
my $reserving_borrowernumber = $builder->build_object( |
| 495 |
firstname => 'Alice', |
488 |
{ |
| 496 |
surname => 'Reservation', |
489 |
class => 'Koha::Patrons', |
| 497 |
categorycode => $patron_category->{categorycode}, |
490 |
value => { |
| 498 |
debarred => '3228-01-01', |
491 |
firstname => 'Katrin', |
| 499 |
branchcode => $branch, |
492 |
surname => 'Reservation', |
| 500 |
); |
493 |
categorycode => $patron_category->{categorycode}, |
|
|
494 |
branchcode => $branch, |
| 495 |
} |
| 496 |
} |
| 497 |
)->store->borrowernumber; |
| 501 |
|
498 |
|
| 502 |
my %expired_borrower_data = ( |
499 |
my $hold_waiting_borrowernumber = $builder->build_object( |
| 503 |
firstname => 'Ça', |
500 |
{ |
| 504 |
surname => 'Glisse', |
501 |
class => 'Koha::Patrons', |
| 505 |
categorycode => $patron_category->{categorycode}, |
502 |
value => { |
| 506 |
branchcode => $branch, |
503 |
firstname => 'Kyle', |
| 507 |
dateexpiry => dt_from_string->subtract( months => 1 ), |
504 |
surname => 'Reservation', |
| 508 |
autorenew_checkouts => 1, |
505 |
categorycode => $patron_category->{categorycode}, |
| 509 |
); |
506 |
branchcode => $branch, |
|
|
507 |
} |
| 508 |
} |
| 509 |
)->store->borrowernumber; |
| 510 |
|
510 |
|
| 511 |
my $renewing_borrower_obj = Koha::Patron->new(\%renewing_borrower_data)->store; |
511 |
my $restricted_borrower_obj = $builder->build_object( |
| 512 |
my $renewing_borrowernumber = $renewing_borrower_obj->borrowernumber; |
512 |
{ |
| 513 |
my $reserving_borrowernumber = Koha::Patron->new(\%reserving_borrower_data)->store->borrowernumber; |
513 |
class => 'Koha::Patrons', |
| 514 |
my $hold_waiting_borrowernumber = Koha::Patron->new(\%hold_waiting_borrower_data)->store->borrowernumber; |
514 |
value => { |
| 515 |
my $restricted_borrower_obj = Koha::Patron->new(\%restricted_borrower_data)->store; |
515 |
firstname => 'Alice', |
|
|
516 |
surname => 'Reservation', |
| 517 |
categorycode => $patron_category->{categorycode}, |
| 518 |
debarred => '3228-01-01', |
| 519 |
branchcode => $branch, |
| 520 |
} |
| 521 |
} |
| 522 |
)->store; |
| 516 |
|
523 |
|
| 517 |
my $expired_borrower_obj = Koha::Patron->new(\%expired_borrower_data)->store; |
524 |
my $expired_borrower_obj = $builder->build_object( |
|
|
525 |
{ |
| 526 |
class => 'Koha::Patrons', |
| 527 |
value => { |
| 528 |
firstname => 'Ça', |
| 529 |
surname => 'Glisse', |
| 530 |
categorycode => $patron_category->{categorycode}, |
| 531 |
branchcode => $branch, |
| 532 |
dateexpiry => dt_from_string->subtract( months => 1 ), |
| 533 |
autorenew_checkouts => 1, |
| 534 |
} |
| 535 |
} |
| 536 |
); |
| 518 |
|
537 |
|
| 519 |
my $bibitems = ''; |
538 |
my $bibitems = ''; |
| 520 |
my $priority = '1'; |
539 |
my $priority = '1'; |
|
Lines 1851-1869
subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
Link Here
|
| 1851 |
} |
1870 |
} |
| 1852 |
); |
1871 |
); |
| 1853 |
|
1872 |
|
|
|
1873 |
my $borrower1 = $builder->build_object( |
| 1874 |
{ |
| 1875 |
class => 'Koha::Patrons', |
| 1876 |
value => { |
| 1877 |
firstname => 'Kyle', |
| 1878 |
surname => 'Hall', |
| 1879 |
categorycode => $patron_category->{categorycode}, |
| 1880 |
branchcode => $library2->{branchcode}, |
| 1881 |
} |
| 1882 |
} |
| 1883 |
); |
| 1884 |
|
| 1885 |
my $borrowernumber2 = $builder->build_object( |
| 1886 |
{ |
| 1887 |
class => 'Koha::Patrons', |
| 1888 |
value => { |
| 1889 |
firstname => 'Chelsea', |
| 1890 |
surname => 'Hall', |
| 1891 |
categorycode => $patron_category->{categorycode}, |
| 1892 |
branchcode => $library2->{branchcode}, |
| 1893 |
|
| 1894 |
} |
| 1895 |
} |
| 1896 |
)->borrowernumber; |
| 1854 |
|
1897 |
|
| 1855 |
my $borrower1 = Koha::Patron->new({ |
|
|
| 1856 |
firstname => 'Kyle', |
| 1857 |
surname => 'Hall', |
| 1858 |
categorycode => $patron_category->{categorycode}, |
| 1859 |
branchcode => $library2->{branchcode}, |
| 1860 |
})->store; |
| 1861 |
my $borrowernumber2 = Koha::Patron->new({ |
| 1862 |
firstname => 'Chelsea', |
| 1863 |
surname => 'Hall', |
| 1864 |
categorycode => $patron_category->{categorycode}, |
| 1865 |
branchcode => $library2->{branchcode}, |
| 1866 |
})->store->borrowernumber; |
| 1867 |
my $patron_category_2 = $builder->build( |
1898 |
my $patron_category_2 = $builder->build( |
| 1868 |
{ |
1899 |
{ |
| 1869 |
source => 'Category', |
1900 |
source => 'Category', |
|
Lines 1874-1885
subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
Link Here
|
| 1874 |
} |
1905 |
} |
| 1875 |
} |
1906 |
} |
| 1876 |
); |
1907 |
); |
| 1877 |
my $borrowernumber3 = Koha::Patron->new({ |
1908 |
|
| 1878 |
firstname => 'Carnegie', |
1909 |
my $borrowernumber3 = $builder->build_object( |
| 1879 |
surname => 'Hall', |
1910 |
{ |
| 1880 |
categorycode => $patron_category_2->{categorycode}, |
1911 |
class => 'Koha::Patrons', |
| 1881 |
branchcode => $library2->{branchcode}, |
1912 |
value => { |
| 1882 |
})->store->borrowernumber; |
1913 |
firstname => 'Carnegie', |
|
|
1914 |
surname => 'Hall', |
| 1915 |
categorycode => $patron_category_2->{categorycode}, |
| 1916 |
branchcode => $library2->{branchcode}, |
| 1917 |
} |
| 1918 |
} |
| 1919 |
)->borrowernumber; |
| 1883 |
|
1920 |
|
| 1884 |
my $issue = AddIssue( $borrower1, $item_1->barcode ); |
1921 |
my $issue = AddIssue( $borrower1, $item_1->barcode ); |
| 1885 |
|
1922 |
|
|
Lines 2041-2052
subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
Link Here
|
| 2041 |
} |
2078 |
} |
| 2042 |
); |
2079 |
); |
| 2043 |
|
2080 |
|
| 2044 |
my $borrower = Koha::Patron->new({ |
2081 |
my $borrower = $builder->build_object( |
| 2045 |
firstname => 'fn', |
2082 |
{ |
| 2046 |
surname => 'dn', |
2083 |
class => 'Koha::Patrons', |
| 2047 |
categorycode => $patron_category->{categorycode}, |
2084 |
value => { |
| 2048 |
branchcode => $branch, |
2085 |
firstname => 'fn', |
| 2049 |
})->store; |
2086 |
surname => 'dn', |
|
|
2087 |
categorycode => $patron_category->{categorycode}, |
| 2088 |
branchcode => $branch, |
| 2089 |
} |
| 2090 |
} |
| 2091 |
); |
| 2050 |
|
2092 |
|
| 2051 |
my $issue = AddIssue( $borrower, $item->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); |
2093 |
my $issue = AddIssue( $borrower, $item->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); |
| 2052 |
my ( $renewed, $error ) = CanBookBeRenewed( $borrower, $issue ); |
2094 |
my ( $renewed, $error ) = CanBookBeRenewed( $borrower, $issue ); |
|
Lines 2522-2546
subtest 'MultipleReserves' => sub {
Link Here
|
| 2522 |
my $checkitem = undef; |
2564 |
my $checkitem = undef; |
| 2523 |
my $found = undef; |
2565 |
my $found = undef; |
| 2524 |
|
2566 |
|
| 2525 |
my %renewing_borrower_data = ( |
2567 |
# Renewing borrower |
| 2526 |
firstname => 'John', |
2568 |
my $patron = $builder->build_object( |
| 2527 |
surname => 'Renewal', |
2569 |
{ |
| 2528 |
categorycode => $patron_category->{categorycode}, |
2570 |
class => 'Koha::Patrons', |
| 2529 |
branchcode => $branch, |
2571 |
value => { |
|
|
2572 |
firstname => 'John', |
| 2573 |
surname => 'Renewal', |
| 2574 |
categorycode => $patron_category->{categorycode}, |
| 2575 |
branchcode => $branch, |
| 2576 |
} |
| 2577 |
} |
| 2530 |
); |
2578 |
); |
| 2531 |
my $patron = Koha::Patron->new(\%renewing_borrower_data)->store; |
2579 |
|
| 2532 |
my $issue = AddIssue( $patron, $item_1->barcode); |
2580 |
my $issue = AddIssue( $patron, $item_1->barcode); |
| 2533 |
my $datedue = dt_from_string( $issue->date_due() ); |
2581 |
my $datedue = dt_from_string( $issue->date_due() ); |
| 2534 |
is (defined $issue->date_due(), 1, "item 1 checked out"); |
2582 |
is (defined $issue->date_due(), 1, "item 1 checked out"); |
| 2535 |
my $borrowing_borrowernumber = Koha::Checkouts->find({ itemnumber => $item_1->itemnumber })->borrowernumber; |
2583 |
my $borrowing_borrowernumber = Koha::Checkouts->find({ itemnumber => $item_1->itemnumber })->borrowernumber; |
| 2536 |
|
2584 |
|
| 2537 |
my %reserving_borrower_data1 = ( |
2585 |
my $reserving_borrowernumber1 = $builder->build_object( |
| 2538 |
firstname => 'Katrin', |
2586 |
{ |
| 2539 |
surname => 'Reservation', |
2587 |
class => 'Koha::Patrons', |
| 2540 |
categorycode => $patron_category->{categorycode}, |
2588 |
value => { |
| 2541 |
branchcode => $branch, |
2589 |
firstname => 'Katrin', |
| 2542 |
); |
2590 |
surname => 'Reservation', |
| 2543 |
my $reserving_borrowernumber1 = Koha::Patron->new(\%reserving_borrower_data1)->store->borrowernumber; |
2591 |
categorycode => $patron_category->{categorycode}, |
|
|
2592 |
branchcode => $branch, |
| 2593 |
} |
| 2594 |
} |
| 2595 |
)->borrowernumber; |
| 2596 |
|
| 2544 |
AddReserve( |
2597 |
AddReserve( |
| 2545 |
{ |
2598 |
{ |
| 2546 |
branchcode => $branch, |
2599 |
branchcode => $branch, |
|
Lines 2555-2567
subtest 'MultipleReserves' => sub {
Link Here
|
| 2555 |
} |
2608 |
} |
| 2556 |
); |
2609 |
); |
| 2557 |
|
2610 |
|
| 2558 |
my %reserving_borrower_data2 = ( |
2611 |
my $reserving_borrowernumber2 = $builder->build_object( |
| 2559 |
firstname => 'Kirk', |
2612 |
{ |
| 2560 |
surname => 'Reservation', |
2613 |
class => 'Koha::Patrons', |
| 2561 |
categorycode => $patron_category->{categorycode}, |
2614 |
value => { |
| 2562 |
branchcode => $branch, |
2615 |
firstname => 'Kirk', |
| 2563 |
); |
2616 |
surname => 'Reservation', |
| 2564 |
my $reserving_borrowernumber2 = Koha::Patron->new(\%reserving_borrower_data2)->store->borrowernumber; |
2617 |
categorycode => $patron_category->{categorycode}, |
|
|
2618 |
branchcode => $branch, |
| 2619 |
} |
| 2620 |
} |
| 2621 |
)->borrowernumber; |
| 2622 |
|
| 2565 |
AddReserve( |
2623 |
AddReserve( |
| 2566 |
{ |
2624 |
{ |
| 2567 |
branchcode => $branch, |
2625 |
branchcode => $branch, |
|
Lines 4406-4412
subtest 'CanBookBeIssued | item-level_itypes=biblio' => sub {
Link Here
|
| 4406 |
|
4464 |
|
| 4407 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); # biblio |
4465 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); # biblio |
| 4408 |
my $library = $builder->build( { source => 'Branch' } ); |
4466 |
my $library = $builder->build( { source => 'Branch' } ); |
| 4409 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } )->store; |
4467 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } ); |
| 4410 |
|
4468 |
|
| 4411 |
my $item = $builder->build_sample_item( |
4469 |
my $item = $builder->build_sample_item( |
| 4412 |
{ |
4470 |
{ |
|
Lines 4425-4431
subtest 'CanBookBeIssued | notforloan' => sub {
Link Here
|
| 4425 |
t::lib::Mocks::mock_preference('AllowNotForLoanOverride', 0); |
4483 |
t::lib::Mocks::mock_preference('AllowNotForLoanOverride', 0); |
| 4426 |
|
4484 |
|
| 4427 |
my $library = $builder->build( { source => 'Branch' } ); |
4485 |
my $library = $builder->build( { source => 'Branch' } ); |
| 4428 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } )->store; |
4486 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } ); |
| 4429 |
|
4487 |
|
| 4430 |
my $itemtype = $builder->build( |
4488 |
my $itemtype = $builder->build( |
| 4431 |
{ |
4489 |
{ |
|
Lines 4892-4898
subtest 'Incremented fee tests' => sub {
Link Here
|
| 4892 |
class => 'Koha::Patrons', |
4950 |
class => 'Koha::Patrons', |
| 4893 |
value => { categorycode => $patron_category->{categorycode} } |
4951 |
value => { categorycode => $patron_category->{categorycode} } |
| 4894 |
} |
4952 |
} |
| 4895 |
)->store; |
4953 |
); |
| 4896 |
|
4954 |
|
| 4897 |
my $itemtype = $builder->build_object( |
4955 |
my $itemtype = $builder->build_object( |
| 4898 |
{ |
4956 |
{ |
|
Lines 5157-5163
subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub {
Link Here
|
| 5157 |
class => 'Koha::Patrons', |
5215 |
class => 'Koha::Patrons', |
| 5158 |
value => { categorycode => $patron_category->{categorycode} } |
5216 |
value => { categorycode => $patron_category->{categorycode} } |
| 5159 |
} |
5217 |
} |
| 5160 |
)->store; |
5218 |
); |
| 5161 |
|
5219 |
|
| 5162 |
my $itemtype = $builder->build_object( |
5220 |
my $itemtype = $builder->build_object( |
| 5163 |
{ |
5221 |
{ |
|
Lines 5204-5210
subtest 'CanBookBeIssued & CircConfirmItemParts' => sub {
Link Here
|
| 5204 |
class => 'Koha::Patrons', |
5262 |
class => 'Koha::Patrons', |
| 5205 |
value => { categorycode => $patron_category->{categorycode} } |
5263 |
value => { categorycode => $patron_category->{categorycode} } |
| 5206 |
} |
5264 |
} |
| 5207 |
)->store; |
5265 |
); |
| 5208 |
|
5266 |
|
| 5209 |
my $item = $builder->build_sample_item( |
5267 |
my $item = $builder->build_sample_item( |
| 5210 |
{ |
5268 |
{ |
|
Lines 5275-5281
subtest 'Filling a hold should cancel existing transfer' => sub {
Link Here
|
| 5275 |
branchcode => $libraryA->branchcode, |
5333 |
branchcode => $libraryA->branchcode, |
| 5276 |
} |
5334 |
} |
| 5277 |
} |
5335 |
} |
| 5278 |
)->store; |
5336 |
); |
| 5279 |
|
5337 |
|
| 5280 |
my $item = $builder->build_sample_item({ |
5338 |
my $item = $builder->build_sample_item({ |
| 5281 |
homebranch => $libraryB->branchcode, |
5339 |
homebranch => $libraryB->branchcode, |
| 5282 |
- |
|
|