Closed memisibram closed 8 months ago
Thanks for the heads up.
I think the real problem is that the XMWriter is processing null values where it should not. Can you please verify that after this change you get the expected results?
Method Firebed\AadeMyData\Xml\XMLWriter::build (line 23)
protected function build(DOMNode $parent, string $nodeName, mixed $nodeValue, $namespace = null): void
{
if (is_null($nodeValue)) { // <-- Add this check here
return;
}
if ($nodeValue instanceof Type) {
$this->buildType($parent, $nodeName, $nodeValue);
return;
}
if (is_array($nodeValue)) {
$this->buildArray($parent, $nodeName, $nodeValue);
return;
}
$namespaceURI = $this->getNamespace($namespace);
$child = $this->createElement($nodeName, $this->toValue($nodeValue), $namespaceURI);
$parent->appendChild($child);
}
I tried but it didn't work
invoice Details section
["invoiceDetails"]
["incomeClassification"]=>
array(1) {
[0]=>
object(Firebed\AadeMyData\Models\IncomeClassification)#106 (3) {
["attributes":protected]=>
array(2) {
["classificationCategory"]=>
enum(Firebed\AadeMyData\Enums\IncomeClassificationCategory::CATEGORY_3)
["amount"]=>
float(0)
}
}
}
invoice Summary section
`["invoiceSummary"]
["incomeClassification"]=>
array(1) {
[0]=>
object(Firebed\AadeMyData\Models\IncomeClassification)#131 (3) {
["attributes":protected]=>
array(3) {
["classificationType"]=> //< --This classificationType is redundant
NULL
["classificationCategory"]=>
enum(Firebed\AadeMyData\Enums\IncomeClassificationCategory::CATEGORY_3)
["amount"]=>
float(0)
}
}
}
must be invoice Summary section
["invoiceSummary"]
["incomeClassification"]=>
array(1) {
[0]=>
object(Firebed\AadeMyData\Models\IncomeClassification)#131 (3) {
["attributes":protected]=>
array(2) {
["classificationCategory"]=>
enum(Firebed\AadeMyData\Enums\IncomeClassificationCategory::CATEGORY_3)
["amount"]=>
float(0)
}
}
}
That's the expected behavior. With the change I suggested though, the classificationType
may be included in the type's attributes
array with null value, but it will not be included in the xml.
Yes, as you said, it is not included in the xml. I tried it in developer mode and it sends the document, no problem, thank you.
Thanks for the v1.0.8 updates. First of all, summarizeInvoice() was very necessary, but there is a small error. If the document is only a transport document, that is, InvoiceType: 9.3, setClassificationType should not be sent because it does not update E3. In this document type, we only need to declare ClassificationCategory(IncomeClassificationCategory::CATEGORY_3) and setAmount(0).
For now, I changed the 50th line of firebed\aade-mydata\src\Actions\GroupClassifications.php to this way.
if($type != null) $icls->setClassificationType($type);
everything seems okay.