Lines 18-24
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use utf8; |
19 |
use utf8; |
20 |
|
20 |
|
21 |
use Test::More tests => 125; |
21 |
use Test::More tests => 126; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
|
23 |
|
24 |
use Data::Dumper; |
24 |
use Data::Dumper; |
Lines 105-110
my $borrower = {
Link Here
|
105 |
branchcode => $library2->{branchcode} |
105 |
branchcode => $library2->{branchcode} |
106 |
}; |
106 |
}; |
107 |
|
107 |
|
|
|
108 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
109 |
|
108 |
# No userenv, PickupLibrary |
110 |
# No userenv, PickupLibrary |
109 |
t::lib::Mocks::mock_preference('IndependentBranches', '0'); |
111 |
t::lib::Mocks::mock_preference('IndependentBranches', '0'); |
110 |
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary'); |
112 |
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary'); |
Lines 1901-1906
subtest 'AddReturn + suspension_chargeperiod' => sub {
Link Here
|
1901 |
); |
1903 |
); |
1902 |
}; |
1904 |
}; |
1903 |
|
1905 |
|
|
|
1906 |
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { |
1907 |
plan tests => 2; |
1908 |
|
1909 |
my $library = $builder->build( { source => 'Branch' } ); |
1910 |
my $patron1 = $builder->build_object( |
1911 |
{ |
1912 |
class => 'Koha::Patrons', |
1913 |
value => { |
1914 |
branchcode => $library->{branchcode}, |
1915 |
firstname => "Happy", |
1916 |
surname => "Gilmore", |
1917 |
} |
1918 |
} |
1919 |
); |
1920 |
my $patron2 = $builder->build_object( |
1921 |
{ |
1922 |
class => 'Koha::Patrons', |
1923 |
value => { |
1924 |
branchcode => $library->{branchcode}, |
1925 |
firstname => "Billy", |
1926 |
surname => "Madison", |
1927 |
} |
1928 |
} |
1929 |
); |
1930 |
|
1931 |
C4::Context->_new_userenv('xxx'); |
1932 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', ''); |
1933 |
|
1934 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
1935 |
my $biblionumber = $biblioitem->{biblionumber}; |
1936 |
my $item = $builder->build( |
1937 |
{ source => 'Item', |
1938 |
value => { |
1939 |
homebranch => $library->{branchcode}, |
1940 |
holdingbranch => $library->{branchcode}, |
1941 |
notforloan => 0, |
1942 |
itemlost => 0, |
1943 |
withdrawn => 0, |
1944 |
biblionumber => $biblionumber, |
1945 |
} |
1946 |
} |
1947 |
); |
1948 |
|
1949 |
my ( $error, $question, $alerts ); |
1950 |
my $issue = AddIssue( $patron1->unblessed, $item->{barcode} ); |
1951 |
|
1952 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
1953 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); |
1954 |
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' ); |
1955 |
|
1956 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1); |
1957 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); |
1958 |
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' ); |
1959 |
|
1960 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
1961 |
}; |
1962 |
|
1963 |
|
1904 |
subtest 'AddReturn | is_overdue' => sub { |
1964 |
subtest 'AddReturn | is_overdue' => sub { |
1905 |
plan tests => 5; |
1965 |
plan tests => 5; |
1906 |
|
1966 |
|
1907 |
- |
|
|