Bug 25375: Get biblionumber from the correct MARC field

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0ce7293ad5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0fa52d7b65)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Julian Maurice 2020-09-04 12:25:17 +04:00 committed by Arthur Suzuki
parent fc2a5c514c
commit d550066a0f
1 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,7 @@ use Koha::SearchMarcMaps;
use Koha::Caches;
use C4::Heading;
use C4::AuthoritiesMarc qw( GuessAuthTypeCode );
use C4::Biblio;
use Carp qw( carp croak );
use Clone qw( clone );
@ -771,7 +772,10 @@ sub marc_records_to_documents {
# Check if there is at least one available item
if ($self->index eq $BIBLIOS_INDEX) {
my $biblio = Koha::Biblios->find($record->field('001')->data);
my ($tag, $code) = C4::Biblio::GetMarcFromKohaField('biblio.biblionumber');
my $field = $record->field($tag);
my $biblionumber = $field->is_control_field ? $field->data : $field->subfield($code);
my $biblio = Koha::Biblios->find($biblionumber);
my $items = $biblio->items;
my $available = 0;
while (my $item = $items->next) {