Skip to content

Commit 452e723

Browse files
committed
Edit pull request to not show empty elements in UNB
1 parent b0dfa8b commit 452e723

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

src/Generator/Interchange.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ public function compose()
117117
$composedMessages[] = $msgContent;
118118
}
119119

120-
$applicationReference = $this->appref;
121-
if ($applicationReference === null && isset($composedMessages[0][0][2][0])) {
122-
$applicationReference = (string) $composedMessages[0][0][2][0];
120+
if ($this->appref === null && isset($composedMessages[0][0][2][0])) {
121+
$this->appref = (string) $composedMessages[0][0][2][0];
123122
}
124123

125124
$unb = [
@@ -131,12 +130,8 @@ public function compose()
131130
$this->interchangeCode,
132131
];
133132

134-
if ($applicationReference !== null && $applicationReference !== '') {
135-
$unb[] = $applicationReference;
136-
$unb[] = [];
137-
$unb[] = [];
138-
$unb[] = [];
139-
$unb[] = [];
133+
if ($this->appref !== null && $this->appref !== '') {
134+
$unb[] = $this->appref;
140135
}
141136

142137
$temp[] = $unb;

tests/GeneratorTest/OrdersCompatibilityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function test_interchange_uses_first_message_identifier_as_default_applic
9090

9191
$message = $this->encodeOrders($orders);
9292

93-
self::assertStringContainsString('+QUOTES++++\'UNH+', $message);
93+
self::assertStringContainsString('+QUOTES\'UNH+', $message);
9494
}
9595

9696
public function test_nad_segments_trim_trailing_empty_components_when_only_identifier_is_provided(): void

0 commit comments

Comments
 (0)