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.
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