Bug 3142: (QA follow-up) Include notforloan itemtypes

As was done in the code already.
Note that we are ignoring effective itemtype now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2021-10-08 09:10:22 +00:00 committed by Jonathan Druart
parent 10b971c08b
commit 05ddd7eede
2 changed files with 17 additions and 2 deletions

View file

@ -61,6 +61,7 @@ sub filter_by_for_hold {
rule_value => 'not_allowed',
}
)->get_column('itemtype');
push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype');
return $self->search(
{

View file

@ -1510,7 +1510,7 @@ subtest 'can_be_transferred' => sub {
};
subtest 'filter_by_for_hold' => sub {
plan tests => 9;
plan tests => 11;
my $biblio = $builder->build_sample_biblio;
is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' );
@ -1536,7 +1536,8 @@ subtest 'filter_by_for_hold' => sub {
t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1);
is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - damaged if AllowHoldsOnDamagedItems' );
my $not_holdable_itemtype = $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype;
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' });
my $not_holdable_itemtype = $itemtype->itemtype;
$builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
@ -1553,6 +1554,19 @@ subtest 'filter_by_for_hold' => sub {
);
is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - holdallowed=not_allowed' );
# Remove rule, test notforloan on itemtype
Koha::CirculationRules->set_rule(
{
branchcode => undef,
itemtype => $not_holdable_itemtype,
rule_name => 'holdallowed',
rule_value => undef,
}
);
is( $biblio->items->filter_by_for_hold->count, 7, '7 items for hold - rule deleted' );
$itemtype->notforloan(1)->store;
is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - notforloan' );
$biblio->delete;
};