Bugzilla – Attachment 13462 Details for
Bug 6536
Z3950 Search Enhancements: SRU targets and additional XSLT processing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug MT6536: Followup: Fix some issues for unimarc
Bug-MT6536-Followup-Fix-some-issues-for-unimarc.patch (text/plain), 4.50 KB, created by
Jonathan Druart
on 2012-11-15 15:00:54 UTC
(
hide
)
Description:
Bug MT6536: Followup: Fix some issues for unimarc
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-11-15 15:00:54 UTC
Size:
4.50 KB
patch
obsolete
>From 03feabe9261b4090e3b4e708b972dd7c3d9c678e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 15 Nov 2012 14:47:29 +0100 >Subject: [PATCH] Bug MT6536: Followup: Fix some issues for unimarc > >1/ In the Breeding module, it is useless to parse 2x the xslt >transformation. > >2/ Fix encoding in the xslt > >3/ The as_xml method takes the marcflavour value. >--- > C4/Breeding.pm | 30 ++++++++++++-------- > C4/ImportBatch.pm | 6 +++- > .../intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl | 4 +-- > 3 files changed, 25 insertions(+), 15 deletions(-) > >diff --git a/C4/Breeding.pm b/C4/Breeding.pm >index cb04e14..f2ac82c 100644 >--- a/C4/Breeding.pm >+++ b/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; > } > >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index b6db406..22040d2 100644 >--- a/C4/ImportBatch.pm >+++ b/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(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl >index bb6cd09..790a3fa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl >@@ -141,8 +141,8 @@ with Koha; if not, write to the Free Software Foundation, Inc., > <xsl:otherwise>y</xsl:otherwise> > </xsl:choose> > </xsl:variable> >- <!-- Demander à nicomo pour les 2 variables suivantes --> >- <xsl:variable name="cs"><xsl:value-of select="' '" /></xsl:variable> >+ <!-- cs is the character set. 50 is utf8 the default value for Koha --> >+ <xsl:variable name="cs"><xsl:value-of select="'50 '" /></xsl:variable> > <xsl:variable name="acs"><xsl:value-of select="' '" /></xsl:variable> > <xsl:variable name="aot" select="substring(text(),34,1)" /> > <xsl:value-of select="concat($deof,$topd,$d1,$d2,$il,$gpc,$mrc,$loc,$tc,$cs,$acs,$aot)" /> >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6536
:
4540
|
4541
|
4959
|
6901
|
6919
|
6920
|
6924
|
13462
|
26169
|
26170
|
26171
|
26172
|
29754
|
29755
|
29756
|
29779
|
29780
|
29788
|
29790
|
29791
|
29812
|
29813
|
29814
|
29815
|
29816
|
29817
|
29818
|
29819
|
30189
|
30190
|
30191
|
30192
|
30193
|
30194
|
30900
|
30901
|
30902
|
30903
|
30904
|
30905
|
30906
|
30907
|
30929
|
30930
|
30931
|
30932
|
30933
|
30934
|
30935
|
30936
|
31046
|
31048
|
31137
|
31193
|
31194
|
31195
|
31227
|
31247
|
31248
|
37264