-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse MT940 loses data when new line ist between code-characters #98
Comments
I cannot reproduce your issue. So far, I haven't looked at your proposed fix, but I'm happy to do so once I understand the issue. Are you testing with the latest released version (1.0.4) or the code in the master branch? I copied the current
In particular, the What am I missing? |
@Makku01 Could you try https://github.com/nemiah/phpFinTS? I just made some fixes concerning a similar problem. |
@Philipp91 Please try your GIST without the charcters for the new line as in:
As you'll see, the Account Number is empty. PS: Sorry for the delayed reply! |
166?00GUTSCHRIFT?109251?20SVWZ+Rechnung xxx?30DEUTDEDB276?3 1DE1127xxxxx40011xxxxxx?32Testfirma GmbH
This is the description in the MT940 Class as it enters the function
protected function parseDescription($descr)
As you see, after the BIC the code for accountnumber is splitted by a newline:
xxxx?3[new line]1
So the parser can't parse the accountnumber and it's displayed as empty.
I've added the following to line 155 ofMT940.php
//search for newlines in codes from 10-63 and remove them foreach($prepared as $key => $value){ $keystring = (string) $key; if(strlen ($keystring) == 2){ $first = substr($keystring,0,1); $last = substr($keystring,-1,1); $descr = str_replace("$first\r\n$last", "$first$last", $descr); } }
This will remove the newlines in all codes with two digits from 10 to 63.
As I'm not a php expert, this code is working for me and i'd like know wether it is suitable!
The text was updated successfully, but these errors were encountered: