Koha-clms/Koha/Edifact
Martin Renvoize 9d39d80801
Bug 42010: Escape EDIFACT special characters in BGM purchase order number
Bug 20253 introduced the ability to use the basket name as a purchase order
number in the BGM segment of an EDIFACT order message. However, the basket
name was inserted into the BGM segment without escaping EDIFACT special
characters (apostrophe, colon, plus, question mark).

In EDIFACT, the apostrophe (') is the segment terminator, so any literal
apostrophe in data must be escaped with the release character (?) as ?'.
Without this, a basket name like "Children's Requests" would produce an
invalid EDIFACT message.

This fix applies encode_text() to the purchase order number in
beginning_of_message() so all special characters are properly escaped.

Test plan:
- Run t/db_dependent/Koha/Edifact/Order.t
- All tests should pass, including the new tests covering special character
  escaping in BGM segments

Signed-off-by: Graham Jones <GrahamJ@askewsandholts.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-24 15:35:34 +01:00
..
File Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
File.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Files.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Line.pm Bug 40391: Add support for GIR:LSL (Library Sub-Location) in EDIFACT processing 2026-01-12 10:53:29 -07:00
Message.pm Bug 20253: Optionally use buyer's purchase order number from EDIFACT quote as basket name 2025-11-03 14:13:37 -07:00
Order.pm Bug 42010: Escape EDIFACT special characters in BGM purchase order number 2026-03-24 15:35:34 +01:00
Segment.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Transport.pm Bug 38489: Update Koha::Edifact::Transport to use new file transport system 2025-10-14 14:51:48 -06:00