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>
(cherry picked from commit fa443bcef1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-01-04 14:07:11 +00:00 committed by Lucas Gass
parent fc0efe7909
commit e1fcd24cd3
1 changed files with 5 additions and 4 deletions

View File

@ -1494,9 +1494,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) {
@ -1570,7 +1571,7 @@ sub merge {
}
}
next if !$update;
ModBiblio($marcrecord, $biblionumber, $biblio->frameworkcode);
ModBiblio($marcrecord, $biblio->biblionumber, $biblio->frameworkcode);
$counteditedbiblio++;
}
return $counteditedbiblio;