|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of riesenia/pohoda package. |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the MIT License |
|
7
|
|
|
* (c) RIESENIA.com |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
declare(strict_types=1); |
|
11
|
|
|
|
|
12
|
|
|
namespace Riesenia\Pohoda\Supplier; |
|
13
|
|
|
|
|
14
|
|
|
use Riesenia\Pohoda\AbstractAgenda; |
|
15
|
|
|
use Riesenia\Pohoda\Common\OptionsResolver; |
|
16
|
|
|
|
|
17
|
|
|
class SupplierItem extends AbstractAgenda |
|
18
|
|
|
{ |
|
19
|
|
|
/** @var string[] */ |
|
20
|
|
|
protected array $refElements = ['refAd', 'currency', 'deliveryPeriod']; |
|
21
|
|
|
|
|
22
|
|
|
/** @var string[] */ |
|
23
|
|
|
protected array $elements = ['default', 'refAd', 'orderCode', 'orderName', 'purchasingPrice', 'currency', 'rate', 'payVAT', 'ean', 'printEAN', 'unitEAN', 'unitCoefEAN', 'deliveryTime', 'deliveryPeriod', 'minQuantity', 'unit', 'note']; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* {@inheritdoc} |
|
27
|
|
|
*/ |
|
28
|
1 |
|
public function getXML(): \SimpleXMLElement |
|
29
|
|
|
{ |
|
30
|
1 |
|
$xml = $this->createXML()->addChild('sup:supplierItem', '', $this->namespace('sup')); |
|
31
|
|
|
|
|
32
|
|
|
// handle default |
|
33
|
1 |
|
if ($this->data['default']) { |
|
34
|
1 |
|
$xml->addAttribute('default', strval($this->data['default'])); |
|
35
|
1 |
|
unset($this->data['default']); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
$this->addElements($xml, $this->elements, 'sup'); |
|
39
|
|
|
|
|
40
|
1 |
|
return $xml; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* {@inheritdoc} |
|
45
|
|
|
*/ |
|
46
|
1 |
|
protected function configureOptions(OptionsResolver $resolver): void |
|
47
|
|
|
{ |
|
48
|
|
|
// available options |
|
49
|
1 |
|
$resolver->setDefined($this->elements); |
|
50
|
|
|
|
|
51
|
1 |
|
$resolver->setNormalizer('default', $this->normalizerFactory->getClosure('bool')); |
|
52
|
1 |
|
$resolver->setNormalizer('orderCode', $this->normalizerFactory->getClosure('string64')); |
|
53
|
1 |
|
$resolver->setNormalizer('orderName', $this->normalizerFactory->getClosure('string90')); |
|
54
|
1 |
|
$resolver->setNormalizer('purchasingPrice', $this->normalizerFactory->getClosure('number')); |
|
55
|
1 |
|
$resolver->setNormalizer('rate', $this->normalizerFactory->getClosure('float')); |
|
56
|
1 |
|
$resolver->setNormalizer('payVAT', $this->normalizerFactory->getClosure('bool')); |
|
57
|
1 |
|
$resolver->setNormalizer('ean', $this->normalizerFactory->getClosure('string20')); |
|
58
|
1 |
|
$resolver->setNormalizer('printEAN', $this->normalizerFactory->getClosure('bool')); |
|
59
|
1 |
|
$resolver->setNormalizer('unitEAN', $this->normalizerFactory->getClosure('string10')); |
|
60
|
1 |
|
$resolver->setNormalizer('unitCoefEAN', $this->normalizerFactory->getClosure('float')); |
|
61
|
1 |
|
$resolver->setNormalizer('deliveryTime', $this->normalizerFactory->getClosure('int')); |
|
62
|
1 |
|
$resolver->setNormalizer('minQuantity', $this->normalizerFactory->getClosure('float')); |
|
63
|
1 |
|
$resolver->setNormalizer('unit', $this->normalizerFactory->getClosure('string10')); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|