From 1fe388bfdf515d0ad56cf8ea9d2af231ca020e43 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Thu, 10 Jan 2019 09:15:28 +0200 Subject: [PATCH] Bug-22092 - When creating a new subscription, biblio.serial is not set if field 942 is missing. --- C4/Serials.pm | 6 +++++- api/v1/swagger-ui | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 7e88f3aeee..24dee49f3f 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1629,7 +1629,11 @@ sub NewSubscription { my $record = GetMarcBiblio($biblionumber); my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $bib->{'frameworkcode'} ); if ($tag) { - eval { $record->field($tag)->update( $subf => 1 ); }; + if (my $f = $record->field($tag)) { + $f->update( $subf => 1 ) + } else { + $record->append_fields(MARC::Field->new($tag, '', '', $subf => 1)); + } } ModBiblio( $record, $biblionumber, $bib->{'frameworkcode'} ); } diff --git a/api/v1/swagger-ui b/api/v1/swagger-ui index f1dc8522ad..dfcd29dd67 160000 --- a/api/v1/swagger-ui +++ b/api/v1/swagger-ui @@ -1 +1 @@ -Subproject commit f1dc8522ad16a271fe2af2eb00d82a2cd9dc4dcd +Subproject commit dfcd29dd676ac23a054404ee803615b6dc788fab -- 2.17.1