Lines 62-68
BEGIN {
Link Here
|
62 |
TransformMarcToKoha |
62 |
TransformMarcToKoha |
63 |
TransformHtmlToMarc |
63 |
TransformHtmlToMarc |
64 |
TransformHtmlToXml |
64 |
TransformHtmlToXml |
65 |
prepare_host_field |
|
|
66 |
); |
65 |
); |
67 |
|
66 |
|
68 |
# Internal functions |
67 |
# Internal functions |
Lines 2996-3136
sub ModBiblioMarc {
Link Here
|
2996 |
return $biblionumber; |
2995 |
return $biblionumber; |
2997 |
} |
2996 |
} |
2998 |
|
2997 |
|
2999 |
=head2 prepare_host_field |
|
|
3000 |
|
3001 |
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour ); |
3002 |
Generate the host item entry for an analytic child entry |
3003 |
|
3004 |
=cut |
3005 |
|
3006 |
sub prepare_host_field { |
3007 |
my ( $hostbiblio, $marcflavour ) = @_; |
3008 |
$marcflavour ||= C4::Context->preference('marcflavour'); |
3009 |
|
3010 |
my $biblio = Koha::Biblios->find($hostbiblio); |
3011 |
my $host = $biblio->metadata->record; |
3012 |
|
3013 |
# unfortunately as_string does not 'do the right thing' |
3014 |
# if field returns undef |
3015 |
my %sfd; |
3016 |
my $field; |
3017 |
my $host_field; |
3018 |
if ( $marcflavour eq 'MARC21' ) { |
3019 |
if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) { |
3020 |
my $s = $field->as_string('ab'); |
3021 |
if ($s) { |
3022 |
$sfd{a} = $s; |
3023 |
} |
3024 |
} |
3025 |
if ( $field = $host->field('245') ) { |
3026 |
my $s = $field->as_string('a'); |
3027 |
if ($s) { |
3028 |
$sfd{t} = $s; |
3029 |
} |
3030 |
} |
3031 |
if ( $field = $host->field('260') ) { |
3032 |
my $s = $field->as_string('abc'); |
3033 |
if ($s) { |
3034 |
$sfd{d} = $s; |
3035 |
} |
3036 |
} |
3037 |
if ( $field = $host->field('240') ) { |
3038 |
my $s = $field->as_string(); |
3039 |
if ($s) { |
3040 |
$sfd{b} = $s; |
3041 |
} |
3042 |
} |
3043 |
if ( $field = $host->field('022') ) { |
3044 |
my $s = $field->as_string('a'); |
3045 |
if ($s) { |
3046 |
$sfd{x} = $s; |
3047 |
} |
3048 |
} |
3049 |
if ( $field = $host->field('020') ) { |
3050 |
my $s = $field->as_string('a'); |
3051 |
if ($s) { |
3052 |
$sfd{z} = $s; |
3053 |
} |
3054 |
} |
3055 |
if ( $field = $host->field('001') ) { |
3056 |
$sfd{w} = $field->data(),; |
3057 |
} |
3058 |
$host_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
3059 |
return $host_field; |
3060 |
} elsif ( $marcflavour eq 'UNIMARC' ) { |
3061 |
|
3062 |
#author |
3063 |
if ( $field = $host->field('700') || $host->field('710') || $host->field('720') ) { |
3064 |
my $s = $field->as_string('ab'); |
3065 |
if ($s) { |
3066 |
$sfd{a} = $s; |
3067 |
} |
3068 |
} |
3069 |
|
3070 |
#title |
3071 |
if ( $field = $host->field('200') ) { |
3072 |
my $s = $field->as_string('a'); |
3073 |
if ($s) { |
3074 |
$sfd{t} = $s; |
3075 |
} |
3076 |
} |
3077 |
|
3078 |
#place of publicaton |
3079 |
if ( $field = $host->field('210') ) { |
3080 |
my $s = $field->as_string('a'); |
3081 |
if ($s) { |
3082 |
$sfd{c} = $s; |
3083 |
} |
3084 |
} |
3085 |
|
3086 |
#date of publication |
3087 |
if ( $field = $host->field('210') ) { |
3088 |
my $s = $field->as_string('d'); |
3089 |
if ($s) { |
3090 |
$sfd{d} = $s; |
3091 |
} |
3092 |
} |
3093 |
|
3094 |
#edition statement |
3095 |
if ( $field = $host->field('205') ) { |
3096 |
my $s = $field->as_string(); |
3097 |
if ($s) { |
3098 |
$sfd{e} = $s; |
3099 |
} |
3100 |
} |
3101 |
|
3102 |
#URL |
3103 |
if ( $field = $host->field('856') ) { |
3104 |
my $s = $field->as_string('u'); |
3105 |
if ($s) { |
3106 |
$sfd{u} = $s; |
3107 |
} |
3108 |
} |
3109 |
|
3110 |
#ISSN |
3111 |
if ( $field = $host->field('011') ) { |
3112 |
my $s = $field->as_string('a'); |
3113 |
if ($s) { |
3114 |
$sfd{x} = $s; |
3115 |
} |
3116 |
} |
3117 |
|
3118 |
#ISBN |
3119 |
if ( $field = $host->field('010') ) { |
3120 |
my $s = $field->as_string('a'); |
3121 |
if ($s) { |
3122 |
$sfd{y} = $s; |
3123 |
} |
3124 |
} |
3125 |
if ( $field = $host->field('001') ) { |
3126 |
$sfd{0} = $field->data(),; |
3127 |
} |
3128 |
$host_field = MARC::Field->new( 461, '0', ' ', %sfd ); |
3129 |
return $host_field; |
3130 |
} |
3131 |
return; |
3132 |
} |
3133 |
|
3134 |
=head2 UpdateTotalIssues |
2998 |
=head2 UpdateTotalIssues |
3135 |
|
2999 |
|
3136 |
UpdateTotalIssues($biblionumber, $increase, [$value]) |
3000 |
UpdateTotalIssues($biblionumber, $increase, [$value]) |