|
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 2935-3068
sub ModBiblioMarc {
Link Here
|
| 2935 |
return $biblionumber; |
2934 |
return $biblionumber; |
| 2936 |
} |
2935 |
} |
| 2937 |
|
2936 |
|
| 2938 |
=head2 prepare_host_field |
|
|
| 2939 |
|
| 2940 |
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour ); |
| 2941 |
Generate the host item entry for an analytic child entry |
| 2942 |
|
| 2943 |
=cut |
| 2944 |
|
| 2945 |
sub prepare_host_field { |
| 2946 |
my ( $hostbiblio, $marcflavour ) = @_; |
| 2947 |
$marcflavour ||= C4::Context->preference('marcflavour'); |
| 2948 |
|
| 2949 |
my $biblio = Koha::Biblios->find($hostbiblio); |
| 2950 |
my $host = $biblio->metadata->record; |
| 2951 |
# unfortunately as_string does not 'do the right thing' |
| 2952 |
# if field returns undef |
| 2953 |
my %sfd; |
| 2954 |
my $field; |
| 2955 |
my $host_field; |
| 2956 |
if ( $marcflavour eq 'MARC21' ) { |
| 2957 |
if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) { |
| 2958 |
my $s = $field->as_string('ab'); |
| 2959 |
if ($s) { |
| 2960 |
$sfd{a} = $s; |
| 2961 |
} |
| 2962 |
} |
| 2963 |
if ( $field = $host->field('245') ) { |
| 2964 |
my $s = $field->as_string('a'); |
| 2965 |
if ($s) { |
| 2966 |
$sfd{t} = $s; |
| 2967 |
} |
| 2968 |
} |
| 2969 |
if ( $field = $host->field('260') ) { |
| 2970 |
my $s = $field->as_string('abc'); |
| 2971 |
if ($s) { |
| 2972 |
$sfd{d} = $s; |
| 2973 |
} |
| 2974 |
} |
| 2975 |
if ( $field = $host->field('240') ) { |
| 2976 |
my $s = $field->as_string(); |
| 2977 |
if ($s) { |
| 2978 |
$sfd{b} = $s; |
| 2979 |
} |
| 2980 |
} |
| 2981 |
if ( $field = $host->field('022') ) { |
| 2982 |
my $s = $field->as_string('a'); |
| 2983 |
if ($s) { |
| 2984 |
$sfd{x} = $s; |
| 2985 |
} |
| 2986 |
} |
| 2987 |
if ( $field = $host->field('020') ) { |
| 2988 |
my $s = $field->as_string('a'); |
| 2989 |
if ($s) { |
| 2990 |
$sfd{z} = $s; |
| 2991 |
} |
| 2992 |
} |
| 2993 |
if ( $field = $host->field('001') ) { |
| 2994 |
$sfd{w} = $field->data(),; |
| 2995 |
} |
| 2996 |
$host_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
| 2997 |
return $host_field; |
| 2998 |
} |
| 2999 |
elsif ( $marcflavour eq 'UNIMARC' ) { |
| 3000 |
#author |
| 3001 |
if ( $field = $host->field('700') || $host->field('710') || $host->field('720') ) { |
| 3002 |
my $s = $field->as_string('ab'); |
| 3003 |
if ($s) { |
| 3004 |
$sfd{a} = $s; |
| 3005 |
} |
| 3006 |
} |
| 3007 |
#title |
| 3008 |
if ( $field = $host->field('200') ) { |
| 3009 |
my $s = $field->as_string('a'); |
| 3010 |
if ($s) { |
| 3011 |
$sfd{t} = $s; |
| 3012 |
} |
| 3013 |
} |
| 3014 |
#place of publicaton |
| 3015 |
if ( $field = $host->field('210') ) { |
| 3016 |
my $s = $field->as_string('a'); |
| 3017 |
if ($s) { |
| 3018 |
$sfd{c} = $s; |
| 3019 |
} |
| 3020 |
} |
| 3021 |
#date of publication |
| 3022 |
if ( $field = $host->field('210') ) { |
| 3023 |
my $s = $field->as_string('d'); |
| 3024 |
if ($s) { |
| 3025 |
$sfd{d} = $s; |
| 3026 |
} |
| 3027 |
} |
| 3028 |
#edition statement |
| 3029 |
if ( $field = $host->field('205') ) { |
| 3030 |
my $s = $field->as_string(); |
| 3031 |
if ($s) { |
| 3032 |
$sfd{e} = $s; |
| 3033 |
} |
| 3034 |
} |
| 3035 |
#URL |
| 3036 |
if ( $field = $host->field('856') ) { |
| 3037 |
my $s = $field->as_string('u'); |
| 3038 |
if ($s) { |
| 3039 |
$sfd{u} = $s; |
| 3040 |
} |
| 3041 |
} |
| 3042 |
#ISSN |
| 3043 |
if ( $field = $host->field('011') ) { |
| 3044 |
my $s = $field->as_string('a'); |
| 3045 |
if ($s) { |
| 3046 |
$sfd{x} = $s; |
| 3047 |
} |
| 3048 |
} |
| 3049 |
#ISBN |
| 3050 |
if ( $field = $host->field('010') ) { |
| 3051 |
my $s = $field->as_string('a'); |
| 3052 |
if ($s) { |
| 3053 |
$sfd{y} = $s; |
| 3054 |
} |
| 3055 |
} |
| 3056 |
if ( $field = $host->field('001') ) { |
| 3057 |
$sfd{0} = $field->data(),; |
| 3058 |
} |
| 3059 |
$host_field = MARC::Field->new( 461, '0', ' ', %sfd ); |
| 3060 |
return $host_field; |
| 3061 |
} |
| 3062 |
return; |
| 3063 |
} |
| 3064 |
|
| 3065 |
|
| 3066 |
=head2 UpdateTotalIssues |
2937 |
=head2 UpdateTotalIssues |
| 3067 |
|
2938 |
|
| 3068 |
UpdateTotalIssues($biblionumber, $increase, [$value]) |
2939 |
UpdateTotalIssues($biblionumber, $increase, [$value]) |