https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44218

--- Comment #2 from Frédéric Demians <[email protected]> ---
Created attachment 212298
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212298&action=edit
Bug 44218: Do not HTML-escape values copied by unimarc_field_4XX.pl

When a UNIMARC record is linked to another record with the 4XX
cataloguing plugin (unimarc_field_4XX.pl), some subfields of the linked
record (200$a, 200$e, 200$f, 210$c, etc.) are copied into the 4XX field
being edited. The template injects these values into a JavaScript
string with:

    subfield.value = "[% To.json( subfield_value_t ) | html %]";

To.json already escapes the value for a JavaScript string. The extra
html filter turns & into &amp; and " into &quot;, and those entities
are copied as-is into the subfield and saved in the record. On some
distributions (for instance Ubuntu 22.04) the html filter of Template
Toolkit also turns ' into &#39;, so every title with an apostrophe is
corrupted too.

This patch uses the $raw filter instead, as is done everywhere else
To.json is used inside a script.

Test plan:
1. Use a UNIMARC installation.
2. Create or edit a record A whose title (200$a) is:
     L'art "roman" & gothique
3. Create a new record B and link it to A in 463 using the 4XX plugin
   (click the "..." of 463, search for A, click "Choose").
4. Look at 463$t in record B
   => It contains &amp; and &quot; (and &#39; on some systems)
5. Apply the patch.
6. Repeat 3.
   => 463$t contains exactly: L'art "roman" & gothique
7. prove t/db_dependent/cataloguing/value_builder/unimarc_field_4XX.t
   => PASS

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to