Skip to content

Commit 9ac3aca

Browse files
author
Mads Møller
committed
add PIA for item
1 parent b7549e4 commit 9ac3aca

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

src/Generator/Orders/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* Class Item
9-
* @package EDI\Generator\Ordrsp
9+
* @package EDI\Generator\Orders
1010
*/
1111
class Item extends Base
1212
{

src/Generator/traits/Item.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
*/
1212
trait Item
1313
{
14-
1514
/** @var array */
1615
protected $position;
1716

17+
/** @var array */
18+
protected $additionalProductId;
19+
1820
/** @var array */
1921
protected $quantity;
2022

@@ -52,6 +54,7 @@ trait Item
5254
protected $composeKeys
5355
= [
5456
'position',
57+
'additionalProductId',
5558
'quantity',
5659
'deliveryNoteDate',
5760
'orderNumberWholesaler',
@@ -99,6 +102,34 @@ public function setPosition($position, $articleNumber, $numberType = 'MF')
99102
return $this;
100103
}
101104

105+
/**
106+
* @return array
107+
*/
108+
public function getAdditionalProductId()
109+
{
110+
return $this->additionalProductId;
111+
}
112+
113+
/**
114+
* @param string $identifier
115+
* @param string $qualifier
116+
* @param string $code
117+
* @return $this
118+
*/
119+
public function setAdditionalProductId(string $identifier, string $qualifier = '1', string $code = 'SRV')
120+
{
121+
$this->additionalProductId = [
122+
'PIA',
123+
$qualifier,
124+
[
125+
$identifier,
126+
$code
127+
]
128+
];
129+
130+
return $this;
131+
}
132+
102133
/**
103134
* @return array
104135
*/

tests/GeneratorTest/OrdersTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public function testOrders96AEancom()
150150
'313122',
151151
'EN'
152152
)
153+
->setAdditionalProductId('1', '313322', 'SA')
153154
->setQuantity('213')
154155
->setGrossPrice(22.12);
155156
$orders->addItem($item);
@@ -173,7 +174,7 @@ public function testOrders96AEancom()
173174
$message = str_replace("'", "'\n", $encoder->get());
174175
//fwrite(STDOUT, "\n\nORDERS\n" . $message);
175176

176-
$this->assertStringContainsString('UNT+26', $message);
177+
$this->assertStringContainsString('UNT+27', $message);
177178
} catch (EdifactException $e) {
178179
fwrite(STDOUT, "\n\nORDERS\n" . $e->getMessage());
179180
}

0 commit comments

Comments
 (0)