View | Details | Raw Unified | Return to bug 5067
Collapse All | Expand All

(-)a/misc/migration_tools/bulkmarcimport.pl (-16 / +14 lines)
Lines 34-39 binmode(STDOUT, ":utf8"); Link Here
34
my ( $input_marc_file, $number, $offset) = ('',0,0);
34
my ( $input_marc_file, $number, $offset) = ('',0,0);
35
my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile);
35
my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile);
36
my ($sourcetag,$sourcesubfield,$idmapfl);
36
my ($sourcetag,$sourcesubfield,$idmapfl);
37
my $cleanisbn = 1;
37
38
38
$|=1;
39
$|=1;
39
40
Lines 59-64 GetOptions( Link Here
59
    'x:s' => \$sourcetag,
60
    'x:s' => \$sourcetag,
60
    'y:s' => \$sourcesubfield,
61
    'y:s' => \$sourcesubfield,
61
    'idmap:s' => \$idmapfl,
62
    'idmap:s' => \$idmapfl,
63
    'cleanisbn!'     => \$cleanisbn, 
62
);
64
);
63
$biblios=!$authorities||$biblios;
65
$biblios=!$authorities||$biblios;
64
66
Lines 176-182 RECORD: while ( ) { Link Here
176
        # from because we don't have access to the original blob.  Note
178
        # from because we don't have access to the original blob.  Note
177
        # that the staging import can deal with this condition (via
179
        # that the staging import can deal with this condition (via
178
        # C4::Charset::MarcToUTF8Record) because it doesn't use MARC::Batch.
180
        # C4::Charset::MarcToUTF8Record) because it doesn't use MARC::Batch.
179
        $i++;
180
        next;
181
        next;
181
    }
182
    }
182
    # skip if we get an empty record (that is MARC valid, but will result in AddBiblio failure
183
    # skip if we get an empty record (that is MARC valid, but will result in AddBiblio failure
Lines 197-216 RECORD: while ( ) { Link Here
197
    }
198
    }
198
    my $isbn;
199
    my $isbn;
199
    # remove trailing - in isbn (only for biblios, of course)
200
    # remove trailing - in isbn (only for biblios, of course)
200
    if ($biblios) {
201
    if ($biblios && $cleanisbn) {
201
        if ($marcFlavour eq 'UNIMARC') {
202
        my $tag = $marcFlavour eq 'UNIMARC' ? '010' : '020';
202
            if (my $f010 = $record->field('010')) {
203
        my $field = $record->field($tag);
203
                $isbn = $f010->subfield('a');
204
        my $isbn = $field && $field->subfield('a');
204
                $isbn =~ s/-//g;
205
        if ( $isbn ) {
205
                $f010->update('a' => $isbn);
206
            $isbn =~ s/-//g;
206
            }
207
            $field->update('a' => $isbn);
207
        } else {
208
            if (my $f020 = $record->field('020')) {
209
                if ($isbn = $f020->subfield('a')) {
210
                    $isbn =~ s/-//g;
211
                    $f020->update('a' => $isbn);
212
                }
213
            }
214
        }
208
        }
215
    }
209
    }
216
    my $id;
210
    my $id;
Lines 519-524 If set, a search will be done on isbn, and, if the same isbn is found, the Link Here
519
biblio is not added. It's another method to deduplicate.  B<-match> & B<-isbn>
513
biblio is not added. It's another method to deduplicate.  B<-match> & B<-isbn>
520
can be both set.
514
can be both set.
521
515
516
=item B<-cleanisbn>
517
518
Clean ISBN fields from entering biblio records, ie removes hyphens. By default,
519
ISBN are cleaned. --nocleanisbn will keep ISBN unchanged.
520
522
=item B<-x>=I<TAG>
521
=item B<-x>=I<TAG>
523
522
524
Source bib I<TAG> for reporting the source bib number
523
Source bib I<TAG> for reporting the source bib number
525
- 

Return to bug 5067