Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheme and List attributes present causes Warnings #64

Open
DemigodCode opened this issue Mar 14, 2024 · 2 comments
Open

Scheme and List attributes present causes Warnings #64

DemigodCode opened this issue Mar 14, 2024 · 2 comments

Comments

@DemigodCode
Copy link

Is there any reason why those attributes are at e.g. TaxCategory ID?

All Validators are warning that that should not be present.

I can't upload the file to two Peppol Access Points.

@TSimkus
Copy link

TSimkus commented Mar 23, 2024

Hey @DemigodCode

Are you talking about this in TaxCategory?

public function setId(?string $id, $attributes = null): TaxCategory
{
$this->id = $id;
if (isset($attributes)) {
$this->idAttributes = $attributes;
}
return $this;
}

If so, at least I, do not see any references in the documentation that these attributes should be set.
But for now, you can pass an empty array for the $attribute parameter when setting id as a workaround:

$taxCategory = (new TaxCategory)
            ->setId(UNCL5305::STANDARD_RATE, [])

@kouinkouin
Copy link

Hello,

@DemigodCode , are you talking about the warning UBL-CR-678 ("A UBL invoice should not include the TaxCategory/ID schemeID")?
I use this document as reference: https://docs.peppol.eu/poacc/billing/3.0/2023-Q4/bis/ , you can search "UBL-CR-678".
I use this validator to validate my XML's: https://www.ubl.be/validator/ .

If yes, to solve this warning, I update the class NumNum\UBL\TaxScheme::xmlSerialize():

@@ -92,9 +92,11 @@ class TaxScheme implements XmlSerializable
      */
     public function xmlSerialize(Writer $writer): void
     {
-        $writer->write([
-            Schema::CBC . 'ID' => $this->id
-        ]);
+        if ($this->id !== null) {
+            $writer->write([
+                Schema::CBC . 'ID' => $this->id
+            ]);
+        }
         if ($this->name !== null) {
             $writer->write([
                 Schema::CBC . 'Name' => $this->name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants