https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33350 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #148796|0 |1 is obsolete| | --- Comment #3 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 201637 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201637&action=edit Fix greedy regex in repeat_enclosing_tags — non-greedy while loop processes each block independently. Includes unit test. The root cause is a greedy .* in GetPreparedLetter's repeat_enclosing_tags block (C4/Letters.pm). When a template has multiple <item> blocks (e.g. bilingual ODUE with one block per language), the greedy match consumes from the first <item> to the last </item>, merging all blocks and swallowing the text between them. Fix: non-greedy .*? in a while loop — each block matched and expanded independently. Tested manually in a local instance against a customized ODUE email template with the pattern English + Spanish <item> blocks. Re Lucas's comment: yes, TT's [% FOREACH item IN items %]...[% END %] can do this, but it uses a different code path in GetPreparedLetter (the loops parameter, not repeat). The <item>...</item> syntax is the legacy/historical notice format and both coexist. Many production templates rely on this syntax. Migrating them all to TT would be a separate, potentially breaking effort. Re the unit test request: included. New subtest in t/db_dependent/Letters.t — "Bug 33350 - repeat_enclosing_tags expands each block independently" — creates a template with two <item> blocks, calls GetPreparedLetter with two pre-resolved item hashrefs, and asserts each block is expanded independently with all items. Greetings, Adolfo. -- You are receiving this mail because: You are watching all bug changes.