Skip to content

Commit

Permalink
add PIA for item
Browse files Browse the repository at this point in the history
  • Loading branch information
Mads Møller committed Apr 26, 2019
1 parent b7549e4 commit 9ac3aca
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Generator/Orders/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* Class Item
* @package EDI\Generator\Ordrsp
* @package EDI\Generator\Orders
*/
class Item extends Base
{
Expand Down
33 changes: 32 additions & 1 deletion src/Generator/traits/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
*/
trait Item
{

/** @var array */
protected $position;

/** @var array */
protected $additionalProductId;

/** @var array */
protected $quantity;

Expand Down Expand Up @@ -52,6 +54,7 @@ trait Item
protected $composeKeys
= [
'position',
'additionalProductId',
'quantity',
'deliveryNoteDate',
'orderNumberWholesaler',
Expand Down Expand Up @@ -99,6 +102,34 @@ public function setPosition($position, $articleNumber, $numberType = 'MF')
return $this;
}

/**
* @return array
*/
public function getAdditionalProductId()
{
return $this->additionalProductId;
}

/**
* @param string $identifier
* @param string $qualifier
* @param string $code
* @return $this
*/
public function setAdditionalProductId(string $identifier, string $qualifier = '1', string $code = 'SRV')
{
$this->additionalProductId = [
'PIA',
$qualifier,
[
$identifier,
$code
]
];

return $this;
}

/**
* @return array
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/GeneratorTest/OrdersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public function testOrders96AEancom()
'313122',
'EN'
)
->setAdditionalProductId('1', '313322', 'SA')
->setQuantity('213')
->setGrossPrice(22.12);
$orders->addItem($item);
Expand All @@ -173,7 +174,7 @@ public function testOrders96AEancom()
$message = str_replace("'", "'\n", $encoder->get());
//fwrite(STDOUT, "\n\nORDERS\n" . $message);

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

0 comments on commit 9ac3aca

Please sign in to comment.