From: Jared Camins-Esakov <[email protected]> This patch makes it impossible to save records with variables fields that don't contain any subfields. Prior to this patch, link_bibs_to_authorities.pl would sometimes corrupt records.
Signed-off-by: Ian Walls <[email protected]> --- C4/Biblio.pm | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 0cc63ab..b151d71 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -326,6 +326,14 @@ sub ModBiblio { $record->append_fields($field); } + foreach my $field ($record->fields()) { + if (! $field->is_control_field()) { + if (scalar($field->subfields()) == 0) { + $record->delete_fields($field); + } + } + } + # update biblionumber and biblioitemnumber in MARC # FIXME - this is assuming a 1 to 1 relationship between # biblios and biblioitems -- 1.5.6.5 _______________________________________________ Koha-patches mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
