edifact-mapping icon indicating copy to clipboard operation
edifact-mapping copied to clipboard

`MappingProvider::loadCodesXml()` should return `title` instead of `desc` values (or both)

Open DuaelFr opened this issue 2 months ago • 3 comments

Hi! Thanks for this very useful package!

I was trying to decode a DTM message and hoped to get the date format in the codes returned by the loadCodesXml() method but only found the description which is not as useful.

Do you thing this method should return both the title and the desc values of the codes or that we should have a different dedicated method to get the titles?

DuaelFr avatar Nov 05 '25 17:11 DuaelFr

can you clarify with an example of what you want to extract?

sabas avatar Nov 06 '25 14:11 sabas

@sabas Thank you for your reply!

For example, in src/Mapping/D00B/codes.xml, the <data_element id="2379"> contains the date format used in its elements' title attributes. I'd like to be able to get those values instead of the desc attribute content which doesn't help me parse the date value I am given in the EDI file.

It could also be useful when building some kind of UI to display data. Eg. the titles from <data_element id="2155"> could help display something like "XXX € Per day".

DuaelFr avatar Nov 19 '25 08:11 DuaelFr

@DuaelFr understood! I tweaked loadCodesXml with an optional parameter, if you pass true you get an array instead of plainly desc

sabas avatar Nov 20 '25 10:11 sabas