|
Lines 3638-3656
Generate the host item entry for an analytic child entry
Link Here
|
| 3638 |
|
3638 |
|
| 3639 |
sub prepare_host_field { |
3639 |
sub prepare_host_field { |
| 3640 |
my ( $hostbiblio, $marcflavour ) = @_; |
3640 |
my ( $hostbiblio, $marcflavour ) = @_; |
| 3641 |
$marcflavour ||= 'MARC21'; |
3641 |
$marcflavour ||= C4::Context->preference('marcflavour'); |
| 3642 |
my $host = GetMarcBiblio($hostbiblio); |
3642 |
my $host = GetMarcBiblio($hostbiblio); |
| 3643 |
if ( $marcflavour eq 'MARC21' ) { |
3643 |
# unfortunately as_string does not 'do the right thing' |
| 3644 |
|
3644 |
# if field returns undef |
| 3645 |
# unfortunately as_string does not 'do the right thing' |
3645 |
my %sfd; |
| 3646 |
# if field returns undef |
3646 |
my $field; |
| 3647 |
my %sfd; |
3647 |
my $host_field; |
| 3648 |
my $field; |
3648 |
if ( $marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC' ) { |
| 3649 |
if ( $field = $host->author() ) { |
3649 |
if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) { |
| 3650 |
$sfd{a} = $field; |
3650 |
my $s = $field->as_string('ab'); |
|
|
3651 |
if ($s) { |
| 3652 |
$sfd{a} = $s; |
| 3653 |
} |
| 3651 |
} |
3654 |
} |
| 3652 |
if ( $field = $host->title() ) { |
3655 |
if ( $field = $host->field('245') ) { |
| 3653 |
$sfd{t} = $field; |
3656 |
my $s = $field->as_string('a'); |
|
|
3657 |
if ($s) { |
| 3658 |
$sfd{t} = $s; |
| 3659 |
} |
| 3654 |
} |
3660 |
} |
| 3655 |
if ( $field = $host->field('260') ) { |
3661 |
if ( $field = $host->field('260') ) { |
| 3656 |
my $s = $field->as_string('abc'); |
3662 |
my $s = $field->as_string('abc'); |
|
Lines 3673-3685
sub prepare_host_field {
Link Here
|
| 3673 |
if ( $field = $host->field('020') ) { |
3679 |
if ( $field = $host->field('020') ) { |
| 3674 |
my $s = $field->as_string('a'); |
3680 |
my $s = $field->as_string('a'); |
| 3675 |
if ($s) { |
3681 |
if ($s) { |
| 3676 |
$sfd{x} = $s; |
3682 |
$sfd{z} = $s; |
| 3677 |
} |
3683 |
} |
| 3678 |
} |
3684 |
} |
| 3679 |
if ( $field = $host->field('001') ) { |
3685 |
if ( $field = $host->field('001') ) { |
| 3680 |
$sfd{w} = $field->data(),; |
3686 |
$sfd{w} = $field->data(),; |
| 3681 |
} |
3687 |
} |
| 3682 |
my $host_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
3688 |
$host_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
|
|
3689 |
return $host_field; |
| 3690 |
} |
| 3691 |
elsif ( $marcflavour eq 'UNIMARC' ) { |
| 3692 |
#author |
| 3693 |
if ( $field = $host->field('700') || $host->field('710') || $host->field('720') ) { |
| 3694 |
my $s = $field->as_string('ab'); |
| 3695 |
if ($s) { |
| 3696 |
$sfd{a} = $s; |
| 3697 |
} |
| 3698 |
} |
| 3699 |
#title |
| 3700 |
if ( $field = $host->field('200') ) { |
| 3701 |
my $s = $field->as_string('a'); |
| 3702 |
if ($s) { |
| 3703 |
$sfd{t} = $s; |
| 3704 |
} |
| 3705 |
} |
| 3706 |
#place of publicaton |
| 3707 |
if ( $field = $host->field('210') ) { |
| 3708 |
my $s = $field->as_string('a'); |
| 3709 |
if ($s) { |
| 3710 |
$sfd{c} = $s; |
| 3711 |
} |
| 3712 |
} |
| 3713 |
#date of publication |
| 3714 |
if ( $field = $host->field('210') ) { |
| 3715 |
my $s = $field->as_string('d'); |
| 3716 |
if ($s) { |
| 3717 |
$sfd{d} = $s; |
| 3718 |
} |
| 3719 |
} |
| 3720 |
#edition statement |
| 3721 |
if ( $field = $host->field('205') ) { |
| 3722 |
my $s = $field->as_string(); |
| 3723 |
if ($s) { |
| 3724 |
$sfd{a} = $s; |
| 3725 |
} |
| 3726 |
} |
| 3727 |
#URL |
| 3728 |
if ( $field = $host->field('856') ) { |
| 3729 |
my $s = $field->as_string('u'); |
| 3730 |
if ($s) { |
| 3731 |
$sfd{u} = $s; |
| 3732 |
} |
| 3733 |
} |
| 3734 |
#ISSN |
| 3735 |
if ( $field = $host->field('011') ) { |
| 3736 |
my $s = $field->as_string('a'); |
| 3737 |
if ($s) { |
| 3738 |
$sfd{x} = $s; |
| 3739 |
} |
| 3740 |
} |
| 3741 |
#ISBN |
| 3742 |
if ( $field = $host->field('010') ) { |
| 3743 |
my $s = $field->as_string('a'); |
| 3744 |
if ($s) { |
| 3745 |
$sfd{y} = $s; |
| 3746 |
} |
| 3747 |
} |
| 3748 |
if ( $field = $host->field('001') ) { |
| 3749 |
$sfd{0} = $field->data(),; |
| 3750 |
} |
| 3751 |
$host_field = MARC::Field->new( 461, '0', ' ', %sfd ); |
| 3683 |
return $host_field; |
3752 |
return $host_field; |
| 3684 |
} |
3753 |
} |
| 3685 |
return; |
3754 |
return; |