From 2c88e1e0f8b9422121edd30ff54494085eaf87eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 26 May 2010 15:49:34 +0200 Subject: [PATCH] Bug 5639 (MT #3605) Fix escaping in ILSDI Signed-off-by: Chris Cormack Signed-off-by: Paul Poulain --- C4/ILSDI/Services.pm | 15 ++----- koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt | 44 ++++++++++---------- opac/ilsdi.pl | 1 - 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index ba0c429052..90f741a213 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -193,15 +193,12 @@ sub GetRecords { # Get the biblioitem from the biblionumber my $biblioitem = ( GetBiblioItemByBiblioNumber( $biblionumber, undef ) )[0]; if ( not $biblioitem->{'biblionumber'} ) { - $biblioitem = "RecordNotFound"; + $biblioitem->{code} = "RecordNotFound"; } # We don't want MARC to be displayed delete $biblioitem->{'marc'}; - # nor the XML declaration of MARCXML - $biblioitem->{'marcxml'} =~ s/<\?xml version="1.0" encoding="UTF-8"\?>//go; - # Get most of the needed data my $biblioitemnumber = $biblioitem->{'biblioitemnumber'}; my @reserves = GetReservesFromBiblionumber( $biblionumber, undef, undef ); @@ -224,8 +221,6 @@ sub GetRecords { $biblioitem->{'reserves'}->{'reserve'} = $reserves[1]; $biblioitem->{'issues'}->{'issue'} = $issues; - map { $biblioitem->{$_} = encode_entities( $biblioitem->{$_}, '&' ) } grep( !/marcxml/, keys %$biblioitem ); - push @records, $biblioitem; } @@ -256,18 +251,16 @@ sub GetAuthorityRecords { return { code => 'UnsupportedSchema' }; } - my $records; + my @records; # Let's loop over the authority IDs foreach my $authid ( split( / /, $cgi->param('id') ) ) { # Get the record as XML string, or error code - my $record = GetAuthorityXML($authid) || "RecordNotFound"; - $record =~ s/<\?xml(.*)\?>//go; - $records .= $record; + push @records, GetAuthorityXML($authid) || { code => 'RecordNotFound' }; } - return $records; + return { record => \@records }; } =head2 LookupPatron diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt index 765febc164..acd12588eb 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt @@ -120,6 +120,7 @@ <biblioitemnumber>1</biblioitemnumber> <isbn>9782862749198</isbn> <marcxml> + <?xml version="1.0" encoding="UTF-8" ?> <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd" @@ -208,6 +209,7 @@ <biblioitemnumber>2</biblioitemnumber> <isbn>9782265078031</isbn> <marcxml> + <?xml version="1.0" encoding="UTF-8" ?> <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd" @@ -316,41 +318,39 @@ ilsdi.pl?service=GetAuthorityRecords&id=1+2+99999

Example Response

-
<?xml version="1.0" encoding="ISO-8859-1" ?>
+
<xml version="1.0" encoding="UTF-8">;
 <GetAuthorityRecords>
+  <record>
+    <?xml version="1.0" encoding="UTF-8"?>
   <record
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd"
     xmlns="http://www.loc.gov/MARC21/slim">
-    <leader>00126nx  j2200073   4500 </leader>
+      <leader>00182     2200085   4500</leader>
     <controlfield tag="001">1</controlfield>
-    <datafield tag="250" ind1=" " ind2=" ">
-      <subfield code="a">TECHNIQUE</subfield>
+      <datafield tag="200" ind1=" " ind2=" ">
+        <subfield code="a">Hugo</subfield>
+        <subfield code="b">Victor</subfield>
     </datafield>
-    <datafield tag="100" ind1=" " ind2=" ">
-      <subfield code="a">20071210afrey50      ba0</subfield>
-    </datafield>
-    <datafield tag="152" ind1=" " ind2=" ">
-      <subfield code="b">NC</subfield>
-    </datafield>
-  </record>
-  <record
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd"
-    xmlns="http://www.loc.gov/MARC21/slim">
-    <leader>00130nx  j2200073   4500 </leader>
-    <controlfield tag="001">2</controlfield>
-    <datafield tag="250" ind1=" " ind2=" ">
-      <subfield code="a">CHEMIN DE FER</subfield>
+      <datafield tag="801" ind1=" " ind2=" ">
+        <subfield code="a">France</subfield>
+        <subfield code="b">Nimes</subfield>
+        <subfield code="c">2010/04/13</subfield>
     </datafield>
     <datafield tag="100" ind1=" " ind2=" ">
-      <subfield code="a">20071210afrey50      ba0</subfield>
+        <subfield code="a">20100413     50                    </subfield>
     </datafield>
     <datafield tag="152" ind1=" " ind2=" ">
-      <subfield code="b">NC</subfield>
+        <subfield code="b">NP</subfield>
     </datafield>
   </record>
-  <record>RecordNotFound</record>
+  </record>
+  <record>
+    <code>RecordNotFound</code>
+  </record>
+  <record>
+    <code>RecordNotFound</code>
+  </record>
 </GetAuthorityRecords>
[% ELSIF ( LookupPatron ) %] diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl index 56058f0e72..48fd7ba209 100755 --- a/opac/ilsdi.pl +++ b/opac/ilsdi.pl @@ -233,7 +233,6 @@ print CGI::header('-type'=>'text/xml', '-charset'=>'utf-8'); print XMLout( $out, noattr => 1, - noescape => 1, nosort => 1, xmldecl => '', RootName => $service, -- 2.39.5