From 3e75f79a279d0bbd6e48a78f85534e11df42bf58 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 4 Jan 2024 14:07:11 +0000 Subject: [PATCH] Bug 35702: Fetch biblios at once and loop Test plan: prove -v t/db_dependent/Authority/Merge.t --- C4/AuthoritiesMarc.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 7319d0e4256..c787c68f7e8 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1571,9 +1571,10 @@ sub merge { : { map { ( $_->[0], 1 ); } ( @record_from, @record_to ) }; my $counteditedbiblio = 0; - foreach my $biblionumber ( @biblionumbers ) { - my $biblio = Koha::Biblios->find($biblionumber); - next unless $biblio; + + my $biblios = Koha::Biblios->search({ biblionumber => { -in => \@biblionumbers } }); + + while ( my $biblio = $biblios->next ) { my $marcrecord = $biblio->metadata->record; my $update = 0; foreach my $tagfield (@$tags_using_authtype) { @@ -1647,7 +1648,7 @@ sub merge { } } next if !$update; - ModBiblio($marcrecord, $biblionumber, $biblio->frameworkcode); + ModBiblio($marcrecord, $biblio->id, $biblio->frameworkcode); $counteditedbiblio++; } return $counteditedbiblio; -- 2.30.2