|
Lines 320-325
sub export_marc_records_from_sth {
Link Here
|
| 320 |
? GetXmlBiblio( $record_number ) |
320 |
? GetXmlBiblio( $record_number ) |
| 321 |
: GetAuthorityXML( $record_number ); |
321 |
: GetAuthorityXML( $record_number ); |
| 322 |
if ($record_type eq 'biblio'){ |
322 |
if ($record_type eq 'biblio'){ |
|
|
323 |
$marcxml = fix_isbn_hyphens($marcxml, 1) if C4::Context->preference("IsbnIssnRemoveHyphens"); |
| 323 |
my @items = GetItemsInfo($record_number); |
324 |
my @items = GetItemsInfo($record_number); |
| 324 |
if (@items){ |
325 |
if (@items){ |
| 325 |
my $record = MARC::Record->new; |
326 |
my $record = MARC::Record->new; |
|
Lines 433-438
sub get_corrected_marc_record {
Link Here
|
| 433 |
|
434 |
|
| 434 |
if (defined $marc) { |
435 |
if (defined $marc) { |
| 435 |
fix_leader($marc); |
436 |
fix_leader($marc); |
|
|
437 |
$marc = fix_isbn_hyphens($marc, 0) if C4::Context->preference("IsbnIssnRemoveHyphens"); |
| 436 |
if ($record_type eq 'biblio') { |
438 |
if ($record_type eq 'biblio') { |
| 437 |
my $succeeded = fix_biblio_ids($marc, $record_number); |
439 |
my $succeeded = fix_biblio_ids($marc, $record_number); |
| 438 |
return unless $succeeded; |
440 |
return unless $succeeded; |
|
Lines 572-577
sub fix_unimarc_100 {
Link Here
|
| 572 |
} |
574 |
} |
| 573 |
} |
575 |
} |
| 574 |
|
576 |
|
|
|
577 |
sub fix_isbn_hyphens { |
| 578 |
my $data = shift; |
| 579 |
my $isxml = shift; |
| 580 |
|
| 581 |
my $isbn; |
| 582 |
my $issn; |
| 583 |
my $encoding = C4::Context->preference("marcflavour"); |
| 584 |
|
| 585 |
if ( $encoding eq 'UNIMARC' ) { |
| 586 |
unless ($isxml){ |
| 587 |
foreach my $f010 ($data->field('010')) { |
| 588 |
$isbn = $f010->subfield('a'); |
| 589 |
$isbn =~ s/-//g; |
| 590 |
$f010->update( 'a' => $isbn ); |
| 591 |
} |
| 592 |
foreach my $f011 ($data->field('011')) { |
| 593 |
if ( $f011->subfield('a') ) { |
| 594 |
$issn = $f011->subfield('a'); |
| 595 |
$issn =~ s/-//g; |
| 596 |
$f011->update( 'a' => $issn ); |
| 597 |
} |
| 598 |
} |
| 599 |
}else{ |
| 600 |
my $parser = XML::LibXML->new(); |
| 601 |
$parser->recover_silently(1); |
| 602 |
my $xslt = XML::LibXSLT->new(); |
| 603 |
my $source = $parser->parse_string($data); |
| 604 |
|
| 605 |
my $style_doc = $parser->parse_file("$kohadir/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl"); |
| 606 |
my $stylesheet = $xslt->parse_stylesheet($style_doc); |
| 607 |
my $result_parse = $stylesheet->transform($source); |
| 608 |
$data = $stylesheet->output_string($result_parse); |
| 609 |
} |
| 610 |
} elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') { |
| 611 |
unless ($isxml){ |
| 612 |
foreach my $f020 ($data->field('020')) { |
| 613 |
$isbn = $f020->subfield('a'); |
| 614 |
$isbn =~ s/-//g; |
| 615 |
$f020->update( 'a' => $isbn ); |
| 616 |
} |
| 617 |
foreach my $f022 ($data->field('022')) { |
| 618 |
$issn = $f022->subfield('a'); |
| 619 |
$issn =~ s/-//g; |
| 620 |
$f022->update( 'a' => $issn ); |
| 621 |
} |
| 622 |
}else{ |
| 623 |
my $parser = XML::LibXML->new(); |
| 624 |
$parser->recover_silently(1); |
| 625 |
my $xslt = XML::LibXSLT->new(); |
| 626 |
my $source = $parser->parse_string($data); |
| 627 |
|
| 628 |
my $style_doc = $parser->parse_file("$kohadir/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl"); |
| 629 |
my $stylesheet = $xslt->parse_stylesheet($style_doc); |
| 630 |
my $result_parse = $stylesheet->transform($source); |
| 631 |
$data = $stylesheet->output_string($result_parse); |
| 632 |
} |
| 633 |
} |
| 634 |
|
| 635 |
return $data; |
| 636 |
} |
| 637 |
|
| 575 |
sub do_indexing { |
638 |
sub do_indexing { |
| 576 |
my ($record_type, $op, $record_dir, $reset_index, $noshadow, $record_format, $zebraidx_log_opt) = @_; |
639 |
my ($record_type, $op, $record_dir, $reset_index, $noshadow, $record_format, $zebraidx_log_opt) = @_; |
| 577 |
|
640 |
|