From: Dan Pearl Date: Fri, 9 Mar 2018 17:33:15 +0000 (-0500) Subject: LP1754455 - Add option to marc_export to suppress output of 0 subfields X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8c33921e0d6ce8ba4c7c96b311c457ac3939021e;p=working%2FEvergreen.git LP1754455 - Add option to marc_export to suppress output of 0 subfields Signed-off-by: Dan Pearl --- diff --git a/Open-ILS/src/support-scripts/marc_export.in b/Open-ILS/src/support-scripts/marc_export.in index 403187498e..e2acaca2a2 100755 --- a/Open-ILS/src/support-scripts/marc_export.in +++ b/Open-ILS/src/support-scripts/marc_export.in @@ -86,6 +86,7 @@ sub new { 'mfhd', 'all', 'replace_001', + 'strip_0', 'location=s', 'money=s', 'config=s', @@ -126,6 +127,7 @@ Usage: $0 [options] --type or -t Record type (BIBLIO, AUTHORITY) [BIBLIO] --all or -a Export all records; ignores input list --replace_001 Replace the 001 field value with the record ID + --strip_0 Strip subfield 0 from all fields --store Use the given storage backend to connect to the database. Choices are (reporter, cstore, storage) [reporter] --since Export records modified since a certain date and time. @@ -524,6 +526,13 @@ sub next { $marc->insert_fields_ordered($tcn); } } + if ($Marque::config->option_value('strip_0')) { + my @my_fields = $marc->fields(); + foreach my $test_field (@my_fields){ + $test_field->MARC::Field::delete_subfield('0') + if !$test_field->is_control_field(); + } + } if ($Marque::config->option_value('items')) { my @acps = $self->acps_for_bre($r); foreach my $acp (@acps) { @@ -889,6 +898,13 @@ sub next { $marc->insert_fields_ordered($tcn); } } + if ($Marque::config->option_value('strip_0')) { + my @my_fields = $marc->fields(); + foreach my $test_field (@my_fields){ + $test_field->MARC::Field::delete_subfield('0') + if !$test_field->is_control_field(); + } + } if ($Marque::config->option_value('since')) { my $leader = $marc->leader(); if ($U->is_true($r->deleted())) {