Bug 24488: (QA follow-up) Make pending reserves faster

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Josef Moravec 2020-11-17 18:35:07 +00:00 committed by Jonathan Druart
parent ed4ad48c56
commit 3c4985fbd6

View file

@ -194,9 +194,7 @@ my @biblionumbers = uniq $distinct_holds->get_column('biblionumber');
# make final reserves hash and fill with info
my $reserves;
foreach my $bibnum ( @biblionumbers ){
my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 });
my @checkouts = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 });
my @waiting_holds = map { $_->itemnumber } Koha::Holds->search({'found' => 'W'}, { columns => [ 'itemnumber' ], collapse => 1 });
my @items = Koha::Items->search(
@ -205,7 +203,8 @@ foreach my $bibnum ( @biblionumbers ){
itemlost => 0,
withdrawn => 0,
notforloan => 0,
itemnumber => { -not_in => [ @branchtransfers, @checkouts, @waiting_holds ] },
onloan => undef,
itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] },
}
);