Bug 35702: Fetch biblios at once and loop

Test plan:
prove -v t/db_dependent/Authority/Merge.t

Signed-off-by: David Nind <david@davidnind.com>

Amended-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Replace $biblio->id with $biblio->biblionumber

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1847e2ab56)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2024-01-04 14:07:11 +00:00 committed by Fridolin Somers
parent f8ab19a3eb
commit fa443bcef1

View file

@ -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;