Lines 1920-1926
subtest 'store() tests' => sub {
Link Here
|
1920 |
|
1920 |
|
1921 |
subtest 'Recalls tests' => sub { |
1921 |
subtest 'Recalls tests' => sub { |
1922 |
|
1922 |
|
1923 |
plan tests => 23; |
1923 |
plan tests => 25; |
1924 |
|
1924 |
|
1925 |
$schema->storage->txn_begin; |
1925 |
$schema->storage->txn_begin; |
1926 |
|
1926 |
|
Lines 1938-1943
subtest 'Recalls tests' => sub {
Link Here
|
1938 |
|
1938 |
|
1939 |
t::lib::Mocks::mock_userenv( { patron => $patron1 } ); |
1939 |
t::lib::Mocks::mock_userenv( { patron => $patron1 } ); |
1940 |
t::lib::Mocks::mock_preference('UseRecalls', 1); |
1940 |
t::lib::Mocks::mock_preference('UseRecalls', 1); |
|
|
1941 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
1941 |
|
1942 |
|
1942 |
my $recall1 = Koha::Recall->new( |
1943 |
my $recall1 = Koha::Recall->new( |
1943 |
{ patron_id => $patron1->borrowernumber, |
1944 |
{ patron_id => $patron1->borrowernumber, |
Lines 2016-2021
subtest 'Recalls tests' => sub {
Link Here
|
2016 |
|
2017 |
|
2017 |
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall if on_shelf_recalls = all and items are still available" ); |
2018 |
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall if on_shelf_recalls = all and items are still available" ); |
2018 |
|
2019 |
|
|
|
2020 |
my $item2_itype = $builder->build_object({ class => 'Koha::ItemTypes' }); |
2021 |
$item2->set({ itype => $item2_itype->itemtype })->store; |
2022 |
$item2 = Koha::Items->find( $item2->id ); |
2023 |
|
2024 |
Koha::CirculationRules->set_rules({ |
2025 |
branchcode => $branchcode, |
2026 |
categorycode => $patron1->categorycode, |
2027 |
itemtype => $item2->effective_itemtype, |
2028 |
rules => { |
2029 |
recalls_allowed => 0, |
2030 |
recalls_per_record => 1, |
2031 |
on_shelf_recalls => 'all', |
2032 |
}, |
2033 |
}); |
2034 |
is( $item1->can_be_recalled({ patron => $patron1 }), 1, "Can recall because on_shelf_recalls = all and other attached item is not allowed to be recalled so doesn't count" ); |
2035 |
|
2036 |
Koha::CirculationRules->set_rules({ |
2037 |
branchcode => $branchcode, |
2038 |
categorycode => $patron1->categorycode, |
2039 |
itemtype => $item2->effective_itemtype, |
2040 |
rules => { |
2041 |
recalls_allowed => 1, |
2042 |
recalls_per_record => 1, |
2043 |
on_shelf_recalls => 'all', |
2044 |
}, |
2045 |
}); |
2046 |
my $allocated_hold = $builder->build_object({ class => 'Koha::Holds', value => { itemnumber => $item2->id, borrowernumber => $patron3->id, branchcode => $branchcode, found => 'W' } }); |
2047 |
is( $item1->can_be_recalled({ patron => $patron1 }), 1, "Can recall because on_shelf_recalls = all and other attached item is allocated elsewhere so doesn't count" ); |
2048 |
|
2019 |
Koha::CirculationRules->set_rules({ |
2049 |
Koha::CirculationRules->set_rules({ |
2020 |
branchcode => $branchcode, |
2050 |
branchcode => $branchcode, |
2021 |
categorycode => $patron1->categorycode, |
2051 |
categorycode => $patron1->categorycode, |
2022 |
- |
|
|