Lines 2011-2020
subtest 'filter_by_for_hold' => sub {
Link Here
|
2011 |
rule_value => 'not_allowed', |
2011 |
rule_value => 'not_allowed', |
2012 |
} |
2012 |
} |
2013 |
); |
2013 |
); |
2014 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' }); |
2014 |
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } ); |
2015 |
my $not_holdable_itemtype = $itemtype->itemtype; |
2015 |
my $not_holdable_itemtype = $itemtype->itemtype; |
2016 |
my $itemtype2 = $builder->build_object({ class => 'Koha::ItemTypes' }); |
2016 |
my $itemtype2 = $builder->build_object( { class => 'Koha::ItemTypes' } ); |
2017 |
my $holdable_itemtype = $itemtype2->itemtype; |
2017 |
my $holdable_itemtype = $itemtype2->itemtype; |
2018 |
Koha::CirculationRules->set_rule( |
2018 |
Koha::CirculationRules->set_rule( |
2019 |
{ |
2019 |
{ |
2020 |
branchcode => undef, |
2020 |
branchcode => undef, |
Lines 2028-2036
subtest 'filter_by_for_hold' => sub {
Link Here
|
2028 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
2028 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
2029 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); # more robust tests |
2029 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); # more robust tests |
2030 |
is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' ); |
2030 |
is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' ); |
2031 |
$builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0, itype => $not_holdable_itemtype } ); |
2031 |
$builder->build_sample_item( |
|
|
2032 |
{ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $not_holdable_itemtype } ); |
2032 |
is( $biblio->items->filter_by_for_hold->count, 0, 'default rule prevents hold' ); |
2033 |
is( $biblio->items->filter_by_for_hold->count, 0, 'default rule prevents hold' ); |
2033 |
$builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0, itype => $holdable_itemtype } ); |
2034 |
$builder->build_sample_item( |
|
|
2035 |
{ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $holdable_itemtype } ); |
2034 |
is( $biblio->items->filter_by_for_hold->count, 1, 'hold allowed despite default rule' ); |
2036 |
is( $biblio->items->filter_by_for_hold->count, 1, 'hold allowed despite default rule' ); |
2035 |
|
2037 |
|
2036 |
# Reset items and circ rules to remove default rule |
2038 |
# Reset items and circ rules to remove default rule |
2037 |
- |
|
|