|
Lines 470-521
subtest "CanBookBeRenewed tests" => sub {
Link Here
|
| 470 |
); |
470 |
); |
| 471 |
|
471 |
|
| 472 |
# Create borrowers |
472 |
# Create borrowers |
| 473 |
my %renewing_borrower_data = ( |
|
|
| 474 |
firstname => 'John', |
| 475 |
surname => 'Renewal', |
| 476 |
categorycode => $patron_category->{categorycode}, |
| 477 |
branchcode => $branch, |
| 478 |
autorenew_checkouts => 1, |
| 479 |
); |
| 480 |
|
| 481 |
my %reserving_borrower_data = ( |
| 482 |
firstname => 'Katrin', |
| 483 |
surname => 'Reservation', |
| 484 |
categorycode => $patron_category->{categorycode}, |
| 485 |
branchcode => $branch, |
| 486 |
); |
| 487 |
|
473 |
|
| 488 |
my %hold_waiting_borrower_data = ( |
474 |
my $renewing_borrower_obj = $builder->build_object( |
| 489 |
firstname => 'Kyle', |
475 |
{ |
| 490 |
surname => 'Reservation', |
476 |
class => 'Koha::Patrons', |
| 491 |
categorycode => $patron_category->{categorycode}, |
477 |
value => { |
| 492 |
branchcode => $branch, |
478 |
firstname => 'John', |
| 493 |
); |
479 |
surname => 'Renewal', |
|
|
480 |
categorycode => $patron_category->{categorycode}, |
| 481 |
branchcode => $branch, |
| 482 |
autorenew_checkouts => 1, |
| 483 |
} |
| 484 |
} |
| 485 |
)->store; |
| 486 |
my $renewing_borrowernumber = $renewing_borrower_obj->borrowernumber; |
| 494 |
|
487 |
|
| 495 |
my %restricted_borrower_data = ( |
488 |
my $reserving_borrowernumber = $builder->build_object( |
| 496 |
firstname => 'Alice', |
489 |
{ |
| 497 |
surname => 'Reservation', |
490 |
class => 'Koha::Patrons', |
| 498 |
categorycode => $patron_category->{categorycode}, |
491 |
value => { |
| 499 |
debarred => '3228-01-01', |
492 |
firstname => 'Katrin', |
| 500 |
branchcode => $branch, |
493 |
surname => 'Reservation', |
| 501 |
); |
494 |
categorycode => $patron_category->{categorycode}, |
|
|
495 |
branchcode => $branch, |
| 496 |
} |
| 497 |
} |
| 498 |
)->store->borrowernumber; |
| 502 |
|
499 |
|
| 503 |
my %expired_borrower_data = ( |
500 |
my $hold_waiting_borrowernumber = $builder->build_object( |
| 504 |
firstname => 'Ça', |
501 |
{ |
| 505 |
surname => 'Glisse', |
502 |
class => 'Koha::Patrons', |
| 506 |
categorycode => $patron_category->{categorycode}, |
503 |
value => { |
| 507 |
branchcode => $branch, |
504 |
firstname => 'Kyle', |
| 508 |
dateexpiry => dt_from_string->subtract( months => 1 ), |
505 |
surname => 'Reservation', |
| 509 |
autorenew_checkouts => 1, |
506 |
categorycode => $patron_category->{categorycode}, |
| 510 |
); |
507 |
branchcode => $branch, |
|
|
508 |
} |
| 509 |
} |
| 510 |
)->store->borrowernumber; |
| 511 |
|
511 |
|
| 512 |
my $renewing_borrower_obj = Koha::Patron->new(\%renewing_borrower_data)->store; |
512 |
my $restricted_borrower_obj = $builder->build_object( |
| 513 |
my $renewing_borrowernumber = $renewing_borrower_obj->borrowernumber; |
513 |
{ |
| 514 |
my $reserving_borrowernumber = Koha::Patron->new(\%reserving_borrower_data)->store->borrowernumber; |
514 |
class => 'Koha::Patrons', |
| 515 |
my $hold_waiting_borrowernumber = Koha::Patron->new(\%hold_waiting_borrower_data)->store->borrowernumber; |
515 |
value => { |
| 516 |
my $restricted_borrower_obj = Koha::Patron->new(\%restricted_borrower_data)->store; |
516 |
firstname => 'Alice', |
|
|
517 |
surname => 'Reservation', |
| 518 |
categorycode => $patron_category->{categorycode}, |
| 519 |
debarred => '3228-01-01', |
| 520 |
branchcode => $branch, |
| 521 |
} |
| 522 |
} |
| 523 |
)->store; |
| 517 |
|
524 |
|
| 518 |
my $expired_borrower_obj = Koha::Patron->new(\%expired_borrower_data)->store; |
525 |
my $expired_borrower_obj = $builder->build_object( |
|
|
526 |
{ |
| 527 |
class => 'Koha::Patrons', |
| 528 |
value => { |
| 529 |
firstname => 'Ça', |
| 530 |
surname => 'Glisse', |
| 531 |
categorycode => $patron_category->{categorycode}, |
| 532 |
branchcode => $branch, |
| 533 |
dateexpiry => dt_from_string->subtract( months => 1 ), |
| 534 |
autorenew_checkouts => 1, |
| 535 |
} |
| 536 |
} |
| 537 |
); |
| 519 |
|
538 |
|
| 520 |
my $bibitems = ''; |
539 |
my $bibitems = ''; |
| 521 |
my $priority = '1'; |
540 |
my $priority = '1'; |
|
Lines 1931-1949
subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
Link Here
|
| 1931 |
} |
1950 |
} |
| 1932 |
); |
1951 |
); |
| 1933 |
|
1952 |
|
|
|
1953 |
my $borrower1 = $builder->build_object( |
| 1954 |
{ |
| 1955 |
class => 'Koha::Patrons', |
| 1956 |
value => { |
| 1957 |
firstname => 'Kyle', |
| 1958 |
surname => 'Hall', |
| 1959 |
categorycode => $patron_category->{categorycode}, |
| 1960 |
branchcode => $library2->{branchcode}, |
| 1961 |
} |
| 1962 |
} |
| 1963 |
); |
| 1964 |
|
| 1965 |
my $borrowernumber2 = $builder->build_object( |
| 1966 |
{ |
| 1967 |
class => 'Koha::Patrons', |
| 1968 |
value => { |
| 1969 |
firstname => 'Chelsea', |
| 1970 |
surname => 'Hall', |
| 1971 |
categorycode => $patron_category->{categorycode}, |
| 1972 |
branchcode => $library2->{branchcode}, |
| 1973 |
|
| 1974 |
} |
| 1975 |
} |
| 1976 |
)->borrowernumber; |
| 1934 |
|
1977 |
|
| 1935 |
my $borrower1 = Koha::Patron->new({ |
|
|
| 1936 |
firstname => 'Kyle', |
| 1937 |
surname => 'Hall', |
| 1938 |
categorycode => $patron_category->{categorycode}, |
| 1939 |
branchcode => $library2->{branchcode}, |
| 1940 |
})->store; |
| 1941 |
my $borrowernumber2 = Koha::Patron->new({ |
| 1942 |
firstname => 'Chelsea', |
| 1943 |
surname => 'Hall', |
| 1944 |
categorycode => $patron_category->{categorycode}, |
| 1945 |
branchcode => $library2->{branchcode}, |
| 1946 |
})->store->borrowernumber; |
| 1947 |
my $patron_category_2 = $builder->build( |
1978 |
my $patron_category_2 = $builder->build( |
| 1948 |
{ |
1979 |
{ |
| 1949 |
source => 'Category', |
1980 |
source => 'Category', |
|
Lines 1954-1965
subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
Link Here
|
| 1954 |
} |
1985 |
} |
| 1955 |
} |
1986 |
} |
| 1956 |
); |
1987 |
); |
| 1957 |
my $borrowernumber3 = Koha::Patron->new({ |
1988 |
|
| 1958 |
firstname => 'Carnegie', |
1989 |
my $borrowernumber3 = $builder->build_object( |
| 1959 |
surname => 'Hall', |
1990 |
{ |
| 1960 |
categorycode => $patron_category_2->{categorycode}, |
1991 |
class => 'Koha::Patrons', |
| 1961 |
branchcode => $library2->{branchcode}, |
1992 |
value => { |
| 1962 |
})->store->borrowernumber; |
1993 |
firstname => 'Carnegie', |
|
|
1994 |
surname => 'Hall', |
| 1995 |
categorycode => $patron_category_2->{categorycode}, |
| 1996 |
branchcode => $library2->{branchcode}, |
| 1997 |
} |
| 1998 |
} |
| 1999 |
)->borrowernumber; |
| 1963 |
|
2000 |
|
| 1964 |
my $issue = AddIssue( $borrower1, $item_1->barcode ); |
2001 |
my $issue = AddIssue( $borrower1, $item_1->barcode ); |
| 1965 |
|
2002 |
|
|
Lines 2121-2132
subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
Link Here
|
| 2121 |
} |
2158 |
} |
| 2122 |
); |
2159 |
); |
| 2123 |
|
2160 |
|
| 2124 |
my $borrower = Koha::Patron->new({ |
2161 |
my $borrower = $builder->build_object( |
| 2125 |
firstname => 'fn', |
2162 |
{ |
| 2126 |
surname => 'dn', |
2163 |
class => 'Koha::Patrons', |
| 2127 |
categorycode => $patron_category->{categorycode}, |
2164 |
value => { |
| 2128 |
branchcode => $branch, |
2165 |
firstname => 'fn', |
| 2129 |
})->store; |
2166 |
surname => 'dn', |
|
|
2167 |
categorycode => $patron_category->{categorycode}, |
| 2168 |
branchcode => $branch, |
| 2169 |
} |
| 2170 |
} |
| 2171 |
); |
| 2130 |
|
2172 |
|
| 2131 |
my $issue = AddIssue( $borrower, $item->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); |
2173 |
my $issue = AddIssue( $borrower, $item->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); |
| 2132 |
my ( $renewed, $error ) = CanBookBeRenewed( $borrower, $issue ); |
2174 |
my ( $renewed, $error ) = CanBookBeRenewed( $borrower, $issue ); |
|
Lines 2623-2647
subtest 'MultipleReserves' => sub {
Link Here
|
| 2623 |
my $checkitem = undef; |
2665 |
my $checkitem = undef; |
| 2624 |
my $found = undef; |
2666 |
my $found = undef; |
| 2625 |
|
2667 |
|
| 2626 |
my %renewing_borrower_data = ( |
2668 |
# Renewing borrower |
| 2627 |
firstname => 'John', |
2669 |
my $patron = $builder->build_object( |
| 2628 |
surname => 'Renewal', |
2670 |
{ |
| 2629 |
categorycode => $patron_category->{categorycode}, |
2671 |
class => 'Koha::Patrons', |
| 2630 |
branchcode => $branch, |
2672 |
value => { |
|
|
2673 |
firstname => 'John', |
| 2674 |
surname => 'Renewal', |
| 2675 |
categorycode => $patron_category->{categorycode}, |
| 2676 |
branchcode => $branch, |
| 2677 |
} |
| 2678 |
} |
| 2631 |
); |
2679 |
); |
| 2632 |
my $patron = Koha::Patron->new(\%renewing_borrower_data)->store; |
2680 |
|
| 2633 |
my $issue = AddIssue( $patron, $item_1->barcode); |
2681 |
my $issue = AddIssue( $patron, $item_1->barcode); |
| 2634 |
my $datedue = dt_from_string( $issue->date_due() ); |
2682 |
my $datedue = dt_from_string( $issue->date_due() ); |
| 2635 |
is (defined $issue->date_due(), 1, "item 1 checked out"); |
2683 |
is (defined $issue->date_due(), 1, "item 1 checked out"); |
| 2636 |
my $borrowing_borrowernumber = Koha::Checkouts->find({ itemnumber => $item_1->itemnumber })->borrowernumber; |
2684 |
my $borrowing_borrowernumber = Koha::Checkouts->find({ itemnumber => $item_1->itemnumber })->borrowernumber; |
| 2637 |
|
2685 |
|
| 2638 |
my %reserving_borrower_data1 = ( |
2686 |
my $reserving_borrowernumber1 = $builder->build_object( |
| 2639 |
firstname => 'Katrin', |
2687 |
{ |
| 2640 |
surname => 'Reservation', |
2688 |
class => 'Koha::Patrons', |
| 2641 |
categorycode => $patron_category->{categorycode}, |
2689 |
value => { |
| 2642 |
branchcode => $branch, |
2690 |
firstname => 'Katrin', |
| 2643 |
); |
2691 |
surname => 'Reservation', |
| 2644 |
my $reserving_borrowernumber1 = Koha::Patron->new(\%reserving_borrower_data1)->store->borrowernumber; |
2692 |
categorycode => $patron_category->{categorycode}, |
|
|
2693 |
branchcode => $branch, |
| 2694 |
} |
| 2695 |
} |
| 2696 |
)->borrowernumber; |
| 2697 |
|
| 2645 |
AddReserve( |
2698 |
AddReserve( |
| 2646 |
{ |
2699 |
{ |
| 2647 |
branchcode => $branch, |
2700 |
branchcode => $branch, |
|
Lines 2656-2668
subtest 'MultipleReserves' => sub {
Link Here
|
| 2656 |
} |
2709 |
} |
| 2657 |
); |
2710 |
); |
| 2658 |
|
2711 |
|
| 2659 |
my %reserving_borrower_data2 = ( |
2712 |
my $reserving_borrowernumber2 = $builder->build_object( |
| 2660 |
firstname => 'Kirk', |
2713 |
{ |
| 2661 |
surname => 'Reservation', |
2714 |
class => 'Koha::Patrons', |
| 2662 |
categorycode => $patron_category->{categorycode}, |
2715 |
value => { |
| 2663 |
branchcode => $branch, |
2716 |
firstname => 'Kirk', |
| 2664 |
); |
2717 |
surname => 'Reservation', |
| 2665 |
my $reserving_borrowernumber2 = Koha::Patron->new(\%reserving_borrower_data2)->store->borrowernumber; |
2718 |
categorycode => $patron_category->{categorycode}, |
|
|
2719 |
branchcode => $branch, |
| 2720 |
} |
| 2721 |
} |
| 2722 |
)->borrowernumber; |
| 2723 |
|
| 2666 |
AddReserve( |
2724 |
AddReserve( |
| 2667 |
{ |
2725 |
{ |
| 2668 |
branchcode => $branch, |
2726 |
branchcode => $branch, |
|
Lines 4504-4510
subtest 'CanBookBeIssued | item-level_itypes=biblio' => sub {
Link Here
|
| 4504 |
|
4562 |
|
| 4505 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); # biblio |
4563 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); # biblio |
| 4506 |
my $library = $builder->build( { source => 'Branch' } ); |
4564 |
my $library = $builder->build( { source => 'Branch' } ); |
| 4507 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } )->store; |
4565 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } ); |
| 4508 |
|
4566 |
|
| 4509 |
my $item = $builder->build_sample_item( |
4567 |
my $item = $builder->build_sample_item( |
| 4510 |
{ |
4568 |
{ |
|
Lines 4523-4529
subtest 'CanBookBeIssued | notforloan' => sub {
Link Here
|
| 4523 |
t::lib::Mocks::mock_preference('AllowNotForLoanOverride', 0); |
4581 |
t::lib::Mocks::mock_preference('AllowNotForLoanOverride', 0); |
| 4524 |
|
4582 |
|
| 4525 |
my $library = $builder->build( { source => 'Branch' } ); |
4583 |
my $library = $builder->build( { source => 'Branch' } ); |
| 4526 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } )->store; |
4584 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } ); |
| 4527 |
|
4585 |
|
| 4528 |
my $itemtype = $builder->build( |
4586 |
my $itemtype = $builder->build( |
| 4529 |
{ |
4587 |
{ |
|
Lines 5061-5067
subtest 'Incremented fee tests' => sub {
Link Here
|
| 5061 |
class => 'Koha::Patrons', |
5119 |
class => 'Koha::Patrons', |
| 5062 |
value => { categorycode => $patron_category->{categorycode} } |
5120 |
value => { categorycode => $patron_category->{categorycode} } |
| 5063 |
} |
5121 |
} |
| 5064 |
)->store; |
5122 |
); |
| 5065 |
|
5123 |
|
| 5066 |
my $itemtype = $builder->build_object( |
5124 |
my $itemtype = $builder->build_object( |
| 5067 |
{ |
5125 |
{ |
|
Lines 5326-5332
subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub {
Link Here
|
| 5326 |
class => 'Koha::Patrons', |
5384 |
class => 'Koha::Patrons', |
| 5327 |
value => { categorycode => $patron_category->{categorycode} } |
5385 |
value => { categorycode => $patron_category->{categorycode} } |
| 5328 |
} |
5386 |
} |
| 5329 |
)->store; |
5387 |
); |
| 5330 |
|
5388 |
|
| 5331 |
my $itemtype = $builder->build_object( |
5389 |
my $itemtype = $builder->build_object( |
| 5332 |
{ |
5390 |
{ |
|
Lines 5373-5379
subtest 'CanBookBeIssued & CircConfirmItemParts' => sub {
Link Here
|
| 5373 |
class => 'Koha::Patrons', |
5431 |
class => 'Koha::Patrons', |
| 5374 |
value => { categorycode => $patron_category->{categorycode} } |
5432 |
value => { categorycode => $patron_category->{categorycode} } |
| 5375 |
} |
5433 |
} |
| 5376 |
)->store; |
5434 |
); |
| 5377 |
|
5435 |
|
| 5378 |
my $item = $builder->build_sample_item( |
5436 |
my $item = $builder->build_sample_item( |
| 5379 |
{ |
5437 |
{ |
|
Lines 5444-5450
subtest 'Filling a hold should cancel existing transfer' => sub {
Link Here
|
| 5444 |
branchcode => $libraryA->branchcode, |
5502 |
branchcode => $libraryA->branchcode, |
| 5445 |
} |
5503 |
} |
| 5446 |
} |
5504 |
} |
| 5447 |
)->store; |
5505 |
); |
| 5448 |
|
5506 |
|
| 5449 |
my $item = $builder->build_sample_item({ |
5507 |
my $item = $builder->build_sample_item({ |
| 5450 |
homebranch => $libraryB->branchcode, |
5508 |
homebranch => $libraryB->branchcode, |
| 5451 |
- |
|
|