Lines 1528-1534
MARC field, replacing any blanks with '#'.
Link Here
|
1528 |
sub display_marc_indicators { |
1528 |
sub display_marc_indicators { |
1529 |
my $field = shift; |
1529 |
my $field = shift; |
1530 |
my $indicators = ''; |
1530 |
my $indicators = ''; |
1531 |
if ($field->tag() >= 10) { |
1531 |
if ($field && $field->tag() >= 10) { |
1532 |
$indicators = $field->indicator(1) . $field->indicator(2); |
1532 |
$indicators = $field->indicator(1) . $field->indicator(2); |
1533 |
$indicators =~ s/ /#/g; |
1533 |
$indicators =~ s/ /#/g; |
1534 |
} |
1534 |
} |
Lines 1536-1646
sub display_marc_indicators {
Link Here
|
1536 |
} |
1536 |
} |
1537 |
|
1537 |
|
1538 |
sub GetNormalizedUPC { |
1538 |
sub GetNormalizedUPC { |
1539 |
my ($record,$marcflavour) = @_; |
1539 |
my ($marcrecord,$marcflavour) = @_; |
1540 |
my (@fields,$upc); |
1540 |
|
1541 |
|
1541 |
if ($marcrecord) { |
1542 |
if ($marcflavour eq 'UNIMARC') { |
1542 |
if ($marcflavour eq 'UNIMARC') { |
1543 |
@fields = $record->field('072'); |
1543 |
my @fields = $marcrecord->field('072'); |
1544 |
foreach my $field (@fields) { |
1544 |
foreach my $field (@fields) { |
1545 |
my $upc = _normalize_match_point($field->subfield('a')); |
1545 |
my $upc = _normalize_match_point($field->subfield('a')); |
1546 |
if ($upc ne '') { |
1546 |
if ($upc) { |
1547 |
return $upc; |
1547 |
return $upc; |
|
|
1548 |
} |
1548 |
} |
1549 |
} |
1549 |
} |
|
|
1550 |
|
1550 |
|
1551 |
} |
1551 |
} |
1552 |
else { # assume marc21 if not unimarc |
1552 |
else { # assume marc21 if not unimarc |
1553 |
@fields = $record->field('024'); |
1553 |
my @fields = $marcrecord->field('024'); |
1554 |
foreach my $field (@fields) { |
1554 |
foreach my $field (@fields) { |
1555 |
my $indicator = $field->indicator(1); |
1555 |
my $indicator = $field->indicator(1); |
1556 |
my $upc = _normalize_match_point($field->subfield('a')); |
1556 |
my $upc = _normalize_match_point($field->subfield('a')); |
1557 |
if ($indicator == 1 and $upc ne '') { |
1557 |
if ($upc && $indicator == 1 ) { |
1558 |
return $upc; |
1558 |
return $upc; |
|
|
1559 |
} |
1559 |
} |
1560 |
} |
1560 |
} |
1561 |
} |
1561 |
} |
1562 |
} |
|
|
1563 |
return; |
1562 |
} |
1564 |
} |
1563 |
|
1565 |
|
1564 |
# Normalizes and returns the first valid ISBN found in the record |
1566 |
# Normalizes and returns the first valid ISBN found in the record |
1565 |
# ISBN13 are converted into ISBN10. This is required to get some book cover images. |
1567 |
# ISBN13 are converted into ISBN10. This is required to get some book cover images. |
1566 |
sub GetNormalizedISBN { |
1568 |
sub GetNormalizedISBN { |
1567 |
my ($isbn,$record,$marcflavour) = @_; |
1569 |
my ($isbn,$marcrecord,$marcflavour) = @_; |
1568 |
my @fields; |
|
|
1569 |
if ($isbn) { |
1570 |
if ($isbn) { |
1570 |
# Koha attempts to store multiple ISBNs in biblioitems.isbn, separated by " | " |
1571 |
# Koha attempts to store multiple ISBNs in biblioitems.isbn, separated by " | " |
1571 |
# anything after " | " should be removed, along with the delimiter |
1572 |
# anything after " | " should be removed, along with the delimiter |
1572 |
($isbn) = split(/\|/, $isbn ); |
1573 |
($isbn) = split(/\|/, $isbn ); |
1573 |
return _isbn_cleanup($isbn); |
1574 |
return _isbn_cleanup($isbn); |
1574 |
} |
1575 |
} |
1575 |
return unless $record; |
1576 |
if ($marcrecord) { |
1576 |
|
1577 |
|
1577 |
if ($marcflavour eq 'UNIMARC') { |
1578 |
if ($marcflavour eq 'UNIMARC') { |
1578 |
@fields = $record->field('010'); |
1579 |
my @fields = $marcrecord->field('010'); |
1579 |
foreach my $field (@fields) { |
1580 |
foreach my $field (@fields) { |
1580 |
my $isbn = $field->subfield('a'); |
1581 |
my $isbn = $field->subfield('a'); |
1581 |
if ($isbn) { |
1582 |
if ($isbn) { |
1582 |
return _isbn_cleanup($isbn); |
1583 |
return _isbn_cleanup($isbn); |
1583 |
} else { |
1584 |
} |
1584 |
return; |
|
|
1585 |
} |
1585 |
} |
1586 |
} |
1586 |
} |
1587 |
} |
1587 |
else { # assume marc21 if not unimarc |
1588 |
else { # assume marc21 if not unimarc |
1588 |
my @fields = $marcrecord->field('020'); |
1589 |
@fields = $record->field('020'); |
1589 |
foreach my $field (@fields) { |
1590 |
foreach my $field (@fields) { |
1590 |
$isbn = $field->subfield('a'); |
1591 |
$isbn = $field->subfield('a'); |
1591 |
if ($isbn) { |
1592 |
if ($isbn) { |
1592 |
return _isbn_cleanup($isbn); |
1593 |
return _isbn_cleanup($isbn); |
1593 |
} |
1594 |
} else { |
|
|
1595 |
return; |
1596 |
} |
1594 |
} |
1597 |
} |
1595 |
} |
1598 |
} |
1596 |
} |
|
|
1597 |
return; |
1599 |
} |
1598 |
} |
1600 |
|
1599 |
|
1601 |
sub GetNormalizedEAN { |
1600 |
sub GetNormalizedEAN { |
1602 |
my ($record,$marcflavour) = @_; |
1601 |
my ($marcrecord,$marcflavour) = @_; |
1603 |
my (@fields,$ean); |
1602 |
|
1604 |
|
1603 |
if ($marcrecord) { |
1605 |
if ($marcflavour eq 'UNIMARC') { |
1604 |
if ($marcflavour eq 'UNIMARC') { |
1606 |
@fields = $record->field('073'); |
1605 |
my @fields = $marcrecord->field('073'); |
1607 |
foreach my $field (@fields) { |
1606 |
foreach my $field (@fields) { |
1608 |
$ean = _normalize_match_point($field->subfield('a')); |
1607 |
my $ean = _normalize_match_point($field->subfield('a')); |
1609 |
if ($ean ne '') { |
1608 |
if ( $ean ) { |
1610 |
return $ean; |
1609 |
return $ean; |
|
|
1610 |
} |
1611 |
} |
1611 |
} |
1612 |
} |
1612 |
} |
1613 |
} |
1613 |
else { # assume marc21 if not unimarc |
1614 |
else { # assume marc21 if not unimarc |
1614 |
my @fields = $marcrecord->field('024'); |
1615 |
@fields = $record->field('024'); |
1615 |
foreach my $field (@fields) { |
1616 |
foreach my $field (@fields) { |
1616 |
my $indicator = $field->indicator(1); |
1617 |
my $indicator = $field->indicator(1); |
1617 |
my $ean = _normalize_match_point($field->subfield('a')); |
1618 |
$ean = _normalize_match_point($field->subfield('a')); |
1618 |
if ( $ean && $indicator == 3 ) { |
1619 |
if ($indicator == 3 and $ean ne '') { |
1619 |
return $ean; |
1620 |
return $ean; |
1620 |
} |
1621 |
} |
1621 |
} |
1622 |
} |
1622 |
} |
1623 |
} |
1623 |
} |
|
|
1624 |
return; |
1624 |
} |
1625 |
} |
1625 |
sub GetNormalizedOCLCNumber { |
|
|
1626 |
my ($record,$marcflavour) = @_; |
1627 |
my (@fields,$oclc); |
1628 |
|
1626 |
|
1629 |
if ($marcflavour eq 'UNIMARC') { |
1627 |
sub GetNormalizedOCLCNumber { |
1630 |
# TODO: add UNIMARC fields |
1628 |
my ($marcrecord,$marcflavour) = @_; |
1631 |
} |
1629 |
if ($marcrecord && $marcflavour ne 'UNIMARC' ) { |
1632 |
else { # assume marc21 if not unimarc |
1630 |
my @fields = $marcrecord->field('035'); |
1633 |
@fields = $record->field('035'); |
|
|
1634 |
foreach my $field (@fields) { |
1631 |
foreach my $field (@fields) { |
1635 |
$oclc = $field->subfield('a'); |
1632 |
my $oclc = $field->subfield('a'); |
1636 |
if ($oclc =~ /OCoLC/) { |
1633 |
if ($oclc =~ /OCoLC/) { |
1637 |
$oclc =~ s/\(OCoLC\)//; |
1634 |
$oclc =~ s/\(OCoLC\)//; |
1638 |
return $oclc; |
1635 |
return $oclc; |
1639 |
} else { |
|
|
1640 |
return; |
1641 |
} |
1636 |
} |
1642 |
} |
1637 |
} |
1643 |
} |
1638 |
} |
|
|
1639 |
return; |
1644 |
} |
1640 |
} |
1645 |
|
1641 |
|
1646 |
sub GetAuthvalueDropbox { |
1642 |
sub GetAuthvalueDropbox { |
1647 |
- |
|
|