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