Bug 26989

Summary: Ensure no CR occurs in an EDIFACT order message
Product: Koha Reporter: Colin Campbell <colin.campbell>
Component: AcquisitionsAssignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact: Kyle M Hall <kyle>
Severity: normal    
Priority: P5 - low CC: andrewfh, fridolin.somers, kyle, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12
Attachments: Patch to remove unwanted CRs etc from ORDER message
Bug 26989: Safeguard Order Messages from unwanted characters
Bug 26989: Safeguard Order Messages from unwanted characters

Description Colin Campbell 2020-11-10 14:18:55 UTC
It is possible that a Carriage Return may occur in a field derived from a Koha note or shelfmark. If it persists in the message it can cause some parser software to truncate the message. Add a safeguard that no CRs persist in the generated message
Comment 1 Colin Campbell 2020-11-10 14:41:03 UTC
Created attachment 113414 [details] [review]
Patch to remove unwanted CRs etc from ORDER message

Substitution should remove any unwanted characters from message in final formatting.

In production at a site who helpfully(?) were adding CR after all notes and in some shelfmarks.

Trivial code change
Comment 2 Owen Leonard 2021-04-15 15:14:27 UTC
Created attachment 119637 [details] [review]
Bug 26989: Safeguard Order Messages from unwanted characters

Carriage returns in notes were causing a supplier's parser
to truncate Order messages received from Koha.
Have removed those and also made a global removal of CR, Line feeds
and tabs - the latter two having the possibility of causing
errors in the future

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

There was no test plan to follow, but the patch appears to be making
sensible changes. If someone wants to provide a thorough test plan I can
re-test.
Comment 3 Martin Renvoize 2021-04-16 15:13:09 UTC
Grr, this is another one where I've spent some time trying to work out how to write a unit test for the change but completely failed.. leaving for another QA person to take a look and comment.
Comment 4 Kyle M Hall 2021-04-16 16:31:05 UTC
Created attachment 119765 [details] [review]
Bug 26989: Safeguard Order Messages from unwanted characters

Carriage returns in notes were causing a supplier's parser
to truncate Order messages received from Koha.
Have removed those and also made a global removal of CR, Line feeds
and tabs - the latter two having the possibility of causing
errors in the future

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

There was no test plan to follow, but the patch appears to be making
sensible changes. If someone wants to provide a thorough test plan I can
re-test.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Jonathan Druart 2021-04-21 08:46:41 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 6 Fridolin Somers 2021-04-29 09:45:48 UTC
Pushed to 20.11.x for 20.11.06
Comment 7 Andrew Fuerste-Henry 2021-05-24 15:29:21 UTC
Pushed to 20.05.x for 20.05.12
Comment 8 Victor Grousset/tuxayo 2021-05-24 16:57:35 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.