Lines 1476-1481
sub get_marc_hostinfo_only {
Link Here
|
1476 |
return $hostinfo; |
1476 |
return $hostinfo; |
1477 |
} |
1477 |
} |
1478 |
|
1478 |
|
|
|
1479 |
=head3 link_marc_host |
1480 |
|
1481 |
=cut |
1482 |
|
1483 |
sub link_marc_host { |
1484 |
my ( $self, $params ) = @_; |
1485 |
|
1486 |
my $host = Koha::Biblios->find( $params->{biblionumber} ); |
1487 |
return unless $host; |
1488 |
|
1489 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1490 |
my $marc_host = $host->metadata->record; |
1491 |
my %sfd; |
1492 |
my $field; |
1493 |
my $host_field; |
1494 |
|
1495 |
if ( $marcflavour eq 'MARC21' ) { |
1496 |
# Author |
1497 |
if ( $field = |
1498 |
$marc_host->field('100') || $marc_host->field('110') || $marc_host->field('111') ) |
1499 |
{ |
1500 |
my $s = $field->as_string('ab'); |
1501 |
if ($s) { |
1502 |
$sfd{a} = $s; |
1503 |
} |
1504 |
} |
1505 |
# Title |
1506 |
if ( $field = $marc_host->field('245') ) { |
1507 |
my $s = $field->as_string('ab'); |
1508 |
if ($s) { |
1509 |
$sfd{t} = $s; |
1510 |
} |
1511 |
} |
1512 |
# Uniform title |
1513 |
if ( $field = $marc_host->field('240') ) { |
1514 |
my $s = $field->as_string('a'); |
1515 |
if ($s) { |
1516 |
$sfd{s} = $s; |
1517 |
} |
1518 |
} |
1519 |
# Publication |
1520 |
if ( $field = $marc_host->field('260') ) { |
1521 |
my $s = $field->as_string('abc'); |
1522 |
if ($s) { |
1523 |
$sfd{d} = $s; |
1524 |
} |
1525 |
} |
1526 |
# Edition |
1527 |
if ( $field = $marc_host->field('250') ) { |
1528 |
my $s = $field->as_string('ab'); |
1529 |
if ($s) { |
1530 |
$sfd{b} = $s; |
1531 |
} |
1532 |
} |
1533 |
# ISSN |
1534 |
if ( $field = $marc_host->field('022') ) { |
1535 |
my $s = $field->as_string('a'); |
1536 |
if ($s) { |
1537 |
$sfd{x} = $s; |
1538 |
} |
1539 |
} |
1540 |
# ISBN |
1541 |
if ( $field = $marc_host->field('020') ) { |
1542 |
my $s = $field->as_string('a'); |
1543 |
if ($s) { |
1544 |
$sfd{z} = $s; |
1545 |
} |
1546 |
} |
1547 |
if ( C4::Context->preference('UseControlNumber') ) { |
1548 |
# Control number |
1549 |
if ( $field = $marc_host->field('001') ) { |
1550 |
$sfd{w} = $field->data(),; |
1551 |
} |
1552 |
# Control number identifier |
1553 |
if ( $field = $marc_host->field('003') ) { |
1554 |
$sfd{w} = '('.$field->data().')'.$sfd{w}; |
1555 |
} |
1556 |
} |
1557 |
$host_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
1558 |
} |
1559 |
elsif ( $marcflavour eq 'UNIMARC' ) { |
1560 |
|
1561 |
#author |
1562 |
if ( $field = |
1563 |
$marc_host->field('700') || $marc_host->field('710') || $marc_host->field('720') ) |
1564 |
{ |
1565 |
my $s = $field->as_string('ab'); |
1566 |
if ($s) { |
1567 |
$sfd{a} = $s; |
1568 |
} |
1569 |
} |
1570 |
|
1571 |
#title |
1572 |
if ( $field = $marc_host->field('200') ) { |
1573 |
my $s = $field->as_string('a'); |
1574 |
if ($s) { |
1575 |
$sfd{t} = $s; |
1576 |
} |
1577 |
} |
1578 |
|
1579 |
#place of publicaton |
1580 |
if ( $field = $marc_host->field('210') ) { |
1581 |
my $s = $field->as_string('a'); |
1582 |
if ($s) { |
1583 |
$sfd{c} = $s; |
1584 |
} |
1585 |
} |
1586 |
|
1587 |
#date of publication |
1588 |
if ( $field = $marc_host->field('210') ) { |
1589 |
my $s = $field->as_string('d'); |
1590 |
if ($s) { |
1591 |
$sfd{d} = $s; |
1592 |
} |
1593 |
} |
1594 |
|
1595 |
#edition statement |
1596 |
if ( $field = $marc_host->field('205') ) { |
1597 |
my $s = $field->as_string(); |
1598 |
if ($s) { |
1599 |
$sfd{e} = $s; |
1600 |
} |
1601 |
} |
1602 |
|
1603 |
#URL |
1604 |
if ( $field = $marc_host->field('856') ) { |
1605 |
my $s = $field->as_string('u'); |
1606 |
if ($s) { |
1607 |
$sfd{u} = $s; |
1608 |
} |
1609 |
} |
1610 |
|
1611 |
#ISSN |
1612 |
if ( $field = $marc_host->field('011') ) { |
1613 |
my $s = $field->as_string('a'); |
1614 |
if ($s) { |
1615 |
$sfd{x} = $s; |
1616 |
} |
1617 |
} |
1618 |
|
1619 |
#ISBN |
1620 |
if ( $field = $marc_host->field('010') ) { |
1621 |
my $s = $field->as_string('a'); |
1622 |
if ($s) { |
1623 |
$sfd{y} = $s; |
1624 |
} |
1625 |
} |
1626 |
if ( $field = $marc_host->field('001') ) { |
1627 |
$sfd{0} = $field->data(),; |
1628 |
} |
1629 |
$host_field = MARC::Field->new( 461, '0', ' ', %sfd ); |
1630 |
} |
1631 |
|
1632 |
my $marc_record = $self->metadata->record; |
1633 |
$marc_record->append_fields($host_field); |
1634 |
|
1635 |
C4::Biblio::ModBiblioMarc($marc_record, $self->biblionumber); |
1636 |
return $self; |
1637 |
} |
1638 |
|
1479 |
=head3 recalls |
1639 |
=head3 recalls |
1480 |
|
1640 |
|
1481 |
my $recalls = $biblio->recalls; |
1641 |
my $recalls = $biblio->recalls; |
1482 |
- |
|
|