From 1847e2ab565243a9e8fcaf8ddbfe48136041e61b 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 Signed-off-by: David Nind Amended-by: Jonathan Druart Replace $biblio->id with $biblio->biblionumber Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer --- C4/AuthoritiesMarc.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 7319d0e425..6af31ec6b9 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->biblionumber, $biblio->frameworkcode); $counteditedbiblio++; } return $counteditedbiblio; -- 2.39.5