Giter Site home page Giter Site logo

Comments (9)

johanib avatar johanib commented on July 22, 2024 1

@sabas
I created this pr:
#135

I did some small refactoring to reduce the amount of nested if/else constructions.
Please let me know if you have any comments.

from edifact.

sabas avatar sabas commented on July 22, 2024 1

The processs doesn't exist actually, in my projects I use directly the master branch 🤣
I usually do it after someone reminds me to do it... I'll tag 1.1 in a few hours!

from edifact.

iGrog avatar iGrog commented on July 22, 2024

unwrap function in Reader removes CR+LF+0x00, but unwrap in Parser doesn't:

$string = \preg_replace('#[\x00\r\n]#', '', $string);

Is that how it should be?

https://github.com/php-edifact/edifact/blob/master/src/EDI/Reader.php#L557

https://github.com/php-edifact/edifact/blob/master/src/EDI/Parser.php#L467

from edifact.

sabas avatar sabas commented on July 22, 2024

Hi, your input EDI has a line-break inside the segment, it shouldn't be valid as the linebreak character isn't in the UNOB charset...
I modified the Parser to add a feature to detect an error where there's no segment terminator in files that are formatted with one segment per line.
If you pass ->setStrict(true) to the Parser instance before running it on the edi it reverts to the previous behaviour... @johanib
@iGrog I believe the unwrap function in Reader is a version of more than 5 years ago of the same function in Parser :-D
Reader and Analyser need some refactoring probably....

from edifact.

johanib avatar johanib commented on July 22, 2024

@sabas Thanks! I'm not sure how I missed ->setStrict(true), but it solves my linebreak issue 😅

One more thing I don't understand, given these EDI segments:

FTX+AAI+++PLS ENSURE TO TAKE OUR APPROVAL PRIOR STUFFING ANY NON HAZ CHEMICA:LS'
FTX+ABV+++THIS BOOKING CONFIRMATION IS SUBJECT TO SEALING'
FTX+AAI+++THE SHIPPER SHALL NOT BE RESPONSIBLE FOR ANY COSTS/DELAYS OCCUR

I really can't figure out how to extract the FTX+AAI segments...
Do you know if this library is capable of reading these segments?
It seems it always returns with the error 'Segment is ambiguous'.

I wrote some hacky solution to accomplish this and a test to illustrate what I expect as output:
https://github.com/johanib/edifact/pull/1/files

from edifact.

sabas avatar sabas commented on July 22, 2024

What about returning you an array of results instead of null? Would it make sense? Are you using Reader to extract specific information?

from edifact.

johanib avatar johanib commented on July 22, 2024

For my purposes I do not need to extract the individual FTX+AAI segments.
But afaik, the readEdiDataValue function is build on the idea that the caller specifies what it wants to read, so I added the $offset parameter.

Returning an array would work for my case.

There are also some checks at the bottom of the readEdiDataValue function. They would need to be looped if the function would start to return arrays. So I'm not sure if that will make it better.

I can probably improve my initial suggestion to make it more nice if you think it's a good addition.

from edifact.

sabas avatar sabas commented on July 22, 2024

Of course, feel free to send a PR :)

from edifact.

johanib avatar johanib commented on July 22, 2024

🎊
Just a question: What is the release process like?
I see the latest tag / composer package is from October last year.
Can we release this version? :)

from edifact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.