Bug 42010 - Include escaping when using PO numbers in EDI acqusitions
Summary: Include escaping when using PO numbers in EDI acqusitions
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on: 20253
Blocks: 38195
  Show dependency treegraph
 
Reported: 2026-03-06 10:25 UTC by Martin Renvoize (ashimema)
Modified: 2026-03-06 10:30 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Unsponsored
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 42010: Escape EDIFACT special characters in BGM purchase order number (5.04 KB, patch)
2026-03-06 10:30 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2026-03-06 10:25:11 UTC
In bug #20253 we added support for using PO numbers as basket names.. we neglected to add escaping to the resulting basketnames that could then be used in corresponding orders.

This bug servers to add that escaping as a follow-up to the original enhancement.
Comment 1 Martin Renvoize (ashimema) 2026-03-06 10:30:16 UTC
Created attachment 194624 [details] [review]
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