Skip to content

Commit

Permalink
Fix for activities starting with (int) 0, pad left with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
liagkos committed Jul 12, 2018
1 parent f807d30 commit d0d0b0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ $reply = $client->exec($params);
{
"code":5200000,
"descr":"ΕΞΟΡΥΞΗ ΛΙΓΝΙΤΗ",
"formatted":"52.00.00.0"
"formatted":"05.20.00.00"
},
{
"code":35111000,
Expand Down
2 changes: 2 additions & 0 deletions src/Vatidinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ private function parseActivities($activities, $separator)
*/
private function formatActivity($activity, $separator)
{
// Fix for activities starting with 0, not displayed in (int) format
$activity = str_pad($activity, 8, '0', STR_PAD_LEFT);
return substr($activity, 0, 2) . $separator .
substr($activity, 2,2) . $separator .
substr($activity, 4,2) . $separator .
Expand Down

0 comments on commit d0d0b0e

Please sign in to comment.