Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 113; |
20 |
use Test::More tests => 114; |
21 |
|
21 |
|
22 |
use DateTime; |
22 |
use DateTime; |
23 |
|
23 |
|
Lines 86-91
my $borrower = {
Link Here
|
86 |
branchcode => $library2->{branchcode} |
86 |
branchcode => $library2->{branchcode} |
87 |
}; |
87 |
}; |
88 |
|
88 |
|
|
|
89 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
90 |
|
89 |
# No userenv, PickupLibrary |
91 |
# No userenv, PickupLibrary |
90 |
t::lib::Mocks::mock_preference('IndependentBranches', '0'); |
92 |
t::lib::Mocks::mock_preference('IndependentBranches', '0'); |
91 |
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary'); |
93 |
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary'); |
Lines 1750-1755
subtest 'AddReturn + CumulativeRestrictionPeriods' => sub {
Link Here
|
1750 |
is( $debarments->[0]->{expiration}, $expected_expiration ); |
1752 |
is( $debarments->[0]->{expiration}, $expected_expiration ); |
1751 |
}; |
1753 |
}; |
1752 |
|
1754 |
|
|
|
1755 |
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { |
1756 |
plan tests => 2; |
1757 |
|
1758 |
my $library = $builder->build( { source => 'Branch' } ); |
1759 |
my $patron1 = $builder->build_object( |
1760 |
{ |
1761 |
class => 'Koha::Patrons', |
1762 |
value => { |
1763 |
branchcode => $library->{branchcode}, |
1764 |
firstname => "Happy", |
1765 |
surname => "Gilmore", |
1766 |
} |
1767 |
} |
1768 |
); |
1769 |
my $patron2 = $builder->build_object( |
1770 |
{ |
1771 |
class => 'Koha::Patrons', |
1772 |
value => { |
1773 |
branchcode => $library->{branchcode}, |
1774 |
firstname => "Billy", |
1775 |
surname => "Madison", |
1776 |
} |
1777 |
} |
1778 |
); |
1779 |
|
1780 |
C4::Context->_new_userenv('xxx'); |
1781 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', ''); |
1782 |
|
1783 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
1784 |
my $biblionumber = $biblioitem->{biblionumber}; |
1785 |
my $item = $builder->build( |
1786 |
{ source => 'Item', |
1787 |
value => { |
1788 |
homebranch => $library->{branchcode}, |
1789 |
holdingbranch => $library->{branchcode}, |
1790 |
notforloan => 0, |
1791 |
itemlost => 0, |
1792 |
withdrawn => 0, |
1793 |
biblionumber => $biblionumber, |
1794 |
} |
1795 |
} |
1796 |
); |
1797 |
|
1798 |
my ( $error, $question, $alerts ); |
1799 |
my $issue = AddIssue( $patron1->unblessed, $item->{barcode} ); |
1800 |
|
1801 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
1802 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); |
1803 |
is( $question->{ISSUED_TO_ANOTHER}, 1, 'ISSUED_TO_ANOTHER question flag should be set if AutoReturnCheckedOutItems is disabled and item is checked out to another' ); |
1804 |
|
1805 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1); |
1806 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); |
1807 |
is( $alerts->{RETURNED_FROM_ANOTHER}->{patron}->borrowernumber, $patron1->borrowernumber, 'RETURNED_FROM_ANOTHER alert flag should be set if AutoReturnCheckedOutItems is enabled and item is checked out to another' ); |
1808 |
|
1809 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
1810 |
}; |
1811 |
|
1812 |
|
1753 |
subtest 'AddReturn | is_overdue' => sub { |
1813 |
subtest 'AddReturn | is_overdue' => sub { |
1754 |
plan tests => 5; |
1814 |
plan tests => 5; |
1755 |
|
1815 |
|
1756 |
- |
|
|