Bug 30730: (follow-up) Simplify query

This patch drops the 'fetch all non-loanable items' query used in the
subsequent query as part of the 'not_in' and instead replaces it with a
simple filter on 'notforloan => 0'

Test plan
Run the included unit tests before and apply applying the followup.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Martin Renvoize 2022-05-19 15:52:21 +01:00 committed by Fridolin Somers
parent fdfb75eaf6
commit c3f2852209
1 changed files with 2 additions and 8 deletions

View File

@ -134,19 +134,13 @@ sub get_items_that_can_fill {
collapse => 1,
}
)->get_column('itemnumber');
my @notforloan = Koha::Items->search(
{ notforloan => { '!=' => 0 } },
{
columns => ['itemnumber'],
collapse => 1,
}
)->get_column('itemnumber');
return Koha::Items->search(
{
-or => \@bibs_or_items,
itemnumber => { -not_in => [ @branchtransfers, @waiting_holds, @notforloan ] },
itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] },
onloan => undef,
notforloan => 0,
}
)->filter_by_for_hold();
}