Lines 1465-1471
MARC field, replacing any blanks with '#'.
Link Here
|
1465 |
sub display_marc_indicators { |
1465 |
sub display_marc_indicators { |
1466 |
my $field = shift; |
1466 |
my $field = shift; |
1467 |
my $indicators = ''; |
1467 |
my $indicators = ''; |
1468 |
if ($field->tag() >= 10) { |
1468 |
if ($field && $field->tag() >= 10) { |
1469 |
$indicators = $field->indicator(1) . $field->indicator(2); |
1469 |
$indicators = $field->indicator(1) . $field->indicator(2); |
1470 |
$indicators =~ s/ /#/g; |
1470 |
$indicators =~ s/ /#/g; |
1471 |
} |
1471 |
} |
Lines 1473-1583
sub display_marc_indicators {
Link Here
|
1473 |
} |
1473 |
} |
1474 |
|
1474 |
|
1475 |
sub GetNormalizedUPC { |
1475 |
sub GetNormalizedUPC { |
1476 |
my ($record,$marcflavour) = @_; |
1476 |
my ($marcrecord,$marcflavour) = @_; |
1477 |
my (@fields,$upc); |
1477 |
|
1478 |
|
1478 |
if ($marcrecord) { |
1479 |
if ($marcflavour eq 'UNIMARC') { |
1479 |
if ($marcflavour eq 'UNIMARC') { |
1480 |
@fields = $record->field('072'); |
1480 |
my @fields = $marcrecord->field('072'); |
1481 |
foreach my $field (@fields) { |
1481 |
foreach my $field (@fields) { |
1482 |
my $upc = _normalize_match_point($field->subfield('a')); |
1482 |
my $upc = _normalize_match_point($field->subfield('a')); |
1483 |
if ($upc ne '') { |
1483 |
if ($upc) { |
1484 |
return $upc; |
1484 |
return $upc; |
|
|
1485 |
} |
1485 |
} |
1486 |
} |
1486 |
} |
|
|
1487 |
|
1487 |
|
1488 |
} |
1488 |
} |
1489 |
else { # assume marc21 if not unimarc |
1489 |
else { # assume marc21 if not unimarc |
1490 |
@fields = $record->field('024'); |
1490 |
my @fields = $marcrecord->field('024'); |
1491 |
foreach my $field (@fields) { |
1491 |
foreach my $field (@fields) { |
1492 |
my $indicator = $field->indicator(1); |
1492 |
my $indicator = $field->indicator(1); |
1493 |
my $upc = _normalize_match_point($field->subfield('a')); |
1493 |
my $upc = _normalize_match_point($field->subfield('a')); |
1494 |
if ($indicator == 1 and $upc ne '') { |
1494 |
if ($upc && $indicator == 1 ) { |
1495 |
return $upc; |
1495 |
return $upc; |
|
|
1496 |
} |
1496 |
} |
1497 |
} |
1497 |
} |
1498 |
} |
1498 |
} |
1499 |
} |
|
|
1500 |
return; |
1499 |
} |
1501 |
} |
1500 |
|
1502 |
|
1501 |
# Normalizes and returns the first valid ISBN found in the record |
1503 |
# Normalizes and returns the first valid ISBN found in the record |
1502 |
# ISBN13 are converted into ISBN10. This is required to get some book cover images. |
1504 |
# ISBN13 are converted into ISBN10. This is required to get some book cover images. |
1503 |
sub GetNormalizedISBN { |
1505 |
sub GetNormalizedISBN { |
1504 |
my ($isbn,$record,$marcflavour) = @_; |
1506 |
my ($isbn,$marcrecord,$marcflavour) = @_; |
1505 |
my @fields; |
|
|
1506 |
if ($isbn) { |
1507 |
if ($isbn) { |
1507 |
# Koha attempts to store multiple ISBNs in biblioitems.isbn, separated by " | " |
1508 |
# Koha attempts to store multiple ISBNs in biblioitems.isbn, separated by " | " |
1508 |
# anything after " | " should be removed, along with the delimiter |
1509 |
# anything after " | " should be removed, along with the delimiter |
1509 |
($isbn) = split(/\|/, $isbn ); |
1510 |
($isbn) = split(/\|/, $isbn ); |
1510 |
return _isbn_cleanup($isbn); |
1511 |
return _isbn_cleanup($isbn); |
1511 |
} |
1512 |
} |
1512 |
return unless $record; |
1513 |
if ($marcrecord) { |
1513 |
|
1514 |
|
1514 |
if ($marcflavour eq 'UNIMARC') { |
1515 |
if ($marcflavour eq 'UNIMARC') { |
1515 |
@fields = $record->field('010'); |
1516 |
my @fields = $marcrecord->field('010'); |
1516 |
foreach my $field (@fields) { |
1517 |
foreach my $field (@fields) { |
1517 |
my $isbn = $field->subfield('a'); |
1518 |
my $isbn = $field->subfield('a'); |
1518 |
if ($isbn) { |
1519 |
if ($isbn) { |
1519 |
return _isbn_cleanup($isbn); |
1520 |
return _isbn_cleanup($isbn); |
1520 |
} else { |
1521 |
} |
1521 |
return; |
|
|
1522 |
} |
1522 |
} |
1523 |
} |
1523 |
} |
1524 |
} |
1524 |
else { # assume marc21 if not unimarc |
1525 |
else { # assume marc21 if not unimarc |
1525 |
my @fields = $marcrecord->field('020'); |
1526 |
@fields = $record->field('020'); |
1526 |
foreach my $field (@fields) { |
1527 |
foreach my $field (@fields) { |
1527 |
$isbn = $field->subfield('a'); |
1528 |
$isbn = $field->subfield('a'); |
1528 |
if ($isbn) { |
1529 |
if ($isbn) { |
1529 |
return _isbn_cleanup($isbn); |
1530 |
return _isbn_cleanup($isbn); |
1530 |
} |
1531 |
} else { |
|
|
1532 |
return; |
1533 |
} |
1531 |
} |
1534 |
} |
1532 |
} |
1535 |
} |
1533 |
} |
|
|
1534 |
return; |
1536 |
} |
1535 |
} |
1537 |
|
1536 |
|
1538 |
sub GetNormalizedEAN { |
1537 |
sub GetNormalizedEAN { |
1539 |
my ($record,$marcflavour) = @_; |
1538 |
my ($marcrecord,$marcflavour) = @_; |
1540 |
my (@fields,$ean); |
1539 |
|
1541 |
|
1540 |
if ($marcrecord) { |
1542 |
if ($marcflavour eq 'UNIMARC') { |
1541 |
if ($marcflavour eq 'UNIMARC') { |
1543 |
@fields = $record->field('073'); |
1542 |
my @fields = $marcrecord->field('073'); |
1544 |
foreach my $field (@fields) { |
1543 |
foreach my $field (@fields) { |
1545 |
$ean = _normalize_match_point($field->subfield('a')); |
1544 |
my $ean = _normalize_match_point($field->subfield('a')); |
1546 |
if ($ean ne '') { |
1545 |
if ( $ean ) { |
1547 |
return $ean; |
1546 |
return $ean; |
|
|
1547 |
} |
1548 |
} |
1548 |
} |
1549 |
} |
1549 |
} |
1550 |
} |
1550 |
else { # assume marc21 if not unimarc |
1551 |
else { # assume marc21 if not unimarc |
1551 |
my @fields = $marcrecord->field('024'); |
1552 |
@fields = $record->field('024'); |
1552 |
foreach my $field (@fields) { |
1553 |
foreach my $field (@fields) { |
1553 |
my $indicator = $field->indicator(1); |
1554 |
my $indicator = $field->indicator(1); |
1554 |
my $ean = _normalize_match_point($field->subfield('a')); |
1555 |
$ean = _normalize_match_point($field->subfield('a')); |
1555 |
if ( $ean && $indicator == 3 ) { |
1556 |
if ($indicator == 3 and $ean ne '') { |
1556 |
return $ean; |
1557 |
return $ean; |
1557 |
} |
1558 |
} |
1558 |
} |
1559 |
} |
1559 |
} |
1560 |
} |
1560 |
} |
|
|
1561 |
return; |
1561 |
} |
1562 |
} |
1562 |
sub GetNormalizedOCLCNumber { |
|
|
1563 |
my ($record,$marcflavour) = @_; |
1564 |
my (@fields,$oclc); |
1565 |
|
1563 |
|
1566 |
if ($marcflavour eq 'UNIMARC') { |
1564 |
sub GetNormalizedOCLCNumber { |
1567 |
# TODO: add UNIMARC fields |
1565 |
my ($marcrecord,$marcflavour) = @_; |
1568 |
} |
1566 |
if ($marcrecord && $marcflavour ne 'UNIMARC' ) { |
1569 |
else { # assume marc21 if not unimarc |
1567 |
my @fields = $marcrecord->field('035'); |
1570 |
@fields = $record->field('035'); |
|
|
1571 |
foreach my $field (@fields) { |
1568 |
foreach my $field (@fields) { |
1572 |
$oclc = $field->subfield('a'); |
1569 |
my $oclc = $field->subfield('a'); |
1573 |
if ($oclc =~ /OCoLC/) { |
1570 |
if ($oclc =~ /OCoLC/) { |
1574 |
$oclc =~ s/\(OCoLC\)//; |
1571 |
$oclc =~ s/\(OCoLC\)//; |
1575 |
return $oclc; |
1572 |
return $oclc; |
1576 |
} else { |
|
|
1577 |
return; |
1578 |
} |
1573 |
} |
1579 |
} |
1574 |
} |
1580 |
} |
1575 |
} |
|
|
1576 |
return; |
1581 |
} |
1577 |
} |
1582 |
|
1578 |
|
1583 |
sub GetAuthvalueDropbox { |
1579 |
sub GetAuthvalueDropbox { |
1584 |
- |
|
|