From 0e9810169caad6d03ce6a2f022dd49bc27203556 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 31 Aug 2021 12:59:56 +0000 Subject: [PATCH] Bug 27981: Adjust imported records, svc/import_bibs, records from Z3950 --- C4/ImportBatch.pm | 4 ++++ cataloguing/addbiblio.pl | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 2 ++ svc/import_bib | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index db26883354..a9f5cfad99 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -630,6 +630,10 @@ sub BatchCommitRecords { foreach my $item_field ($marc_record->field($item_tag)) { $marc_record->delete_field($item_field); } + if(C4::Context->preference('autoControlNumber') eq 'biblionumber'){ + my @control_num = $marc_record->field('001'); + $marc_record->delete_fields(@control_num); + } } my ($record_result, $item_result, $record_match) = diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index b2aeea0faf..d0f4b5aba2 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -81,6 +81,10 @@ sub MARCfindbreeding { # remove the - in isbn, koha store isbn without any - if ($marc) { my $record = MARC::Record->new_from_usmarc($marc); + if(C4::Context->preference('autoControlNumber') eq 'biblionumber'){ + my @control_num = $record->field('001'); + $record->delete_fields(@control_num); + } my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField( 'biblioitems.isbn' ); if ( $record->field($isbnfield) ) { foreach my $field ( $record->field($isbnfield) ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index 5bc0b8a283..d2b14f3630 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -412,6 +412,8 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr backends[ parts[0] ].get( parts[1], function( record ) { if ( !record.error ) { + var remove_control_num = [% IF Koha.Preference('autoControlNumber') == 'OFF' %] 0 [% ELSE %] 1 [% END %]; + if( remove_control_num ){ record.removeField("001"); } editor.displayRecord( record ); editor.focus(); } diff --git a/svc/import_bib b/svc/import_bib index 47f5c455b9..0ad68adacf 100755 --- a/svc/import_bib +++ b/svc/import_bib @@ -79,6 +79,10 @@ sub import_bib { $result->{'error'} = $@; return $result; } + if(C4::Context->preference('autoControlNumber') eq 'biblionumber'){ + my @control_num = $record->field('001'); + $marc_record->delete_fields(@control_num); + } my $import_record_id = AddBiblioToBatch($batch_id, 0, $marc_record, "utf8", int(rand(99999))); my @import_items_ids = AddItemsToImportBiblio($batch_id, $import_record_id, $marc_record, 'UPDATE COUNTS'); -- 2.20.1