CleverIT / UBL_invoice

MIT License
36 stars 39 forks source link

version 2.0 vs 2.1 #15

Closed boflor closed 5 years ago

boflor commented 5 years ago

This library seems to be generating versio 2.0 UBL files, is that correct? The current standard is 2.1. Is there a difference between both versions or can you just modify it to 2.1?

homer8173 commented 5 years ago

i've done a test here : https://peppol.helger.com/public/locale-en_US/menuitem-validation-bis2 and my 2.1 file succeed on 2.2 test

homer8173 commented 5 years ago

here is my generator :

class Generator
{
    public static $currencyID;

    public static function invoice(Invoice $invoice, $currencyId = 'EUR')
    {
        self::$currencyID = $currencyId;

        $xmlService = new Service();

        $xmlService->namespaceMap = [
            "urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" => 'qdt',
            "urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2" => 'ccts',
            "urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0" => 'stat',
            'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc',
            'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac',
            "urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2" => 'udt',
            'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2' => '',
            "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" => 'cec',
            "urn:AIFE:Facture:Extension" => 'aife'
        ];

        return $xmlService->write('Invoice', [
                $invoice
        ]);
    }
}
Stormyy commented 5 years ago

The UBL version has been upgraded to 2.1. No changes have to be made other than change the version number. UBL 2.1 is backwards compatible. Version v1.3.0 is now serving UBL 2.1

UBL 2.2 is not possible at the moment since the validator we are using for tests does not support it yet.