@@ -, +, @@
---
C4/Breeding.pm | 30 ++++++++++++--------
C4/ImportBatch.pm | 6 +++-
.../intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl | 4 +--
3 files changed, 25 insertions(+), 15 deletions(-)
--- a/C4/Breeding.pm
+++ a/C4/Breeding.pm
@@ -542,10 +542,14 @@ sub handle_one_result {
$hServer[$conn]->{syntax});
}
else { #z3950
- ($marcrecord)= MarcToUTF8Record($rec->raw(),
- marcflavour_from_syntax($conn), $hServer[$conn]->{encoding});
+ if ($hServer[$conn]->{encoding} eq 'utf8'){
+ $marcrecord= MARC::Record->new_from_usmarc($rec->raw());
+ C4::Charset::SetUTF8Flag $marcrecord;
+ }else{
+ ($marcrecord) = MarcToUTF8Record($rec->raw(), marcflavour_from_syntax($conn), $hServer[$conn]->{encoding})
+ }
}
- $marcrecord->encoding('UTF-8'); #force UTF-8
+
#convert to system marc flavour and/or additional xslt proc.
$marcrecord= do_xslt_processing($conn, $marcrecord);
@@ -570,15 +574,7 @@ sub do_xslt_processing {
my ($conn, $marcrecord)= @_;
my ($res, $newmarcrec, $parser, $style_doc, $stylesheet);
- if($hServer[$conn]->{marc_conv} && defined $xsltconv) {
- $parser = XML::LibXML->new();
- $res= $parser->parse_string($marcrecord->as_xml());
- $res= $xsltconv->transform($res);
- $res= $xsltconv->output_string($res);
- $newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8');
- }
-
- if($hServer[$conn]->{add_xslt}) { #server specific xslt proc
+ if($hServer[$conn]->{add_xslt}) { #server specific xslt proc
$res= $newmarcrec? $newmarcrec->as_xml(): $marcrecord->as_xml();
$parser = XML::LibXML->new() unless $parser;
$res= $parser->parse_string($res);
@@ -595,6 +591,16 @@ sub do_xslt_processing {
warn "z3950_search: XSLT problem with ".$hServer[$conn]->{add_xslt};
}
}
+
+ if( not $newmarcrec and $hServer[$conn]->{marc_conv} and defined $xsltconv) {
+ $parser = XML::LibXML->new();
+ $res= $parser->parse_string($marcrecord->as_xml());
+ $res= $xsltconv->transform($res);
+ $res= $xsltconv->output_string($res);
+
+ $newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8');
+ }
+
return $newmarcrec // $marcrecord;
}
--- a/C4/ImportBatch.pm
+++ a/C4/ImportBatch.pm
@@ -1137,7 +1137,11 @@ sub _create_import_record {
my $sth = $dbh->prepare("INSERT INTO import_records (import_batch_id, record_sequence, marc, marcxml,
record_type, encoding, z3950random)
VALUES (?, ?, ?, ?, ?, ?, ?)");
- $sth->execute($batch_id, $record_sequence, $marc_record->as_usmarc(), $marc_record->as_xml(),
+
+ my $usmarc = $marc_record->as_usmarc();
+ my $xml = $marc_record->as_xml( C4::Context->preference("marcflavour") );
+
+ $sth->execute($batch_id, $record_sequence, $usmarc, $xml,
$record_type, $encoding, $z3950random);
my $import_record_id = $dbh->{'mysql_insertid'};
$sth->finish();
--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl
+++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl
@@ -141,8 +141,8 @@ with Koha; if not, write to the Free Software Foundation, Inc.,
y
-
-
+
+
--