Lines 2203-2210
sub PrepHostMarcField {
Link Here
|
2203 |
|
2203 |
|
2204 |
=head2 TransformHtmlToXml |
2204 |
=head2 TransformHtmlToXml |
2205 |
|
2205 |
|
2206 |
$xml = TransformHtmlToXml( $tags, $subfields, $values, $indicator, |
2206 |
$xml = TransformHtmlToXml( $tags, $subfields, $values, $indicator, $auth_type ) |
2207 |
$ind_tag, $auth_type ) |
|
|
2208 |
|
2207 |
|
2209 |
$auth_type contains : |
2208 |
$auth_type contains : |
2210 |
|
2209 |
|
Lines 2221-2227
$auth_type contains :
Link Here
|
2221 |
=cut |
2220 |
=cut |
2222 |
|
2221 |
|
2223 |
sub TransformHtmlToXml { |
2222 |
sub TransformHtmlToXml { |
2224 |
my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_; |
2223 |
my ( $tags, $subfields, $values, $auth_type ) = @_; |
2225 |
my $xml = MARC::File::XML::header('UTF-8'); |
2224 |
my $xml = MARC::File::XML::header('UTF-8'); |
2226 |
$xml .= "<record>\n"; |
2225 |
$xml .= "<record>\n"; |
2227 |
$auth_type = C4::Context->preference('marcflavour') unless $auth_type; |
2226 |
$auth_type = C4::Context->preference('marcflavour') unless $auth_type; |
Lines 2260-2280
sub TransformHtmlToXml {
Link Here
|
2260 |
# } |
2259 |
# } |
2261 |
if ( ( @$tags[$i] ne $prevtag ) ) { |
2260 |
if ( ( @$tags[$i] ne $prevtag ) ) { |
2262 |
$j++ unless ( @$tags[$i] eq "" ); |
2261 |
$j++ unless ( @$tags[$i] eq "" ); |
2263 |
my $indicator1 = eval { substr( @$indicator[$j], 0, 1 ) }; |
|
|
2264 |
my $indicator2 = eval { substr( @$indicator[$j], 1, 1 ) }; |
2265 |
my $ind1 = _default_ind_to_space($indicator1); |
2266 |
my $ind2; |
2267 |
if ( @$indicator[$j] ) { |
2268 |
$ind2 = _default_ind_to_space($indicator2); |
2269 |
} else { |
2270 |
warn "Indicator in @$tags[$i] is empty"; |
2271 |
$ind2 = " "; |
2272 |
} |
2273 |
if ( !$first ) { |
2262 |
if ( !$first ) { |
2274 |
$xml .= "</datafield>\n"; |
2263 |
$xml .= "</datafield>\n"; |
2275 |
if ( ( @$tags[$i] && @$tags[$i] > 10 ) |
2264 |
if ( ( @$tags[$i] && @$tags[$i] > 10 ) |
2276 |
&& ( @$values[$i] ne "" ) ) { |
2265 |
&& ( @$values[$i] ne "" ) ) { |
2277 |
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n"; |
2266 |
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"\" ind2=\"\">\n"; |
2278 |
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; |
2267 |
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; |
2279 |
$first = 0; |
2268 |
$first = 0; |
2280 |
} else { |
2269 |
} else { |
Lines 2293-2319
sub TransformHtmlToXml {
Link Here
|
2293 |
$xml .= "<controlfield tag=\"@$tags[$i]\">@$values[$i]</controlfield>\n"; |
2282 |
$xml .= "<controlfield tag=\"@$tags[$i]\">@$values[$i]</controlfield>\n"; |
2294 |
$first = 1; |
2283 |
$first = 1; |
2295 |
} else { |
2284 |
} else { |
2296 |
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n"; |
2285 |
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"\" ind2=\"\">\n"; |
2297 |
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; |
2286 |
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; |
2298 |
$first = 0; |
2287 |
$first = 0; |
2299 |
} |
2288 |
} |
2300 |
} |
2289 |
} |
2301 |
} |
2290 |
} |
2302 |
} else { # @$tags[$i] eq $prevtag |
2291 |
} else { # @$tags[$i] eq $prevtag |
2303 |
my $indicator1 = eval { substr( @$indicator[$j], 0, 1 ) }; |
|
|
2304 |
my $indicator2 = eval { substr( @$indicator[$j], 1, 1 ) }; |
2305 |
my $ind1 = _default_ind_to_space($indicator1); |
2306 |
my $ind2; |
2307 |
if ( @$indicator[$j] ) { |
2308 |
$ind2 = _default_ind_to_space($indicator2); |
2309 |
} else { |
2310 |
warn "Indicator in @$tags[$i] is empty"; |
2311 |
$ind2 = " "; |
2312 |
} |
2313 |
if ( @$values[$i] eq "" ) { |
2292 |
if ( @$values[$i] eq "" ) { |
2314 |
} else { |
2293 |
} else { |
2315 |
if ($first) { |
2294 |
if ($first) { |
2316 |
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n"; |
2295 |
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"\" ind2=\"\">\n"; |
2317 |
$first = 0; |
2296 |
$first = 0; |
2318 |
} |
2297 |
} |
2319 |
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; |
2298 |
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; |