Bug 23251

Summary: EDI Order line incorrectly terminated when it ends with a quoted apostrophe
Product: Koha Reporter: Colin Campbell <colin.campbell>
Component: AcquisitionsAssignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: emma.ternrud, fridolin.somers, hayleypelham, lucas
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.03
Attachments: Patch and test
Bug 23251 Correct formatting of IMD data ending in apostrophe
Bug 23251: Correct formatting of IMD data ending in apostrophe
Bug 23251: Correct formatting of IMD data ending in apostrophe

Description Colin Campbell 2019-07-02 09:48:56 UTC
Apostrophe is used to terminate segments in Edifact orders. Therefore if appearing in the data it is quoted - Code should not assume that a quoted apostrophe is a valid segment terminator

e.g.
LIN+4++9781471186684:EN'
IMD+L+009+:::Newton-John, Olivia'
IMD+L+050+:::Don?'t stop believin?'
IMD+L+109+:::Simon & Schuster'
QTY+21:1'
GIR+001+001:LFN+CRO:LLO+BAH:LST+920 NEW:LSM'
PRI+AAE:20.00:CA'
RFF+LI:93323'
RFF+QLI:OTM88093/00004'
  
The IMD 050 line is incorrectly formed it should end believin?''
Comment 1 Colin Campbell 2019-07-02 15:14:42 UTC
Created attachment 91188 [details] [review]
Patch and test

To test apply the patch and tests should still pass including new test for correct behaviour when data ends with apostrophe
Comment 2 Hayley Pelham 2019-07-25 23:08:18 UTC
Created attachment 91782 [details] [review]
Bug 23251 Correct formatting of IMD data ending in apostrophe

IMD text data may end in an apostrophe (e.g. dreamin' )
This was causing the segment to be incorrectly formatted
as only the last character was checked, not the preceding
character to check whether it was quoted

add a test for this specific occurence

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 3 Hayley Pelham 2019-07-25 23:12:50 UTC
Created attachment 91783 [details] [review]
Bug 23251: Correct formatting of IMD data ending in apostrophe

IMD text data may end in an apostrophe (e.g. dreamin' )
This was causing the segment to be incorrectly formatted
as only the last character was checked, not the preceding
character to check whether it was quoted

add a test for this specific occurence

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 4 Hayley Pelham 2019-07-25 23:13:21 UTC
Hi Colin,

I've signed off the patch, but have a look here at the guidelines for patches:
https://wiki.koha-community.org/wiki/Commit_messages#Good_commit_messages

Namely, the commit message and the Bugzilla message should be the same, and the patch message should contain Bug XXXX: in the subject heading.

Thanks for contributing! And do let me know if you have any questions about the above :)
Comment 5 Kyle M Hall 2019-07-26 14:51:57 UTC
Created attachment 91814 [details] [review]
Bug 23251: Correct formatting of IMD data ending in apostrophe

IMD text data may end in an apostrophe (e.g. dreamin' )
This was causing the segment to be incorrectly formatted
as only the last character was checked, not the preceding
character to check whether it was quoted

add a test for this specific occurence

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Martin Renvoize 2019-07-26 15:19:28 UTC
Nice work!

Pushed to master for 19.11.00
Comment 7 Fridolin Somers 2019-08-09 12:55:06 UTC
Pushed to 19.05.x for 19.05.03
Comment 8 Lucas Gass 2019-09-03 21:29:45 UTC
backported to 18.11.x for 18.11.10