Open haltuf opened 1 year ago
Vyřešil jsem takto:
1/ vytvořením nového Riesenia\Pohoda\Invoice\RecyclingContrib
(defacto kopie ze Stock):
<?php declare(strict_types=1);
namespace Riesenia\Pohoda\Invoice;
use Riesenia\Pohoda\Agenda;
use Riesenia\Pohoda\Common\OptionsResolver;
class RecyclingContrib extends Agenda
{
/** @var string[] */
protected $_refElements = ['recyclingContribType'];
/** @var string[] */
protected $_elements = ['recyclingContribType', 'recyclingContribText', 'recyclingContribAmount', 'recyclingContribUnit', 'coefficientOfRecyclingContrib'];
/**
* {@inheritdoc}
*/
public function getXML(): \SimpleXMLElement
{
$xml = $this->_createXML()->addChild('inv:recyclingContrib', '', $this->_namespace('inv'));
$this->_addElements($xml, $this->_elements, 'typ');
return $xml;
}
/**
* {@inheritdoc}
*/
protected function _configureOptions(OptionsResolver $resolver)
{
// available options
$resolver->setDefined($this->_elements);
$resolver->setNormalizer('recyclingContribType', $resolver->getNormalizer('string32'));
$resolver->setNormalizer('recyclingContribText', $resolver->getNormalizer('string90'));
$resolver->setNormalizer('recyclingContribAmount', $resolver->getNormalizer('float'));
$resolver->setNormalizer('recyclingContribUnit', $resolver->getNormalizer('string2'));
$resolver->setNormalizer('coefficientOfRecyclingContrib', $resolver->getNormalizer('float'));
}
}
2/ úpravou Riesenia\Pohoda\Invoice\Item
protected $_elements = ['text', 'quantity', 'unit', 'coefficient', 'payVAT', 'rateVAT', 'percentVAT', 'discountPercentage', 'homeCurrency', 'foreignCurrency', 'typeServiceMOSS', 'note', 'code', 'guarantee', 'guaranteeType', 'stockItem', 'accounting', 'classificationVAT', 'classificationKVDPH', 'centre', 'activity', 'contract', 'expirationDate', 'PDP', 'recyclingContrib'];
a
public function __construct(array $data, string $ico, bool $resolveOptions = true)
{
if (isset($data['recyclingContrib'])) {
$data['recyclingContrib'] = new RecyclingContrib($data['recyclingContrib'], $ico, $resolveOptions);
}
parent::__construct($data, $ico, $resolveOptions);
}
Omlouvám se, že neposílám rovnou PR, ale řešil jsem velmi narychlo.
zdravim. budete mat priestor na toto spravit pr?
@segy zkusím v pátek.
kedykolvek :)
RP lze zadat i přímo do faktury:
XML requestu pak vypadá takto: