diff --git a/Doxyfile b/Doxyfile index 09d5e7ff2..2b01ef747 100644 --- a/Doxyfile +++ b/Doxyfile @@ -218,7 +218,7 @@ JAVADOC_AUTOBRIEF = YES # interpreted by doxygen. # The default value is: NO. -JAVADOC_BANNER = NO +JAVADOC_BANNER = YES # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If diff --git a/composer.json b/composer.json index ee0c5eec8..378633807 100644 --- a/composer.json +++ b/composer.json @@ -2,9 +2,10 @@ "require": { "horstoeko/zugferd": "^1.0", "zetacomponents/mail": "^1.10", - "num-num/ubl-invoice": "^1.21", "php-curl-class/php-curl-class": "^12.0", "chillerlan/php-authenticator": "^5.2", - "endroid/qr-code": "^6.0" + "endroid/qr-code": "^6.0", + "smalot/pdfparser": "^2.12", + "atgp/factur-x": "^2.4" } } diff --git a/composer.lock b/composer.lock index 4e866e855..412b4a1b3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,68 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "03e0b831d2d0674eac8b1d9fb8f1a615", + "content-hash": "68f9e79352fa7a801c4e3e4382827005", "packages": [ + { + "name": "atgp/factur-x", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/atgp/factur-x.git", + "reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/atgp/factur-x/zipball/0edbe1e935c3f81dcf3e306b2ce5876bf715bea1", + "reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-libxml": "*", + "ext-simplexml": "*", + "ext-zlib": "*", + "php": ">=7.4", + "setasign/fpdf": "^1.8", + "setasign/fpdi": "^2.0", + "smalot/pdfparser": "^0.19.0|~1.0|~2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~3.1", + "phpstan/phpstan": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Atgp\\FacturX\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "@GP", + "homepage": "https://www.atgp.net/" + } + ], + "description": "PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files", + "keywords": [ + "ZUGFeRD", + "factur-x", + "invoice", + "pdf", + "php", + "xml" + ], + "support": { + "issues": "https://github.com/atgp/factur-x/issues", + "source": "https://github.com/atgp/factur-x/tree/v2.4.0" + }, + "time": "2025-09-24T13:02:08+00:00" + }, { "name": "bacon/bacon-qr-code", "version": "v3.0.1", @@ -887,78 +947,6 @@ ], "time": "2025-05-26T15:55:41+00:00" }, - { - "name": "num-num/ubl-invoice", - "version": "v1.21.2", - "source": { - "type": "git", - "url": "https://github.com/num-num/ubl-invoice.git", - "reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/num-num/ubl-invoice/zipball/195712b3071e23c5aaa6fe95cb9e2de55c3d1348", - "reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8.0", - "sabre/xml": "^4.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.0", - "squizlabs/php_codesniffer": "^3.7" - }, - "type": "library", - "autoload": { - "psr-4": { - "NumNum\\UBL\\": [ - "src" - ], - "NumNum\\UBL\\Tests\\": [ - "tests" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bert Devriese", - "email": "bert@numnum.be", - "homepage": "https://www.numnum.be", - "role": "Developer" - } - ], - "description": "A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files", - "homepage": "https://github.com/num-num/ubl-invoice", - "keywords": [ - "E-Invoice", - "digital invoice", - "efff", - "einvoice", - "electronic invoice", - "euinvoice", - "invoice", - "peppol", - "peppol bis", - "peppol invoice", - "peppolbis", - "ubl", - "ubl invoice", - "ublinvoice", - "xml", - "xml invoice" - ], - "support": { - "issues": "https://github.com/num-num/ubl-invoice/issues", - "source": "https://github.com/num-num/ubl-invoice/tree/v1.21.2" - }, - "time": "2025-07-01T11:58:25+00:00" - }, { "name": "paragonie/constant_time_encoding", "version": "v3.0.0", @@ -1153,135 +1141,6 @@ }, "time": "2025-07-13T07:04:09+00:00" }, - { - "name": "sabre/uri", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sabre-io/uri.git", - "reference": "38eeab6ed9eec435a2188db489d4649c56272c51" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabre-io/uri/zipball/38eeab6ed9eec435a2188db489d4649c56272c51", - "reference": "38eeab6ed9eec435a2188db489d4649c56272c51", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.64", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^1.12", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "^9.6" - }, - "type": "library", - "autoload": { - "files": [ - "lib/functions.php" - ], - "psr-4": { - "Sabre\\Uri\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - } - ], - "description": "Functions for making sense out of URIs.", - "homepage": "http://sabre.io/uri/", - "keywords": [ - "rfc3986", - "uri", - "url" - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "issues": "https://github.com/sabre-io/uri/issues", - "source": "https://github.com/fruux/sabre-uri" - }, - "time": "2024-09-04T15:30:08+00:00" - }, - { - "name": "sabre/xml", - "version": "4.0.6", - "source": { - "type": "git", - "url": "https://github.com/sabre-io/xml.git", - "reference": "a89257fd188ce30e456b841b6915f27905dfdbe3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabre-io/xml/zipball/a89257fd188ce30e456b841b6915f27905dfdbe3", - "reference": "a89257fd188ce30e456b841b6915f27905dfdbe3", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "lib-libxml": ">=2.6.20", - "php": "^7.4 || ^8.0", - "sabre/uri": ">=2.0,<4.0.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.64", - "phpstan/phpstan": "^1.12", - "phpunit/phpunit": "^9.6" - }, - "type": "library", - "autoload": { - "files": [ - "lib/Deserializer/functions.php", - "lib/Serializer/functions.php" - ], - "psr-4": { - "Sabre\\Xml\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - }, - { - "name": "Markus Staab", - "email": "markus.staab@redaxo.de", - "role": "Developer" - } - ], - "description": "sabre/xml is an XML library that you may not hate.", - "homepage": "https://sabre.io/xml/", - "keywords": [ - "XMLReader", - "XMLWriter", - "dom", - "xml" - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "issues": "https://github.com/sabre-io/xml/issues", - "source": "https://github.com/fruux/sabre-xml" - }, - "time": "2024-09-06T08:00:55+00:00" - }, { "name": "setasign/fpdf", "version": "1.8.6", @@ -1402,16 +1261,16 @@ }, { "name": "smalot/pdfparser", - "version": "v2.12.0", + "version": "v2.12.1", "source": { "type": "git", "url": "https://github.com/smalot/pdfparser.git", - "reference": "8440edbf58c8596074e78ada38dcb0bd041a5948" + "reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smalot/pdfparser/zipball/8440edbf58c8596074e78ada38dcb0bd041a5948", - "reference": "8440edbf58c8596074e78ada38dcb0bd041a5948", + "url": "https://api.github.com/repos/smalot/pdfparser/zipball/98d31ba34ef5b5a98897ef4b6c3925d502ea53b1", + "reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1", "shasum": "" }, "require": { @@ -1447,9 +1306,9 @@ ], "support": { "issues": "https://github.com/smalot/pdfparser/issues", - "source": "https://github.com/smalot/pdfparser/tree/v2.12.0" + "source": "https://github.com/smalot/pdfparser/tree/v2.12.1" }, - "time": "2025-03-31T13:16:09+00:00" + "time": "2025-07-31T06:19:56+00:00" }, { "name": "symfony/deprecation-contracts", diff --git a/html/.cvsignore b/html/.cvsignore deleted file mode 100755 index 0d3c38dd8..000000000 --- a/html/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.log -ajax diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css index 8d84feb1b..9b7d338f2 100644 --- a/html/css/style-classic7.css +++ b/html/css/style-classic7.css @@ -69,6 +69,7 @@ BODY { --font-button:'roboto light'; --font-super:'roboto regular'; --font-title:'Montserrat Regular'; + --bg-inner-box:#DCE1EF; } input{ font-family: 'OpenSansRegular'; @@ -1252,7 +1253,7 @@ box-shadow: 10px 10px 5px #888; *******************************************************************************/ div.inner_box { - background-color: #DCE1EF; + background-color: var(--bg-inner-box); font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif; font-family: 'OpenSansRegular'; /*! font-family: 'var(--font-button)'; */ @@ -1271,7 +1272,7 @@ div.inner_box { left:0px ; } div.inner_box2 { - background-color: #DCE1EF; + background-color: var(--bg-inner-box); font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif; font-family: 'OpenSansRegular'; /*! font-family: 'var(--font-button)'; */ @@ -2349,7 +2350,7 @@ table.vert_mtitle { } table.vert_mtitle td.first { - background-color: #DCE1EF; + background-color: var(--bg-inner-box); } table.vert_mtitle td { border : 1px solid #99B1DF; @@ -2567,7 +2568,7 @@ td.box { .smoke { text-align: center; - background-color: #DCE1EF; + background-color: var(--bg-inner-box); margin:0px; overflow:hidden; z-index:3; @@ -4072,4 +4073,20 @@ h2.h-section { margin-bottom: 0.5rem; border-radius: 5px; } - + /** + electronc invoice errors in SALE + */ +#invoice_error_popover { + background-color: var(--bg-inner-box); + position: absolute; + z-index: 1; + padding: 1rem; + left: 10%; + border:1px solid navy; +} +/** + * Button error + */ +.bt-error { + color:var(--color-red); +} \ No newline at end of file diff --git a/include/XMLDocument/Error_Message.php b/include/XMLDocument/Error_Message.php new file mode 100644 index 000000000..45e9487b7 --- /dev/null +++ b/include/XMLDocument/Error_Message.php @@ -0,0 +1,137 @@ +'CUST_NAME' + - ATTR_DEF_ADRESS=>'CUST_ADDR' + - ATTR_DEF_POSTCODE=>'CUST_POSTCD' + - ATTR_DEF_CITY=>'CUST_CITY' + - ATTR_DEF_COUNTRY_CODE=>'CUST_CDCOUNTRY' + - ATTR_DEF_NUMTVA=>'CUST_VAT' + - ATTR_DEF_PEPPOLID=>'CUST_PEPPOLID' + - company, + - "INVOICE_EMAIL_COMPANY" company's email + - 'INVOICE_CONTACT_NAME' contact name + - 'COMPANY_LEGAL_ENTITY' legal form of company + - 'COMPANY_LEGAL_REGISTRATION' full name + - 'COMPANY_BANK_IBAN' IBAN bank account + - 'COMPANY_BANK_BIC' BIC bank account + - 'COMPANY_UBL_ID' PEPPOL id + - 'MY_COUNTRY_CODE' country code (normally BE) + - 'MY_NAME' short company name + - 'MY_STREET' address + - 'MY_CITY' address + - 'MY_TVA' VAT number + * + */ +class Error_Message +{ + + private $a_error; + private $a_message_company; + private $a_message_customer; + + /** + * @brief constructo + * @param $a_error (double array) + */ + public function __construct($a_error) + { + $this->a_error = $a_error; + $this->a_message_company = array( + "INVOICE_EMAIL_COMPANY" => _("L'email de la société ") + , 'INVOICE_CONTACT_NAME' => _("Nom du contact") + , 'COMPANY_LEGAL_ENTITY' => _("Type de société (SRL,ASBL,...)") + , 'COMPANY_LEGAL_REGISTRATION' => _("Nom complet de la société") + , 'COMPANY_BANK_IBAN' => _("Compte en banque (IBAN) de la société") + , 'COMPANY_BANK_BIC' => _("Code BIC de compte en banque") + , 'COMPANY_UBL_ID' => _("Identifiant PEPPOL") + , 'MY_COUNTRY_CODE' => _('Code Pays') + , 'MY_NAME' => _("Nom de la société") + , 'MY_STREET' => _("Adresse de la société") + , 'MY_CITY' => _("Ville") + , 'MY_TVA' => _("Numéro de TVA") + // , 'SIREN'=> 'SIREN' + // , 'SIRET'=> 'SIRET' + ); + $this->a_message_customer = array( + 'name' => _("Nom") + , 'street' => _("Adresse") + , 'postalzone' => _("Code postal") + , 'city' => _("Ville") + , 'country'=>_("Code pays") + , 'customer_id' => _("Numéro de TVA") + , 'endpoint_id' => _('Identifiant PEPPOL') + + ); + + } + + public function get_a_error() + { + return $this->a_error; + } + + public function set_a_error($a_error) + { + $this->a_error = $a_error; + return $this; + } + + /** + * @brief returns the text of an error + * @param $code (string or number) + * @param $type (string) customer , general or company + */ + function get_message_error($code, $type) + { + if ($type == "customer") + { + $a_error = $this->a_error['customer']; + $a_message = $this->a_message_customer; + } else if ($type == "company") + { + $a_error = $this->a_error['company']; + $a_message = $this->a_message_company; + } else + { + throw new \Exception("EM116: unknow type"); + } + + return $a_message[$code]; + } +} diff --git a/include/XMLDocument/FacturX.php b/include/XMLDocument/FacturX.php index 48e68fa52..08ea2d52b 100644 --- a/include/XMLDocument/FacturX.php +++ b/include/XMLDocument/FacturX.php @@ -19,15 +19,25 @@ namespace Noalyss\XMLDocument; */ // Copyright Author Dany De Bontridder danydb@aevalys.eu 22/10/23 -use \Kinulab\Facturx\CrossIndustryInvoice as KINU_FX1; -use \Atgp\FacturX as FX_ATGP; +use horstoeko\zugferd\codelists\ZugferdCountryCodes; +use horstoeko\zugferd\codelists\ZugferdCurrencyCodes; +use horstoeko\zugferd\codelists\ZugferdElectronicAddressScheme; +use horstoeko\zugferd\codelists\ZugferdInvoiceType; +use horstoeko\zugferd\codelists\ZugferdReferenceCodeQualifiers; +use horstoeko\zugferd\codelists\ZugferdUnitCodes; +use horstoeko\zugferd\codelists\ZugferdVatCategoryCodes; +use horstoeko\zugferd\codelists\ZugferdVatTypeCodes; +use horstoeko\zugferd\ZugferdDocumentBuilder; +use horstoeko\zugferd\ZugferdProfiles; + /** * @file * @brief answer to an inplace object */ class FacturX extends XMLInvoice { - const EXTRA_PARAMETER = ["INVOICE_EMAIL_COMPANY" + const EXTRA_PARAMETER = [ + "INVOICE_EMAIL_COMPANY" , 'INVOICE_CONTACT_NAME' , 'COMPANY_LEGAL_ENTITY' , 'COMPANY_LEGAL_REGISTRATION' @@ -40,38 +50,54 @@ class FacturX extends XMLInvoice , 'MY_CITY' , 'MY_COUNTRY_CODE' , 'MY_TVA' - ,'SIREN' - ,'SIRET' + // ,'SIREN' + // ,'SIRET' ]; protected $pdf_filename; function build_data($jr_id): array { - $result = parent::build_data($jr_id); - - - $customer=new \Fiche($this->cn,$result['customer']['card_id']); - $result['customer']['siren']=$customer->get_attribute(ATTR_DEF_SIREN); - $result['customer']['siret']=$customer->get_attribute(ATTR_DEF_SIRET); - return $result; + $this->data=parent::build_data($jr_id); + return $this->data; } /** * @brief check that mandatory info are saved in the DB * @param $a_error (array) array of errors, empty if nothing found */ - function check_company_data(&$a_error) { - echo "not implemented"; - return true; + function check_company_data() + { + $a_error=array(); + $company = $this->load_noalyss_parameter(); + foreach (FacturX::EXTRA_PARAMETER as $item) { + if (!isset($company[$item]) || trim($company[$item]) == '') { + $a_error[]=$item; + } + } + return $a_error; } /** * @brief check that mandatory info are saved in the DB for customer * @param $customer_id (int) card of the customer FICHE.F_ID * @param $a_error (array) array of errors, empty if nothing found */ - function check_customer_data($customer_id,&$a_error){ - echo "not implemented"; - return true; + function check_customer_data($customer_id){ + $a_error=array(); + $a_needed=[ATTR_DEF_NAME=>'name' + ,ATTR_DEF_ADRESS=>'street' + ,ATTR_DEF_POSTCODE=>'postalzone' + ,ATTR_DEF_CITY=>'city' + ,ATTR_DEF_COUNTRY_CODE=>'country' + ,ATTR_DEF_NUMTVA=>'customer_id' + ,ATTR_DEF_PEPPOLID=>'endpoint_id' + ]; + foreach ($a_needed as $item=>$value) { + if ( $this->data['customer'][$value]=="") { + $a_error[]=$value; + } + } + + return $a_error; } /** @@ -83,53 +109,81 @@ class FacturX extends XMLInvoice function make_xml($jr_id) { $this->data = $this->build_data($jr_id); - $invoice= new KINU_FX1\CrossIndustryInvoice(KINU_FX1\CrossIndustryInvoice::PROFILE_BASIC_WL); - $invoice->setInvoiceNumber($this->data['id']); - $invoice->setInvoiceType(KINU_FX1\CrossIndustryInvoice::INVOICE_TYPE_COMMERCIAL_INVOICE); - $invoice->setIssueDate(\DateTime::createFromFormat( 'Y-m-d',$this->data['issue_date'])); - - if ( $this->data['due_date'] !="") { - $invoice->setDueDate(\DateTime::createFromFormat( 'Y-m-d',$this->data['due_date'])); - }else { - $due_date=\DateTime::createFromFormat( 'Y-m-d',$this->data['issue_date']); - $due_date->modify('+ 30 days'); - $invoice->setDueDate($due_date); - - } - $supplier=new KINU_FX1\LegalEntity(); $company = $this->load_noalyss_parameter(); - $supplier->setName($company['MY_NAME']); - $supplier->setSiren($company['SIREN']); - $supplier->setSiret($company['SIRET']); - //$supplier->setSiren('999999'); - $supplier->setVatIdentifier($company['MY_TVA']); - $supplier_addres=new KINU_FX1\Address(); - $supplier_addres->setCityName($company['MY_CITY']) - ->setCountryId($company['MY_COUNTRY_CODE']) - ->setCityName($company['MY_CITY']) - ->setLines($company['MY_STREET']); - $supplier->setAddress($supplier_addres); - $invoice->setPaymentInstruction(null); - $invoice->setPaymentMeansCode(0); - $invoice->setSeller($supplier); - $invoice->setBuyer(new KINU_FX1\LegalEntity); - $buyer=$invoice->getBuyer(); - $buyer->setName($this->data['customer']['name']); - $buyer->setSiren($this->data['customer']['siren']); - $buyer->setSiret($this->data['customer']['siret']); - $buyer->setVatIdentifier($this->data['customer']['customer_id']); - $buyer->setAddress(new KINU_FX1\Address()); - $address=$buyer->getAddress(); - $address->setLines($this->data['customer']['street']) - ->setCityName($this->data['customer']['city']) - ->setZipCode($this->data['customer']['postalzone']) - ->setCountryId($this->data['customer']['country']); + // var_dump($this->data); + $documentBuilder = ZugferdDocumentBuilder::createNew(ZugferdProfiles::PROFILE_XRECHNUNG_3); + $documentBuilder->setDocumentInformation( + $this->data['id'] + ,"380" + ,\DateTime::createFromFormat( 'Y-m-d',$this->data["issue_date"]) + , $this->data['currency'] + ); - $invoice->setCurrencyCode('EUR'); + $documentBuilder->addDocumentPaymentTerm( + sprintf("IBAN %s",$company['COMPANY_BANK_IBAN']) + ,\DateTime::createFromFormat( 'Y-m-d',$this->data["due_date"]) + , $this->data['info']['communication'] + ); + //------------------------------------------------ + // SELLER + //------------------------------------------------ + $documentBuilder->setDocumentSeller($company['MY_NAME'], ); + $documentBuilder->addDocumentSellerGlobalId($company['SIREN'], '0009'); + $documentBuilder->addDocumentSellerTaxNumber($company['MY_TVA']); + $documentBuilder->addDocumentSellerVATRegistrationNumber($company['MY_TVA']); + $documentBuilder->setDocumentSellerAddress( + $company['MY_STREET'] + , '', '' + , $company['MY_POSTCODE'] + , $company['MY_CITY'] + ,$company['MY_COUNTRY_CODE']); + + $documentBuilder->setDocumentSellerCommunication(ZugferdElectronicAddressScheme::UNECE3155_EM + , $company["INVOICE_EMAIL_COMPANY"]); + + //------------------------------------------------ + // BUYER + //------------------------------------------------ + + $documentBuilder->setDocumentBuyer($this->data['customer']['name'], $this->data['customer']['customer_id']); + $documentBuilder->setDocumentBuyerAddress( + $this->data['customer']['street'] + , '' + , '' + , $this->data['customer']['postalzone'] + , $this->data['customer']['city'] + , $this->data['customer']['country'] + ); +// $documentBuilder->setDocumentBuyerContact('H. Meier', 'Einkauf', '+49-333-4444444', '+49-333-5555555', 'hm@kunde.de'); +// $documentBuilder->setDocumentBuyerCommunication(ZugferdElectronicAddressScheme::UNECE3155_EM, 'purchase@kunde.de'); + + $documentBuilder->setDocumentBuyerOrderReferencedDocument($this->data['info']['order']); + + //------------------------------------------------ + // Item & total + //------------------------------------------------ + $base=0;$vat=0; $nb=count($this->data['operation']); - ///@note : Pour l'autoliquidation le total TVA = 0 + for ($i=0;$i < $nb;$i++) { + $documentBuilder->addNewPosition($i+1); + $documentBuilder->setDocumentPositionProductDetails($this->data['operation'][$i]['qcode'] + ,$this->data['operation'][$i]['name'] + ,$this->data['operation'][$i]['description'] + ); + $documentBuilder->setDocumentPositionNetPrice($this->data['operation'][$i]['price']); + $documentBuilder->setDocumentPositionQuantity($this->data['operation'][$i]['quantity'] + ,$this->data['operation'][$i]['code_quantity'] + ); + $documentBuilder->addDocumentPositionTax( + $this->data['operation'][$i]['vat_code'] + , ZugferdVatTypeCodes::VALUE_ADDED_TAX + , bcmul($this->data['operation'][$i]['vat_rate'],100,2) + ); + $documentBuilder->setDocumentPositionLineSummation($this->data['operation'][$i]['price']); + + $base=bcadd($base,$this->data['operation'][$i]['price'],2); $vat=bcadd($vat,$this->data['operation'][$i]['vat'],2); $vat=bcsub($vat,$this->data['operation'][$i]['vat_reversed'],2); @@ -140,12 +194,40 @@ class FacturX extends XMLInvoice * il faut alors un "reste" à payer. * Pas de détail par articles ? */ - $invoice->setTaxBasisTotalAmount($base); - $invoice->setTaxTotalAmount($vat); - $invoice->setGrandTotalAmount($tt); - $invoice->setDuePayableAmount($tt); - $xml = KINU_FX1\XmlWriter::write($invoice); - return $xml; + ///@TODO DNY : ajouter les TVA par types ( addDocumentTax) + /// ainsi que la Somme des totaux (setDocumentSummation) + $subTotal=$this->data['subTotalVAT']; + $nb_sub=count($subTotal); + for ($i=0;$i<$nb_sub;$i++) + { + $documentBuilder->addDocumentTax( + $subTotal[$i]["vat_code"] + , ZugferdVatTypeCodes::VALUE_ADDED_TAX + ,sprintf("%.2f",$subTotal[$i]['amount']) + , sprintf("%.2f",$subTotal[$i]['vat']) + , sprintf("%.2f",$subTotal[$i]['percent']) + ); + } + + $documentBuilder->setDocumentSummation( + sprintf("%.2f",$this->data['TaxInclusiveAmount']) + , sprintf("%.2f",$this->data['PayableAmount']) + , sprintf("%.2f",$this->data['TaxExclusiveAmount']) + , 0.0 + , 0.0 + , sprintf("%.2f",$this->data['LineExtensionAmount']) + , sprintf("%.2f",(bcsub($this->data['TaxInclusiveAmount'], + $this->data['TaxExclusiveAmount'], + 2) + ) + ) + , 0 + ); + + + return $documentBuilder; + + } /** * @brief create the invoice in the right format @@ -153,10 +235,14 @@ class FacturX extends XMLInvoice * @return string PDF Invoice including the XML */ function create_invoice($operation_id) { - $xml = $this->make_xml($operation_id); - $facturx = new FX_ATGP\Facturx(); - $invoice=$facturx->generateFacturxFromFiles($this->pdf_filename, $xml); - return $invoice; + $documentBuilder= $this->make_xml($operation_id); + + $invoice = \horstoeko\zugferd\ZugferdDocumentPdfBuilder::fromPdfFile($documentBuilder, $this->pdf_filename); + $invoice->generateDocument(); + $invoice->saveDocument($this->pdf_filename."-new.pdf"); + return $invoice->downloadString(); } + + } \ No newline at end of file diff --git a/include/XMLDocument/InvoiceUBL21.php b/include/XMLDocument/InvoiceUBL21.php index af8edaf62..951d84d93 100644 --- a/include/XMLDocument/InvoiceUBL21.php +++ b/include/XMLDocument/InvoiceUBL21.php @@ -23,12 +23,14 @@ namespace Noalyss\XMLDocument; /** * @file - * @brief answer to an inplace object + * @brief UBL2.1 Belgique + * - $pdf_filename PDF file to insert into XML, it is the file on the filesystem */ /** * @class * @brief UBL2.1 Belgique - * @note Doit contenir le PDF + * @note Doit contenir le PDF. + * - $pdf_filename PDF file to insert into XML, it is the file on the filesystem @code @@ -52,32 +54,37 @@ class InvoiceUBL21 extends XMLInvoice { , 'MY_STREET' , 'MY_CITY' , 'MY_TVA' + , 'INVOICE_EMAIL_COMPANY' ]; - protected $pdf_filename; //!< PDF file to insert into XML + protected $pdf_filename; //!< PDF file to insert into XML, + // it is the file on the filesystem public function get_pdf_filename() { return $this->pdf_filename; } - - public function set_pdf_filename($pdf_filename) { - $this->pdf_filename = $pdf_filename; - return $this; + /** + * @brief display_error display a warning with all error + */ + function display_error() + { + $a_error=$this->verify(); + include NOALYSS_TEMPLATE."/invoiceUBL21-display_error.php"; } + /** * @brief check that mandatory info are saved in the DB for company (seller) * @param $a_error (array) array of errors, empty if nothing found */ - function check_company_data(&$a_error) { + function check_company_data() { + // var $a_error (array) contains the errors for the company + $a_error=array(); $company = $this->load_noalyss_parameter(); foreach (InvoiceUBL21::EXTRA_PARAMETER as $item) { - if (!isset($company[$item]) || $company[$item] == '') { + if (!isset($company[$item]) || trim($company[$item]) == '') { $a_error[]=$item; } } - if (count($a_error) == 0) { - return true; - } - return false; + return $a_error; } /** * @brief check that mandatory info are saved in the DB for customer @@ -85,26 +92,26 @@ class InvoiceUBL21 extends XMLInvoice { * @param $a_error (array) array of errors, empty if nothing found * @todo : country code au lieu de country !! */ - function check_customer_data($customer_id,&$a_error){ - $card=new \Fiche($this->cn,$customer_id); - $a_needed=[ATTR_DEF_NAME=>_("Nom") - ,ATTR_DEF_ADRESS=>_("Adresse") - ,ATTR_DEF_POSTCODE=>_("Code postal") - ,ATTR_DEF_CITY=>_("Localité") - ,ATTR_DEF_COUNTRY_CODE=>_("Code pays") - ,ATTR_DEF_NUMTVA=>_("Numéro de TVA") + function check_customer_data($customer_id){ + $a_error=array(); + $a_needed=[ATTR_DEF_NAME=>'name' + ,ATTR_DEF_ADRESS=>'street' + ,ATTR_DEF_POSTCODE=>'postalzone' + ,ATTR_DEF_CITY=>'city' + ,ATTR_DEF_COUNTRY_CODE=>'country' + ,ATTR_DEF_NUMTVA=>'customer_id' + ,ATTR_DEF_PEPPOLID=>'endpoint_id' ]; foreach ($a_needed as $item=>$value) { - if (\noalyss_trim($card->get_attribute($item))=="") { - printf (_("ATTENTION donnée manquante dans la fiche client [%s]"),$value); - } + if ( $this->data['customer'][$value]=="") { + $a_error[]=$value; + } } - if (count($a_error) == 0) { - return true; - } - return false; + + return $a_error; } + /** * @brief transform an operation ($jr_id) into an array, which contains * needed information for making an e-invoice @@ -113,61 +120,11 @@ class InvoiceUBL21 extends XMLInvoice { * @param type $jr_id * @see XMLInvoice::build_data */ - function build_data($jr_id): array { - $result = parent::build_data($jr_id); - /** - * Compute totals VAT and AMOUNT - */ - $nb_operation = count($result['operation']); + function build_data($jr_id): array + { - /// block cac:LegalMonetaryTotal - $result['LineExtensionAmount']=0; - $result['TaxExclusiveAmount']=0; - $result['TaxInclusiveAmount']=0; - $result['PayableAmount']=0; - - // block cac:TaxTotal - $result['TaxableAmount']=0; - $result['TaxAmount']=0; - - // array for TaxSubtotal - $VAT_SubTotal=array(); - $idx_subtotal=0; - bcscale(2); - // for each operation - $VAT_SubTotal=array(); - for ($i=0;$i < $nb_operation;$i++) { - $acc_tva=\Acc_TVA::build($this->cn,$result['operation'][$i]['vat_id'] ); - $percent = bcmul($acc_tva->tva_rate,100); - // subtotal for VAT - var_dump($VAT_SubTotal); - $n = \Noalyss\Invoicing\Utility::find_idx($VAT_SubTotal,'percent',$percent); - if ($n == -1 ) { - $n=$idx_subtotal; - $VAT_SubTotal[$idx_subtotal]=array(); - $VAT_SubTotal[$idx_subtotal]['percent']=$percent; - $VAT_SubTotal[$idx_subtotal]['amount']=$VAT_SubTotal[$idx_subtotal]['vat']=0; - $idx_subtotal++; - } - /** - * @todo Pour les intracomm , quel taux utilisé ? 0 ou 21% - */ - $VAT_SubTotal[$n]['amount']=bcadd($VAT_SubTotal[$n]['amount'],$result['operation'][$i]['price']); - $VAT_SubTotal[$n]['vat']=bcadd($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat']); - $VAT_SubTotal[$n]['vat']=bcsub($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat_reversed']); - $result['TaxableAmount']=bcadd( $result['TaxableAmount'],$result['operation'][$i]['price']); - $result['TaxAmount']=bcadd( $result['TaxAmount'],$result['operation'][$i]['vat']); - $result['TaxAmount']=bcsub( $result['TaxAmount'],$result['operation'][$i]['vat_reversed']); - $result['operation'][$i]['vat_percent']=$percent; - } - $result['subTotalVAT']=$VAT_SubTotal; - $result['LineExtensionAmount']= $result['TaxableAmount']; - $result['TaxExclusiveAmount']= $result['TaxableAmount']; - $result['TaxInclusiveAmount']=bcadd( $result['TaxableAmount'],$result['TaxAmount']); - $result['PayableAmount']=bcadd( $result['TaxableAmount'],$result['TaxAmount']);; - - $this->data=$result; - return $result; + $this->data=parent::build_data($jr_id); + return $this->data; } /** * @brief Information customer @@ -178,7 +135,8 @@ class InvoiceUBL21 extends XMLInvoice { $customer=$this->createElement('cac:AccountingCustomerParty'); $customer_party=$customer->appendChild($this->createElement('cac:Party')); ///@todo EndPointID doit être dans les paramètres (voir upgrade.sql) - $customer_party->appendChild($this->createElement('cbc:EndpointID',"ERROR"))->setAttribute('schemeID', 9956); + $customer_party->appendChild($this->createElement('cbc:EndpointID',$this->data['customer']['endpoint_id'])) + ->setAttribute('schemeID', 9925); $party_name=$this->createElement('cac:PartyName'); $party_name->appendChild($this->createElement("cbc:Name", $this->data['customer']['name'])); $customer_party->appendChild($party_name); @@ -187,9 +145,10 @@ class InvoiceUBL21 extends XMLInvoice { $postal_address->appendChild($this->createElement("cbc:CityName", $this->data['customer']['city'])); $postal_address->appendChild($this->createElement("cbc:PostalZone", $this->data['customer']['postalzone'])); ///@todo customer = countryCode doit être dans les paramètres (voir upgrade.sql) - $country_code ="ERROR"; + $country_code =$this->data['customer']['country']; $country=$postal_address->appendChild($this->createElement("cac:Country")); - $country->appendChild($this->createElement('cbc:IdentificationCode',$country_code??"ERROR:COUNTRY_CODE")); + + $country->appendChild($this->createElement('cbc:IdentificationCode',$country_code)); $postal_address->appendChild($country); // Tax Schem @@ -231,16 +190,16 @@ class InvoiceUBL21 extends XMLInvoice { */ function build_paymentInfo() { + $company = $this->load_noalyss_parameter(); $payment=$this->createElement("cac:PaymentMeans"); $payment->appendChild($this->createElement('cbc:PaymentMeansCode',30)); ///@note cbc:PaymentID est la communication lors du paiement - $payment->appendChild($this->createElement('cbc:PaymentID',$this->data["id"])); + $payment->appendChild($this->createElement('cbc:PaymentID',$this->data["info"]['communication'])); $f=$this->createElement ('cac:PayeeFinancialAccount'); ///@todo customer = IBAN doit être dans les paramètres (voir upgrade.sql) - $f->appendChild($this->createElement("cbc:ID", "ERROR:IBAN")); + $f->appendChild($this->createElement("cbc:ID",$company['COMPANY_BANK_IBAN'])); $g=$this->createElement("cac:FinancialInstitutionBranch"); - ///@todo customer = BIC doit être dans les paramètres (voir upgrade.sql) - $g->appendChild($this->createElement("cbc:ID", "ERROR:BIC")); + $g->appendChild($this->createElement("cbc:ID", $company['COMPANY_BANK_BIC'])); $f->appendChild($g); $payment->appendChild($f); @@ -255,7 +214,7 @@ class InvoiceUBL21 extends XMLInvoice { $supplier=$this->createElement('cac:AccountingSupplierParty'); $supplier_party=$supplier->appendChild($this->createElement('cac:Party')); - $supplier_party->appendChild($this->createElement('cbc:EndpointID',$company['COMPANY_UBL_ID']??"ERROR"))->setAttribute('schemeID', 9956); + $supplier_party->appendChild($this->createElement('cbc:EndpointID',$company['COMPANY_UBL_ID']))->setAttribute('schemeID', 9925); $party_name=$this->createElement('cac:PartyName'); $party_name->appendChild($this->createElement('cbc:Name', $this->data['supplier']['name'])); $supplier_party->appendChild($party_name); @@ -325,20 +284,24 @@ class InvoiceUBL21 extends XMLInvoice { function build_taxTotal() { $taxTotal=$this->createElement("cac:TaxTotal"); - $taxTotal->appendChild($this->createElement('cbc:TaxAmount',$this->data['TaxAmount'])) - ->setAttribute("currencyID","EUR"); + $taxTotal->appendChild($this->createElement('cbc:TaxAmount',sprintf("%.2f",$this->data['TaxAmount']))) + ->setAttribute("currencyID",$this->data['currency']); // for subTotal $subTotal=$this->data['subTotalVAT']; $nb_sub=count($subTotal); for ($i=0;$i<$nb_sub;$i++) { $subTotalXML=$this->createElement("cac:TaxSubtotal"); - $subTotalXML->appendChild($this->createElement('cbc:TaxableAmount',$subTotal[$i]['amount'])) - ->setAttribute("currencyID","EUR"); - $subTotalXML->appendChild($this->createElement('cbc:TaxAmount',$subTotal[$i]['vat'])) - ->setAttribute("currencyID","EUR"); + $subTotalXML->appendChild($this->createElement('cbc:TaxableAmount',sprintf("%.2f",$subTotal[$i]['amount']))) + ->setAttribute("currencyID", $this->data['currency']); + $subTotalXML->appendChild($this->createElement('cbc:TaxAmount',sprintf("%.2f",$subTotal[$i]['vat']))) + ->setAttribute("currencyID",$this->data['currency']); $taxCategory=$this->createElement("cac:TaxCategory"); - $taxCategory->appendChild($this->createElement("cbc:ID","S")); - $taxCategory->appendChild($this->createElement("cbc:Percent",$subTotal[$i]['percent'])); + /** + * @TODO DNY + * Pas toujours S !? + */ + //$taxCategory->appendChild($this->createElement("cbc:ID",$subTotal[$i]['vat_code'])); + $taxCategory->appendChild($this->createElement("cbc:Percent",sprintf("%.2f",$subTotal[$i]['percent']))); $taxScheme=$this->createElement("cac:TaxScheme"); $taxScheme->appendChild($this->createElement("cbc:ID", "VAT")); $taxCategory->appendChild($taxScheme); @@ -363,14 +326,14 @@ class InvoiceUBL21 extends XMLInvoice { function build_legalMonetaryTotal() { $result=$this->createElement('cac:LegalMonetaryTotal' ); - $result->appendChild($this->createElement("cbc:LineExtensionAmount",$this->data['LineExtensionAmount'])) - ->setAttribute("currencyID","EUR"); - $result->appendChild($this->createElement("cbc:TaxExclusiveAmount",$this->data['TaxExclusiveAmount'])) - ->setAttribute("currencyID","EUR"); - $result->appendChild($this->createElement("cbc:TaxInclusiveAmount",$this->data['TaxInclusiveAmount'])) - ->setAttribute("currencyID","EUR"); - $result->appendChild($this->createElement("cbc:PayableAmount",$this->data['PayableAmount'])) - ->setAttribute("currencyID","EUR"); + $result->appendChild($this->createElement("cbc:LineExtensionAmount",sprintf("%.2f",$this->data['LineExtensionAmount']))) + ->setAttribute("currencyID",$this->data['currency']); + $result->appendChild($this->createElement("cbc:TaxExclusiveAmount",sprintf("%.2f",$this->data['TaxExclusiveAmount']))) + ->setAttribute("currencyID",$this->data['currency']); + $result->appendChild($this->createElement("cbc:TaxInclusiveAmount",sprintf("%.2f",$this->data['TaxInclusiveAmount']))) + ->setAttribute("currencyID", $this->data['currency'] ); + $result->appendChild($this->createElement("cbc:PayableAmount",sprintf("%.2f",$this->data['PayableAmount']))) + ->setAttribute("currencyID", $this->data['currency'] ); return $result; } @@ -404,30 +367,35 @@ class InvoiceUBL21 extends XMLInvoice { $result=$this->createElement('cac:InvoiceLine'); $row=$this->data["operation"][$i]; + $amount=sprintf("%.2f",$row['price']); + $result->appendChild($this->createElement("cbc:ID", $i)); - ///@todo , les unités de quantités devraient être ajoutés à NOALYSS - /// il faut adapter les fiches + $amount=sprintf("%.2f",$row['price']); $result->appendChild( - $this->createElement("cbc:InvoicedQuantity", $row['quantity'])) - ->setAttribute("unitCode", "EA"); - $result->appendChild($this->createElement("cbc:LineExtensionAmount", $row['price'])) - ->setAttribute("currencyID","EUR"); + $this->createElement("cbc:InvoicedQuantity", sprintf("%.2f",$row['quantity']))) + ->setAttribute("unitCode", $row["code_quantity"]); + $result->appendChild($this->createElement("cbc:LineExtensionAmount", $amount)) + ->setAttribute("currencyID",$this->data['currency']); + + // ITEM $item=$this->createElement("cac:Item"); - $card=new \Fiche($this->cn,$row['card_id']); - $item->appendChild($this->createElement("cbc:Name", $card->get_attribute(ATTR_DEF_NAME))); + $item->appendChild($this->createElement("cbc:Description",$row['name'])); + $item->appendChild($this->createElement("cbc:Name", $row['qcode'])); $classifiedTaxCat=$this->createElement("cac:ClassifiedTaxCategory"); - ///@todo cbc:ID S = standard rate et que se passe-t'il pour l'autoliquidation ??? - /// Il faut ajouter dans TVA_RATE , un code pour la TVA, - $classifiedTaxCat->appendChild($this->createElement("cbc:ID", "S")); - $classifiedTaxCat->appendChild($this->createElement("cbc:Percent", $row['vat_percent'])); + + //cbc:ID S = standard rate + /// see TVA_RATE.TVA_PEPPOL_CODE & C0TVA + $classifiedTaxCat->appendChild($this->createElement("cbc:ID", $row['vat_code'])); + $classifiedTaxCat->appendChild($this->createElement("cbc:Percent", sprintf("%.2f",$row['vat_percent']))); + $tax_scheme=$this->createElement('cac:TaxScheme'); $tax_scheme->appendChild($this->createElement("cbc:ID", "VAT")); $classifiedTaxCat->appendChild($tax_scheme); $item->appendChild($classifiedTaxCat); $result->appendChild($item); $price=$result->appendChild($this->createElement("cac:Price")); - $price->appendChild($this->createElement("cbc:PriceAmount", $row['price'])) - ->setAttribute("currencyID","EUR"); + $price->appendChild($this->createElement("cbc:PriceAmount",sprintf("%.2f",abs($row['price_unit'])))) + ->setAttribute("currencyID",$this->data['currency']); $result->appendChild($price); return $result; @@ -435,10 +403,10 @@ class InvoiceUBL21 extends XMLInvoice { } /** * @brief Insert a PDF in the XML + * the document type is not due for BELGIUM @code P01 - InvoicePDF Facture PDF REF_ODT_001 - OpenDocument Fichier OpenDocument pdf_filename == "") return null; - $result=$this->createElement("AdditionalDocumentReference"); /** $pdf_filename = 'chemin/vers/votre/fichier.pdf';*/ - + static $i=0; + $i++; + if ( $this->pdf_filename == null ) { + return null; + } // Lire le fichier PDF - // $pdfContent = file_get_contents($pdfPath); + $pdfContent = file_get_contents( $this->pdf_filename ); - // Encoder le PDF en base64 - // $base64Pdf = base64_encode($pdfContent); + $result=$this->createElement("cac:AdditionalDocumentReference"); + $id=$this->createElement("cbc:ID",$i); + $document_description=$this->createElement("cbc:DocumentDescription" + , $this->data['description']); + + // PDF in base64 + $base64Pdf = base64_encode($pdfContent); + $embeddedDocument=$this->createElement("cbc:EmbeddedDocumentBinaryObject",$base64Pdf); + $embeddedDocument->setAttribute("mimeCode", "application/pdf"); + $embeddedDocument->setAttribute("filename", "facture.pdf"); + $attachment=$this->createElement("cac:Attachment"); + $attachment->appendChild($embeddedDocument); + + $result->appendChild($id); + $result->appendChild($document_description); + $result->appendChild($attachment); return $result; } @@ -496,12 +480,14 @@ class InvoiceUBL21 extends XMLInvoice { $root->appendChild($this->createElement('cbc:ID',$this->data['id'])); $root->appendChild($this->createElement('cbc:IssueDate',$this->data['issue_date'])); - if ($this->data ['due_date'] != '') { - $root->appendChild($this->createElement('cbc:DueDate',$this->data['due_date'])); + if ($this->data ['due_date'] == '') + { + $this->data ['due_date']=$this->data['issue_date']; } + $root->appendChild($this->createElement('cbc:DueDate',$this->data['due_date'])); $root->appendChild($this->createElement('cbc:InvoiceTypeCode',380)); - $root->appendChild($this->createElement('cbc:DocumentCurrencyCode','EUR')); - + $root->appendChild($this->createElement('cbc:DocumentCurrencyCode',$this->data['currency'])); + $root->appendChild($this->createElement('cbc:BuyerReference',$this->data['info']['order'])); /** * insert PDF in the XML */ diff --git a/include/XMLDocument/XMLInvoice.php b/include/XMLDocument/XMLInvoice.php index 60eab9f9d..777236675 100644 --- a/include/XMLDocument/XMLInvoice.php +++ b/include/XMLDocument/XMLInvoice.php @@ -1,7 +1,7 @@ 0 + [info] => Array + [order] = order reference + [communication] = communication added to the invoice [operation] => Array ( [0] => Array @@ -67,6 +70,8 @@ use Noalyss\Utility; [vat] => 2.1000 [vat_id] => 1 [vat_reversed] => 0.0000 + [code_quantity]=> EA + [vat_code]=> Code VAT for PEPPOL (S,K,...) ) [1] => Array @@ -77,6 +82,8 @@ use Noalyss\Utility; [vat] => 17.5200 [vat_id] => 1 [vat_reversed] => 0.0000 + [code_quantity]=> EA + [vat_code]=> Code VAT for PEPPOL (S,K,...) ) [2] => Array @@ -87,6 +94,8 @@ use Noalyss\Utility; [vat] => 15.1200 [vat_id] => 5 [vat_reversed] => 15.1200 + [code_quantity]=> EA + [vat_code]=> Code VAT for PEPPOL (S,K,...) ) ) @@ -100,7 +109,8 @@ use Noalyss\Utility; abstract class XMLInvoice extends \DOMDocument { protected $cn; //!< Database conx , current folder - protected $data; //! $data Array data retrieve from DB + protected $data; //! $data (Array) data retrieve from DB + protected $jr_id; //! $jr_id (int) is JRN.JR_ID function __construct(\Database $conx) { parent::__construct("1.0", "UTF-8"); @@ -154,71 +164,149 @@ abstract class XMLInvoice extends \DOMDocument function build_data($jr_id):array { global $g_parameter; + $this->jr_id=$jr_id; $operation = new \Acc_Sold($this->cn,$jr_id); $operation->get(); $result=array(); $result["id"]= $operation->det->jr_pj_number; $result["issue_date"]=$operation->det->jr_date; - $result["due_date"]=$operation->det->jr_ech; + $result["due_date"]=($operation->det->jr_ech=="")?$operation->det->jr_date:$operation->det->jr_ech; // supplier - $result['supplier']=array(); - $result['supplier']['name']=$g_parameter->MY_NAME; - $result['supplier']['street']=$g_parameter->MY_STREET; - $result['supplier']['postalzone']=$g_parameter->MY_POSTCODE; - $result['supplier']['city']=$g_parameter->MY_CITY; - $result['supplier']['country']=$g_parameter->MY_COUNTRY; - $result['supplier']['supplier_id']=$g_parameter->MY_TVA; - // official name of the company - $result['supplier']['registration_name']=$g_parameter->MY_NAME; - // official ID , like VAT - $result['supplier']['supplier_id']=str_replace([" ",".","-","/"],"" ,$g_parameter->MY_TVA); - //@todo - //Autre parametre comme email dans Parameter_Extra_SQL - // - // - // == $result['supplier']['supplier_email']=$g_parameter->; - //@todo TESTER S'IL Y A QQ'CHOSE DE VENDU ! + $result['supplier']=$this->fill_supplier(); + + //customer - $customer=new \Fiche($this->cn,$operation->det->array[0]['qs_client']); - $result['customer']=array(); - $result['customer']['card_id']=$operation->det->array[0]['qs_client']; - $result['customer']['name']=$customer->get_attribute(ATTR_DEF_NAME); - $result['customer']['street']=$customer->get_attribute(ATTR_DEF_ADRESS); - $result['customer']['postalzone']=$customer->get_attribute(ATTR_DEF_POSTCODE); - $result['customer']['city']=$customer->get_attribute(ATTR_DEF_CITY); + $result['customer']=$this->fill_customer($operation->det->array[0]['qs_client']); - // find country_code of this card + // currency + $result['currency']=$this->cn->get_value("select cr_code_iso from currency where id=$1" + ,array($operation->det->currency_id)); - $result['customer']['country']=$customer->get_attribute(ATTR_DEF_COUNTRY); + // document description + $result['description']=$operation->det->jr_comment; - $result['customer']['customer_id']=str_replace([" ",".","-","/"],"" ,$customer->get_attribute(ATTR_DEF_NUMTVA)); - // official name of the company - $result['customer']['registration_name']=$customer->get_attribute(ATTR_DEF_NAME); - // official ID , like VAT - $result['customer']['customer_id']=$customer->get_attribute(ATTR_DEF_NUMTVA); - // +++TODO+++ adapt for all currency - // currency must be EURO ! - $result['currency']=$operation->det->currency_id; // goods and services $result['operation']=array(); + $nb_operation= count($operation->det->array); for ($i=0;$i < $nb_operation;$i++) { $result['operation'][$i]['card_id']=$operation->det->array[$i]['qs_fiche']; $result['operation'][$i]['quantity']=$operation->det->array[$i]['qs_quantite']; - $result['operation'][$i]['price']=$operation->det->array[$i]['qs_price']; - $result['operation'][$i]['vat']=$operation->det->array[$i]['qs_vat']; + $card=new \Fiche($this->cn,$operation->det->array[$i]['qs_fiche']); + $result['operation'][$i]['qcode']=$card->get_attribute(ATTR_DEF_QUICKCODE); + $result['operation'][$i]['name']=$card->get_attribute(ATTR_DEF_NAME); + $result['operation'][$i]['description']=$card->get_attribute(9); + // get the type of unity, if not found then it will be EA + $x= $card->get_attribute(ATTR_DEF_QUANTITY_TYPE,0); + $result['operation'][$i]['code_quantity']=($x===false||$x=="")?"EA":$x; + + // $operation->det->currency_id == 0 default currency of the folder + if ($operation->det->currency_id == 0 ) { + $result['operation'][$i]['price']=$operation->det->array[$i]['qs_price']; + $result['operation'][$i]['price_unit']=$operation->det->array[$i]['qs_unit']; + $result['operation'][$i]['vat']=$operation->det->array[$i]['qs_vat']; + } else { + $result['operation'][$i]['price']=$operation->det->array[$i]['oc_amount']; + $result['operation'][$i]['price_unit']=bcdiv( + $operation->det->array[$i]['oc_amount'], + $operation->det->array[$i]['qs_quantite'], + 2); + $result['operation'][$i]['vat']=$operation->det->array[$i]['oc_vat_amount']; + + } $result['operation'][$i]['vat_id']=$operation->det->array[$i]['qs_vat_code']; +// // tva code for PEPPOL + $x=$this->cn->get_row("select tva_peppol_code,tva_rate from tva_rate where tva_id=$1" + ,[ $result['operation'][$i]['vat_id']]); + $result['operation'][$i]['vat_code']=($x['tva_peppol_code']=="")?"S":$x['tva_peppol_code']; + $result['operation'][$i]['vat_rate']=$x['tva_rate']; + $result['operation'][$i]['vat_reversed']=$operation->det->array[$i]['qs_vat_sided']; } - print_r($result); + //------------------------------------------------ + // retrieve order and comment + //------------------------------------------------ + $a_row=$this->cn->get_array("select id_type,ji_value from jrn_info where jr_id=$1" + ,[$jr_id]); + $nb_row = count($a_row); + $result['info']=[]; + $result['info']['order']='NA'; + $result['info']['communication']=''; + for($i=0;$i<$nb_row;$i++) { + switch ($a_row[$i]['id_type']) { + case 'BON_COMMANDE': + $result['info']['order']=$a_row[$i]['ji_value']; + break; + case 'OTHER': + $result['info']['communication']=$a_row[$i]['ji_value']; + break; + + } + } + $result['info']['communication']=($result['info']['communication']=="")?$result['id']:""; + /** + * Compute totals VAT and AMOUNT + */ + $nb_operation = count($result['operation']); + + /// block cac:LegalMonetaryTotal + $result['LineExtensionAmount']=0; + $result['TaxExclusiveAmount']=0; + $result['TaxInclusiveAmount']=0; + $result['PayableAmount']=0; + + // block cac:TaxTotal + $result['TaxableAmount']=0; + $result['TaxAmount']=0; + + // array for TaxSubtotal + $VAT_SubTotal=array(); + $idx_subtotal=0; + bcscale(2); + // for each operation + $VAT_SubTotal=array(); + for ($i=0;$i < $nb_operation;$i++) { + $acc_tva=\Acc_TVA::build($this->cn,$result['operation'][$i]['vat_id'] ); + $percent = bcmul($acc_tva->tva_rate,100,2); + $idx=sprintf("%s - %s",$percent,$result['operation'][$i]['vat_code'] ); + // subtotal for VAT + $n = find_idx($VAT_SubTotal,'idx',$idx); + if ($n == -1 ) { + $n=$idx_subtotal; + $VAT_SubTotal[$idx_subtotal]=array(); + $VAT_SubTotal[$idx_subtotal]['idx']=$idx; + $VAT_SubTotal[$idx_subtotal]['vat_code']=$result['operation'][$i]['vat_code'] ; + $VAT_SubTotal[$idx_subtotal]['percent']=$percent; + $VAT_SubTotal[$idx_subtotal]['amount']=$VAT_SubTotal[$idx_subtotal]['vat']=0; + $idx_subtotal++; + } + /** + * @todo Pour les intracomm , quel taux utilisé ? 0 ou 21% + */ + $VAT_SubTotal[$n]['amount']=bcadd($VAT_SubTotal[$n]['amount'],$result['operation'][$i]['price']); + $VAT_SubTotal[$n]['vat']=bcadd($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat']); + $VAT_SubTotal[$n]['vat']=bcsub($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat_reversed']); + $result['TaxableAmount']=bcadd( $result['TaxableAmount'],$result['operation'][$i]['price']); + $result['TaxAmount']=bcadd( $result['TaxAmount'],$result['operation'][$i]['vat']); + $result['TaxAmount']=bcsub( $result['TaxAmount'],$result['operation'][$i]['vat_reversed']); + $result['operation'][$i]['vat_percent']=$percent; + } + $result['subTotalVAT']=$VAT_SubTotal; + $result['LineExtensionAmount']= $result['TaxableAmount']; + $result['TaxExclusiveAmount']= $result['TaxableAmount']; + $result['TaxInclusiveAmount']=bcadd( $result['TaxableAmount'],$result['TaxAmount']); + $result['PayableAmount']=bcadd( $result['TaxableAmount'],$result['TaxAmount']); + return $result; } + + /** * @brief make an array of parameter_extra where pe_code as key and pe_value * as value - * @return array + * @return array keys : pe_code,pe_value */ function load_noalyss_parameter() { @@ -238,19 +326,218 @@ abstract class XMLInvoice extends \DOMDocument abstract function make_xml($jr_id); /** * @brief check that mandatory info are saved in the DB for company (seller) - * @param $a_error (array) array of errors, empty if nothing found */ - abstract function check_company_data(&$a_error) ; + abstract function check_company_data() ; /** * @brief check that mandatory info are saved in the DB for customer * @param $customer_id (int) card of the customer FICHE.F_ID - * @param $a_error (array) array of errors, empty if nothing found */ - abstract function check_customer_data($customer_id,&$a_error) ; + abstract function check_customer_data($customer_id) ; /** * @brief create the invoice in the right format, with PDF if any * @param $operation_id (int) JRN.JR_ID * @return string : XML or PDF format */ abstract function create_invoice($operation_id) ; + + /** + * @brief display_error display a warning with all error + */ + public function display_error() + { + $a_error=$this->verify(); + include NOALYSS_TEMPLATE."/xmlinvoice-display_error.php"; + + } + + /** + * @brief check that the VAT is using a PEPPOL Code + */ + function check_VAT() + { + $a_error=array(); + $nb_operation=count($this->data['operation']); + for ($i=0;$i <$nb_operation;$i++) + { + if ( $this->data['operation'][$i]['vat_code'] == "" ) { + $card=new \Fiche( + $this->cn + ,$this->data['operation'][$i]['card_id'] + ); + $tva= \Acc_Tva::build($this->cn, $this->data['operation'][$i]['vat_id']); + $a_error[]=sprintf(_("%s : %s code TVA pour PEPPOL non configuré code TVA [ %s %s ]") + , $i + , $card->get_quick_code() + ,$tva->tva_id + ,$tva->tva_code + ); + } + } + return $a_error; + } + + /** + * @brief thanks MY_INVOICE_FORMAT , create the corresponding object + * - UBL21BEL => InvoiceUBL21 + * - FacturX => FACTURXFR + * @returns null MY_INVOICE_FORMAT is BASIC + */ + static function build_xmlinvoice(\Database $conx) { + global $g_parameter; + if ($g_parameter->MY_INVOICE_FORMAT == 'UBL21BEL') { + return new \Noalyss\XMLDocument\InvoiceUBL21($conx); + } + if ($g_parameter->MY_INVOICE_FORMAT == 'FACTURXFR') { + return new \Noalyss\XMLDocument\FacturX($conx); + } + return null; + } + + /** + * @brief check that all the data are correct + * @returns null : no errors, string separated with comma of error code + * @see get_message_error + */ + public function verify() + { + // verify all VAT + ///@var $a_error : array of error_code see check_company_error + $a_error = array(); + $a_error['general'] = []; + $a_error['operation']=[]; + + // verify that all needed data in PARAMETER are valid + $a_error['company'] = $this->check_company_data(); + $a_error['customer'] = $this->check_customer_data($this->data['customer']['card_id']); + + return $a_error; + } + + /** + * @brief retrieve data from customer and return it into an array + * @param $card_id (int) FICHE.F_ID + * @return array keys : + * - name + * - ,street + * - ,postalzone + * - ,city + * - ,country + * - ,customer_id => VAT Number + * - , registration_name, + * - card_id + */ + function fill_customer($card_id):array + { + $customer =new \Fiche($this->cn,$card_id); + $result=array(); + $result['card_id']=$card_id; + $result['name']=$customer->get_attribute(ATTR_DEF_NAME,0); + $result['street']=$customer->get_attribute(ATTR_DEF_ADRESS,0); + $result['postalzone']=$customer->get_attribute(ATTR_DEF_POSTCODE,0); + $result['city']=$customer->get_attribute(ATTR_DEF_CITY,0); + + // find country_code of this card + $result['country']=$customer->get_attribute(ATTR_DEF_COUNTRY_CODE,0); + + // official ID , like VAT + $result['customer_id']=str_replace([" ",".","-","/"],"" ,$customer->get_attribute(ATTR_DEF_NUMTVA,0)); + // official name of the company + $result['registration_name']=$customer->get_attribute(ATTR_DEF_NAME,0); + $result['endpoint_id']=$customer->get_attribute(ATTR_DEF_PEPPOLID,0); + return $result; + } + /** + * @brief complete $this->data from $g_parameter (global variable) for + * Noalyss_Folder_Parameter + * @return array keys : + * - name + * - ,street + * - ,postalzone + * - ,city + * - ,country + * - supplier_id => VAT Number + * - registration_name, + * + */ + function fill_supplier():array + { + $a_parameter=$this->load_noalyss_parameter(); + $result=array(); + $result['name']=$a_parameter['MY_NAME']; + $result['street']=$a_parameter['MY_STREET']; + $result['postalzone']=$a_parameter['MY_POSTCODE']; + $result['city']=$a_parameter['MY_CITY']; + $result['country']=$a_parameter['MY_COUNTRY']; + // official name of the company + $result['registration_name']=$a_parameter['MY_NAME']; + // official ID , like VAT + $result['supplier_id']=str_replace([" ",".","-","/"],"" ,$a_parameter['MY_TVA']); + $result['COUNTRY_CODE']=$a_parameter['COUNTRY_CODE']??""; + $result['COMPANY_LEGAL_REGISTRATION']=$a_parameter['COMPANY_LEGAL_REGISTRATION']??""; + $result['COMPANY_LEGAL_ENTITY']=$a_parameter['COMPANY_LEGAL_ENTITY']??""; + $result['INVOICE_CONTACT_NAME']=$a_parameter['INVOICE_CONTACT_NAME']??""; + $result['INVOICE_EMAIL_COMPANY']=$a_parameter['INVOICE_EMAIL_COMPANY']??""; + $result['COMPANY_UBL_ID']=$a_parameter['COMPANY_UBL_ID']??""; + return $result; + } + /** + * @brief build operation from array + * key : + * - [e_march0] => Quick code of the item + - [e_march0_label] => Label of item + - [e_march0_price] => Unit Price + - [e_quant0] => Quantity + - [htva_march0] => Price w/0 VAT + - [e_march0_tva_id] => Code VAT + - [e_march0_tva_amount] => Amount VAT + - [tva_march0] => Amount VAT (duplicate -> to remove) + - [tvac_march0] => Total Amount Tax included + * @param type $a_array + * @return type + */ + function fill_operation_from_array($a_array) + { + $result=array(); + $http=new \HttpInput(); + $http->set_array($a_array); + + $nb_item=$http->get_value("nb_item"); + for ($i=0;$i<$nb_item;$i++) + { + if ( $http->get_value("e_march{$i}_tva_id") == "") + { + continue; + } + $operation=array(); + $card=\Fiche::from_qcode($this->cn,trim($http->get_value("e_march{$i}"))); + $operation['card_id']=$card->id; + $operation['quantity']=$http->get_value("e_quant{$i}"); + $operation['price']=$http->get_value("e_march{$i}_price"); + $operation['vat']=$http->get_value("tvac_march{$i}"); + $tva= \Acc_Tva::build($this->cn, $http->get_value("e_march{$i}_tva_id")); + $operation['vat_id']=$tva->tva_id; + $operation['vat_reversed']=($tva->tva_both_side==1)?$operation['vat']:0; + $operation['vat_code']=$tva->tva_peppol_code; + + $operation['code_quantity']=$card->get_attribute(ATTR_DEF_QUANTITY_TYPE,0); + $operation['code_quantity']=($operation['code_quantity']=="")?"EA":$operation['code_quantity']; + $result[$i]=$operation; + } + return $result; + } + + /** + * @brief set the PDF + * @param $pdf_filename (string) full path to the PDF + * @return $this + * @throws \Exception if the filename doesn't exist + */ + public function set_pdf_filename($pdf_filename) { + if ( !file_exists($pdf_filename)) { + throw new \Exception("AD65 $pdf_filename doesn't not exist"); + } + $this->pdf_filename = $pdf_filename; + return $this; + } + } diff --git a/include/XMLDocument/xmlinvoice_reader.class.php b/include/XMLDocument/xmlinvoice_reader.class.php new file mode 100644 index 000000000..6e62822e7 --- /dev/null +++ b/include/XMLDocument/xmlinvoice_reader.class.php @@ -0,0 +1,540 @@ +domDocument = $domDocument; + $this->xpath = new \DOMXPath($this->domDocument); + } + + /** + * + * @return \DOMDocument + */ + public function get_domDocument(): \DOMDocument + { + return $this->domDocument; + } + + public function get_xpath(): \DOMXPath + { + return $this->xpath; + } + + public function set_domDocument($domDocument) + { + $this->domDocument = $domDocument; + return $this; + } + + /** + * @brief Build an XMLInvoice_Reader object from an XML string + * @param $string (string) XML + * @return \Noalyss\XMLDocument\XMLInvoice_Reader + * @throws \Exception if xml not valid + */ + static function build_from_string($string) + { + $dm = new \DOMDocument(); + if ($dm->loadXML($string) != false) + { + return new XMLInvoice_Reader($dm); + } else + { + throw new \Exception("XR55: not a valid XML"); + } + } + + /** + * @brief Build an XMLInvoice_Reader object from an XML file + * @param $filename (string) file and path to the file + * @return \Noalyss\XMLDocument\XMLInvoice_Reader + * @throws \Exception if xml not valid + */ + static function build_from_file($filename) + { + if (!file_exists($filename)) + { + throw new \Exception("XR62: file not found $filename", 62); + } + $dm = new \DOMDocument(); + if ($dm->load($filename) != false) + { + return new XMLInvoice_Reader($dm); + } else + { + throw new \Exception("XR55: not a valid XML", 55); + } + } + + /** + * @brief execute a XPATH query of the DOMDocument and return the result + * or null if nothing found + * @param $query (string) valid XPath Query + * @return null or DOMNodeList or DOMElement + */ + public function get_node($query) + { + if ($this->xpath->query($query)->length == 0) + { + return null; + } + return $this->xpath->query($query); + } + + /** + * @brief returns the embedded document in an array (keys : filecontent (BYTES),mimecode , filename) + * or false if there is no document + * @return bool|array keys : filecontent (BYTES),mimecode , filename) + * or false if there is no document + * @throws \Exception if there are several documents + * + */ + public function get_embedded_document() + { + if (($node = $this->get_node("//cac:AdditionalDocumentReference")) == false) + { + return false; + } + if ($node->length > 1) + { + throw new \Exception("XR110 Too many documents found", 110); + } + ///@var DOMNodeList $data //cac:AdditionalDocumentReference[1]/cac:Attachment[1]/cbc:EmbeddedDocumentBinaryObject[1] + if ( + ($data = $this->get_node("//cac:AdditionalDocumentReference[1]/cac:Attachment[1]/cbc:EmbeddedDocumentBinaryObject[1]")) == null + ) + { + + throw new \Exception("X116 Document corrupted", 116); + } + $filecontent = base64_decode($data->item(0)->nodeValue); + $mimecode = $data->item(0)->getAttribute("mimeCode"); + $filename = $data->item(0)->getAttribute("filename"); + return array("filecontent" => $filecontent, + "mimecode" => $mimecode, + "filename" => $filename); + } + + /** + * @brief get the node value + * @param $query (string) valid XPath query + * @param $ix (int) the item number + * @return string + */ + function get_node_value($query, $ix = 0) + { + return $this->get_node($query)?->item($ix)?->nodeValue; + } + + /** + * @brief get the customer info from XML + * @return array + */ + function get_customer(): array + { + $result = []; + $result['ID'] = $this->get_node_value("//cac:AccountingCustomerParty[1]/cac:Party[1]/cbc:EndpointID[1]"); + $result['name'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PartyName[1]/cbc:Name[1]'); + $result['street'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:StreetName[1]'); + $result['city'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:CityName[1]'); + $result['postcode'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:PostalZone[1]'); + $result['country_code'] = $this->get_node_value("//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cac:Country[1]/cbc:IdentificationCode[1]"); + $result['company_id'] = $this->get_node_value("//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PartyTaxScheme[1]/cbc:CompanyID[1]"); + return $result; + } + + /** + * @brief get the supplier info from XML + * @return array + */ + function get_supplier(): array + { + $result = []; + $result['ID'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cbc:EndpointID[1]"); + $result['name'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyName[1]/cbc:Name[1]"); + $result['street'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:StreetName[1]"); + $result['city'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:CityName[1]"); + $result['postcode'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:PostalZone[1]"); + $result['country_code'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cac:Country[1]/cbc:IdentificationCode[1]"); + $result['company_id'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyTaxScheme[1]/cbc:CompanyID[1]"); + return $result; + } + + /** + * @brief get the Taxes info from XML + * @return array + */ + function get_taxes(): array + { + $result = []; + $node = $this->get_node("//cac:TaxTotal/cac:TaxSubtotal"); + + for ($e = 0; $e < $node->length; $e++) + { + $row = []; + $xml = simplexml_import_dom($node->item($e)); + // /Invoice/cac:TaxTotal[1]/cac:TaxSubtotal[1]/cbc:TaxableAmount[1] + + $row ['taxable_amount'] = $xml->xpath("//cbc:TaxableAmount")[$e] . ""; + $row ['tax'] = $xml->xpath("//cbc:TaxAmount")[$e] . ""; + $row ['tax_id'] = $xml->xpath("//cac:TaxCategory/cbc:ID")[$e] . ""; + $row ['tax_percent'] = $xml->xpath("//cac:TaxCategory/cbc:Percent")[$e] . ""; + // $row ['name'] =$xml->xpath("//cac:InvoiceLine/cac:Item/cbc:Name")[$e]."
"; + /** + * @TODODNY + * Implémenter les allowances + */ + $result[] = $row; + } + return $result; + } + + /** + * @brief retrieve InvoiceLines + * @TODO XMLInvoice_Reader->get_invoiceLine * Implémenter les allowances + */ + function get_invoiceLine(): array + { + $result = []; + $node = $this->get_node("//cac:InvoiceLine"); + for ($e = 0; $e < $node->length; $e++) + { + $row = []; + $xml = simplexml_import_dom($node->item($e)); + //var_dump($xml->asXML()); + $row ['quantity'] = $this->get_node_value("//cbc:InvoicedQuantity", $e); + $row ['amount'] = $this->get_node_value("//cbc:LineExtensionAmount", $e); + $row ['description'] = $this->get_node_value("//cac:Item/cbc:Description", $e); + $row ['name'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cbc:Name", $e); + $row ['unit_price'] = $this->get_node_value("//cac:InvoiceLine/cac:Price/cbc:PriceAmount", $e); + $row ['tva_id'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID", $e); + $row ['tva_percent'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent", $e); + + $result[] = $row; + } + return $result; + } + + /** + * @brief get the Payment Means info from XML + * @return array + */ + function get_payment_mean(): array + { + $result = []; + $result['payment_code'] = $this->get_node_value("//cac:PaymentMeans[1]/cbc:PaymentMeansCode[1]"); + $result['label'] = $this->get_node_value("//cac:PaymentMeans[1]/cbc:PaymentID[1]"); + $result['iban'] = $this->get_node_value("//cac:PaymentMeans[1]/cac:PayeeFinancialAccount[1]/cbc:ID[1]"); + $result['bic'] = $this->get_node_value("//cac:PaymentMeans[1]/cac:PayeeFinancialAccount[1]/cac:FinancialInstitutionBranch[1]/cbc:ID[1]"); + $result['note'] = []; + $note = $this->get_node("//cac:PaymentTerms/cbc:Note"); + if ($note != null) + { + $a = $note->length; + for ($i = 0; $i < $a; $i++) + { + $result['note'][] = $note->item(0)->nodeValue; + } + } + /** + + In geval van betaling binnen 14 dagen is 2% (52.00€) betalingskorting van + toepassing en het te betalen bedrag = 3053.68€ + En cas de paiement dans les 14 jours, l'escompte conditionnel de 2% (52.00€) est appliqué et le montant payable = 3053.68€ + In case of payment within 14 days, 2% (52.00€) conditional cash/payment discount applies and the payable amount = 3053.68€ + + + */ + return $result; + } + + /** + * @brief get the node value from simpleXML + * @param $xml (\SimpleXMLElement) fragment of XML dom + * @param $query (string) XPath query + * @return string + */ + protected function get_simple_xml_value(\SimpleXMLElement $xml, $query): string + { + $x = $xml->xpath($query); + $result = (count($x) == 0) ? "" : $x[0]; + return (string) $result; + } + + /** + * @brief get the amount summary info from XML + * @return array + */ + function get_amount_summary(): array + { + $result = []; + $node = $this->get_node("//cac:LegalMonetaryTotal"); + $xml = simplexml_import_dom($node->item(0)); + $result['LineExtensionAmount'] = $this->get_simple_xml_value($xml, "cbc:LineExtensionAmount"); + $result['TaxExclusiveAmount'] = $this->get_simple_xml_value($xml, "cbc:TaxExclusiveAmount"); + $result['TaxInclusiveAmount'] = $this->get_simple_xml_value($xml, "cbc:TaxInclusiveAmount"); + $result['PayableAmount'] = $this->get_simple_xml_value($xml, "cbc:PayableAmount"); + $result['AllowanceTotalAmount'] = $this->get_simple_xml_value($xml, "cbc:AllowanceTotalAmount"); + $result['AllowanceTotalAmount'] = ($result['AllowanceTotalAmount'] == "") ? 0 : $result['AllowanceTotalAmount']; + $result['ChargeTotalAmount'] = $this->get_simple_xml_value($xml, "cbc:ChargeTotalAmount"); + $result['ChargeTotalAmount'] = ($result['ChargeTotalAmount'] == "") ? 0 : $result['ChargeTotalAmount']; + return $result; + } + + /** + * @brief get the customer info from XML + * @return array + */ + + /** + * + @code + + false + 64 + Conditional cash/payment discount | Korting contant | Escompte Conditionnel 2% + 4.00 + + S + 6.00 + + VAT + + + + @encode + */ + function get_allowance(): array + { + $result = []; + return $result; + } + + /** + * + * @return array + * @TODODNY + * Implémenter les allowances + */ + function get_info(): array + { + $result = []; + $result['id'] = $this->get_node_value('cbc:ID'); + $result['IssueDate'] = $this->get_node_value('cbc:IssueDate'); + $result['DueDate'] = $this->get_node_value('cbc:DueDate'); + $result['InvoiceTypeCode'] = $this->get_node_value('cbc:InvoiceTypeCode'); + $result['DocumentCurrencyCode'] = $this->get_node_value('cbc:DocumentCurrencyCode'); + $result['BuyerReference'] = $this->get_node_value('cbc:BuyerReference'); + $result['ActualDeliveryDate'] = $this->get_node_value('//cac:Delivery[1]/cbc:ActualDeliveryDate[1]'); + /* + + 2018-07-01 + + */ + return $result; + } + + /** + * @brief make a PDF with the information from XMLInvoice + * @param \Database $cn + * @returns \PDF + */ + public function to_pdf(\Database $cn): \PDF + { + $pdf = new \PDF($cn); + $result = $this->get_info(); + + $pdf->setDossierInfo(_(" id ")." ".$result['id']); + $pdf->AliasNbPages(); + $pdf->setAuthor("Noalyss"); + $pdf->AddPage(); + // 180 mm large + $pdf->setFont("DejaVu", "B", 12); + $pdf->write_cell(60, 4, _("Information facture")); + $pdf->line_new(10); + $pdf->setFont("DejaVu", "", 7); + $pdf->write(4, sprintf(_("Document ID %s"), $result['id'])); + $pdf->ln(); + $pdf->write(4, sprintf(_("Date facture %s"), $result['IssueDate'])); + $pdf->ln(); + $pdf->write(4, sprintf(_("Date échéance %s"), $result['DueDate'])); + $pdf->ln(); + $pdf->write(4, sprintf(_("Code facture %s"), $result['InvoiceTypeCode'])); + $pdf->ln(); + $pdf->write(4, sprintf(_("Devise docuemnt %s"), $result['DocumentCurrencyCode'])); + $pdf->ln(); + $pdf->write(4, sprintf(_("Référence client %s"), $result['BuyerReference'])); + $pdf->ln(); + $pdf->write(4, sprintf(_("Date Livraison %s"), $result['ActualDeliveryDate'])); + $pdf->ln(10); + + $pdf->setFont("DejaVu", "B", 12); + $pdf->write_cell(60, 4, _("Fournisseur")); + $pdf->line_new(12); + $supplier = $this->get_supplier(); + $pdf->setFont("DejaVu", "", 7); + $pdf->write_cell(60, 4, $supplier['name']); + $pdf->write_cell(60, 4, $supplier['company_id']); + $pdf->write_cell(60, 4, $supplier['ID']); + $pdf->line_new(); + $pdf->write_cell(60, 4, $supplier['street']); + $pdf->write_cell(30, 4, $supplier['postcode']); + $pdf->write_cell(60, 4, $supplier['city']); + $pdf->write_cell(20, 4, $supplier['country_code']); + $pdf->line_new(10); + + $customer = $this->get_customer(); + $pdf->setFont("DejaVu", "B", 12); + $pdf->write_cell(60, 4, _("Client")); + $pdf->line_new(10); + $pdf->setFont("DejaVu", "", 7); + $pdf->write_cell(60, 4, $customer['name']); + $pdf->write_cell(60, 4, $customer['company_id']); + $pdf->write_cell(60, 4, $customer['ID']); + $pdf->line_new(); + $pdf->write_cell(60, 4, $customer['street']); + $pdf->write_cell(40, 4, $customer['postcode']); + $pdf->write_cell(60, 4, $customer['city']); + $pdf->write_cell(20, 4, $customer['country_code']); + $pdf->line_new(10); + + $pdf->setFont("DejaVu", "B", 12); + $pdf->write_cell(60, 4, _("Articles")); + $pdf->line_new(10); + $pdf->setFont("DejaVu", "", 7); + $result = $this->get_invoiceLine(); + $pdf->write_cell(50, 4, _("Code"), border: 'B'); + $pdf->write_cell(50, 4, _("Description"), border: 'B'); + $pdf->write_cell(30, 4, _("TVA"), border: 'B', align: 'R'); + $pdf->write_cell(25, 4, _("Quantité"), border: 'B', align: 'R'); + $pdf->write_cell(25, 4, _("Montant HT"), border: 'B', align: 'R'); + $pdf->line_new(); + + $nb_inline = count($result); + for ($i = 0; $i < $nb_inline; $i++) + { + $pdf->write_cell(50, 4, $result[$i]['name']); + $pdf->write_cell(50, 4, $result[$i]['description']); + $pdf->write_cell(25, 4, $result[$i]['tva_percent'], align: 'R'); + $pdf->write_cell(5, 4, $result[$i]['tva_id']); + $pdf->write_cell(25, 4, $result[$i]['quantity'], align: 'R'); + $pdf->write_cell(25, 4, $result[$i]['amount'], align: 'R'); + $pdf->line_new(); + } + $pdf->line_new(10); + + $pdf->setFont("DejaVu", "B", 12); + $pdf->write_cell(60, 4, _("Totaux")); + $pdf->line_new(10); + $pdf->setFont("DejaVu", "", 7); + $result = $this->get_amount_summary(); +// @TODO DNY : Qu'est-ce que LineExtension Amount ?? + $pdf->write_cell(50, 4, _("Base taxe")); + $pdf->write_cell(50, 4, $result['LineExtensionAmount']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("Total Hors Taxe")); + $pdf->write_cell(50, 4, $result['TaxExclusiveAmount']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("Total avec Taxe")); + $pdf->write_cell(50, 4, $result['TaxInclusiveAmount']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("Total à payer")); + $pdf->write_cell(50, 4, $result['PayableAmount']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("Total réduction")); + $pdf->write_cell(50, 4, $result['AllowanceTotalAmount']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("Total charge")); + $pdf->write_cell(50, 4, $result['ChargeTotalAmount']); + $pdf->line_new(); + + $pdf->line_new(10); + $pdf->setFont("DejaVu", "B", 12); + $pdf->write_cell(60, 4, _("TVA")); + $pdf->line_new(10); + $pdf->setFont("DejaVu", "", 7); + $result = $this->get_taxes(); + $pdf->write_cell(25, 4, _("% Taxe"), align: 'R', border: 'B'); + $pdf->write_cell(5, 4, _("Code taxe"), border: 'B'); + $pdf->write_cell(50, 4, _("Base"), align: 'R', border: 'B'); + $pdf->write_cell(50, 4, _("Taxe"), align: 'R', border: 'B'); + $pdf->line_new(); + $nb_inline = count($result); + for ($i = 0; $i < $nb_inline; $i++) + { + $pdf->write_cell(25, 4, $result[$i]['tax_percent'], align: 'R'); + $pdf->write_cell(5, 4, $result[$i]['tax_id']); + $pdf->write_cell(50, 4, $result[$i]['taxable_amount'], align: 'R'); + $pdf->write_cell(50, 4, $result[$i]['tax'], align: 'R'); + + $pdf->line_new(); + } + $pdf->line_new(10); + $pdf->setFont("DejaVu", "B", 12); + $pdf->write_cell(60, 4, _("Paiement")); + $pdf->line_new(10); + $pdf->setFont("DejaVu", "", 7); + $result = $this->get_payment_mean(); + $pdf->write_cell(50, 4, _("Code")); + $pdf->write_cell(50, 4, $result['payment_code']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("IBAN")); + $pdf->write_cell(50, 4, $result['iban']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("BIC")); + $pdf->write_cell(50, 4, $result['bic']); + $pdf->line_new(); + $pdf->write_cell(50, 4, _("Communication")); + $pdf->write_cell(50, 4, $result['label']); + $pdf->line_new(); + $nb_note = count($result['note']); + for ($i = 0; $i < $nb_note; $i++) + { + $pdf->write_cell(40, 4, _("note") . " " . $i); + $pdf->write_multi(140, 4, str_replace(["\n","\r","\t"]," ",$result['note'][$i])); + $pdf->line_new(); + } + return $pdf; + } +} diff --git a/include/ajax/ajax_ledger.php b/include/ajax/ajax_ledger.php index 056088938..c26cf593a 100644 --- a/include/ajax/ajax_ledger.php +++ b/include/ajax/ajax_ledger.php @@ -256,6 +256,11 @@ switch ($action) { $filename = mb_substr($obj->det->jr_pj_name, 0, 60); } echo HtmlInput::show_receipt_document($jr_id, h($filename)); + // if using the XML Belgian format, add a tab for showing it + $acc_document=new Acc_Document($cn,$jr_id); + echo ''. + $acc_document->link_download_xml() + .''; echo $x; echo '

'; echo ''; @@ -268,9 +273,8 @@ switch ($action) { case 'loadfile': if ($access == 'W' && isset ($_FILES)) { $cn->start(); - // remove the file - $grpt = $cn->get_value('select jr_grpt_id from jrn where jr_id=$1', array($jr_id)); - $cn->save_receipt($grpt); + $acc_document=new \Acc_Document($cn,$jr_id); + $acc_document->save_receipt(); $cn->commit(); // Show a link to the new file $op->get(); @@ -290,7 +294,13 @@ switch ($action) { $filename = $obj->det->jr_pj_name; echo HtmlInput::show_receipt_document($jr_id, h($filename)); echo $x; - + // if using the XML Belgian format, add a tab for showing it + $acc_document=new Acc_Document($cn,$jr_id); + echo ''. + $acc_document->link_download_xml() + .''; + echo '

'; + echo ''; echo ''; echo ''; } @@ -325,12 +335,21 @@ switch ($action) { $old_oid = $r['jr_pj']; if (strlen($old_oid) != 0) { // check if this pj is used somewhere else - $c = $cn->count_sql("select * from jrn where jr_pj=" . $old_oid); + $c = $cn->get_value("select count(*) from jrn where jr_pj=$1", + [$old_oid]); + if ($c == 1) $cn->lo_unlink($old_oid); } + $cn->exec_sql("update jrn set jr_pj=null, jr_pj_name=null, " . "jr_pj_type=null where jr_id=$1", array($jr_id)); + + if ( ($oid_xml = $cn->get_value("select jr_document_xml from jrn where jr_id = $1",[$jr_id])) != "") + { + $cn->exec_sql("update jrn set jr_document_xml=null where jr_id=$1", array($jr_id)); + $cn->lo_unlink($oid_xml); + } } } echo ''; diff --git a/include/class/acc_document.class.php b/include/class/acc_document.class.php new file mode 100644 index 000000000..efe9c7ea5 --- /dev/null +++ b/include/class/acc_document.class.php @@ -0,0 +1,387 @@ +document_xml; + } + + public function set_document_xml($document_xml) { + $this->document_xml = $document_xml; + return $this; + } + + /** + * @brief constructor + * @param $cn \Database + * @param $jr_id (int) JRN.JRID will be in d_id + */ + function __construct($cn, $jr_id=0) + { + $this->db=$cn; + $this->set_id($jr_id); + // counter for MARCH_NEXT + $this->counter=0; + + } + /** + * @brief set_id fill up d_filename, d_mimetype,d_lob,d_description,jr_pj_number + */ + function set_id($jr_id) { + $this->d_id=$jr_id; + if ( $jr_id == 0 ){ + return $this; + } + $row = $this->db->get_row("select jr_comment + ,jr_pj + ,jr_pj_name + ,jr_pj_type + ,jr_pj_number + ,jr_document_xml + from jrn + where + jr_id=$1", [$this->d_id]); + if ( empty ($row)) { + return $this; + } + $this->d_name=$row['jr_pj_number']; + $this->d_description=$row['jr_comment']; + $this->d_mimetype=$row['jr_pj_type']; + $this->d_filename=$row['jr_pj_name']; + $this->d_lob=$row['jr_pj']; + $this->document_xml=$row['jr_document_xml']; + return $this; + } + /** + * @brief save the file into DB, will create a large object if there + * is no document to replace. It will change the d_filename, d_mimetype + * + * @param $d_filename (string) full path to the file to load into DB + * + * @returns false if d_id = 0 or the file doesn't exist, true for success + */ + function update($filename) { + if ($this->d_id == 0) return false; + if ( ! file_exists($filename)) return false; + $this->db->start(); + $this->d_mimetype= mime_content_type($filename); + $this->d_filename= basename($filename); + if ( $this->d_lob == "") { + $this->db->lo_unlink($this->d_lob); + } + + $this->d_lob=$this->db->lo_import($filename); + $this->db->exec_sql( + "update jrn set jr_pj=$1,jr_pj_name=$2,jr_pj_type=$3 + where jr_id=$4", + [$this->d_lob,$this->d_filename,$this->d_mimetype,$this->d_id] + ); + $this->db->commit(); + return true; + } + /** + * @brief for FACTURX we replace the PDF save in DB by this one, always + * a PDF (since it is a FACTURX document) + */ + function replace_receipt($new_oid) + { + if ($this->d_lob != "") + { + $this->db->lo_unlink($this->d_lob); + } + $this->d_lob=$new_oid; + $this->db->exec_sql(" + update jrn + set + jr_pj = $1 + ,jr_pj_name =$2 + ,jr_pj_type =$3 + where jr_id=$4 + ", + [$this->d_lob + ,$this->d_filename + ,$this->d_mimetype + ,$this->d_id] + ); + + } + /** + * @brief save the Large Object $oid in the column JRN.JR_DOCUMENT_XML + * @param $oid( OID) PostgreSQL Object ID + */ + function update_document_xml($oid){ + $this->db->exec_sql("update jrn set jr_document_xml=$1 where + jr_id=$2",[ + $oid, + $this->d_id + ]); + + } + /** + * @brief create the invoice and saved it as attachment to the + * operation, + * @param $p_array is normally the $_POST + @verbatim + Array + ( + [ledger_type] => VEN + [gDossier] => x + [nb_item] => 1 (number of item used to numerate e_marchX, e_quantX ,...) + [p_jrn] => 2 + [p_jrn_predef] => 2 + [jrn_type] => VEN or ACH + [e_date] => 10.06.2025 (date) + [e_ech] => limite date + [e_client] => CLIENT + [e_pj] => 25.827 + [e_pj_suggest] => 25.827 + [e_comm] => E-INVOICE + [p_currency_code] => 0 + [p_currency_rate] => 1 (rate if 1 for EURO) + [jrn_note_input] => + [e_march0] => 7DVINV + [e_march0_label] => Label of the operation + [e_march0_price] => 10.0000 + [e_quant0] => 1.0000 + [htva_march0] => 10 + [e_march0_tva_id] => 1 + [e_march0_tva_amount] => 2.1 + [tva_march0] => 2.1 + [tvac_march0] => 12.1 + ... + [mp_date] => (dd.mm.yyyy date of payment) + [acompte] => 0 (amount to deduce as advance payment) + [e_comm_paiement] => (string : comment of the payment) + [e_mp] => 0 (method of payment it is the XX in e_mp_qcode_XX) + [e_mp_qcode_16] => Banque 1 + [e_mp_qcode_17] => Banque 2 + [view_invoice] => Enregistrer + [gen_doc] => int DOCUMENT_MODELE.MD_ID , document template to use + ) + * @endverbatim + * @todo rewrite code : remove extract and +SQL value + * @returns void + */ + function create_document($internal, $p_array) { + $this->f_id = $p_array['e_client']; + // var md_id (int) DOCUMENT_MODELE.MD_ID + $this->md_id = $p_array['gen_doc']; + // var ag_id == 0 fake follow-up + $this->ag_id = 0; + // var e_pj (string) receipt nb + $p_array['e_pj'] = $this->db->get_value("select jr_pj_number from jrn where jr_id=$1" + , [$this->d_id]); + $filename = ""; + // generate the document and set d_lob,d_mimetype, + $this->generate($p_array, $p_array['e_pj']); + + // Move the document to accountancy (table JRN), + $this->moveDocumentACC($internal); + + // Update the comment with invoice number, if the comment is empty + if (!isset($p_array['e_comm']) || noalyss_strlentrim($p_array['e_comm']) == 0) { + $sql = "update jrn set jr_comment=' document " . $this->d_number . "' where jr_internal=$1"; + $this->db->exec_sql($sql, [$internal]); + } + } + + /** + * @brief export the file to the file system and complet $this->d_mimetype, d_filename and + * @param $destination_file (string) full path to document + * @return bool false for failure and string (the full path_name) for success + */ + function export_file($destination_file) { + + if (empty($this->d_filename)) { + return false; + } + + $this->db->start(); + if ($this->db->lo_export($this->d_lob, $destination_file) == false) { + record_log("ACD122. cannot export"); + $this->db->commit(); + return false; + } + $this->db->commit(); + + return $destination_file; + } + /** + * \brief Save a "piece justificative" , the name must be a receipt. If it + * is a XML document, split it into 2 parts : PDF and XML + * the PDF be stored in JR_PJ and the XML into JR_DOCUMENT_XML + * + * + * \return $oid of the lob file if success null if a error occurs + * + */ + function save_receipt() + { + $this->db->start(); + /** + * pj is the $_FILES key + */ + $a_file= $this->db->upload('pj',only_oid:false); + if ($a_file == false) { + return false; + } + $oid=$a_file['oid']; + // Remove old document if any + $old_oid = $this->db->get_value("select jr_pj from jrn where jr_id=$1" + ,[$this->d_id]); + + if ( $old_oid != "") + { + $this->db->lo_unlink( $old_oid); + } + + // if there is a e-invoice in XML + if ( $_FILES['pj']['type'] == 'text/xml' + || $_FILES['pj']['type'] == 'application/xml' + ) + { + // save the XML + $this->db->exec_sql("update jrn set jr_document_xml = $1 + where + jr_id=$2", + [$oid,$this->d_id]); + + $xmlreader= XMLInvoice_Reader::build_from_file($a_file['filename']); + + //@var $embedded_file (array) keys = filecontent: binary data + //,mimecode mimetype and filename (string) + try + { + $embedded_file=$xmlreader->get_embedded_document(); + if ($embedded_file == false) + { + $embedded_file=array(); + // create a PDF with standard information + $pdf=$xmlreader->to_pdf($this->db); + $file_oid=$this->db->lo_write($pdf->Output("S")); + $embedded_file['filename']="invoice.pdf"; + $embedded_file['mimecode']="application/pdf"; + } + else + { + $file_oid=$this->db->lo_write($embedded_file['filecontent']); + if ( $file_oid == false ) + { + // create a PDF with standard information + $pdf=$xmlreader->to_pdf($this->db); + $file_oid=$this->db->lo_write($pdf->Output("S")); + } + } + //@var $file_oid OID of the large object saved in DB + + + $this->d_name=$embedded_file['filename']; + $this->d_description=$embedded_file['filename']; + $this->d_lob=$file_oid; + $this->d_mimetype=$embedded_file['mimecode']; + // save extracted document into DB + $this->db->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2, + jr_pj_type=$3 where jr_id=$4", + array( + $this->d_lob + , $this->d_name + , $this->d_description + , $this->d_id + ) + ); + return $file_oid; + } catch (\Exception $e ) { + \record_log($e); + // if exception is not too many document or document corrupted + // then rethrow the exception + if ( !in_array(e->getCode(),[110,116]) ) + { + throw new \Exception("X281 ",281,$e); + } + } + + } + + // save new document + $this->db->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2, + jr_pj_type=$3 where jr_id=$4", + array( + $oid + , $_FILES['pj']['name'] + , $_FILES['pj']['type'] + , $this->d_id + ) + ); + $this->d_name=$_FILES['pj']['name']; + $this->d_description=$_FILES['pj']['name']; + $this->d_lob=$oid; + $this->d_mimetype=$_FILES['pj']['type']; + $this->db->commit(); + + return $oid; + } + /** + * @brief return a string with a link download XML or an empty string + * if there is no XML to download + */ + function link_download_xml():string + { + $xml_oid=$this->db->get_value("select jr_document_xml from jrn where jr_id=$1", + [$this->d_id]); + if ($xml_oid == "") { return "";} + $url= "export.php?".http_build_query( + [ + "gDossier"=>\Dossier::id(), + "jr_id"=>$this->d_id, + "act"=>'RAW:xml-invoice' + ]); + $r = sprintf('',$url); + $r .= _("XML") + .'' + .'' + .''; + return $r; + } + +} \ No newline at end of file diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 426c012c5..12e6e336d 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -1610,6 +1610,7 @@ class Acc_Ledger extends jrn_def_sql $acc_end->currency_rate=$currency_rate; $acc_end->currency_rate_ref=$currency_rate_ref->get_rate(); + // @var $jr_id (int) JRN.JR_ID $jr_id=$acc_end->insert_jrn(); $this->jr_id=$jr_id; @@ -1651,7 +1652,8 @@ class Acc_Ledger extends jrn_def_sql */ if (isset($_FILES["pj"])) { - $this->db->save_receipt($seq); + $acc_document=new Acc_Document($this->db, $jr_id); + $acc_document->save_receipt(); } /*---------------------------------------------- * Save the note @@ -1973,31 +1975,22 @@ class Acc_Ledger extends jrn_def_sql } /** - * @brief create the invoice and saved it as attachment to the - * operation, + * @brief alias for Acc_Document->create_document * @param $internal is the internal code * @param $p_array is normally the $_POST - * @todo rewrite code : remove extract and +SQL value - * \return a string + @see Acc_Document::create_document + * @return a string */ function create_document($internal, $p_array) { - $doc=new Document($this->db); - $doc->f_id=$p_array['e_client']; - $doc->md_id=$p_array['gen_doc']; - $doc->ag_id=0; - $p_array['e_pj']=$this->pj; - $filename=""; - $doc->Generate($p_array, $p_array['e_pj']); - // Move the document to the jrn - $doc->moveDocumentPj($internal); - // Update the comment with invoice number, if the comment is empty - if (!isset($p_array['e_comm'])||noalyss_strlentrim($p_array['e_comm'])==0) - { - $sql="update jrn set jr_comment=' document ".$doc->d_number."' where jr_internal=$1"; - $this->db->exec_sql($sql,[$internal]); + $id=$this->db->get_value('select jr_id from jrn where jr_internal=$1', + [$internal]); + if ( $id == "") { + return; } - return h($doc->d_name.' ('.$doc->d_filename.')'); + $acc_document=new Acc_Document($this->db,$id); + $acc_document->create_document($internal,$p_array); + return h($acc_document->d_name.' ('.$acc_document->d_filename.')'); } /** diff --git a/include/class/acc_ledger_fin.class.php b/include/class/acc_ledger_fin.class.php index 0f7ce0b88..b5a9a8cee 100644 --- a/include/class/acc_ledger_fin.class.php +++ b/include/class/acc_ledger_fin.class.php @@ -983,6 +983,7 @@ class Acc_Ledger_Fin extends Acc_Ledger throw new Exception (_("Erreur de balance"),EXC_BALANCE); // $acc_operation->update_receipt(); + $this->jr_id=&$jr_id; $this->db->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($acc_operation->pj, $jr_id)); $internal=$this->compute_internal_code($seq); @@ -1073,21 +1074,18 @@ class Acc_Ledger_Fin extends Acc_Ledger $class=($i%2==0)?' class="even" ':' class="odd" '; $ret.=tr($row, $class); - if ($i==0) + if ($i==0 && isset($_FILES['pj']) ) { // first record we upload the files and // keep variable to update other row of jrn - if (isset($_FILES['pj'])) - $oid=$this->db->save_receipt($seq); + $acc_document=new Acc_Document($this->db,$jr_id); + $oid=$acc_document->save_receipt(); } - else + elseif ($oid != 0 ) { - if ($oid!=0) - { - $this->db->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2, - jr_pj_type=$3 where jr_grpt_id=$4", - array($oid, $_FILES['pj']['name'], $_FILES['pj']['type'], $seq)); - } + $this->db->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2, + jr_pj_type=$3 where jr_grpt_id=$4", + array($oid, $_FILES['pj']['name'], $_FILES['pj']['type'], $seq)); } } // for nbitem // increment pj diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 8690df2e0..089301c39 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -29,9 +29,86 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; /*! * \class Acc_Ledger_Purchase - * \brief Handle the ledger of purchase, - * - * + ** @brief : input, confirm and save new operations in edger of purchase + the $_POST data is an array with these keys + @code + Array +( + +// ===================== +// ANALYTIC PART +// ===================== + [pa_id] => Array + ( + [0] => 1 + ) + + [op] => Array + ( + [0] => 0 + ) + + [amount_t0] => 10 + [hplan] => Array + ( + [0] => Array + ( + [0] => -1 + ) + + ) + + [val] => Array + ( + [0] => Array + ( + [0] => 10 + ) + + ) +// ===================== +// SALES DATA +// ===================== + + [e_client] => QuickCode supplier + [nb_item] => number of items (lines of invoice) + [p_jrn] => JRN_DEF.JRN_DEF_ID id of the ledger + [jrn_note_input] => Note JRN_NOTE.N_TEXT + [mt] => 1759130008.8134 + [p_currency_rate] => Currency Rate + [p_currency_code] => Currency Code + [e_comm] => Description of invoice + [e_date] => date invoice + [e_ech] => limit date + [e_pj] => Receipt number + [e_pj_suggest] => suggested receipt number + [e_mp] => payment means ( + [jrn_type] => Type of ledger (always ACH) + //--------------------------------------------- + // For each invoice line + //--------------------------------------------- + [e_march0] => QuickCode of the item + [e_march0_label] => label + [e_march0_price] => unit price + [e_march0_tva_id] => VAT ID + [e_march0_tva_amount] => amount of VAT + [e_quant0] => quantity of item +//======================== +// MISC +//======================== + [repo] => 1 (repository) + [gen_invoice] => on (it is asked to generate an invoice + [gen_doc] => Document template id + [bon_comm] => JRN_INFO. + [other_info] = JRN_INFO.> + [opd_name] => Name of operation template + [od_description] => Description of operation template + [reverse_date] => if reverse is asked + [ext_label] => Label for revese operation + [jr_optype] => Type of operation NOR:Normal,, EXT; reverse, .. +) + @endcode + */ class Acc_Ledger_Purchase extends Acc_Ledger { @@ -978,7 +1055,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger if ( isset ($_FILES)) { if ( sizeof($_FILES) != 0 ) - $this->db->save_receipt($seq); + $acc_document=new \Acc_Document($this->db, $this->jr_id); + $acc_document->save_receipt(); + $this->doc=HtmlInput::show_receipt_document($this->jr_id,h($_FILES['pj']['name'])); } $str_file=""; /* Generate an document and save it into the database (Note de frais only) diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index 2f832ef26..5d3f554c8 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -28,9 +28,87 @@ require_once NOALYSS_INCLUDE.'/lib/user_common.php'; require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; /*! - * \brief Handle the ledger of sold, - * - * @exception throw an exception is something is wrong + * @class Acc_Ledger_Sale + * @brief : input, confirm and save new operations in edger of sales + the $_POST data is an array with these keys + @code + Array +( + +// ===================== +// ANALYTIC PART +// ===================== + [pa_id] => Array + ( + [0] => 1 + ) + + [op] => Array + ( + [0] => 0 + ) + + [amount_t0] => 10 + [hplan] => Array + ( + [0] => Array + ( + [0] => -1 + ) + + ) + + [val] => Array + ( + [0] => Array + ( + [0] => 10 + ) + + ) +// ===================== +// SALES DATA +// ===================== + + [e_client] => QuickCode customer + [nb_item] => number of items (lines of invoice) + [p_jrn] => JRN_DEF.JRN_DEF_ID id of the ledger + [jrn_note_input] => Note JRN_NOTE.N_TEXT + [mt] => 1759130008.8134 + [p_currency_rate] => Currency Rate + [p_currency_code] => Currency Code + [e_comm] => Description of invoice + [e_date] => date invoice + [e_ech] => limit date + [e_pj] => Receipt number + [e_pj_suggest] => suggested receipt number + [e_mp] => payment means ( + [jrn_type] => Type of ledger (always VEN) + //--------------------------------------------- + // For each invoice line + //--------------------------------------------- + [e_march0] => QuickCode of the item + [e_march0_label] => label + [e_march0_price] => unit price + [e_march0_tva_id] => VAT ID + [e_march0_tva_amount] => amount of VAT + [e_quant0] => quantity of item +//======================== +// MISC +//======================== + [repo] => 1 (repository) + [gen_invoice] => on (it is asked to generate an invoice + [gen_doc] => Document template id + [bon_comm] => JRN_INFO. + [other_info] = JRN_INFO.> + [opd_name] => Name of operation template + [od_description] => Description of operation template + [reverse_date] => if reverse is asked + [ext_label] => Label for revese operation + [jr_optype] => Type of operation NOR:Normal,, EXT; reverse, .. +) + @endcode + */ class Acc_Ledger_Sale extends Acc_Ledger { @@ -698,17 +776,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { where j_id in (select j_id from jrnx where j_grpt=$2)' , array($internal, $seq)); - /* Save the attachment or generate doc */ - if (isset($_FILES['pj'])) { - if (noalyss_strlentrim($_FILES['pj']['name']) != 0) - $this->db->save_receipt($seq); - else - /* Generate an invoice and save it into the database */ - if (isset($_POST['gen_invoice'])) { - $file = $this->create_document($internal, $p_array); - $this->doc=HtmlInput::show_receipt_document($this->jr_id,h($file)); - } - } + //---------------------------------------- // Save the payer //---------------------------------------- @@ -932,6 +1000,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { $r.='' . _('Numéro Pièce') .$span.''. hb($this->pj) . ''; } } + $e_comm=($e_comm == "")?_('Facture')." $e_pj":$e_comm; $r.=''; $r.=''; $r.=' ' . _('Date') . ' ' . hb($e_date) . ''; @@ -954,7 +1023,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { $r.=''; $r.=''; - $r.=' ' . _('Client') . ' ' . hb($e_client . ':' . $client_name) . ''; + $r.=' ' . _('Client') . ' ' . HtmlInput::card_detail($e_client).":".hb( $client_name) . ''; $r.=''; $r.=''; $r.='
'._('Note').' '.h($p_array['jrn_note_input']).'
'; @@ -1296,7 +1365,8 @@ EOF; return $r; } - /*!\brief the function extra info allows to + /*! + * \brief the function extra info allows to * - add a attachment * - generate an invoice * - insert extra info @@ -1304,31 +1374,35 @@ EOF; */ public function extra_info() { - $r = '
'; + $r = '
'; // check for upload piece $file = new IFile(); $file->table = 0; $file->setAlertOnSize(true); $r.='

'; + + // add a receipt $r.=_("Ajoutez une pièce justificative "); $r.=$file->input("pj", ""); - - if ($this->db->count_sql("select md_id,md_name from document_modele where md_affect='VEN' ") > 0) { - - - $r.=_('ou générer une facture') . ' '; - // We propose to generate the invoice and some template - $doc_gen = new ISelect(); - $doc_gen->name = "gen_doc"; - $doc_gen->value = $this->db->make_array( - "select md_id,md_name " . - " from document_modele where md_affect='VEN' order by 2"); - $r.=$doc_gen->input() . '
'; - } + + //------------------------------------------------ + // Propose to generate an invoice + //------------------------------------------------ + $r.=_('ou générer une facture') . ' '; + // We propose to generate the invoice and some template + $doc_gen = new ISelect(); + $doc_gen->name = "gen_doc"; + $doc_gen->value = $this->db->make_array( + "select md_id,md_name " . + " from document_modele where md_affect='VEN' ". + " union select -2,'"._("0 - Facture PDF Standard")."' ". + " order by 2"); + $r.=$doc_gen->input() . '
'; + $r.='
'; $obj = new IText(); - $r.=_('Numero de bon de commande : ') . $obj->input('bon_comm') . '
'; - $r.=_('Communication ou autre information : ') . $obj->input('other_info') . '
'; + $r.=_('Numero de bon de commande') . $obj->input('bon_comm') . '
'; + $r.=_('Communication') . $obj->input('other_info') . '
'; $r.='

'; $r.='
'; return $r; diff --git a/include/class/acc_operation.class.php b/include/class/acc_operation.class.php index c5e806437..e4175573b 100644 --- a/include/class/acc_operation.class.php +++ b/include/class/acc_operation.class.php @@ -91,9 +91,9 @@ class Acc_Operation jr_id {$this->jr_id} jr_optype {$this->jr_optype} amount {$this->amount} - currency_rate {$this->amount} - currency_rate_ref {$this->amount} - currency_id {$this->amount} + currency_rate {$this->currency_rate} + currency_rate_ref {$this->currency_rate_ref} + currency_id {$this->currency_id} ] EOF; return $r; @@ -1031,11 +1031,43 @@ EOF; /** * @class Acc_Detail * @brief Contains the detail of an operation Acc_Operation + * propery : + * - $det + - jr_id PKfrom table JRN + - jr_def_id id of the ledger (FK to - _DEF- _DEF_ID)from table JRN + - jr_montant AMOUNT of the operationfrom table JRN + - jr_comment COMMENT from table JRN + - jr_date DATEfrom table JRN + - jr_grpt_id CODE to group - X rowsfrom table JRN + - jr_internal INTERNAL CODEfrom table JRN + - jr_tech_date DATE OF CHANGEfrom table JRN + - jr_tech_per FK TO PARAM_PERIODEP_IDfrom table JRN + - jrn_ech from table JRN + - jr_ech DATE LIMIT OF PAYMENTfrom table JRN + - jr_rapt from table JRN + - jr_echfrom table JRN + - jr_validfrom table JRN + - jr_opid from table JRN + - jr_c_opidfrom table JRN + - jr_pj OID OF THE DOCUMENTfrom table JRN + - jr_pj_name NAME OF THE DOCUMENTfrom table JRN + - jr_pj_typefrom table JRN + - jr_pj_number RECEIPT NBfrom table JRN + - jr_mt INTERNAL CODEfrom table JRN + - jr_raptfrom table JRN + - jr_date_paid DATE OF PAYMENTfrom table JRN + - jr_optype TYPE OF OPERATION NOR = NORMAL OPE=OPENING EXT=EXTOURNEfrom table JRN + - currency_id FK TO CURRENCYIDfrom table JRN + - currency_rate amountfrom table JRN + - currency_rate_ref amount in CURRENT_HISTORYCH_VALUEfrom table JRN + * - note from table JRN_NOTE + - $jr_id JRN.JR_ID + - $info */ class Acc_Detail extends Acc_Operation { - public $det; - public $jr_id; + public $det;//!< Object with columns from JRN + public $jr_id;//! $jr_id (int) JRN.JR_ID public $info; function __construct($p_cn,$p_jrid=0) @@ -1050,10 +1082,34 @@ class Acc_Detail extends Acc_Operation */ function get() { - $sql="SELECT jr_id, jr_def_id, jr_montant, jr_comment, jr_date, jr_grpt_id, - jr_internal, jr_tech_date, jr_tech_per, jrn_ech, jr_ech, jr_rapt,jr_ech, - jr_valid, jr_opid, jr_c_opid, jr_pj, jr_pj_name, jr_pj_type, - jr_pj_number, jr_mt,jr_rapt,jr_date_paid,jr_optype,currency_id,currency_rate,currency_rate_ref + $sql="SELECT jr_id + , jr_def_id + , jr_montant + , jr_comment + , jr_date + , jr_grpt_id + , jr_internal + , jr_tech_date + , jr_tech_per + , jrn_ech + , jr_ech + , jr_rapt + ,jr_ech + , jr_valid + , jr_opid + , jr_c_opid + , jr_pj + , jr_pj_name + , jr_pj_type, + jr_pj_number + , jr_mt + ,jr_rapt + ,jr_date_paid + ,jr_optype + ,currency_id + ,currency_rate + ,currency_rate_ref + ,jr_document_xml FROM jrn where jr_id=$1"; $array=$this->db->get_array($sql,array($this->jr_id)); if ( count($array) == 0 ) throw new Exception('Aucune ligne trouvée'); @@ -1363,4 +1419,5 @@ class Acc_Fin extends Acc_Detail return $array; } + } diff --git a/include/class/acc_tva.class.php b/include/class/acc_tva.class.php index e9df34fc0..52318de3d 100644 --- a/include/class/acc_tva.class.php +++ b/include/class/acc_tva.class.php @@ -30,7 +30,9 @@ "label"=>"tva_label", "rate"=>"tva_rate", "comment"=>"tva_comment", - "account"=>"tva_poste"); + "account"=>"tva_poste" + tva_peppol_code + * ); */ class Acc_Tva @@ -42,7 +44,9 @@ class Acc_Tva "account"=>"tva_poste", "both_side"=>'tva_both_side', 'tva_reverse_account'=>'tva_reverse_account', - 'tva_code'=>'tva_code'); + 'tva_code'=>'tva_code', + "tva_peppol_code"=>"tva_peppol_code" + ); public $tva_id, $tva_label, $tva_rate, @@ -50,16 +54,18 @@ class Acc_Tva $tva_poste, $tva_both_side, $tva_code, - $tva_reverse_account; + $tva_reverse_account, + $tva_peppol_code + ; private $cn; //!< Database connection private Tva_Rate_SQL $tva_rate_sql; - function __construct ($p_init,$p_tva_id=-1) + function __construct (Database $cn,$p_tva_id=-1) { - $this->cn=$p_init; - $this->tva_rate_sql=new Tva_Rate_SQL($p_init,$p_tva_id); + $this->cn=$cn; + $this->tva_rate_sql=new Tva_Rate_SQL($cn,$p_tva_id); $this->tva_id=$p_tva_id; $this->tva_label=&$this->tva_rate_sql->tva_label; $this->tva_rate=&$this->tva_rate_sql->tva_rate; @@ -68,6 +74,7 @@ class Acc_Tva $this->tva_both_side=&$this->tva_rate_sql->tva_both_side; $this->tva_code=&$this->tva_rate_sql->tva_code; $this->tva_reverse_account=&$this->tva_rate_sql->tva_reverse_account; + $this->tva_peppol_code=&$this->tva_rate_sql->tva_peppol_code; } /** diff --git a/include/class/card_property.class.php b/include/class/card_property.class.php index c40c21d3e..01e364ee5 100644 --- a/include/class/card_property.class.php +++ b/include/class/card_property.class.php @@ -699,4 +699,18 @@ class Card_Property } return null; } + /** + * @brief returns the property value of a card without creating a card + * @param \Database $conx + * @param $card_id (int) FICHE.F_ID + * @param $property_id (int) ad_value + * @return string or false if nothing was found + */ + static function get_attribute(\Database $conx, $card_id,$property_id) + { + $r=$conx->get_value("select ad_value from fiche_detail where + ad_id = $1 and f_id=$2",[$property_id,$card_id]); + if ( $conx->count() == 0) { return false;} + return $r; + } } diff --git a/include/class/database.class.php b/include/class/database.class.php index 38a8e0daf..22e4009eb 100644 --- a/include/class/database.class.php +++ b/include/class/database.class.php @@ -81,34 +81,6 @@ class Database extends DatabaseCore . ",dbname = ".$this->get_dbname() . "]"; } - /*** - * \brief Save a "piece justificative" , the name must be pj - * - * \param $seq jr_grpt_id - * \return $oid of the lob file if success - * null if a error occurs - * - */ - function save_receipt($seq) - { - $oid = $this->upload('pj'); - if ($oid == false) { - return false; - } - // Remove old document - $ret = $this->exec_sql("select jr_pj from jrn where jr_grpt_id=$seq"); - if (pg_num_rows($ret) != 0) { - $r = pg_fetch_array($ret, 0); - $old_oid = $r['jr_pj']; - if (strlen($old_oid??"") != 0) - $this->lo_unlink( $old_oid); - } - // Load new document - $this->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2, - jr_pj_type=$3 where jr_grpt_id=$4", - array($oid, $_FILES['pj']['name'], $_FILES['pj']['type'], $seq)); - return $oid; - } /** * \brief Get version of a database, the content of the diff --git a/include/class/document.class.php b/include/class/document.class.php index adfa92197..9c96b9479 100644 --- a/include/class/document.class.php +++ b/include/class/document.class.php @@ -19,10 +19,14 @@ */ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/*! \file +/*! + * \file * \brief Class Document corresponds to the table document */ -/*! \brief Class Document corresponds to the table document +/*! + * \class + * \brief + * Class Document corresponds to the table DOCUMENT */ class Document @@ -38,7 +42,7 @@ class Document var $d_number; /*!< $d_number number of the document */ var $md_id; /*!< $md_id document's template */ var $f_id; /*!< fiche.f_id */ - private $counter; /*!< counter for the items ( goods ) */ + protected $counter; /*!< counter for the items ( goods ) */ var $d_name; /*!< document name */ var $md_type ; /*!< Type of document */ /*! @@ -54,6 +58,24 @@ class Document // counter for MARCH_NEXT $this->counter=0; } + + function __toString(): string + { + return "Document[db=" . $this->db + . ", d_id=" . $this->d_id + . ", ag_id=" . $this->ag_id + . ", d_mimetype=" . $this->d_mimetype + . ", d_filename=" . $this->d_filename + . ", d_lob=" . $this->d_lob + . ", d_description=" . $this->d_description + . ", d_number=" . $this->d_number + . ", md_id=" . $this->md_id + . ", f_id=" . $this->f_id + . ", counter=" . $this->counter + . ", d_name=" . $this->d_name + . ", md_type=" . $this->md_type + . "]"; + } /** * @brief insert a minimal document and set the d_id @@ -105,16 +127,20 @@ class Document /*! * \brief Generate the document, Call $this-\>replace to replace * tag by value - * @param p_array contains the data normally it is the $_POST - * @param $p_filename contains the new filename + * @param p_array contains the data normally it is the $_POST (see Acc_Ledger_Sale or + * Acc_Ledger_Purchase) + * @see Acc_Ledger_Sale + * @see Acc_Ledger_Purchase + * @param $p_filename contains the new filename, if not given the filename will be generated * \return an string : the url where the generated doc can be found, the name * of the file and his mimetype */ function generate($p_array, $p_filename="") { + try { - // create a temp directory in /tmp to unpack file and to parse it + ///@var $dirname (string) temp directory in /tmp to unpack file and to parse it $dirname=tempnam($_ENV['TMP'], 'doc_'); if ($dirname == false) { throw new Exception ('DC117 cannot create tmp file',5000); @@ -124,6 +150,31 @@ class Document if ( mkdir($dirname) == false ) { throw new Exception ("DC121 cannot create $dirname directory",5000); } + /** + * md_id == -2 is the standard PDF invoice, you don't parse or compute + * it + */ + if ( $this->md_id == -2) + { + $file_to_parse=str_replace( + array('/', '*', '<', '>', ';', ',', '\\', '.', ':', '(', ')', ' ', '[', ']') + , "-" + , "inv-std-".$p_array['e_pj'].".pdf"); + + $this->d_number=$this->db->get_next_seq("seq_doc_type_stdinv"); + $this->d_filename=$file_to_parse; + $this->d_mimetype="application/pdf"; + $this->d_name=$file_to_parse; + $standard_invoice=new \Noalyss\Invoice_PDF($this->db,$dirname,$file_to_parse); + $standard_invoice->set_data($p_array); + $standard_invoice->export(); + $this->saveGenerated($dirname.DIRECTORY_SEPARATOR.$file_to_parse); + // Invoice + $href=http_build_query(array('gDossier'=>Dossier::id(), "d_id"=>$this->d_id, 'act'=>'RAW:document')); + $ret=''._('Document').''; + return $ret; + } + // Retrieve the lob and save it into $dirname $this->db->start(); $dm_info="select md_name,md_type,md_lob,md_filename,md_mimetype @@ -145,7 +196,8 @@ class Document record_log(sprintf('DOCUMENT.GENERATE.D1 , export failed %s %s',$dirname, $filename)); throw new Exception(sprintf(_("Export a échoué pour %s"), $filename)); } - + // $type (letter) type of document : OOo for openoffice otherwise n , with OOo the file + // is a ZIP XML $type="n"; // if the doc is a OOo, we need to unzip it first // and the name of the file to change is always content.xml @@ -247,7 +299,7 @@ class Document { if (mkdir($temp_dir)==false) { - $msg=sprintf("D221."._("Ne peut pas créer le répertoire %s", $temp_dir)); + $msg=sprintf("D221."._("Ne peut pas créer le répertoire %s"), $temp_dir); record_log("D221".$msg); throw new Exception($msg); } @@ -332,10 +384,9 @@ class Document } /*! - * \brief Save the generated Document + * \brief insert the generated Document into the database, update the $this->d_id + * that is the PK of document. and load the PDF into the database. * \param $p_file is the generated file - * - * * \return 0 if no error otherwise 1 */ @@ -716,22 +767,22 @@ class Document $p_tag=noalyss_str_replace('=', '', $p_tag); $r="Tag inconnu"; static $aComment=NULL; - static $counter_comment=1; /* d_id==0) { - return; + return false; } $this->db->start(); $ret=$this->db->exec_sql( "select d_id,d_lob,d_filename,d_mimetype from document where d_id=$1", [$this->d_id]); if (Database::num_row($ret)==0) { - return; + return false; } $row=Database::fetch_array($ret, 0); //the document is saved into file $tmp @@ -1916,15 +1964,14 @@ class Document } /** * @brief transform the current Document to a PDF, returns the full path of the PDF from the TMP folder + * if the file IS a pdf , then export it and return the path to the file. + * + * @todo replace use of unoconv with a PHP lib to convert into PDF * @return string full path to the PDF file */ function transform2pdf() { - if (GENERATE_PDF == 'NO' ) { - \record_log(__FILE__."D1857 PDF not available"); - throw new \Exception("Cannot not transform to PDF",5000); - } - // Extract from public.document + // Extract from public.document $dirname=tempnam($_ENV['TMP'],"document"); if ( $dirname == false ) { @@ -1935,6 +1982,16 @@ class Document if ( mkdir($dirname) == false ) { throw new Exception("D1868.cannot create tmp directory",5000); } + if ( $this->d_mimetype == "application/pdf") { + $destination_file=$dirname."/".$this->d_filename; + $this->export_file($destination_file); + return $dirname."/".$destination_file; + return; + } + if (GENERATE_PDF == 'NO' ) { + \record_log(__FILE__."D1857 PDF not available"); + throw new \Exception("Cannot not transform to PDF",5000); + } $destination_file=$dirname."/".$this->d_filename; $this->export_file($destination_file); diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 6af61e002..b5e349ff7 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -329,7 +329,7 @@ class Fiche * @param int $p_ad_id AD_ID from attr_def.ad_id * @param int $p_return 1 return NOTFOUND otherwise an empty string * @see constant.php - * @return string + * @return string * @note reread data from database and so it reset previous unsaved change */ function get_attribute($p_ad_id,$p_return=1) @@ -1345,16 +1345,17 @@ class Fiche bcscale(4); $gDossier=dossier::id(); $p_search=sql_string($p_search); - $script=$_SERVER['PHP_SELF']; + $script=$_SERVER['PHP_SELF']??""; // Creation of the nav bar // Get the max numberRow $filter_amount=''; - global $g_user; $filter_year=" j_tech_per in (select p_id from parm_periode ". "where p_exercice='".$g_user->get_exercice()."')"; - if ( $p_amount) $filter_amount=' and f_id in (select f_id from jrnx where '.$filter_year.')'; + if ($p_amount) { + $filter_amount = ' and f_id in (select f_id from jrnx where ' . $filter_year . ')'; + } $all_tiers=$this->count_by_modele($this->fiche_def_ref,"",$p_sql.$filter_amount); // Get offset and page variable @@ -1495,21 +1496,23 @@ class Fiche return $this->fiche_def; } /*! - *************************************************** - * \brief Check if a fiche is used by a jrn + * \brief Check if a card can be used and then belong tp a specific ledger, it the card + * * return 1 if the fiche is in the range otherwise 0, the quick_code * or the id must be set * * - * \param $p_jrn journal_id - * \param $p_type : deb or cred default empty + * \param $jrn_def_id journal_id (JRN.JRN_DEF_ID) + * \param $side : deb or cred , default empty = both * - * \return 1 if the fiche is in the range otherwise < 1 - * -1 the card doesn't exist - * -2 the ledger has no card to check + * \return 1 if the card belongs to the ledger, + * 0 the card doesn't belong, + * -1 the card doesn't exist, + * -2 the ledger has no card to check, + * -3 there is no category of card for this ledger * */ - function belong_ledger($p_jrn,$p_type="") + function belong_ledger($jrn_def_id,$side="") { // check if we have a quick_code or a f_id if (($this->quick_code==null || $this->quick_code == "" ) @@ -1519,41 +1522,38 @@ class Fiche } //retrieve the quick_code - if ( $this->quick_code=="") - $this->quick_code=$this->get_quick_code(); - - - if ( $this->quick_code==null) - return -1; - - if ( $this->id == 0 ) - if ( $this->get_by_qcode(null,false) == 1) - return -1; - - $get=""; - if ( $p_type == 'deb' ) - { - $get='jrn_def_fiche_deb'; - }elseif ( $p_type == 'cred' ) - { - $get='jrn_def_fiche_cred'; + if ($this->quick_code == "") { + $this->quick_code = $this->get_quick_code(); } - if ( $get != "" ) + + + if ($this->quick_code == null) { + return -1; + } + + if ($this->id == 0 && $this->get_by_qcode(null, false) == 1) { + return -1; + } + + if ( $side == 'deb' ) { - $Res=$this->cn->exec_sql("select $get as fiche from jrn_def where jrn_def_id=$p_jrn"); + $Res=$this->cn->exec_sql("select jrn_def_fiche_deb as fiche from jrn_def where jrn_def_id=$1",[$jrn_def_id]); + }elseif ( $side == 'cred' ) + { + $Res=$this->cn->exec_sql("select jrn_def_fiche_cred as fiche from jrn_def where jrn_def_id=$1",[$jrn_def_id]); } else { // Get all the fiche type (deb and cred) $Res=$this->cn->exec_sql(" select jrn_def_fiche_cred as fiche - from jrn_def where jrn_def_id=$p_jrn + from jrn_def where jrn_def_id=$1 union select jrn_def_fiche_deb - from jrn_def where jrn_def_id=$p_jrn" + from jrn_def where jrn_def_id=$1", + [$jrn_def_id] ); } - $Max=Database::num_row($Res); - if ( $Max==0) + if ( Database::num_row($Res)==0) { return -2; } @@ -1582,11 +1582,11 @@ class Fiche fd_id in (".$str_list.") and f_id= ".$this->id; $Res=$this->cn->exec_sql($sql); - $Max=Database::num_row($Res); - if ($Max==0 ) + if (Database::num_row($Res) == 0) { return 0; - else - return 1; + } + return 1; + } /*! * \brief get all the card from a categorie @@ -1968,12 +1968,12 @@ class Fiche } /** * @brief create a card from a qcode and returns a card - * @param string $p_qcode qcode of the card + * @param $cn Database cnx + * @param $p_qcode (string) qcode of the card */ - static function from_qcode($p_qcode) + static function from_qcode(Database $cn,string $p_qcode) { - $cn=Dossier::connect(); - $card=new Card($cn); + $card=new Fiche($cn); $card->get_by_qcode($p_qcode); return $card; } diff --git a/include/class/invoice_pdf.class.php b/include/class/invoice_pdf.class.php new file mode 100644 index 000000000..cf87fbe79 --- /dev/null +++ b/include/class/invoice_pdf.class.php @@ -0,0 +1,332 @@ +dirname; + } + + public function get_filename() + { + return $this->filename; + } + + public function set_dirname($dirname) + { + $this->dirname = $dirname; + return $this; + } + + public function set_filename($filename) + { + $this->filename = $filename; + return $this; + } + + function set_data($array) + { + $this->data = $array; + return $this; + } + + function get_data() + { + return $this->data; + } + + function footer() + { + //Position at 1 cm from bottom + $this->SetY(-10); + //Arial italic 8 + $this->SetFont('Arial', '', 8); + //Page number + parent::Cell(0, 8, " Page " . $this->PageNo() . '/{nb}', 0, 0, 'C'); + parent::Ln(3); + } + + function header() + { + global $g_parameter; + $this->setY(15); + $this->SetFont('DejaVu', '', 6); + $colsize = 90; + $this->write_multi($colsize, 3, $g_parameter->MY_NAME); + $this->write_multi($colsize, 3, $this->data['e_date'], border: '', align: 'R'); + $this->line_new(); + $this->write_multi($colsize, 3, + sprintf("%s %s " + , $g_parameter->MY_STREET + , $g_parameter->MY_NUMBER)); + $this->line_new(); + $this->write_multi($colsize, 3, $g_parameter->MY_POSTCODE + . " " . $g_parameter->MY_CITY + . " " . $g_parameter->MY_COUNTRY + ); + $this->line_new(); + $this->write_multi($colsize, 3, $g_parameter->MY_TVA); + $this->line_new(); + + $email_company = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['INVOICE_EMAIL_COMPANY']); + $site = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['WEB_COMPANY']); + // for FRANCE , the SIREN and SIRET must be given + $siren = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['SIREN']); + $siret = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['SIRET']); + $iban = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['COMPANY_BANK_IBAN']); + $bic = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['COMPANY_BANK_BIC']); + + if ($siret != "") + { + $this->write_multi($colsize, 3, "SIRET $siret"); + $this->line_new(); + } + if ($siren != "") + { + $this->write_multi($colsize, 3, "SIREN $siren"); + $this->line_new(); + } + if ($iban != "") + { + $this->write_multi($colsize, 3, "IBAN $iban BIC $bic"); + $this->line_new(); + } + if ($g_parameter->MY_PHONE != "") + { + $this->write_multi($colsize, 3, sprintf(_("Tel %s "), + $g_parameter->MY_PHONE + )); + $this->line_new(); + } + if ($email_company != "") + { + $this->write_multi($colsize, 3, sprintf(_("email %s "), + $email_company)); + $this->line_new(); + } + if ($site != "") + { + $this->write_multi($colsize, 3, sprintf(_("site %s"), + $site + )); + $this->line_new(); + } + $this->setFont("DejaVu", 'B', 14); + $this->write_multi(40, 10, ""); + $this->write_multi(100, 10, _("Facture") . " " . $this->data['e_pj'], border: 1, align: 'C'); + $this->write_multi(40, 10, ""); + $this->line_new(10); + $this->ln(5); + } + + //! + //@brief make the invoice + function export() + { + $this->SetAuthor('NOALYSS'); + $this->AliasNbPages(); + $this->AddPage(); + $this->SetAutoPageBreak(true, $this->bMargin*1); + $this->setTitle($this->filename, true); + // $customer (Fiche) retrieve card of the customer + $customer = new \Fiche($this->cn); + $customer->get_by_qcode(trim($this->data['e_client'])); + + $this->setFont("DejaVu", '', 7); + $this->write_cell(50, 4, ""); + $this->write_cell(60, 4, sprintf(_("Echéance %s"), $this->data['e_ech'])); + $this->line_new(); + $this->write_cell(50, 4, ""); + $this->write_cell(100, 4, _("Client"), 'B', 'R'); + $this->line_new(); + $this->write_cell(50, 4, ""); + $this->write_cell(110, 4, $customer->get_attribute(ATTR_DEF_NAME) + . " " . $customer->get_attribute(ATTR_DEF_FIRST_NAME, 0)); + $this->line_new(); + $this->write_cell(50, 4, ""); + $this->write_cell(110, 4, $customer->get_attribute(ATTR_DEF_ADRESS, 0)); + $this->line_new(); + $this->write_cell(50, 4, ""); + $this->write_cell(110, 4, $customer->get_attribute(ATTR_DEF_POSTCODE, 0) + . " " . $customer->get_attribute(ATTR_DEF_CITY, 0) + ); + $this->line_new(); + $this->write_cell(50, 4, ""); + $this->write_cell(110, 4, $customer->get_attribute(ATTR_DEF_COUNTRY, 0)); + $this->line_new(); + $this->write_cell(50, 4, ""); + $this->write_cell(110, 4, $customer->get_attribute(ATTR_DEF_NUMTVA, 0)); + $this->line_new(); + $a_tva_amount = []; + $a_tva_code = []; + $col = array( + "quick_code" => 30, + "label" => 80, + "quantity" => 25, + "price" => 25, + "vat_code" => 20 + ); + $this->SetFont("DejaVu", "B", 12); + $this->write_multi(50, 20, ""); + $this->write_multi(50, 20, _("Détails")); + $this->line_new(); + $this->SetFont("DejaVuCond", "", 7); + $currency = new \Acc_Currency($this->cn, $this->data['p_currency_code']); + $this->write_multi(60, 4, sprintf(_("Les montants sont en %s taux %s") + , $currency->get_code() + , $this->data['p_currency_rate'])); + $this->line_new(4); + if ($this->data["bon_comm"] != "") + { + $this->write_multi(120, 4, sprintf(_("Bon de commande / référence %s") + , $this->data["bon_comm"])); + $this->line_new(4); + } + $this->line_new(4); + $this->SetFont("DejaVu", "", 7); + $this->write_multi($col['quick_code'], 4, _("Article"), 1); + $this->write_multi($col['label'], 4, _("Description"), 1); + $this->write_multi($col['quantity'], 4, _("Quantité"), 1); + $this->write_multi($col['price'], 4, _("Prix"), 1); + $this->write_multi($col['vat_code'], 4, _("TVA"), 1); + $this->line_new(); + ///@var $tot_amount (float) total amount without VAT + ///@var $tot_vat (float) total VAT + ///@var $line (int) line printed + $tot_amount = $tot_vat = $line =0; + for ($i = 0; $i < $this->data['nb_item']; $i++) + { + $item = new \Fiche($this->cn); + if (!isset($this->data['e_march' . $i]) || $this->data['e_march' . $i] == "") + { + continue; + } + $line++; + $item->get_by_qcode(trim($this->data['e_march' . $i])); + $fill = $this->is_fill($line); + $this->write_multi($col['quick_code'], 4, $item->get_attribute(ATTR_DEF_QUICKCODE),'','',$fill); + $this->write_multi($col['label'], 4, $this->data['e_march' . $i . '_label'],fill:$fill); + $this->write_multi($col['quantity'], 4, nbm($this->data['e_quant' . $i]), '', 'R',fill:$fill); + $this->write_multi($col['price'], 4, nbm($this->data['e_march' . $i . '_price']), '', 'R',fill:$fill); + $this->write_multi($col['vat_code'], 4, $this->data['e_march' . $i . '_tva_id'], '', 'C',fill:$fill); + $x = $this->data['e_march' . $i . '_tva_id']; + if (!isset($a_tva_amount[$x])) + { + $a_tva_amount[$x] = 0; + } + $a_tva_amount[$x] = bcadd($a_tva_amount[$x], $this->data["e_march" . $i . "_tva_amount"], 2); + $tot_amount = bcadd($tot_amount + , bcmul($this->data['e_march' . $i . '_price'] + , $this->data['e_quant' . $i] + , 2 + ) + , 2); + $tot_vat = bcadd($tot_vat + , $this->data['e_march' . $i . '_tva_amount'] + , 2); + $this->line_new(4); + if ($this->GetY()>250) { + $this->AddPage(); + } + } + $this->line_new(10); + $this->SetFont("DejaVu", "B", 9); + $this->write_multi(30, 4, _("TVA")); + $this->line_new(5); + $this->SetFont("DejaVu", "", 7); + foreach ($a_tva_amount as $tva_id => $tva_amount) + { + $tva = \Acc_Tva::build($this->cn, $tva_id); + $this->write_multi(20, 4, ""); + $this->write_multi(80, 4, $tva->tva_id + . " / " . $tva->tva_code + . " / " . $tva->tva_label + . " / " . $tva->tva_rate * 100 + ); + + $this->write_multi(50, 4, $tva_amount); + $this->line_new(); + } + $this->ln(20); + $this->SetFont("DejaVu", "B", 9); + $this->write_multi(30, 4, _("TOTAUX")); + $this->line_new(); + $this->SetFont("DejaVu", "", 7); + $this->write_multi(60, 4, _("Total Hors TVA ")); + $this->write_multi(60, 4, nbm($tot_amount), '', 'R'); + $this->line_new(); + $this->write_multi(60, 4, _("Total TVA ")); + $this->write_multi(60, 4, nbm($tot_vat), '', 'R'); + $this->line_new(); + $this->write_multi(60, 4, _("Total ")); + $this->write_multi(60, 4, nbm(bcadd($tot_amount, $tot_vat, 2),2), '', 'R'); + $this->line_new(); + $iban = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['COMPANY_BANK_IBAN']); + if ($this->data['e_ech'] != "" && $iban != "") + { + $info = ($this->data["other_info"] == "") ? $this->data["e_pj"] : $this->data["other_info"]; + $bic = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1", + ['COMPANY_BANK_IBAN']); + $this->write_multi(150, 4, + sprintf(_("Paiement avant le %s sur le compte %s (BIC %s) avec comme message %s"), + $this->data['e_ech'] + , $iban + , $bic + , $this->data["other_info"] + ) + ); + $this->line_new(); + } + $this->Output($this->dirname . DIRECTORY_SEPARATOR . $this->filename, "F"); + } +} diff --git a/include/class/operation_exercice.class.php b/include/class/operation_exercice.class.php index 9a5831ce6..7867f5d00 100644 --- a/include/class/operation_exercice.class.php +++ b/include/class/operation_exercice.class.php @@ -227,10 +227,10 @@ select sum(signed_amount) delta,sum(debit) debit,sum(credit) credit from saldo_d $ledger->save($oe_data); $oe_result=_("Détail opération"); $oe_result.=sprintf('%s
', - $ledger->jr_id, dossier::id(), $ledger->internal); + $ledger->jr_id, dossier::id(), $ledger->jr_internal); $cn->exec_sql("update operation_exercice set oe_transfer_date=to_timestamp($1,'DD.MM.YY HH24:MI') , jr_internal=$2 where oe_id=$3", - [date('d.m.Y H:i'),$ledger->internal,$this->operation_exercice_sql->oe_id]); + [date('d.m.Y H:i'),$ledger->jr_internal,$this->operation_exercice_sql->oe_id]); $cn->commit(); return true; diff --git a/include/class/tva_rate_mtable.class.php b/include/class/tva_rate_mtable.class.php index c722c27a5..e58e9e54b 100644 --- a/include/class/tva_rate_mtable.class.php +++ b/include/class/tva_rate_mtable.class.php @@ -191,13 +191,13 @@ class Tva_Rate_MTable extends Manage_Table_SQL $text->selected=$value; $text->transform(array( null=>_('-') - ,"S"=>_('Taux standard') - ,'AE'=>_('Autoliquidate mais pas INTRACOMM.') - ,'Z'=>_("TVA à 0%") - ,'K'=>_('Autoliquidation INTRACOMM.') - ,'G'=>_('TVA exempt pour export hors Europe') - ,'O'=>_('TVA Hors périmètre application') - ,'E'=>_('Exempté de TVA') + ,"S"=>_('S Taux standard') + ,'AE'=>_('AE Autoliquidate mais pas INTRACOMM.') + ,'Z'=>_("Z TVA à 0%") + ,'K'=>_('K Autoliquidation INTRACOMM.') + ,'G'=>_('G TVA exempt pour export hors Europe') + ,'O'=>_('O TVA Hors périmètre application') + ,'E'=>_('E Exempté de TVA') )); echo $text->input(); }elseif ($key == "tva_id") { diff --git a/include/compta_ods.inc.php b/include/compta_ods.inc.php index a749e448b..b4468737d 100644 --- a/include/compta_ods.inc.php +++ b/include/compta_ods.inc.php @@ -92,7 +92,7 @@ if (!isset($_POST['summary']) && !isset($_POST['save'])) { echo _("Détail opération"); echo " "; printf('%s
', - $jr_id, dossier::id(), $ledger->internal); + $jr_id, dossier::id(), $ledger->jr_internal); echo '
'; // show feedback diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index b4dc5217c..838a048fd 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -33,7 +33,8 @@ $http=new HttpInput(); $strac=$http->request('ac'); $ac="ac=".$strac; $p_msg=""; -$post_jrn=$http->post("p_jrn", "string",""); +//@var $post_jrn (int) Ledger id JRN_DEF.JRN_DEF_ID +$post_jrn=$http->post("p_jrn", "number",""); //---------------------------------------------------------------------- // Encode a new invoice // empty form for encoding @@ -65,6 +66,9 @@ if ( isset ($_POST['view_invoice'] ) ) $p_msg=$e->getMessage(); $correct=1; } + //------------------------------------------------ + // Confirm before saving + //------------------------------------------------ // if correct is not set it means it is correct if ( ! isset($correct)) { @@ -79,6 +83,28 @@ if ( isset ($_POST['view_invoice'] ) ) echo '
'; echo dossier::hidden(); echo $Ledger->confirm($_POST ); + //---------------------------------------------------- + // Check that INVOICE can be generated + // for e-invoice only + //---------------------------------------------------- + if ($g_parameter->MY_INVOICE_FORMAT != 'BASIC') + { + $xmldocument= \Noalyss\XMLDocument\XMLInvoice::build_xmlinvoice($cn); + $array=[]; + $array['supplier']=$xmldocument->fill_supplier(); + $customer=Fiche::from_qcode($cn,trim($http->post("e_client"))); + + $array['customer']=$xmldocument->fill_customer($customer->id); + $array['operation']=$xmldocument->fill_operation_from_array($_POST); + $array['due_date']=$http->post("e_ech"); + if ( $array['due_date'] == '') + { + $array['due_date']=$http->post("e_date"); + } + $xmldocument->set_data($array); + $xmldocument->display_error(); + } + echo HtmlInput::hidden('ac',$strac); $Ledger->input_extra_info(); echo HtmlInput::submit("record", _("Enregistrement"), 'onClick="return verify_ca(\'\');"'); @@ -121,10 +147,113 @@ if ( isset($_POST['record']) ) else echo '
'; - $Ledger=new Acc_Ledger_Sale($cn,$_POST['p_jrn']); + $Ledger=new Acc_Ledger_Sale($cn,$post_jrn); try { $internal=$Ledger->insert($_POST); + + // var $receipt (string) contains the name of the file name of + // the invoice (document created), if empty there + // is no invoice + + $receipt=''; + //------------------------------------------------------- + // Generate a XLM invoice + // if a document has been created create the XML file + //------------------------------------------------------- + ///@var $flag_invoice (int) error for invoice generating. + /// 0 = nothing no invoice created + /// 1 = cannot create e-invoice + /// 2 = create e-invoice requested + $flag_invoice=0; + /* Save the attachment or generate doc */ + if (isset($_FILES['pj']) && noalyss_strlentrim($_FILES['pj']['name']) != 0) + { + $acc_document=new Acc_Document($cn,$Ledger->jr_id); + $acc_document->save_receipt(); + $receipt= HtmlInput::show_receipt_document($Ledger->jr_id + ,h($_FILES['pj']['name'])); + } + else + /* Generate an invoice and save it into the database */ + if (isset($_POST['gen_invoice'])) + { + //@var $invoice_template (int) get the invoice number DOCUMENT_MODELE.MD_ID + $invoice_template=$http->post("gen_doc","number"); + // generate an invoice + $file = $Ledger->create_document($internal, $_POST); + $receipt= HtmlInput::show_receipt_document($Ledger->jr_id + ,h($file)); + $acc_document=new Acc_Document($cn,$Ledger->jr_id); + + /** + * @todo si Client non belge ou pas de n° de tva alors pas de e-facture + */ + if ($g_parameter->MY_INVOICE_FORMAT != 'BASIC' && ! empty($acc_document->d_filename )) + { + $flag_invoice=2; + $xmldocument= \Noalyss\XMLDocument\XMLInvoice::build_xmlinvoice($cn); + $xmldocument->build_data($Ledger->jr_id); + $code_error = $xmldocument->verify() ; + // check that all the sub arrays are empty + if ( ! empty( array_filter($code_error,function($a){ if (!empty($a)) return true; }))) + { + $xmldocument->display_error(); + $flag_invoice=1; + } + } + //------------------------------------------------ + // flag_invoice == 2 , generate an e-invoice + //------------------------------------------------ + if ( $flag_invoice == 2 ) + { + $pdf_filename=$acc_document->d_filename; + if ( $acc_document->d_mimetype != 'application/pdf') + { + $pdf_filename=$acc_document->transform2pdf(); + + // save PDF In db + $acc_document->update($pdf_filename); + }else{ + $pdf_filename=$_ENV['TMP']."/".$pdf_filename; + $acc_document->export_file($pdf_filename); + } + // make the PDF + $xmldocument->set_pdf_filename($pdf_filename); + + // make the XML + PDF + $xml=$xmldocument->create_invoice($Ledger->jr_id); + if (DEBUGNOALYSS > 1) { + $mt=date ('ymd-Hi').'+'.$Ledger->jr_id; + $uniq= $_ENV['TMP']. DIRECTORY_SEPARATOR."$mt-e-invoice.xml"; + file_put_contents($uniq, $xml); + chmod ($uniq,774); + echo \Noalyss\Dbg::echo_file("file save $uniq"); + + } + // FOR BELGIUM : XML and PDF will be store separately + // save XML string into the DB + $oid=$cn->lo_write($xml); + echo \Noalyss\Dbg::echo_var(1, "oid is $oid"); + if ($oid == false) { + throw new Exception ('CV177 : cannot import e-invoice'); + } + if ( $g_parameter->MY_INVOICE_FORMAT == 'UBL21BEL') + { + $acc_document->update_document_xml($oid); + $receipt= HtmlInput::show_receipt_document($Ledger->jr_id,$acc_document->d_filename) + . $acc_document->link_download_xml(); + }elseif ($g_parameter->MY_INVOICE_FORMAT=='FACTURXFR') + { + $acc_document->replace_receipt($oid); + $receipt= HtmlInput::show_receipt_document($Ledger->jr_id,$acc_document->d_filename); + } + + } + + } + + } catch (\Exception $e) { if ( $e->getCode()==EXC_BALANCE) @@ -144,14 +273,17 @@ if ( isset($_POST['record']) ) } /* Show button */ - echo '

Enregistrement

'; - + echo '

'._("Enregistré").'

'; + if ($flag_invoice == 1) { + echo_warning(_("Impossible de générer facture électronique") ); + $xmldocument->display_error(); + } echo $Ledger->confirm($_POST,true); /* Show link for Invoice */ - if (isset ($Ledger->doc) ) + if ($receipt != "") { echo '

'._('Document').'

'; - echo $Ledger->doc; + echo $receipt; } diff --git a/include/constant.php b/include/constant.php index 3c3464076..bb1a6014a 100644 --- a/include/constant.php +++ b/include/constant.php @@ -224,8 +224,8 @@ define("ATTR_DEF_BQ_NO", 3); define("ATTR_DEF_BQ_NAME", 4); define("ATTR_DEF_PRIX_ACHAT", 7); define("ATTR_DEF_PRIX_VENTE", 6); -define("ATTR_DEF_TVA", 2); -define("ATTR_DEF_NUMTVA", 13); +define("ATTR_DEF_TVA", 2); // usable VAT for goods and services +define("ATTR_DEF_NUMTVA", 13); // number of VAT define("ATTR_DEF_ADRESS", 14); define("ATTR_DEF_POSTCODE", 15); define("ATTR_DEF_COUNTRY", 16); @@ -427,7 +427,13 @@ function noalyss_class_autoloader($class) 'noalyss\file_cache'=>"lib/file_cache.class.php", "pdfland"=>"class/pdf_land.class.php", "noalyss\widget\widget"=>"widget/widget.php", - "noalyss\otp"=>"lib/otp.class.php" + "noalyss\otp"=>"lib/otp.class.php", + 'noalyss\xmldocument\xmlinvoice'=>'XMLDocument/XMLInvoice.php', + 'noalyss\xmldocument\facturx'=>'XMLDocument/FacturX.php', + 'noalyss\xmldocument\invoiceubl21'=>'XMLDocument/InvoiceUBL21.php', + 'noalyss\xmldocument\error_message'=>'XMLDocument/Error_Message.php', + "noalyss\invoice_pdf"=>"class/invoice_pdf.class.php", + 'noalyss\xmldocument\xmlinvoice_reader'=>'XMLDocument/xmlinvoice_reader.class.php' ); if (isset ($aClass[$class])) { require_once NOALYSS_INCLUDE . "/" . $aClass[$class]; diff --git a/include/export/export_receipt.php b/include/export/export_receipt.php index 0cc3027a5..2c03ff409 100644 --- a/include/export/export_receipt.php +++ b/include/export/export_receipt.php @@ -32,7 +32,7 @@ try } catch (Exception $exc) { - error_log($exc->getTraceAsString()); + record_log($exc); return; } $cn=Dossier::connect(); diff --git a/include/export/export_xml-invoice.php b/include/export/export_xml-invoice.php new file mode 100644 index 000000000..b02ac65f3 --- /dev/null +++ b/include/export/export_xml-invoice.php @@ -0,0 +1,122 @@ +get('jr_id',"number"); +} +catch (Exception $exc) +{ + record_log($exc); + return; +} + +$cn=Dossier::connect(); + +$r=$cn->exec_sql("select jr_def_id from jrn where jr_id=$1",array($jr_id)); + +if ( Database::num_row($r) == 0 ) +{ + echo_error("Invalid operation id jr_id=$jr_id"); + exit; +} +$a=Database::fetch_array($r,0); +$jrn=$a['jr_def_id']; +global $g_user; +if ($g_user->check_jrn($jrn) == 'X' ) +{ + /* Cannot Access */ + NoAccess(); + exit -1; +} + +$ret=$cn->exec_sql("select jr_pj_name,jr_pj_number ,jr_document_xml from jrn where jr_id=$1", + array($jr_id)); + +if ( Database::num_row ($ret) == 0 ) + return; + +$row=Database::fetch_array($ret,0); + +if ( $row['jr_document_xml']==null ) +{ + ini_set('zlib.output_compression','Off'); + header("Pragma: public"); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); + header("Cache-Control: must-revalidate"); + header('Content-type: '.'text/plain'); + header('Content-Disposition: attachment;filename=vide.txt',FALSE); + header("Accept-Ranges: bytes"); + echo "******************"; + echo _("Fichier effacé"); + echo "******************"; + exit(); +} +$tmp=tempnam($_ENV['TMP'],'document_'); + +$new_name=$row['jr_pj_name']; +$receipt_number=clean_filename($row['jr_pj_number']); +$receipt_number=noalyss_str_replace('.','-',$receipt_number); +if ( ! empty($receipt_number) && strpos($new_name,$receipt_number) === false ) { + + $new_name=$receipt_number.'-'.$new_name; +} +// replace extension by xml (normally a PDF) +//@var $pos_ext (int) where is the last dot +$pos_ext=strrpos($new_name,'.'); +if ( $pos_ext == 0) +{ + // there is no extension + $new_name.='.xml'; +}else { + $new_name=substr_replace($new_name,'.xml',$pos_ext); +} +$cn->start(); + +$cn->lo_export($row['jr_document_xml'],$tmp); +$cn->commit(); + +ini_set('zlib.output_compression','Off'); +header("Pragma: public"); +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); +header("Cache-Control: must-revalidate"); +header('Content-type: application/xml'); +header('Content-Disposition: attachment;filename="'.$new_name.'"',FALSE); +header("Accept-Ranges: bytes"); + +$file=fopen($tmp,'r'); +while ( !feof ($file) ) + echo fread($file,8192); + +fclose($file); + +unlink ($tmp); diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index 809af585b..a471ddbe1 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -1877,3 +1877,20 @@ function guidv4($data = null) { // Output the 36 character UUID. return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } +/** + * @brief retrieve the index for the key percent, returns -1 if nothing found + * @param $array (array) SubTotal + * @param $key (string) name of the key + * @param $value (string) value to look for + * @return int + */ +function find_idx($array,$key,$value) { + if ( count($array) == 0 ) { return -1; } + $nb_array=count($array); + for($i=0;$i <$nb_array;$i++) { + if ($array[$i][$key] == $value) { + return $i; + } + } + return -1; +} \ No newline at end of file diff --git a/include/lib/database_core.class.php b/include/lib/database_core.class.php index bea8cf4eb..c6311d29d 100644 --- a/include/lib/database_core.class.php +++ b/include/lib/database_core.class.php @@ -718,27 +718,39 @@ class DatabaseCore } /*** - * \brief Save a document into the database , it just puts the file in the database + * \brief Save one or several documents into the database , it just puts the file in the database * and returns the corresponding OID , the mimetype , size ... of the document * must be set in the calling function. * * \param name of the variable in $_FILES + * \param $only_oid (bool) (default :true) false : return filename and oid in an array , true only OID, * \return $oid of the lob file if success * false if a error occurs or if there is no file to upload + * array(oid, filename) if $only_oid is true * */ - function upload($p_name) + function upload($p_name,$only_oid = false) { + + //var $a : 0 we're in a transaction, 1 we are not in a transaction + $a=0; + if ( $this->status() !== PGSQL_TRANSACTION_INTRANS ) { + $a=1; + $this->start(); + } + /* there is no file to upload */ if ($_FILES[$p_name]["error"] == UPLOAD_ERR_NO_FILE) { + \record_log("DC759: error upload file".var_export($_FILES, true)); + if ( $a==1) { $this->rollback(); } return false; } $new_name = tempnam($_ENV['TMP'], $p_name); if ($_FILES[$p_name]["error"] > 0) { - print_r($_FILES); - echo_error(__FILE__ . ":" . __LINE__ . "Error: " . $_FILES[$p_name]["error"]); + \record_log("DC740: error upload file".var_export($_FILES, true)); + if ( $a==1) { $this->rollback(); } return false; } if (strlen($_FILES[$p_name]['tmp_name']) != 0) { @@ -746,19 +758,101 @@ class DatabaseCore // echo "Image saved"; $oid = pg_lo_import($this->db, $new_name); if ($oid == false) { - echo_error(__FILE__, __LINE__, "cannot upload document"); + \record_log("DC747: error upload file".var_export($_FILES, true). "SQL MESSAGE". pg_last_error($this->db)); $this->rollback(); return false; } - return $oid; + if ( $a == 1 ) { $this->commit(); } + if ($only_oid ){ + return $oid; + }else { + return ["oid"=>$oid,'filename'=>$new_name]; + } } else { - echo "

Error

"; + \record_log("DC754: move_uploaded fails".var_export($_FILES, true)); $this->rollback(); return false; } } + + \record_log("DC576: Files error names empty".var_export($_FILES, true)); + if ( $a == 1) { $this->commit(); } return false; } + /** + * @brief large_object writee: create a Large object if oid is not given + * with data content in a binaray + * @param $binary_data (raw data) binary + * @returns $oid of the LO, false if it fails + */ + function lo_write($binary_data) + { + //var $a : 0 where in a transaction, 1 we are not in a transaction + $a=0; + if ( $this->status() !== PGSQL_TRANSACTION_INTRANS ) { + $a=1; + $this->start(); + } + + $oid= pg_lo_create($this->db); + + if ( ($handle=pg_lo_open($this->db,$oid,"w")) == false ) { return false ;} + pg_lo_write($handle, $binary_data); + pg_lo_close($handle); + if ( $a==1) { $this->commit(); } + return $oid; + + } + /** + * @brief read a Large object with data content in a binary + * @param $oid (int8) oid of the large object + * @returns $binary_data (raw data) binary + */ + function lo_read($oid) + { + //var $a : 0 where in a transaction, 1 we are not in a transaction + $a=0; + if ( $this->status() !== PGSQL_TRANSACTION_INTRANS ) { + $a=1; + $this->start(); + } + + $handle=pg_lo_open($this->db,$oid,"r"); + if ( $handle == false ) { return false ;} + // set position end of the LO + pg_lo_seek($handle, 0, PGSQL_SEEK_END); + // get the size + $size= pg_lo_tell($handle); + // set position to start + pg_lo_seek($handle, 0, PGSQL_SEEK_SET); + // read the comùplete LOB + $binary_data = pg_lo_read($handle,$size ); + pg_lo_close($handle); + if ( $a==1) { $this->commit(); } + return $binary_data; + } + /** + * @brief replace a Large object with data content in a binary + * @param $oid (int8) oid of the large object + * @param $binary_data (raw data) binary + * @returns $oid of the LO, false if it fails + */ + function lo_replace($binary_data, $oid) { + $a = 0; + if ($this->status() !== PGSQL_TRANSACTION_INTRANS) { + $a = 1; + $this->start(); + } + $handle = pg_lo_open($this->db, $oid, "w"); + if ( $handle == false ) { return false ;} + pg_lo_truncate($handle, 0); + pg_lo_write($handle, $binary_data); + pg_lo_close($handle); + if ($a == 1) { + $this->commit(); + } + return $oid; + } /** * \brief wrapper for the function pg_num_rows @@ -823,7 +917,7 @@ class DatabaseCore /** * \brief wrapper for the function pg_lo_unlink * \param $p_oid is the of oid - * \return return the result of the operation + * \return return the result of the operation : false == fails */ function lo_unlink($p_oid) diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php index 3cd985c44..cdea88b46 100644 --- a/include/template/ledger_detail_bottom.php +++ b/include/template/ledger_detail_bottom.php @@ -9,7 +9,7 @@ * @brief show the common parts of operation details * * Variables : $div = popup or box (det[0-9] - * + *@var $obj = Acc_Operation */ bcscale(2); \Noalyss\Dbg::echo_file(__FILE__); @@ -44,13 +44,18 @@ $a_tab['linked_operation_div']=array('id'=>'linked_operation_div'.$div,'label'=> $a_tab['document_operation_div']=array('id'=>'document_operation_div'.$div,'label'=>_('Document').'('.$nb_document.')','display'=>'block'); $a_tab['linked_action_div']=array('id'=>'linked_action_div'.$div,'label'=>_('Actions Gestion').'('.count($a_followup).')','display'=>'none'); $a_tab['analytic_div']=array('id'=>'analytic_div'.$div,'label'=>_('Comptabilité Analytique'),'display'=>'none'); +//var $g_parameter \Noalyss_Parameter_Folder +global $g_parameter; // show tabs if ( $div != "popup") : $a_tab['document_operation_div']['display']='block'; + $tabs=array_column($a_tab,"id"); + ?> +">
    $a_value): ?>
  • - +
@@ -317,9 +322,7 @@ require_once NOALYSS_TEMPLATE.'/ledger_detail_file.php';
- -
-'; if ( $div != 'popup' ) { @@ -408,4 +411,4 @@ echo '
'; }else { echo '

'; } -?> + diff --git a/include/template/xmlinvoice-display_error.php b/include/template/xmlinvoice-display_error.php new file mode 100644 index 000000000..d17c408fa --- /dev/null +++ b/include/template/xmlinvoice-display_error.php @@ -0,0 +1,124 @@ +check_VAT(); + +///@var $total_error (int) total of errors found in e-invoice +$total_error=count ($a_error['general']) + + count($a_error['operation']) + + count($a_error['customer']) + + count($a_error['company']) + +count($a_vat_error); + +if ( $total_error == 0 ) : + return; +endif; +$error_message=new \Noalyss\XMLDocument\Error_Message($a_error); +?> + + \ No newline at end of file diff --git a/scenario/LIB/databasecore.test.php b/scenario/LIB/databasecore.test.php index b1c853736..ad87b9b0a 100644 --- a/scenario/LIB/databasecore.test.php +++ b/scenario/LIB/databasecore.test.php @@ -34,13 +34,34 @@ $cn=Dossier::connect(); echo h2(" Status IDLE"); echo $cn->status(); -echo h2(" Status in begin "); +echo h2(" Status start "); //echo PGSQL_TRANSACTION_INTRANS; echo $cn->start(); echo $cn->status (); echo "
"; $cn->get_value("select count(*) from jrnx"); +echo "
"; echo $cn->status (); - echo PGSQL_TRANSACTION_INTRANS; + +echo "
"; echo h2(" Status after rollback "); echo $cn->commit(); +echo "
"; echo $cn->status (); +echo h1("Upload"); +echo h2("One file"); +if ( isset($_POST['submit_one'])) { + var_dump($_FILES); + // $cn->start(); + if ( $cn->upload("validate_one") != false){ + echo "success : loaded ".var_export($_FILES['validate_one'],true); + } + // $cn->commit(); +}else{ + echo <<
+ + +
+FORM; + +} diff --git a/sql/upgrade.sql b/sql/upgrade.sql index f84d648f5..1c58add80 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -234,7 +234,7 @@ insert into parameter_extra(pe_code,pe_label) values ('COMPANY_LEGAL_ENTITY','Fo insert into parameter_extra(pe_code,pe_label) values ('COMPANY_BANK_IBAN','Compte en banque (IBAN)') on conflict do nothing; insert into parameter_extra(pe_code,pe_label) values ('COMPANY_BANK_BIC','BIC Bank Identification Code') on conflict do nothing; insert into parameter_extra(pe_code,pe_label) values ('COMPANY_UBL_ID','ID PEPPOL') on conflict do nothing; -insert into parameter_extra(pe_code,pe_label) values ('SIRENE','n° SIRENE') on conflict do nothing; +insert into parameter_extra(pe_code,pe_label) values ('SIREN','n° SIREN') on conflict do nothing; insert into parameter_extra(pe_code,pe_label) values ('SIRET','n° SIRET') on conflict do nothing; @@ -276,7 +276,7 @@ insert into quantity_code_ref values ('SEC','Second — seconde'), ('KG','Kilogram — kilogramme'), ('G','Gram — gramme'), -('LB ','Pound (pound) — livre'), +('LB','Pound (pound) — livre'), ('LTR','Liter — litre'), ('MTR','Meter — mètre'), ('CM','Centimeter — centimètre'), @@ -292,3 +292,17 @@ insert into quantity_code_ref values insert into "parameter" values ('MY_INVOICE_FORMAT','BASIC'); + +alter table jrn add jr_document_xml oid; + +comment on column jrn.jr_document_xml is 'OID of the XML files (e-invoice) used only for XML'; + + + create sequence seq_doc_type_stdinv; +comment on sequence seq_doc_type_stdinv is 'Sequence for standard invoice'; + + +INSERT INTO public.menu_ref (me_code, me_menu, me_file, me_url, me_description, me_parameter, me_javascript, me_type, me_description_etendue) +VALUES('RAW:xml-invoice', 'Exporte la facture XML', 'export_xml-invoice.php', NULL, 'export la facture électronique en XML', NULL, NULL, 'PR', NULL); + +insert into profile_menu (me_code,p_id, p_type_display) select 'RAW:xml-invoice',p_id,'P' from profile; \ No newline at end of file diff --git a/unit-test/include/class/Acc_DocumentTest.php b/unit-test/include/class/Acc_DocumentTest.php new file mode 100644 index 000000000..d6993e460 --- /dev/null +++ b/unit-test/include/class/Acc_DocumentTest.php @@ -0,0 +1,125 @@ + + * + */ + +/** + * @file + * @brief noalyss + */ +use PHPUnit\Framework\TestCase; + +require DIRTEST . '/global.php'; + +/** + * @testdox Class xxx : used for ... + * @backupGlobals enabled + * @coversDefaultClass + */ +class Acc_DocumentTest extends TestCase { + + /** + * @var Fiche + */ + protected $object; + protected $connection; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test method is executed. + */ + protected function setUp(): void { + + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test method is executed. + */ + protected function tearDown(): void { + /** + * example + * if ( ! is_object($this->object->fiche_def)) return; + * include_once DIRTEST.'/global.php'; + * $g_connection=Dossier::connect(); + * $sql=new ArrayObject(); + * $sql->append("delete from fiche_detail where f_id in (select f_id from fiche where fd_id =\$1 )"); + * $sql->append("delete from fiche where f_id not in (select f_id from fiche_detail where \$1=\$1)"); + * $sql->append("delete from jnt_fic_attr where fd_id = \$1 "); + * $sql->append("delete from fiche_def where fd_id = \$1"); + * foreach ($sql as $s) { + * $g_connection->exec_sql($s,[$this->object->fiche_def->id]); + * } + */ + } + + /** + * the setUpBeforeClass() template methods is called before the first test of the test case + * class is run + */ + public static function setUpBeforeClass(): void { + // include 'global.php'; + } + + /** + * @brief Data simulation + + * @return array + */ + function dataExample() { + return array( + ['0A', 4] + , ['0B', 6] + , [6, 6] + , ['NONE', -1] + , [14, -1] + , [" ", -1] + , [null, -1] + ); + } + + /** + * tearDownAfterClass() template methods is calleafter the last test of the test case class is run, + * + */ + static function tearDownAfterClass(): void { + // include 'global.php'; + } + +// +// public function dataExample() +// { +// return array([1], [2], [3]); +// } + + /** + * @testdox description of the test + * @covers Acc_Balance::summary_add + * @depend Acc_Balance::summary_init + * @backupGlobals enabled + * @dataProvider dataExample + * @global $g_connection + */ + function testFunction() { + + } +} diff --git a/unit-test/include/class/Acc_TVATest.php b/unit-test/include/class/Acc_TVATest.php index 5956f4de5..878e4bfe0 100644 --- a/unit-test/include/class/Acc_TVATest.php +++ b/unit-test/include/class/Acc_TVATest.php @@ -23,7 +23,7 @@ */ use PHPUnit\Framework\TestCase; - +use PHPUnit\Framework\Attributes\DataProvider; /** * @backupGlobals enabled * @coversDefaultClass \Acc_Payment @@ -84,7 +84,7 @@ class Acc_TVATest extends TestCase } } - function dataCheck() { + static function dataCheck() { return array( ['abc',true] ,['13A',true] @@ -100,6 +100,7 @@ class Acc_TVATest extends TestCase * @dataProvider dataCheck * @return void */ + #[DataProvider('dataCheck')] function testCheck($tva_code,$result) { $cn=\Dossier::connect(); @@ -117,7 +118,7 @@ class Acc_TVATest extends TestCase $this->assertTrue($result==$check," erreur pour $tva_code "); $this->display_error($tva_rate_mtable); } - function dataBuild() { + static function dataBuild() { return array( ['0A',4] ,['0B',6] @@ -133,6 +134,7 @@ class Acc_TVATest extends TestCase * @dataProvider dataBuild * @return void */ + #[DataProvider('dataBuild')] function testBuild($tva_code,$result) { $cn=\Dossier::connect(); diff --git a/unit-test/include/class/DocumentTest.php b/unit-test/include/class/DocumentTest.php index e206f6a88..294298063 100644 --- a/unit-test/include/class/DocumentTest.php +++ b/unit-test/include/class/DocumentTest.php @@ -27,6 +27,8 @@ use PHPUnit\Framework\TestCase; */ require DIRTEST . '/global.php'; +use PHPUnit\Framework\Attributes\DataProvider; + /** * @backupGlobals disabled */ @@ -150,21 +152,7 @@ class DocumentTest extends TestCase { $cn->commit(); } - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp(): void { - - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void { - - } + function testBlank() { $cn = Dossier::connect(); @@ -266,10 +254,10 @@ class DocumentTest extends TestCase { $document->d_id = $d_id; $document->get(); } - return $document; + return $document; } - function dataReplace() { + static function dataReplace() { return array( ["CUST_NAME", "Client 2"], ["SOLDE", 27.29], @@ -285,6 +273,7 @@ class DocumentTest extends TestCase { * @backupGlobals enabled * @dataProvider dataReplace */ + #[DataProvider('dataReplace')] function testReplace2($tag_name, $value) { require "global.php"; static $request = null; @@ -303,7 +292,7 @@ class DocumentTest extends TestCase { $this->assertEquals($name, $value, $tag_name." fails"); } - function dataBalance() + static function dataBalance() { return array( ['CLIENT1',27.29, 4204.14], @@ -316,6 +305,7 @@ class DocumentTest extends TestCase { * @dataProvider dataBalance */ + #[DataProvider('dataBalance')] function testBalance($quickcode,$balance_report,$balance_noreport) { require "global.php"; diff --git a/unit-test/include/class/NoalyssUserTest.php b/unit-test/include/class/NoalyssUserTest.php index 11aa30e80..e9271629c 100644 --- a/unit-test/include/class/NoalyssUserTest.php +++ b/unit-test/include/class/NoalyssUserTest.php @@ -1,6 +1,6 @@ assertEquals($cn->get_value('select count(*) from profile_user where user_name=$1',array('unknown/user')),0); } - public function dataPeriode() + public static function dataPeriode() { return array( [92], @@ -204,6 +204,7 @@ class NoalyssUserTest extends TestCase * @param type $p_id periode id * @dataProvider dataPeriode */ + #[DataProvider('dataPeriode')] public function testPeriode($p_id) { $this->object=new Noalyss_user(Dossier::connect(), USE_ID); diff --git a/unit-test/include/class/acc_accountTest.php b/unit-test/include/class/acc_accountTest.php index d607d5ac2..eaf323509 100644 --- a/unit-test/include/class/acc_accountTest.php +++ b/unit-test/include/class/acc_accountTest.php @@ -1,6 +1,6 @@ object->find_parent(); $this->assertEquals($result,700); } - public function dataFormatAccount() + public static function dataFormatAccount() { return array( ['60élépànç%','60ELEPANC'], @@ -253,6 +253,7 @@ class Acc_AccountTest extends TestCase * @param string $p_result * @dataProvider dataFormatAccount */ + #[DataProvider('dataFormatAccount')] public function testFormatAccount($param,$p_result) { global $g_connection; diff --git a/unit-test/include/class/acc_account_ledgerTest.php b/unit-test/include/class/acc_account_ledgerTest.php index 4997d51e3..561f6c1ab 100644 --- a/unit-test/include/class/acc_account_ledgerTest.php +++ b/unit-test/include/class/acc_account_ledgerTest.php @@ -1,7 +1,7 @@ assertEquals($expected, $a_array); } - function dataGet_Name() + static function dataGet_Name() { return array( array('10', 'Capital '), @@ -301,6 +302,7 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::get_name * @dataProvider dataGet_Name */ + #[DataProvider('dataGet_Name')] public function testGet_name($id, $result) { $this->object->id=$id; @@ -311,13 +313,14 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::do_exist * @dataProvider dataDo_exist */ + #[DataProvider('dataDo_exist')] public function testDo_exist($p_value, $result) { $this->object->id=$p_value; $this->assertEquals($this->object->do_exist(), $result); } - function dataDo_exist() + static function dataDo_exist() { return array( array('400', 1), @@ -380,7 +383,7 @@ class Acc_Account_LedgerTest extends TestCase $this->assertTrue(true, 'Ne peut être testé car vue HTML'); } - public function dataGet_amount_side() + public static function dataGet_amount_side() { return array( array(0, "="), @@ -393,6 +396,7 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::get_amount_side * @dataProvider dataGet_amount_side */ + #[DataProvider('dataGet_amount_side')] public function testGet_amount_side($amount, $result) { $this->assertEquals($this->object->get_amount_side($amount), $result); @@ -404,12 +408,13 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::belong_ledger * @dataProvider DataBelong_ledger */ + #[DataProvider('DataBelong_ledger')] public function testBelong_ledger($p_jrn, $result) { $this->assertEquals($this->object->belong_ledger($p_jrn), $result); } - function DataBelong_ledger() + static function DataBelong_ledger() { return array( array(-1, 0), @@ -420,7 +425,7 @@ class Acc_Account_LedgerTest extends TestCase ); } - public function dataGet_account_ledger() + public static function dataGet_account_ledger() { return array( array(0, array()), @@ -435,6 +440,7 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::get_account_ledger * @dataProvider dataGet_account_ledger */ + #[DataProvider('dataGet_account_ledger')] public function testGet_account_ledger($p_jrn, $result) { $this->assertEquals($this->object->get_account_ledger($p_jrn), $result); @@ -444,13 +450,14 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::build_sql_account * @dataProvider DataBuild_Sql_account */ + #[DataProvider('DataBuild_Sql_account')] public function testBuild_sql_account($p_jrn, $result) { $value=$this->object->build_sql_account($p_jrn); $this->assertEquals(trim($value), $result); } - public function DataBuild_Sql_account() + public static function DataBuild_Sql_account() { return array( array(0, ""), @@ -461,7 +468,7 @@ class Acc_Account_LedgerTest extends TestCase ); } - function dataFind_Card() + static function dataFind_Card() { return array( array('6191', '27'), @@ -475,13 +482,14 @@ class Acc_Account_LedgerTest extends TestCase * @todo Implement testFind_card(). * @dataProvider dataFind_Card() */ + #[DataProvider('dataFind_Card')] public function testFind_card($p_value, $p_card) { $this->object->id=$p_value; $result=$this->object->find_card(); $this->assertEquals($p_card, $result[0]['f_id']); } - public function dataGet_used_accounting() + public static function dataGet_used_accounting() { $array=array( ["01.01.2020","31.12.2020",5,7,4] @@ -500,6 +508,7 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::get_used_accounting * @dataProvider dataGet_used_accounting */ + #[DataProvider('dataGet_used_accounting')] public function testGet_UsedAcccounting($from_date,$to_date,$from_accounting,$to_accounting,$nb_accounting) { $a_result=Acc_Account_Ledger::get_used_accounting(from_date:$from_date @@ -514,7 +523,7 @@ class Acc_Account_LedgerTest extends TestCase /** * @return array : idx [ $accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred] */ - public function dataRowNotLettered() + public static function dataRowNotLettered() { $array=array( ['4400005','01.01.2019','31.12.2019',9,0,954.10] @@ -527,6 +536,7 @@ class Acc_Account_LedgerTest extends TestCase * @covers Acc_Account_Ledger::get_row_date * @dataProvider dataRowNotLettered */ + #[DataProvider('dataRowNotLettered')] public function testGetRowDataNotLetted($accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred) { global $g_connection; diff --git a/unit-test/include/class/acc_computeTest.php b/unit-test/include/class/acc_computeTest.php index 862f785fa..4abf4dc0f 100644 --- a/unit-test/include/class/acc_computeTest.php +++ b/unit-test/include/class/acc_computeTest.php @@ -1,6 +1,6 @@ - -/** - * @file - * @brief concerne acc_ledger_history_purchaseTest.class - */ -class Acc_Ledger_History_PurchaseTest extends TestCase -{ - - /** - * @var - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp():void - { - include DIRTEST.'/global.php'; - global $g_connection; - $this->object=new Acc_Ledger_History_Purchase($g_connection, [3], 92, 131, 'L'); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown():void - { - - } - private function save_file($p_name,$content) - { - $hFile=fopen(__DIR__."/file/".$p_name,"w+"); - fwrite($hFile, $content); - fclose($hFile); - } - //@covers Acc_Ledger_History_Financial::get_row , Acc_Ledger_History_Financial::get_data - function testGet_Row() - { - $this->object->get_row(); - $this->assertEquals(16,count($this->object->get_data()),"Acc_Ledger_History_Purchase->get_data"); - - } - //@covers Acc_Ledger_History_Financial::export_oneline_html - function testExport_Oneline_Html() - { - //- Listing - $name="acc_ledger_history_purchase_export_listing.html"; - $this->object->set_m_mode("L"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - - //- Extended - $name="acc_ledger_history_purchase_export_extended.html"; - $this->object->set_m_mode("E"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - - //- Detail - $name="acc_ledger_history_purchase_export_detail.html"; - $this->object->set_m_mode("D"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - - //- Accounting - $name="acc_ledger_history_purchase_export_accounting.html"; - $this->object->set_m_mode("D"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - } - /** - * @covers Acc_Ledger_History::get_ledger_type - */ - - function testGet_Ledger_type() - { - $this->assertEquals($this->object->get_ledger_type(),'ACH'); - } -} diff --git a/unit-test/include/class/acc_ledger_history_sale.Test.php b/unit-test/include/class/acc_ledger_history_sale.Test.php deleted file mode 100644 index 7a8bb1f61..000000000 --- a/unit-test/include/class/acc_ledger_history_sale.Test.php +++ /dev/null @@ -1,121 +0,0 @@ - - -/** - * @file - * @brief concerne Acc_Ledger_History_SaleTest.class - */ -class Acc_Ledger_History_SaleTest extends TestCase -{ - - /** - * @var - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp():void - { - include 'global.php'; - global $g_connection; - $this->object=new Acc_Ledger_History_Sale($g_connection,[2],92,131,'L'); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown():void - { - - } - function testGet_row() - { - $this->object->get_row(); - $this->assertEquals(6,count($this->object->get_data()),"Acc_Ledger_History_Sale->get_row"); - } - private function save_file($p_name,$content) - { - $hFile=fopen(__DIR__."/file/".$p_name,"w+"); - fwrite($hFile, $content); - fclose($hFile); - } - //@covers Acc_Ledger_History_Sale::export_oneline_html - function testExport_Oneline_Html() - { - //- Listing - $name="acc_ledger_history_sale_export_listing.html"; - $this->object->set_m_mode("L"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - - //- Extended - $name="acc_ledger_history_sale_export_extended.html"; - $this->object->set_m_mode("E"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - - //- Detail - $name="acc_ledger_history_sale_export_detail.html"; - $this->object->set_m_mode("D"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - - //- Accounting - $name="acc_ledger_history_sale_export_accounting.html"; - $this->object->set_m_mode("D"); - ob_start(); - echo \Noalyss\Facility::page_start(); - $this->object->export_html(); - $content=ob_get_contents(); - ob_end_clean(); - $this->save_file($name, $content); - $this->assertFileExists(__DIR__."/file/".$name); - } - /** - * @covers Acc_Ledger_History::get_ledger_type - */ - - function testGet_Ledger_type() - { - $this->assertEquals($this->object->get_ledger_type(),'VEN'); - } -} diff --git a/unit-test/include/class/acc_ledger_info.Test.php b/unit-test/include/class/acc_ledger_infoTest.php similarity index 100% rename from unit-test/include/class/acc_ledger_info.Test.php rename to unit-test/include/class/acc_ledger_infoTest.php diff --git a/unit-test/include/class/acc_ledger_purchaseTest.php b/unit-test/include/class/acc_ledger_purchaseTest.php index 3de6143cd..d61c8e42a 100644 --- a/unit-test/include/class/acc_ledger_purchaseTest.php +++ b/unit-test/include/class/acc_ledger_purchaseTest.php @@ -1,7 +1,7 @@ a_column=array( - "j_id", - "j_date", - "j_date_fmt", - "jr_pj_number", - "j_montant", - "j_debit", - "jr_comment", - "jr_internal", - "jr_id", - "jr_def_id", - "letter", - "letter_diff", - "currency_amount", - "currency_id", - "currency_rate", - "currency_rate_ref", - "cr_code_iso" - ); + "j_id", + "j_date", + "j_date_fmt", + "jr_pj_number", + "j_montant", + "j_debit", + "jr_comment", + "jr_internal", + "jr_id", + "jr_def_id", + "letter", + "letter_diff", + "currency_amount", + "currency_id", + "currency_rate", + "currency_rate_ref", + "cr_code_iso" + ); } - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test method is executed. - */ - protected function tearDown():void - { - - } + /** * the setUpBeforeClass():void template methods is called before the first test of the test case @@ -86,15 +81,8 @@ class Acc_LetterTest extends TestCase } - /** - * tearDownAfterClass():void template methods is calleafter the last test of the test case class is run, - * - */ - static function tearDownAfterClass():void - { - // include 'global.php'; - } - public function dataget_Letter() + + public static function dataget_Letter() { return array([22,577],[26,343]); } @@ -104,6 +92,7 @@ class Acc_LetterTest extends TestCase * @covers Lettering_Card::get_letter * @dataProvider dataget_Letter */ + #[DataProvider('dataget_Letter')] public function testget_letterAccount($p_fiche_id,$p_jrnx_id) { global $g_connection; @@ -155,6 +144,7 @@ class Acc_LetterTest extends TestCase * @covers Lettering_Card::get_letter * @dataProvider dataget_Letter */ + #[DataProvider('dataget_Letter')] public function testget_letterCard($p_fiche_id,$p_jrnx_id) { global $g_connection; @@ -196,7 +186,7 @@ class Acc_LetterTest extends TestCase $g_connection->exec_sql("update jrnx set j_montant =$2 where j_id=$1 ",[$p_jrnx_id,$restore]); } - public function dataDateLimit() + public static function dataDateLimit() { return array( [100,'01.01.2018','31.12.2018'], @@ -210,6 +200,7 @@ class Acc_LetterTest extends TestCase * @param type $p_id * @dataProvider dataDateLimit */ + #[DataProvider('dataDateLimit')] public function testDateLimitComputed($p_periode_id,$p_first_day,$p_last_day) { global $g_connection; @@ -238,6 +229,7 @@ class Acc_LetterTest extends TestCase * @param type $p_id * @dataProvider dataDateLimit */ + #[DataProvider('dataDateLimit')] public function testDateLimitGiven($p_periode_id,$p_first_day,$p_last_day) { global $g_connection; diff --git a/unit-test/include/class/acc_operationTest.php b/unit-test/include/class/acc_operationTest.php index 75e7a23a8..d0328f19d 100644 --- a/unit-test/include/class/acc_operationTest.php +++ b/unit-test/include/class/acc_operationTest.php @@ -1,5 +1,6 @@ exec_sql("delete from plan_analytique where pa_id>1"); } - public function datasqlStmt() + public static function datasqlStmt() { return array([1,"Group 1",1], [2,"Group 2",1], @@ -98,6 +98,7 @@ class Anc_GroupTest extends TestCase * @param type $p_param * @covers */ + #[DataProvider('datasqlStmt')] public function test_sqlStmt($p_ga_id,$pga_description,$ppa_id) { global $g_connection; diff --git a/unit-test/include/class/anc_key.Test.php b/unit-test/include/class/anc_keyTest.php similarity index 100% rename from unit-test/include/class/anc_key.Test.php rename to unit-test/include/class/anc_keyTest.php diff --git a/unit-test/include/class/anc_key_sql.Test.php b/unit-test/include/class/anc_key_sqlTest.php similarity index 94% rename from unit-test/include/class/anc_key_sql.Test.php rename to unit-test/include/class/anc_key_sqlTest.php index aaf1b7a8b..51be4658c 100644 --- a/unit-test/include/class/anc_key_sql.Test.php +++ b/unit-test/include/class/anc_key_sqlTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\TestCase; /** * Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:52. */ -class Anc_Key_Detail_SQLTest extends TestCase +class Anc_Key_SQLTest extends TestCase { /** diff --git a/unit-test/include/class/card_propertyTest.php b/unit-test/include/class/card_propertyTest.php index 2179706fc..2fa654bcf 100644 --- a/unit-test/include/class/card_propertyTest.php +++ b/unit-test/include/class/card_propertyTest.php @@ -289,4 +289,17 @@ class Card_PropertyTest extends TestCase $this->assertTrue(!empty($fiche->get_attribute(ATTR_DEF_ACCOUNT)),' accounting not computed'); } + /** + * @testdox test the function get_attribute + */ + public function testGet_attribute() + { + $g_connection=Dossier::connect(); + $fiche_goods = new \Fiche($g_connection); + $fiche_goods->get_by_qcode("MARCHA"); + $id=$fiche_goods->id; + + $this->assertTrue(\Card_Property::get_attribute($g_connection, $id, ATTR_DEF_QUICKCODE)=="MARCHA","Quick code not retrieved"); + $this->assertTrue(\Card_Property::get_attribute($g_connection, $id, -5)==false,"Inexistant property not detected"); + } } diff --git a/unit-test/include/class/ficheTest.php b/unit-test/include/class/ficheTest.php index 96afd657e..31cca57cd 100644 --- a/unit-test/include/class/ficheTest.php +++ b/unit-test/include/class/ficheTest.php @@ -1,7 +1,7 @@ assertEquals($nb_fiche, $nb_fiche_after, 'card not removed'); } - public function dataEmptyQuickCode() + public static function dataEmptyQuickCode() { return array( array("none", ""), @@ -328,6 +323,7 @@ class FicheTest extends TestCase * @testdox testInsertEmptyQuickCode Test if it is possible to insert an empty quickcode * @dataProvider dataEmptyQuickCode */ + #[DataProvider('dataEmptyQuickCode')] public function testInsertEmptyQuickCode($name, $quick_code) { //insert @@ -338,7 +334,7 @@ class FicheTest extends TestCase $fiche->remove(); } - function dataUpdateQuickCode() + static function dataUpdateQuickCode() { return array( array('a+z+1-5', 'AZ1-5'), @@ -358,6 +354,7 @@ class FicheTest extends TestCase * @testdox testUpdateEmptyQuickCode Test if it is possible to update an empty quickcode * @dataProvider dataUpdateQuickCode */ + #[DataProvider('dataUpdateQuickCode')] public function testUpdateEmptyQuickCode($name, $quick_code) { $aCardId=[]; @@ -439,7 +436,7 @@ where } } - function dataFormat_QuickCode() + static function dataFormat_QuickCode() { return array( array('a+z+1-5','AZ1-5'), @@ -458,12 +455,13 @@ where * @testdox test comptaproc.format_quickcode * @dataProvider dataFormat_Quickcode */ + #[DataProvider('dataFormat_Quickcode')] public function testFormat_QuickCode($p_qcode,$p_result) { $this->assertEquals($p_result,$this->g_connection->get_value( "select comptaproc.format_quickcode($1)", [$p_result]),'quickcode is not transformed correctly'); } - function dataInsertName() + static function dataInsertName() { return array( ['',"Nom vide"], @@ -475,6 +473,7 @@ where * @testdox Test if it is possible to insert an empty name * @dataProvider dataInsertName */ + #[DataProvider('dataInsertName')] public function testInsertName($p_name,$p_result) { @@ -490,6 +489,7 @@ where * @testdox Test if it is possible to insert or update a empty name * @dataProvider dataInsertName */ + #[DataProvider('dataInsertName')] public function testUpdateName($p_name,$p_result) { @@ -613,7 +613,7 @@ where $this->assertEquals($i,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); } } - public function dataAccount() + public static function dataAccount() { return array( ['600002','600002'], @@ -626,6 +626,7 @@ where * @testdox testAccountInsert Set of the accounting while inserting, numeric with automatic * @dataProvider dataAccount */ + #[DataProvider('dataAccount')] public function testAccountInsert($p_value,$p_expected) { $fiche=$this->build_fiche(2, 'PHPUNIT.ACCOUNT.INSERT'); @@ -697,6 +698,7 @@ where * @testdox testAccountUpdate et of the accounting while updating * @dataProvider dataAccount */ + #[DataProvider('dataAccount')] public function testAccountUpdate($p_value,$p_expected) { $this->g_connection->exec_sql("update public.parameter set pr_value = $1 where pr_id=$2", @@ -849,4 +851,6 @@ where $this->g_connection->exec_sql ('update fiche set f_enable=$1 where f_id = $2 or f_id=$3',[1,34,35]); } + + } diff --git a/unit-test/include/class/followup_detail.Test.php b/unit-test/include/class/followup_detailTest.php similarity index 98% rename from unit-test/include/class/followup_detail.Test.php rename to unit-test/include/class/followup_detailTest.php index d27f849a9..c9aed651b 100644 --- a/unit-test/include/class/followup_detail.Test.php +++ b/unit-test/include/class/followup_detailTest.php @@ -34,7 +34,7 @@ use PHPUnit\Framework\TestCase; */ #[\AllowDynamicProperties] -class Follow_Up_DetailTest extends TestCase +class FollowUp_DetailTest extends TestCase { /** diff --git a/unit-test/include/class/impressTest.class.php b/unit-test/include/class/impressTest.class.php index a42966805..17b374239 100644 --- a/unit-test/include/class/impressTest.class.php +++ b/unit-test/include/class/impressTest.class.php @@ -1,7 +1,7 @@ exec_sql("delete from operation_analytique where oa_id > 48 and oa_id < 57"); - $sql="INSERT INTO operation_analytique + $sql="INSERT INTO operation_analytique (oa_id,po_id,oa_amount,oa_description,oa_debit,j_id,oa_date,oa_row,oa_jrnx_id_source,oa_positive,f_id) VALUES - (49,3,90.0000,'',true,18,'2018-02-24',0,NULL,'Y',NULL), - (50,4,93.0000,'',true,18,'2018-02-24',1,NULL,'Y',NULL), - (51,3,10.0000,'Déplacement',false,4,'2018-02-24',0,NULL,'Y',NULL), - (52,1,30.0000,'Déplacement',false,4,'2018-02-24',1,NULL,'Y',NULL), - (53,3,25.0000,'Vente de marchandises',false,7,'2018-02-24',0,NULL,'Y',NULL), - (54,3,91.0000,'Eau',true,371,'2018-04-24',0,NULL,'Y',NULL), - (55,3,80.0000,'Eau',true,371,'2018-04-24',1,NULL,'Y',NULL)"; + (49,3,90.0000,'',true,18,'2018-02-24',0,NULL,'Y',NULL), + (50,4,93.0000,'',true,18,'2018-02-24',1,NULL,'Y',NULL), + (51,3,10.0000,'Déplacement',false,4,'2018-02-24',0,NULL,'Y',NULL), + (52,1,30.0000,'Déplacement',false,4,'2018-02-24',1,NULL,'Y',NULL), + (53,3,25.0000,'Vente de marchandises',false,7,'2018-02-24',0,NULL,'Y',NULL), + (54,3,91.0000,'Eau',true,371,'2018-04-24',0,NULL,'Y',NULL), + (55,3,80.0000,'Eau',true,371,'2018-04-24',1,NULL,'Y',NULL)"; $g_connection->exec_sql($sql); - } /** * @@ -154,6 +145,7 @@ class ImpressTest extends TestCase * @covers Impress::parse_formula * @dataProvider getData_compute_amount */ + #[DataProvider('getData_compute_amount')] function test_compute_amount($p_accounting,$p_amount) { global $g_connection; @@ -224,7 +216,6 @@ class ImpressTest extends TestCase function test_parse_formula() { global $g_connection,$g_user; - $this->setData(); $a_formula=array( 0=>array("sum 70% (credit is negative)", "[70%-s]",-456.80), 1=>array("sum 70% (debit is negative)", "0-round([70%-s],2)",456.80), diff --git a/unit-test/include/class/periodeTest.php b/unit-test/include/class/periodeTest.php index 41a92fbc9..830bbc519 100644 --- a/unit-test/include/class/periodeTest.php +++ b/unit-test/include/class/periodeTest.php @@ -27,7 +27,7 @@ * @brief */ use PHPUnit\Framework\TestCase; - +use PHPUnit\Framework\Attributes\DataProvider; /** * @backupGlobals enabled */ @@ -77,7 +77,7 @@ class PeriodeTest extends TestCase // include 'global.php'; } - public function dataInsert() + public static function dataInsert() { return array( [ '01.01.2023' , '31.01.2023','2020','2020.2023','NOK'], @@ -95,6 +95,7 @@ class PeriodeTest extends TestCase * @param type $p_param * @covers */ + #[DataProvider('dataInsert')] public function testInsert($p_start,$p_end,$p_exercice,$p_exercice_label,$p_status) { global $g_connection; @@ -126,7 +127,7 @@ class PeriodeTest extends TestCase } $g_connection->exec_sql("delete from parm_periode where p_id > 144"); } - public function dataUpdate() + public static function dataUpdate() { return array( [ '01.01.2023' , '31.01.2023','2023','2020.2023','OK'], @@ -141,6 +142,7 @@ class PeriodeTest extends TestCase * * */ + #[DataProvider('dataUpdate')] public function testUpdate($p_start,$p_end,$p_exercice,$p_exercice_label,$p_status) { @@ -183,7 +185,7 @@ class PeriodeTest extends TestCase } - public function dataUpdateException() + public static function dataUpdateException() { return array( [ '01.01.2023' , '31.01.2023','2020','2020.2023','NOK'], @@ -199,6 +201,7 @@ class PeriodeTest extends TestCase * * */ + #[DataProvider('dataUpdateException')] public function testUpdateException($p_start,$p_end,$p_exercice,$p_exercice_label,$p_status) { diff --git a/unit-test/include/class/todo_list.Test.php b/unit-test/include/class/todo_listTest.php similarity index 100% rename from unit-test/include/class/todo_list.Test.php rename to unit-test/include/class/todo_listTest.php diff --git a/unit-test/include/lib/ac_commonTest.php b/unit-test/include/lib/ac_commonTest.php index 91f2ff39c..97e3ff611 100644 --- a/unit-test/include/lib/ac_commonTest.php +++ b/unit-test/include/lib/ac_commonTest.php @@ -1,6 +1,7 @@ assertEquals(isDate($p_date),$return,"Test $p_date"); } - function dataCompareDate () + static function dataCompareDate ():array { return array( ['01.01.1992','05.02.2001',-1], @@ -238,6 +240,7 @@ class Ac_CommonTest extends TestCase * @testDox test cmpDate * @dataProvider dataCompareDate */ + #[DataProvider('dataCompareDate')] function testCompareDate($p_date,$p_date_2,$p_result) { $cmp=cmpDate($p_date,$p_date_2); @@ -266,7 +269,7 @@ class Ac_CommonTest extends TestCase $this->assertEquals("<&",h("<&")); $this->assertEquals(0,h("0")); } - function dataFormat_Date() + static function dataFormat_Date() { return array( ["01.05.2000","DD.MM.YYYY","DD.MM.YY",'01.05.00'], @@ -287,6 +290,7 @@ class Ac_CommonTest extends TestCase * @throws Exception * @dataProvider dataFormat_date */ + #[DataProvider('dataFormat_date')] function testFormatDate($p_date,$p_from,$p_to,$p_result) { $this->assertEquals($p_result,format_date($p_date,$p_from,$p_to)); @@ -305,7 +309,7 @@ class Ac_CommonTest extends TestCase $this->assertEquals("l''éléphant",Database::escape_string("l'éléphant")); $this->assertEquals("l\''éléphant",Database::escape_string("l\'éléphant")); } - function dataNoalyss_trim() + static function dataNoalyss_trim() { return array(["0","0"], [" 0 1 1 1 ","0 1 1 1"], @@ -320,11 +324,12 @@ class Ac_CommonTest extends TestCase * @return void * @dataProvider dataNoalyss_trim */ + #[DataProvider('dataNoalyss_trim')] function testNoalyss_trim($param,$result) { $this->assertEquals($result,noalyss_trim($param)); } - function dataNoalyss_replace() { + static function dataNoalyss_replace() { return array(["0","/","0A0A","/A/A"], ["A","*","0A0A","0*0*"], ["0","/",null,""], @@ -336,11 +341,12 @@ class Ac_CommonTest extends TestCase * @brief Comptability PHP 8.1 , null is not consider as an empty string * @dataProvider dataNoalyss_replace */ + #[DataProvider('dataNoalyss_replace')] function testNoalyss_replace($search,$replace,$string,$expected) { $this->assertEquals($expected,noalyss_str_replace($search,$replace,$string)); } - function dataNoalyss_bcsub() { + static function dataNoalyss_bcsub() { return array( [1,2,-1], [0,2,-2], @@ -353,11 +359,12 @@ class Ac_CommonTest extends TestCase * @brief Comptability PHP 8.1 , null is not consider as an empty string * @dataProvider dataNoalyss_bcsub */ + #[DataProvider('dataNoalyss_bcsub')] function testNoalyss_bcsub($numbera,$numberb,$expected) { $this->assertEquals($expected,noalyss_bcsub($numbera,$numberb)); } - function dataNoalyss_strip_tags() { + static function dataNoalyss_strip_tags() { return array( [null,""], ["",""], @@ -370,6 +377,7 @@ class Ac_CommonTest extends TestCase * @brief Comptability PHP 8.1 , null is not consider as an empty string * @dataProvider dataNoalyss_strip_tags */ + #[DataProvider('dataNoalyss_strip_tags')] function testNoalyss_strip_tags($string,$expected) { $this->assertEquals($expected,noalyss_strip_tags($string)); @@ -429,7 +437,7 @@ EOF; * supply data for user password * @return array[$password, $weakness] 0 means strong password */ - public function dataCheck_password_strength() + public static function dataCheck_password_strength() { return array( ["AAAAAAA",5] @@ -446,6 +454,7 @@ EOF; * @testDoc test the check_password_strength function * @dataProvider dataCheck_password_strength() */ + #[DataProvider('dataCheck_password_strength')] public function testCheck_password_strength($p_password,$p_cnt) { diff --git a/unit-test/include/lib/databaseCoreTest.php b/unit-test/include/lib/databaseCoreTest.php index 5280d19f9..3268a691c 100644 --- a/unit-test/include/lib/databaseCoreTest.php +++ b/unit-test/include/lib/databaseCoreTest.php @@ -123,6 +123,94 @@ class DatabaseCoreTest extends TestCase $this->assertStringContainsString("Documentation", $p_content,"$filename invalid content"); } - + /** + * @brief read / write large object + * @testDox read and write - unlink large object + * + */ + public function testWrite_Read_large_object() + { + $md5="965765540c1531370e5856ff81696107"; + $file=__DIR__."/file/developpement-widget.pdf"; + // step 1 : we create the large object + $binary_data= file_get_contents($file); + $this->assertEquals($md5,md5($binary_data)," error when reading $file "); + $oid = $this->object->lo_write($binary_data); + $this->assertTrue ($oid != false , "writing in DB fails"); + // step 2 = read object + $retrieve = $this->object->lo_read($oid); + $this->assertEquals($md5,md5($retrieve)," error when retrieving file from db"); + + $target=$file."retrieve.pdf"; + if ( file_exists($target) ) { unlink($target);} + + file_put_contents($target, $retrieve); + $this->assertTrue(file_exists($target)); + + if ( file_exists($target) ) { unlink($target);} + $this->assertTrue( $this->object->lo_unlink($oid)," cannot unlink it"); + + + } + /** + * @brief import export large objects + * @testDox import and export large object + * + */ + public function testImport_export_large_object() + { + $md5="965765540c1531370e5856ff81696107"; + $file=__DIR__."/file/developpement-widget.pdf"; + $this->object->start(); + $oid = $this->object->lo_import($file); + $this->object->commit(); + $this->assertTrue( $oid != false , "import of the file fails"); + $target=$file."-tmp"; + if ( file_exists($target) ) { unlink($target);} + $this->object->start(); + $this->object->lo_export($oid , $file."-tmp"); + $this->object->commit(); + $this->assertTrue(file_exists($file."-tmp")," file not exported"); + if ( file_exists($target) ) { unlink($target);} + $this->assertTrue( $this->object->lo_unlink($oid)," cannot unlink it"); + } + + public function testReplace() { + $string=<<object->start(); + $oid=$this->object->lo_write($string); + $this->object->commit(); + + $this->object->start(); + $stringDB = $this->object->lo_read($oid); + $this->object->commit(); + + $this->assertEquals(md5($string),md5($stringDB)," error string from DB corrupted"); + + $string = "second"; + $this->object->start(); + $this->object->lo_replace($string,$oid); + $this->object->commit(); + + $this->object->start(); + $stringDB = $this->object->lo_read($oid); + var_dump($stringDB); + $this->object->commit(); + + $this->assertEquals(md5($string),md5($stringDB)," after lo_replace(), string from DB corrupted"); + } + } \ No newline at end of file diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 3d1a40890..a78ff4100 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -9,8 +9,5 @@ return array( '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', - '383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php', '662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php', - '3569eecfeed3bcf0bad3c998a494ecb8' => $vendorDir . '/sabre/xml/lib/Deserializer/functions.php', - '93aa591bc4ca510c520999e34229ee79' => $vendorDir . '/sabre/xml/lib/Serializer/functions.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index dd4792858..5f357af1a 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -20,12 +20,8 @@ return array( 'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'), 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), - 'Sabre\\Xml\\' => array($vendorDir . '/sabre/xml/lib'), - 'Sabre\\Uri\\' => array($vendorDir . '/sabre/uri/lib'), 'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'), 'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'), - 'NumNum\\UBL\\Tests\\' => array($vendorDir . '/num-num/ubl-invoice/tests'), - 'NumNum\\UBL\\' => array($vendorDir . '/num-num/ubl-invoice/src'), 'Metadata\\' => array($vendorDir . '/jms/metadata/src'), 'JMS\\Serializer\\' => array($vendorDir . '/jms/serializer/src'), 'GoetasWebservices\\Xsd\\XsdToPhpRuntime\\' => array($vendorDir . '/goetas-webservices/xsd2php-runtime/src'), @@ -35,4 +31,5 @@ return array( 'DASPRiD\\Enum\\' => array($vendorDir . '/dasprid/enum/src'), 'Curl\\' => array($vendorDir . '/php-curl-class/php-curl-class/src/Curl'), 'BaconQrCode\\' => array($vendorDir . '/bacon/bacon-qr-code/src'), + 'Atgp\\FacturX\\' => array($vendorDir . '/atgp/factur-x/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 6d5170bf7..670f6fae3 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -10,10 +10,7 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - '383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php', '662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php', - '3569eecfeed3bcf0bad3c998a494ecb8' => __DIR__ . '/..' . '/sabre/xml/lib/Deserializer/functions.php', - '93aa591bc4ca510c520999e34229ee79' => __DIR__ . '/..' . '/sabre/xml/lib/Serializer/functions.php', ); public static $prefixLengthsPsr4 = array ( @@ -42,19 +39,12 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad 'Symfony\\Component\\Validator\\' => 28, 'Symfony\\Component\\Process\\' => 26, 'Symfony\\Component\\Finder\\' => 25, - 'Sabre\\Xml\\' => 10, - 'Sabre\\Uri\\' => 10, ), 'P' => array ( 'ParagonIE\\ConstantTime\\' => 23, 'PHPStan\\PhpDocParser\\' => 21, ), - 'N' => - array ( - 'NumNum\\UBL\\Tests\\' => 17, - 'NumNum\\UBL\\' => 11, - ), 'M' => array ( 'Metadata\\' => 9, @@ -85,6 +75,10 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad array ( 'BaconQrCode\\' => 12, ), + 'A' => + array ( + 'Atgp\\FacturX\\' => 13, + ), ); public static $prefixDirsPsr4 = array ( @@ -144,14 +138,6 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad array ( 0 => __DIR__ . '/..' . '/symfony/finder', ), - 'Sabre\\Xml\\' => - array ( - 0 => __DIR__ . '/..' . '/sabre/xml/lib', - ), - 'Sabre\\Uri\\' => - array ( - 0 => __DIR__ . '/..' . '/sabre/uri/lib', - ), 'ParagonIE\\ConstantTime\\' => array ( 0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src', @@ -160,14 +146,6 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad array ( 0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src', ), - 'NumNum\\UBL\\Tests\\' => - array ( - 0 => __DIR__ . '/..' . '/num-num/ubl-invoice/tests', - ), - 'NumNum\\UBL\\' => - array ( - 0 => __DIR__ . '/..' . '/num-num/ubl-invoice/src', - ), 'Metadata\\' => array ( 0 => __DIR__ . '/..' . '/jms/metadata/src', @@ -204,6 +182,10 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad array ( 0 => __DIR__ . '/..' . '/bacon/bacon-qr-code/src', ), + 'Atgp\\FacturX\\' => + array ( + 0 => __DIR__ . '/..' . '/atgp/factur-x/src', + ), ); public static $prefixesPsr0 = array ( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index eef81dec9..b7ef27d7c 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,5 +1,68 @@ { "packages": [ + { + "name": "atgp/factur-x", + "version": "v2.4.0", + "version_normalized": "2.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/atgp/factur-x.git", + "reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/atgp/factur-x/zipball/0edbe1e935c3f81dcf3e306b2ce5876bf715bea1", + "reference": "0edbe1e935c3f81dcf3e306b2ce5876bf715bea1", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-libxml": "*", + "ext-simplexml": "*", + "ext-zlib": "*", + "php": ">=7.4", + "setasign/fpdf": "^1.8", + "setasign/fpdi": "^2.0", + "smalot/pdfparser": "^0.19.0|~1.0|~2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~3.1", + "phpstan/phpstan": "^2.0" + }, + "time": "2025-09-24T13:02:08+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Atgp\\FacturX\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "@GP", + "homepage": "https://www.atgp.net/" + } + ], + "description": "PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files", + "keywords": [ + "ZUGFeRD", + "factur-x", + "invoice", + "pdf", + "php", + "xml" + ], + "support": { + "issues": "https://github.com/atgp/factur-x/issues", + "source": "https://github.com/atgp/factur-x/tree/v2.4.0" + }, + "install-path": "../atgp/factur-x" + }, { "name": "bacon/bacon-qr-code", "version": "v3.0.1", @@ -920,81 +983,6 @@ ], "install-path": "../jms/serializer" }, - { - "name": "num-num/ubl-invoice", - "version": "v1.21.2", - "version_normalized": "1.21.2.0", - "source": { - "type": "git", - "url": "https://github.com/num-num/ubl-invoice.git", - "reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/num-num/ubl-invoice/zipball/195712b3071e23c5aaa6fe95cb9e2de55c3d1348", - "reference": "195712b3071e23c5aaa6fe95cb9e2de55c3d1348", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8.0", - "sabre/xml": "^4.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.0", - "squizlabs/php_codesniffer": "^3.7" - }, - "time": "2025-07-01T11:58:25+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "NumNum\\UBL\\": [ - "src" - ], - "NumNum\\UBL\\Tests\\": [ - "tests" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bert Devriese", - "email": "bert@numnum.be", - "homepage": "https://www.numnum.be", - "role": "Developer" - } - ], - "description": "A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files", - "homepage": "https://github.com/num-num/ubl-invoice", - "keywords": [ - "E-Invoice", - "digital invoice", - "efff", - "einvoice", - "electronic invoice", - "euinvoice", - "invoice", - "peppol", - "peppol bis", - "peppol invoice", - "peppolbis", - "ubl", - "ubl invoice", - "ublinvoice", - "xml", - "xml invoice" - ], - "support": { - "issues": "https://github.com/num-num/ubl-invoice/issues", - "source": "https://github.com/num-num/ubl-invoice/tree/v1.21.2" - }, - "install-path": "../num-num/ubl-invoice" - }, { "name": "paragonie/constant_time_encoding", "version": "v3.0.0", @@ -1198,141 +1186,6 @@ }, "install-path": "../phpstan/phpdoc-parser" }, - { - "name": "sabre/uri", - "version": "3.0.2", - "version_normalized": "3.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/sabre-io/uri.git", - "reference": "38eeab6ed9eec435a2188db489d4649c56272c51" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabre-io/uri/zipball/38eeab6ed9eec435a2188db489d4649c56272c51", - "reference": "38eeab6ed9eec435a2188db489d4649c56272c51", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.64", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^1.12", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "^9.6" - }, - "time": "2024-09-04T15:30:08+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "lib/functions.php" - ], - "psr-4": { - "Sabre\\Uri\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - } - ], - "description": "Functions for making sense out of URIs.", - "homepage": "http://sabre.io/uri/", - "keywords": [ - "rfc3986", - "uri", - "url" - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "issues": "https://github.com/sabre-io/uri/issues", - "source": "https://github.com/fruux/sabre-uri" - }, - "install-path": "../sabre/uri" - }, - { - "name": "sabre/xml", - "version": "4.0.6", - "version_normalized": "4.0.6.0", - "source": { - "type": "git", - "url": "https://github.com/sabre-io/xml.git", - "reference": "a89257fd188ce30e456b841b6915f27905dfdbe3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabre-io/xml/zipball/a89257fd188ce30e456b841b6915f27905dfdbe3", - "reference": "a89257fd188ce30e456b841b6915f27905dfdbe3", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "lib-libxml": ">=2.6.20", - "php": "^7.4 || ^8.0", - "sabre/uri": ">=2.0,<4.0.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.64", - "phpstan/phpstan": "^1.12", - "phpunit/phpunit": "^9.6" - }, - "time": "2024-09-06T08:00:55+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "lib/Deserializer/functions.php", - "lib/Serializer/functions.php" - ], - "psr-4": { - "Sabre\\Xml\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - }, - { - "name": "Markus Staab", - "email": "markus.staab@redaxo.de", - "role": "Developer" - } - ], - "description": "sabre/xml is an XML library that you may not hate.", - "homepage": "https://sabre.io/xml/", - "keywords": [ - "XMLReader", - "XMLWriter", - "dom", - "xml" - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "issues": "https://github.com/sabre-io/xml/issues", - "source": "https://github.com/fruux/sabre-xml" - }, - "install-path": "../sabre/xml" - }, { "name": "setasign/fpdf", "version": "1.8.6", @@ -1459,17 +1312,17 @@ }, { "name": "smalot/pdfparser", - "version": "v2.12.0", - "version_normalized": "2.12.0.0", + "version": "v2.12.1", + "version_normalized": "2.12.1.0", "source": { "type": "git", "url": "https://github.com/smalot/pdfparser.git", - "reference": "8440edbf58c8596074e78ada38dcb0bd041a5948" + "reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smalot/pdfparser/zipball/8440edbf58c8596074e78ada38dcb0bd041a5948", - "reference": "8440edbf58c8596074e78ada38dcb0bd041a5948", + "url": "https://api.github.com/repos/smalot/pdfparser/zipball/98d31ba34ef5b5a98897ef4b6c3925d502ea53b1", + "reference": "98d31ba34ef5b5a98897ef4b6c3925d502ea53b1", "shasum": "" }, "require": { @@ -1478,7 +1331,7 @@ "php": ">=7.1", "symfony/polyfill-mbstring": "^1.18" }, - "time": "2025-03-31T13:16:09+00:00", + "time": "2025-07-31T06:19:56+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1507,7 +1360,7 @@ ], "support": { "issues": "https://github.com/smalot/pdfparser/issues", - "source": "https://github.com/smalot/pdfparser/tree/v2.12.0" + "source": "https://github.com/smalot/pdfparser/tree/v2.12.1" }, "install-path": "../smalot/pdfparser" }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 260aa5258..e17da84d7 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '9584a3090ab8e976441fa6e8ab7798db0a361830', + 'reference' => '86019118eddd8ca179d77922326c82bf3507b3cf', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,12 +13,21 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '9584a3090ab8e976441fa6e8ab7798db0a361830', + 'reference' => '86019118eddd8ca179d77922326c82bf3507b3cf', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), + 'atgp/factur-x' => array( + 'pretty_version' => 'v2.4.0', + 'version' => '2.4.0.0', + 'reference' => '0edbe1e935c3f81dcf3e306b2ce5876bf715bea1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../atgp/factur-x', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'bacon/bacon-qr-code' => array( 'pretty_version' => 'v3.0.1', 'version' => '3.0.1.0', @@ -136,15 +145,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'num-num/ubl-invoice' => array( - 'pretty_version' => 'v1.21.2', - 'version' => '1.21.2.0', - 'reference' => '195712b3071e23c5aaa6fe95cb9e2de55c3d1348', - 'type' => 'library', - 'install_path' => __DIR__ . '/../num-num/ubl-invoice', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'paragonie/constant_time_encoding' => array( 'pretty_version' => 'v3.0.0', 'version' => '3.0.0.0', @@ -172,24 +172,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'sabre/uri' => array( - 'pretty_version' => '3.0.2', - 'version' => '3.0.2.0', - 'reference' => '38eeab6ed9eec435a2188db489d4649c56272c51', - 'type' => 'library', - 'install_path' => __DIR__ . '/../sabre/uri', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'sabre/xml' => array( - 'pretty_version' => '4.0.6', - 'version' => '4.0.6.0', - 'reference' => 'a89257fd188ce30e456b841b6915f27905dfdbe3', - 'type' => 'library', - 'install_path' => __DIR__ . '/../sabre/xml', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'setasign/fpdf' => array( 'pretty_version' => '1.8.6', 'version' => '1.8.6.0', @@ -209,9 +191,9 @@ 'dev_requirement' => false, ), 'smalot/pdfparser' => array( - 'pretty_version' => 'v2.12.0', - 'version' => '2.12.0.0', - 'reference' => '8440edbf58c8596074e78ada38dcb0bd041a5948', + 'pretty_version' => 'v2.12.1', + 'version' => '2.12.1.0', + 'reference' => '98d31ba34ef5b5a98897ef4b6c3925d502ea53b1', 'type' => 'library', 'install_path' => __DIR__ . '/../smalot/pdfparser', 'aliases' => array(), diff --git a/vendor/num-num/ubl-invoice/.editorconfig b/vendor/num-num/ubl-invoice/.editorconfig deleted file mode 100644 index cd8eb86ef..000000000 --- a/vendor/num-num/ubl-invoice/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -; This file is for unifying the coding style for different editors and IDEs. -; More information at http://editorconfig.org - -root = true - -[*] -charset = utf-8 -indent_size = 4 -indent_style = space -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -trim_trailing_whitespace = false diff --git a/vendor/num-num/ubl-invoice/.gitignore b/vendor/num-num/ubl-invoice/.gitignore deleted file mode 100644 index 826964e0e..000000000 --- a/vendor/num-num/ubl-invoice/.gitignore +++ /dev/null @@ -1,83 +0,0 @@ -## Composer -.idea -composer.phar -/vendor/ - - -## Linux -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - - -## macOS -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - - -## Windows -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# Generated XML files from tests -/tests/*.xml - -# Test cache -.phpunit.result.cache - -# Editors -.vscode/ diff --git a/vendor/num-num/ubl-invoice/CHANGELOG.md b/vendor/num-num/ubl-invoice/CHANGELOG.md deleted file mode 100644 index 10a3731f2..000000000 --- a/vendor/num-num/ubl-invoice/CHANGELOG.md +++ /dev/null @@ -1,261 +0,0 @@ -# Changelog for v1.21.2 - -#### Bug fixes - -- in AllowanceCharge should not crash when the system uses localized number output -- documentTypeCode in AdditionalDocumentReference should not be limited to int values - Thanks [@tgeorgel](https://github.com/tgeorgel) - -# Changelog for v1.21.1 - -#### Bug fixes - -- should not be rounded to zero decimals - -# Changelog for v1.21.0 - -### New features & improvements - -- Add missing ICD Code list. See also https://docs.peppol.eu/poacc/billing/3.0/codelist/ICD/ -- Make optional - Thanks [@chipco](https://github.com/chipco) -- Add to - Thanks [@tgeorgel](https://github.com/tgeorgel) -- Add to - Thanks [@tgeorgel](https://github.com/tgeorgel) -- Allow both and to be present in - Thanks [@tgeorgel](https://github.com/tgeorgel) - -# Changelog for v1.20.0 - -### New features & improvements - -- General change: don't round numbers to two decimals, always use the amount of provided decimals - -# Changelog for v1.19.1 - -### New features & improvements - -- Add `` to `` - Thanks [@ronaldsgailis](https://github.com/ronaldsgailis) - -# Changelog for v1.19.0 - -### New features & improvements - -- Add `` to `` -- -# Changelog for v1.18.2 - -### New features & improvements - -- Add `` to `` - -#### Bug fixes - -- Fix Amount, BaseAmount, TaxCategory tag sort in `` -- Fix parameter type for `` on `` to array - -# Changelog for v1.18.1 - -#### Bug fixes - -- Fix Creditnote `` validation issues, this tag should be optional - -# Changelog for 1.18.0 - -### New features & improvements - -- Support for `` `` --> `cbc:IDPeppol` Scheme identifier - Thanks [@dragonfly4](https://github.com/dragonfly4) -- Support to add `` content without having to use an external file ref but by adding it as a fileStream/fileContents - Thanks [@dietercoopman](https://github.com/dietercoopman), [@bagulho](https://github.com/bagulho) -- Add `` to `` - Thanks [@vsadrn](https://github.com/vsadrn) -- Improved `UNCL4461` support for `` - Thanks [@TSimkus](https://github.com/TSimkus), [@TecsiAron](https://github.com/TecsiAron) -- Add `` support for `` - Thanks [@TSimkus](https://github.com/TSimkus) -- Add `` to `` - Thanks [@TSimkus](https://github.com/TSimkus) -- Add support for `` in Creditnotes - Thanks [@UlusoftConsultancy](https://github.com/UlusoftConsultancy) -- Add `` to `` - Thanks [@Quazz](https://github.com/Quazz) -- Add support for TaxExemptionReason and TaxExemptionReasonCode to `` - Thanks [@bagulho](https://github.com/bagulho) - -### Breaking changes - -- Add support to include multiple `PaymentMeans` - Thanks [@Quazz](https://github.com/Quazz) - -#### Bug fixes - -- Fix `InvoiceTypeCode` documentation dead link - Thanks [@TSimkus](https://github.com/TSimkus) -- Changed `` type from `int` to `float` - Thanks [@TSimkus](https://github.com/TSimkus) - -# Changelog for version 1.17.0 - -### New features & improvements - -- Add list of `VatExemptionCode` options - -# Changelog for version 1.16.0 - -### New features & improvements - -- Add `` to `` -- Add `` to `` - -# Changelog for version 1.15.5 - -### New features & improvements - -- Don't output an InvoiceLine `` when no `` was set -- Don't output `` under InvoiceLine unless explicitely set - -# Changelog for version v1.15.4 - -### New features & improvements - -- Added UNCL5305 codes to be used in various implementations -- Improved default result for UNCL5305 code in `TaxCategory->getId()` if `TaxCategory->setId()` was not used - -# Changelog for version v1.15.3 - -### New features & improvements - -- Added more EAS codes to be used in various implementations - -# Changelog for version v1.15.2 - -### New features & improvements - -- Added `EASCode` list with additional EAS codes to be used in various implementations - -# Changelog for version v1.15.1 - -### New features & improvements - -- Add `PrepaidAmount` to `LegalMonetaryTotal` -- Add `IssueDate` to `OrderReference` -- Add `ICDCode` list to be used in various other places -- Fixed LegalMonetaryTotal which contained a syntax error - -# Changelog for version v1.15 - -### New features & improvements - -- Added the possibility to use `AdditionalDocumentReference` without `Attachment` - Thanks [@pjcarly](https://github.com/pjcarly) -- Added `DocumentTypeCode` on `AdditionalDocumentReference` -- Added setter/getter `InvoicePeriod` `DescriptionCode` (VAT date code UNCL2005 subset) - Thanks [@markovic131](https://github.com/markovic131) -- Added `PartyIdentificationSchemeName` to `Party` - Thanks [@tgeorgel](https://github.com/tgeorgel) -- Added deprecation warning for setAdditionalDocumentReference -- Fixed `ContractDocumentReference` XML position - Thanks [@markovic131](https://github.com/markovic131) -- Fixed `Name` position in `TaxScheme` - Thanks [@tgeorgel](https://github.com/tgeorgel) -- Fixed `InvoicePeriod`, `OrderReference`, `ContractDocumentReference` sorting -- Fixed DocumentType which is not a CommonAggregateComponent - Thanks [@christopheg](https://github.com/christopheg) - -# Changelog for version 1.14 - -### New features & improvements - -- Add support for the `CreditNote` root tag and `CreditNoteLine` tags - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Added `DocumentDescription` in `AdditionalDocumentReference` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Added `ExternalReference` (`URI`) as an alternative for an `EmbeddedDocumentBinaryObject` in `Attachment` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Fixed the appearing order of `Name` and `Percent` in `ClassifiedTaxCategory` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Added `ProfileID` to `Invoice` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Added support for multiple `AdditionalDocumentReference` children to `Invoice` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Made `Description` optional in `Item` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Added `EndpointID` to `Party` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Made `PartyName` optional in `Party` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) -- Added PHP 8 support in `composer.json` - Thanks [@antal-levente](https://github.com/antal-levente) -- Added `Address->CountrySubentity()` - Thanks [@antal-levente](https://github.com/antal-levente) -- Fixed `xmlSerialize()` compatibility warnings - Thanks [@antal-levente](https://github.com/antal-levente) -- Fixed number_format null values warning - Thanks [@antal-levente](https://github.com/antal-levente) -- Add support for `cac:PartyIdentification` `schemeId` attribute -- Add support for `cac:AllowanceCharge` in `Price` tag - -### Breaking changes - -- Changed `InvoiceLine`'s default `UnitCode` from `'MON'` to `UnitCode::UNIT` (in order to match `Price`'s default UnitCode) - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) - -### Breaking changes - -- Changed `InvoiceLine`'s default `UnitCode` from `'MON'` to `UnitCode::UNIT` (in order to match `Price`'s default UnitCode) - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet) - -# Changelog for version 1.13 - -### New features & improvements - -- Add `` child node for `` - -# Changelog for version 1.12 - -### New features & improvements - -- PHP8 Support — Thanks [@ChristianVermeulen](https://github.com/ChristianVermeulen) - -# Changelog for version 1.11 - -### New features & improvements - -- Added new ContractDocumentReference class & tag `` to Invoice — Thanks [@mabjavaid](https://github.com/mabjavaid) -- Remove duplicate validation for `id` on invoice — Thanks [@mabjavaid](https://github.com/mabjavaid) -- Added new cac:PartyIdentification tag to cac:Party - -# Changelog for version 1.10.2 - -### New features & improvements - -- Added AdditionalStreetName in Address.php — Thanks [@jbputit](https://github.com/jbputit) - -# Changelog for version 1.10.1 - -### New features & improvements - -- Added year, month and piece as additional units in UnitCode.php — Thanks [@jbputit](https://github.com/jbputit) -- Added possibility to set InvoicePeriod in InvoiceLine — Thanks [@jbputit](https://github.com/jbputit) - -# Changelog for version 1.10 - -### New features & improvements - -- Added new OrderReferen class & tag `` to Invoice — Thanks [@jbputit](https://github.com/jbputit) - -# Changelog for version 1.9.6 - -### New features & improvements - -- Support for `` in `` — Thanks [@eborned](https://github.com/eborned) - -# Changelog for version 1.9.5 - -### New features & improvements - -- Add `` child node for `` — Thanks [@eborned](https://github.com/eborned) - -# Changelog for version 1.9.4 - -### New features & improvements - -- Bugfix: Fix order of `` node in `` - -# Changelog for version 1.9.3 - -### New features & improvements - -- Bugfix: Use correct number formatting when `` in `` contains a float value -- Bugfix: Use correct number formatting when `` in `` contains a float value -- Bugfix: Use correct number formatting when `` in `` contains a float value - -# Changelog for version 1.9.2 - -### New features & improvements - -- Add `` to `` for non structured payment instructions - -# Changelog for version 1.9.1 - -### New features & improvements - -- Bugfix in ``, set correct order for child nodes `` & `` — Thanks [@stedekay](https://github.com/stedekay) - -# Changelog for version 1.9 - -### New features & improvements - -- Added return type declarations in every class -- Added `PartyTaxScheme` -- Added `Party->setPartyTaxScheme()` - -### Breaking changes - -- `Party->setTaxCompanyName(string)` has been removed since `PartyTaxScheme` has been added -- `Party->setTaxCompanyId(string)` has been removed since `PartyTaxScheme` has been added -- `Party->setTaxScheme(string)` has been removed since `PartyTaxScheme` has been added diff --git a/vendor/num-num/ubl-invoice/CONTRIBUTING.md b/vendor/num-num/ubl-invoice/CONTRIBUTING.md deleted file mode 100644 index 386157063..000000000 --- a/vendor/num-num/ubl-invoice/CONTRIBUTING.md +++ /dev/null @@ -1,60 +0,0 @@ -# Contributing to ubl-invoice - -Are you missing a feature and would you like to add it to the library? Great! Any contributions to this library are welcome. We try to be responsive and release new, non-breaking features as fast as possible. - -## Reporting issues - -This package uses the [GitHub issue tracker](https://github.com/num-num/ubl-invoice/issues) to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. - -## Contributing code - -If you want to add additional tags, attributes or functionality to the library, please feel free to create a [pull request](https://github.com/num-num/ubl-invoice/pulls) with your changes. - -Please try to follow this workflow: - -- Fork the project -- Create a new branch forked from the master branch with a title for your feature (e.g. feature-that-i-want) -- Commit all your code into this branch until you are happy with your contribution -- Document your changes in the **changelog/next-release.md** file ⚠️ -- If possible; try to add unit tests for your contribution -- Create a pull request with your commits - -## Formatting ⚠️ - -Please try to follow [PSR-12](https://www.php-fig.org/psr/psr-12/) rules when writing code. A PSR-12 compliant [phpcs.xml](phpcs.xml) is provided, so if your editor supports [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), your editor should automatically warn you if you are deviating from PSR-12 compliant formatting. - -You can also check code style manually by running `composer phpcs` in the projects' root folder on your disk. - -```zsh -$ cd ubl-invoice -$ composer phpcs -``` - -The project also has PHPStan integrated for code checking, which can be triggered with: - -```zsh -$ cd ubl-invoice -$ composer phpstan -``` - -## Unit testing ⚠️ - -### A note on unit testing - -Although unit testing is included, this repository does not provide exhaustive unit testing for *all* possibilities the library offers. This is definitely a long-term goal. So please try to add unit tests for new functionality that you add. - -### Running the unit tests - -To run the complete suite of unit tests - -```zsh -$ cd ubl-invoice -$ composer test -``` - -To run a single unit test - -```zsh -$ cd ubl-invoice -$ composer test tests/SimpleInvoiceTest.php -``` diff --git a/vendor/num-num/ubl-invoice/LICENSE b/vendor/num-num/ubl-invoice/LICENSE deleted file mode 100644 index 1b2b043d4..000000000 --- a/vendor/num-num/ubl-invoice/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2018 Num•Num - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/num-num/ubl-invoice/README.md b/vendor/num-num/ubl-invoice/README.md deleted file mode 100644 index 180bfd561..000000000 --- a/vendor/num-num/ubl-invoice/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# UBL-Invoice - -A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files. Please feel free to [contribute](https://github.com/num-num/ubl-invoice/pulls) if you are missing features or tags. - -[![Latest Version on Packagist](https://img.shields.io/packagist/v/num-num/ubl-invoice.svg?style=rounded-square)](https://packagist.org/packages/num-num/ubl-invoice) -[![Total Downloads](https://img.shields.io/packagist/dt/num-num/ubl-invoice.svg?style=rounded-square)](https://packagist.org/packages/num-num/ubl-invoice) - -![Num•Num UBL Invoice](https://i.imgur.com/JPyFBYQ.png) - -## Installation and usage - -This package requires PHP 7.4 or higher and is fully compatible with PHP8. Installation can be done through [composer](https://www.getcomposer.org). - -```zsh -$ composer require num-num/ubl-invoice -``` - -## Contributing - -This library is not 100% UBL/Peppol feature-complete, in the sense that it doesn't (yet) support **all** UBL XML tags & functionality. "Yet" being the keyword, since this definitely is the long-term goal. All common UBL tags that are required for most invoices are present in the library. This includes tags for discounts, cash discounts, special vat rates, etc... - -If you are missing functionality, please feel free to add it :-) Adding additional tags & attributes is fairly straight-forward. Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more information. - -## Examples & documentation - -This repository does not have a documentation website at this moment. For now, please check out some code examples by checking the unit tests in the `tests` folder. - -## Changelog - -A changelog is available since version v1.9.0. If you are upgrading a minor version (1.x) or major version, please check the changelog to see if you need to implement any breaking changes... - diff --git a/vendor/num-num/ubl-invoice/composer.json b/vendor/num-num/ubl-invoice/composer.json deleted file mode 100644 index c16e02a39..000000000 --- a/vendor/num-num/ubl-invoice/composer.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "num-num/ubl-invoice", - "description": "A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files", - "keywords": [ - "ubl", - "invoice", - "ublinvoice", - "ubl invoice", - "efff", - "electronic invoice", - "digital invoice", - "xml", - "xml invoice", - "peppol", - "peppol bis", - "peppolbis", - "peppol invoice", - "e-invoice", - "einvoice", - "euinvoice" - ], - "homepage": "https://github.com/num-num/ubl-invoice", - "license": "MIT", - "authors": [ - { - "name": "Bert Devriese", - "email": "bert@numnum.be", - "homepage": "https://www.numnum.be", - "role": "Developer" - } - ], - "require": { - "php": "^7.3 || ^8.0", - "sabre/xml": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0", - "squizlabs/php_codesniffer": "^3.7", - "phpstan/phpstan": "^1.10" - }, - "autoload": { - "psr-4": { - "NumNum\\UBL\\": [ - "src" - ], - "NumNum\\UBL\\Tests\\": [ - "tests" - ] - } - }, - "scripts": { - "test": "vendor/bin/phpunit", - "phpstan": "vendor/bin/phpstan analyse src tests", - "phpcs": "vendor/bin/phpcs -n --standard=phpcs.xml ./src/" - } -} diff --git a/vendor/num-num/ubl-invoice/composer.lock b/vendor/num-num/ubl-invoice/composer.lock deleted file mode 100644 index e563269d2..000000000 --- a/vendor/num-num/ubl-invoice/composer.lock +++ /dev/null @@ -1,1996 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "9a76d358dfc6a0141ffb13da57eac13d", - "packages": [ - { - "name": "sabre/uri", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sabre-io/uri.git", - "reference": "0ab547f34cf15a735e976a285ffc0cfcc27a3f82" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabre-io/uri/zipball/0ab547f34cf15a735e976a285ffc0cfcc27a3f82", - "reference": "0ab547f34cf15a735e976a285ffc0cfcc27a3f82", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.9", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "autoload": { - "files": [ - "lib/functions.php" - ], - "psr-4": { - "Sabre\\Uri\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - } - ], - "description": "Functions for making sense out of URIs.", - "homepage": "http://sabre.io/uri/", - "keywords": [ - "rfc3986", - "uri", - "url" - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "issues": "https://github.com/sabre-io/uri/issues", - "source": "https://github.com/fruux/sabre-uri" - }, - "time": "2022-09-26T06:12:15+00:00" - }, - { - "name": "sabre/xml", - "version": "4.0.0", - "source": { - "type": "git", - "url": "https://github.com/sabre-io/xml.git", - "reference": "5051b30416b60f52395007c7069acbd010edd2a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabre-io/xml/zipball/5051b30416b60f52395007c7069acbd010edd2a7", - "reference": "5051b30416b60f52395007c7069acbd010edd2a7", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "lib-libxml": ">=2.6.20", - "php": "^7.4 || ^8.0", - "sabre/uri": ">=2.0,<4.0.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.9", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "autoload": { - "files": [ - "lib/Deserializer/functions.php", - "lib/Serializer/functions.php" - ], - "psr-4": { - "Sabre\\Xml\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - }, - { - "name": "Markus Staab", - "email": "markus.staab@redaxo.de", - "role": "Developer" - } - ], - "description": "sabre/xml is an XML library that you may not hate.", - "homepage": "https://sabre.io/xml/", - "keywords": [ - "XMLReader", - "XMLWriter", - "dom", - "xml" - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "issues": "https://github.com/sabre-io/xml/issues", - "source": "https://github.com/fruux/sabre-xml" - }, - "time": "2022-09-26T08:40:11+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-03-03T08:28:38+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2022-03-03T13:19:32+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.15.2", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" - }, - "time": "2022-11-12T15:38:23+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" - }, - "time": "2021-07-20T11:28:43+00:00" - }, - { - "name": "phar-io/version", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "1.10.29", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", - "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", - "shasum": "" - }, - "require": { - "php": "^7.2|^8.0" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "keywords": [ - "dev", - "static analysis" - ], - "support": { - "docs": "https://phpstan.org/user-guide/getting-started", - "forum": "https://github.com/phpstan/phpstan/discussions", - "issues": "https://github.com/phpstan/phpstan/issues", - "security": "https://github.com/phpstan/phpstan/security/policy", - "source": "https://github.com/phpstan/phpstan-src" - }, - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://github.com/phpstan", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], - "time": "2023-08-14T13:24:11+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "9.2.19", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-11-18T07:47:47+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "3.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:48:52+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:58:55+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T05:33:50+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "5.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:16:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "9.5.26", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.3.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.5-dev" - } - }, - "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" - }, - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" - } - ], - "time": "2022-10-28T06:00:21+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:08:49+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:08:54+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:30:19+00:00" - }, - { - "name": "sebastian/comparator", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T12:41:17+00:00" - }, - { - "name": "sebastian/complexity", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T15:52:27+00:00" - }, - { - "name": "sebastian/diff", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:10:38+00:00" - }, - { - "name": "sebastian/environment", - "version": "5.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-04-03T09:37:03+00:00" - }, - { - "name": "sebastian/exporter", - "version": "4.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T06:03:37+00:00" - }, - { - "name": "sebastian/global-state", - "version": "5.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-02-14T08:28:10+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-28T06:42:11+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:12:34+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:14:26+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:17:30+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" - }, - { - "name": "sebastian/type", - "version": "3.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-12T14:47:03+00:00" - }, - { - "name": "sebastian/version", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:39:44+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.7.1", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, - "time": "2022-06-18T07:21:10+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2021-07-28T10:34:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^7.3 || ^8.0" - }, - "platform-dev": [], - "plugin-api-version": "2.3.0" -} diff --git a/vendor/num-num/ubl-invoice/phpcs.xml b/vendor/num-num/ubl-invoice/phpcs.xml deleted file mode 100644 index 312f27fc7..000000000 --- a/vendor/num-num/ubl-invoice/phpcs.xml +++ /dev/null @@ -1,350 +0,0 @@ - - - The PSR-12 coding standard. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - error - Method name "%s" must not be prefixed with an underscore to indicate visibility - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - - - - - - - - - - - - - - - 0 - - - 0 - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/num-num/ubl-invoice/phpunit.xml.dist b/vendor/num-num/ubl-invoice/phpunit.xml.dist deleted file mode 100644 index c04fd1fd9..000000000 --- a/vendor/num-num/ubl-invoice/phpunit.xml.dist +++ /dev/null @@ -1,13 +0,0 @@ - - - - - src/ - - - - - tests - - - diff --git a/vendor/num-num/ubl-invoice/src/AdditionalDocumentReference.php b/vendor/num-num/ubl-invoice/src/AdditionalDocumentReference.php deleted file mode 100644 index 5d2130204..000000000 --- a/vendor/num-num/ubl-invoice/src/AdditionalDocumentReference.php +++ /dev/null @@ -1,140 +0,0 @@ -id; - } - - /** - * @param string $id - * @return AdditionalDocumentReference - */ - public function setId(string $id): AdditionalDocumentReference - { - $this->id = $id; - return $this; - } - - /** - * @return string - */ - public function getDocumentType(): ?string - { - return $this->documentType; - } - - /** - * @param string $documentType - * @return AdditionalDocumentReference - */ - public function setDocumentType(string $documentType): AdditionalDocumentReference - { - $this->documentType = $documentType; - return $this; - } - - /** - * @return int|string|null - */ - public function getDocumentTypeCode() - { - return $this->documentTypeCode; - } - - /** - * @param int|string $documentTypeCode - * @return AdditionalDocumentReference - */ - public function setDocumentTypeCode($documentTypeCode): AdditionalDocumentReference - { - $this->documentTypeCode = $documentTypeCode; - return $this; - } - - /** - * @return string - */ - public function getDocumentDescription(): ?string - { - return $this->documentDescription; - } - - /** - * @param string $documentDescription - * @return AdditionalDocumentReference - */ - public function setDocumentDescription(string $documentDescription): AdditionalDocumentReference - { - $this->documentDescription = $documentDescription; - return $this; - } - - /** - * @return Attachment - */ - public function getAttachment(): ?Attachment - { - return $this->attachment; - } - - /** - * @param Attachment $attachment - * @return AdditionalDocumentReference - */ - public function setAttachment(Attachment $attachment): AdditionalDocumentReference - { - $this->attachment = $attachment; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $writer->write([ Schema::CBC . 'ID' => $this->id ]); - - if ($this->documentTypeCode !== null) { - $writer->write([ - Schema::CBC . 'DocumentTypeCode' => $this->documentTypeCode - ]); - } - - if ($this->documentType !== null) { - $writer->write([ - Schema::CBC . 'DocumentType' => $this->documentType - ]); - } - - if ($this->documentDescription !== null) { - $writer->write([ - Schema::CBC . 'DocumentDescription' => $this->documentDescription - ]); - } - - if ($this->attachment !== null) { - $writer->write([ - Schema::CAC . 'Attachment' => $this->attachment - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/Address.php b/vendor/num-num/ubl-invoice/src/Address.php deleted file mode 100644 index e355acb0b..000000000 --- a/vendor/num-num/ubl-invoice/src/Address.php +++ /dev/null @@ -1,189 +0,0 @@ -streetName; - } - - /** - * @param string $streetName - * @return Address - */ - public function setStreetName(?string $streetName): Address - { - $this->streetName = $streetName; - return $this; - } - - /** - * @return string - */ - public function getAdditionalStreetName(): ?string - { - return $this->additionalStreetName; - } - - /** - * @param string $additionalStreetName - * @return Address - */ - public function setAdditionalStreetName(?string $additionalStreetName): Address - { - $this->additionalStreetName = $additionalStreetName; - return $this; - } - - /** - /** - * @return string - */ - public function getBuildingNumber(): ?string - { - return $this->buildingNumber; - } - - /** - * @param string $buildingNumber - * @return Address - */ - public function setBuildingNumber(?string $buildingNumber): Address - { - $this->buildingNumber = $buildingNumber; - return $this; - } - - /** - * @return string - */ - public function getCityName(): ?string - { - return $this->cityName; - } - - /** - * @param string $cityName - * @return Address - */ - public function setCityName(?string $cityName): Address - { - $this->cityName = $cityName; - return $this; - } - - /** - * @return string - */ - public function getPostalZone(): ?string - { - return $this->postalZone; - } - - /** - * @param string $postalZone - * @return Address - */ - public function setPostalZone(?string $postalZone): Address - { - $this->postalZone = $postalZone; - return $this; - } - - /** - * @return string - */ - public function getCountrySubentity(): ?string - { - return $this->countrySubentity; - } - - /** - * @param string $subentity - * @return Address - */ - public function setCountrySubentity(string $countrySubentity): Address - { - $this->countrySubentity = $countrySubentity; - return $this; - } - - /** - * @return Country - */ - public function getCountry(): ?Country - { - return $this->country; - } - - /** - * @param Country $country - * @return Address - */ - public function setCountry(Country $country): Address - { - $this->country = $country; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->streetName !== null) { - $writer->write([ - Schema::CBC . 'StreetName' => $this->streetName - ]); - } - if ($this->additionalStreetName !== null) { - $writer->write([ - Schema::CBC . 'AdditionalStreetName' => $this->additionalStreetName - ]); - } - if ($this->buildingNumber !== null) { - $writer->write([ - Schema::CBC . 'BuildingNumber' => $this->buildingNumber - ]); - } - if ($this->cityName !== null) { - $writer->write([ - Schema::CBC . 'CityName' => $this->cityName, - ]); - } - if ($this->postalZone !== null) { - $writer->write([ - Schema::CBC . 'PostalZone' => $this->postalZone, - ]); - } - if ($this->countrySubentity !== null) { - $writer->write([ - Schema::CBC . 'CountrySubentity' => $this->countrySubentity, - ]); - } - if ($this->country !== null) { - $writer->write([ - Schema::CAC . 'Country' => $this->country, - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/AllowanceCharge.php b/vendor/num-num/ubl-invoice/src/AllowanceCharge.php deleted file mode 100644 index b5be94e34..000000000 --- a/vendor/num-num/ubl-invoice/src/AllowanceCharge.php +++ /dev/null @@ -1,227 +0,0 @@ -chargeIndicator; - } - - /** - * @param bool $chargeIndicator - * @return AllowanceCharge - */ - public function setChargeIndicator(bool $chargeIndicator): AllowanceCharge - { - $this->chargeIndicator = $chargeIndicator; - return $this; - } - - /** - * @return int - */ - public function getAllowanceChargeReasonCode(): ?int - { - return $this->allowanceChargeReasonCode; - } - - /** - * @param int $allowanceChargeReasonCode - * @return AllowanceCharge - */ - public function setAllowanceChargeReasonCode(?int $allowanceChargeReasonCode): AllowanceCharge - { - $this->allowanceChargeReasonCode = $allowanceChargeReasonCode; - return $this; - } - - /** - * @return string - */ - public function getAllowanceChargeReason(): ?string - { - return $this->allowanceChargeReason; - } - - /** - * @param string $allowanceChargeReason - * @return AllowanceCharge - */ - public function setAllowanceChargeReason(?string $allowanceChargeReason): AllowanceCharge - { - $this->allowanceChargeReason = $allowanceChargeReason; - return $this; - } - - /** - * @return float - */ - public function getMultiplierFactorNumeric(): ?float - { - return $this->multiplierFactorNumeric; - } - - /** - * @param float $multiplierFactorNumeric - * @return AllowanceCharge - */ - public function setMultiplierFactorNumeric(?float $multiplierFactorNumeric): AllowanceCharge - { - $this->multiplierFactorNumeric = $multiplierFactorNumeric; - return $this; - } - - /** - * @return float - */ - public function getBaseAmount(): ?float - { - return $this->baseAmount; - } - - /** - * @param float $baseAmount - * @return AllowanceCharge - */ - public function setBaseAmount(?float $baseAmount): AllowanceCharge - { - $this->baseAmount = $baseAmount; - return $this; - } - - /** - * @return float - */ - public function getAmount(): ?float - { - return $this->amount; - } - - /** - * @param float $amount - * @return AllowanceCharge - */ - public function setAmount(?float $amount): AllowanceCharge - { - $this->amount = $amount; - return $this; - } - - /** - * @return TaxCategory - */ - public function getTaxCategory(): ?TaxCategory - { - return $this->taxCategory; - } - - /** - * @param TaxCategory $taxCategory - * @return AllowanceCharge - */ - public function setTaxCategory(?TaxCategory $taxCategory): AllowanceCharge - { - $this->taxCategory = $taxCategory; - return $this; - } - - /** - * @return TaxCategory - */ - public function getTaxtotal(): ?TaxTotal - { - return $this->taxTotal; - } - - /** - * @param TaxTotal $taxTotal - * @return AllowanceCharge - */ - public function setTaxtotal(?TaxTotal $taxTotal): AllowanceCharge - { - $this->taxTotal = $taxTotal; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - Schema::CBC . 'ChargeIndicator' => $this->chargeIndicator ? 'true' : 'false', - ]); - - if ($this->allowanceChargeReasonCode !== null) { - $writer->write([ - Schema::CBC . 'AllowanceChargeReasonCode' => $this->allowanceChargeReasonCode - ]); - } - - if ($this->allowanceChargeReason !== null) { - $writer->write([ - Schema::CBC . 'AllowanceChargeReason' => $this->allowanceChargeReason - ]); - } - - if ($this->multiplierFactorNumeric !== null) { - $writer->write([ - Schema::CBC . 'MultiplierFactorNumeric' => NumberFormatter::format($this->baseAmount) - ]); - } - - $writer->write([ - [ - 'name' => Schema::CBC . 'Amount', - 'value' => NumberFormatter::format($this->amount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ], - ]); - - if ($this->baseAmount !== null) { - $writer->write([ - [ - 'name' => Schema::CBC . 'BaseAmount', - 'value' => NumberFormatter::format($this->baseAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ] - ]); - } - - if ($this->taxCategory !== null) { - $writer->write([ - Schema::CAC . 'TaxCategory' => $this->taxCategory - ]); - } - - if ($this->taxTotal !== null) { - $writer->write([ - Schema::CAC . 'TaxTotal' => $this->taxTotal - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/Attachment.php b/vendor/num-num/ubl-invoice/src/Attachment.php deleted file mode 100644 index 49724070c..000000000 --- a/vendor/num-num/ubl-invoice/src/Attachment.php +++ /dev/null @@ -1,180 +0,0 @@ -filePath)) !== false) { - return $mime_type; - } - - throw new Exception('Could not determine mime_type of '.$this->filePath); - } - - /** - * @return string - */ - public function getFilePath(): ?string - { - return $this->filePath; - } - - /** - * @param string $filePath - * @return Attachment - */ - public function setFilePath(string $filePath): Attachment - { - $this->filePath = $filePath; - return $this; - } - - /** - * @return string - */ - public function getExternalReference(): ?string - { - return $this->externalReference; - } - - /** - * @param string $externalReference - * @return Attachment - */ - public function setExternalReference(string $externalReference): Attachment - { - $this->externalReference = $externalReference; - return $this; - } - - public function getFileStream(): ?string - { - return $this->fileStream; - } - - /** - * @param string $fileStream Base64 encoded filestream - * @param string $fileName - * @return Attachment - */ - public function setFileStream(string $fileStream, string $fileName, ?string $mimeType): Attachment - { - $this->fileStream = $fileStream; - $this->fileName = $fileName; - $this->mimeType = $mimeType; - - return $this; - } - - /** - * @return string - */ - public function getFileName(): string - { - return $this->fileName; - } - - /** - * @param string $fileName - * @return Attachment - */ - public function setFileName(string $fileName): Attachment - { - $this->fileName = $fileName; - return $this; - } - - /** - * @return ?string - */ - public function getMimeType(): ?string - { - return $this->mimeType; - } - - /** - * @param ?string $mimeType - * @return Attachment - */ - public function setMimeType(?string $mimeType): Attachment - { - $this->mimeType = $mimeType; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->filePath === null && $this->externalReference === null && $this->fileStream === null) { - throw new InvalidArgumentException('Attachment must have a filePath, an externalReference, or a fileContent'); - } - - if ($this->fileStream !== null && $this->mimeType === null) { - throw new InvalidArgumentException('Using fileStream, you need to define a mimeType by also using setFileMimeType'); - } - - if ($this->filePath !== null && !file_exists($this->filePath)) { - throw new InvalidArgumentException('Attachment at filePath does not exist'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - if (!empty($this->filePath)) { - $fileContents = base64_encode(file_get_contents($this->filePath)); - $fileName = basename($this->filePath); - $mimeType = $this->getFilePathMimeType(); - } else { - $fileContents = $this->fileStream; - $fileName = $this->fileName; - $mimeType = $this->mimeType; - } - - $writer->write([ - 'name' => Schema::CBC . 'EmbeddedDocumentBinaryObject', - 'value' => $fileContents, - 'attributes' => [ - 'mimeCode' => $mimeType, - 'filename' => $fileName, - ] - ]); - - if ($this->externalReference) { - $writer->writeElement( - Schema::CAC . 'ExternalReference', - [ Schema::CBC . 'URI' => $this->externalReference ] - ); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/BillingReference.php b/vendor/num-num/ubl-invoice/src/BillingReference.php deleted file mode 100644 index 831282487..000000000 --- a/vendor/num-num/ubl-invoice/src/BillingReference.php +++ /dev/null @@ -1,57 +0,0 @@ -invoiceDocumentReference; - } - - /** - * - * @return BillingReference - */ - public function setInvoiceDocumentReference($invoiceDocumentReference): BillingReference - { - $this->invoiceDocumentReference = $invoiceDocumentReference; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->invoiceDocumentReference === null) { - throw new InvalidArgumentException('Missing billingreference invoicedocumentreference'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([Schema::CAC . 'InvoiceDocumentReference' => $this->invoiceDocumentReference]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/ClassifiedTaxCategory.php b/vendor/num-num/ubl-invoice/src/ClassifiedTaxCategory.php deleted file mode 100644 index af50bcd9d..000000000 --- a/vendor/num-num/ubl-invoice/src/ClassifiedTaxCategory.php +++ /dev/null @@ -1,239 +0,0 @@ -id)) { - return $this->id; - } - - if ($this->getPercent() !== null) { - return ($this->getPercent() > 0) - ? UNCL5305::STANDARD_RATE - : UNCL5305::ZERO_RATED_GOODS; - } - - return null; - } - - /** - * @param string $id - * @return ClassifiedTaxCategory - */ - public function setId(?string $id): ClassifiedTaxCategory - { - $this->id = $id; - return $this; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param string $name - * @return ClassifiedTaxCategory - */ - public function setName(?string $name): ClassifiedTaxCategory - { - $this->name = $name; - return $this; - } - - /** - * @return float - */ - public function getPercent(): ?float - { - return $this->percent; - } - - /** - * @param float $percent - * @return ClassifiedTaxCategory - */ - public function setPercent(?float $percent): ClassifiedTaxCategory - { - $this->percent = $percent; - return $this; - } - - /** - * @return TaxScheme - */ - public function getTaxScheme(): ?TaxScheme - { - return $this->taxScheme; - } - - /** - * @param TaxScheme $taxScheme - * @return ClassifiedTaxCategory - */ - public function setTaxScheme(?TaxScheme $taxScheme): ClassifiedTaxCategory - { - $this->taxScheme = $taxScheme; - return $this; - } - - /** - * @return string - */ - public function getSchemeID(): ?string - { - return $this->schemeID; - } - - /** - * @param string $id - * @return ClassifiedTaxCategory - */ - public function setSchemeID(?string $id): ClassifiedTaxCategory - { - $this->schemeID = $id; - return $this; - } - - /** - * @return string - */ - public function getSchemeName(): ?string - { - return $this->schemeName; - } - - /** - * @param string $name - * @return ClassifiedTaxCategory - */ - public function setSchemeName(?string $name): ClassifiedTaxCategory - { - $this->schemeName = $name; - return $this; - } - - /** - * @return string - */ - public function getTaxExemptionReason(): ?string - { - return $this->taxExemptionReason; - } - - /** - * @param string $taxExemptionReason - * @return ClassifiedTaxCategory - */ - public function setTaxExemptionReason(?string $taxExemptionReason): ClassifiedTaxCategory - { - $this->taxExemptionReason = $taxExemptionReason; - return $this; - } - - /** - * @return string - */ - public function getTaxExemptionReasonCode(): ?string - { - return $this->taxExemptionReasonCode; - } - - /** - * @param string $taxExemptionReasonCode - * @return ClassifiedTaxCategory - */ - public function setTaxExemptionReasonCode(?string $taxExemptionReasonCode): ClassifiedTaxCategory - { - $this->taxExemptionReasonCode = $taxExemptionReasonCode; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->getId() === null) { - throw new InvalidArgumentException('Missing taxcategory id'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $schemeAttributes = []; - if ($this->schemeID !== null) { - $schemeAttributes['schemeID'] = $this->schemeID; - } - if ($this->schemeName !== null) { - $schemeAttributes['schemeName'] = $this->schemeName; - } - - $writer->write([ - 'name' => Schema::CBC . 'ID', - 'value' => $this->getId(), - 'attributes' => $schemeAttributes - ]); - - if ($this->name !== null) { - $writer->write([ - Schema::CBC . 'Name' => $this->name, - ]); - } - - if ($this->percent !== null) { - $writer->write([ - Schema::CBC . 'Percent' => number_format($this->percent, 2, '.', ''), - ]); - } - - if ($this->taxExemptionReasonCode !== null) { - $writer->write([ - Schema::CBC . 'TaxExemptionReasonCode' => $this->taxExemptionReasonCode, - Schema::CBC . 'TaxExemptionReason' => $this->taxExemptionReason, - ]); - } - - if ($this->taxScheme !== null) { - $writer->write([Schema::CAC . 'TaxScheme' => $this->taxScheme]); - } else { - $writer->write([ - Schema::CAC . 'TaxScheme' => null, - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/CommodityClassification.php b/vendor/num-num/ubl-invoice/src/CommodityClassification.php deleted file mode 100644 index 37bcf7172..000000000 --- a/vendor/num-num/ubl-invoice/src/CommodityClassification.php +++ /dev/null @@ -1,90 +0,0 @@ -itemClassificationCode; - } - - /** - * @param string $itemClassificationCode - * @return CommodityClassification - */ - public function setItemClassificationCode(?string $itemClassificationCode): CommodityClassification - { - $this->itemClassificationCode = $itemClassificationCode; - return $this; - } - - /** - * @return ?string - */ - public function getItemClassificationListId(): ?string - { - return $this->itemClassificationListId; - } - - /** - * @param ?string $itemClassificationListId - * @return CommodityClassification - */ - public function setItemClassificationListId(?string $itemClassificationListId): CommodityClassification - { - $this->itemClassificationListId = $itemClassificationListId; - return $this; - } - - /** - * @return ?string - */ - public function getItemClassificationListVersionId(): ?string - { - return $this->itemClassificationListVersionId; - } - - /** - * @param ?string $itemClassificationListVersionId - * @return CommodityClassification - */ - public function setItemClassificationListVersionId(?string $itemClassificationListVersionId): CommodityClassification - { - $this->itemClassificationListVersionId = $itemClassificationListVersionId; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $attributes = [ - 'listID' => $this->itemClassificationListId ?? '', - ]; - - if (!empty($this->itemClassificationListVersionId)) { - $attributes['listVersionID'] = $this->itemClassificationListVersionId; - } - - $writer->write([ - 'name' => Schema::CBC . 'ItemClassificationCode', - 'value' => $this->itemClassificationCode ?? '', - 'attributes' => $attributes - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/Contact.php b/vendor/num-num/ubl-invoice/src/Contact.php deleted file mode 100644 index 69af6c898..000000000 --- a/vendor/num-num/ubl-invoice/src/Contact.php +++ /dev/null @@ -1,144 +0,0 @@ -id; - } - - /** - * @param string $id - * @return Contact - */ - public function setId(string $id): Contact - { - $this->id = $id; - return $this; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param mixed $name - * @return Contact - */ - public function setName($name): Contact - { - $this->name = $name; - return $this; - } - - /** - * @return mixed - */ - public function getTelephone(): ?string - { - return $this->telephone; - } - - /** - * @param string $telephone - * @return Contact - */ - public function setTelephone(?string $telephone): Contact - { - $this->telephone = $telephone; - return $this; - } - - /** - * @return string - */ - public function getTelefax(): ?string - { - return $this->telefax; - } - - /** - * @param string $telefax - * @return Contact - */ - public function setTelefax(?string $telefax): Contact - { - $this->telefax = $telefax; - return $this; - } - - /** - * @return string - */ - public function getElectronicMail(): ?string - { - return $this->electronicMail; - } - - /** - * @param string $electronicMail - * @return Contact - */ - public function setElectronicMail(?string $electronicMail): Contact - { - $this->electronicMail = $electronicMail; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->id !== null) { - $writer->write([ - Schema::CBC . 'ID' => $this->id - ]); - } - - if ($this->name !== null) { - $writer->write([ - Schema::CBC . 'Name' => $this->name - ]); - } - - if ($this->telephone !== null) { - $writer->write([ - Schema::CBC . 'Telephone' => $this->telephone - ]); - } - - if ($this->telefax !== null) { - $writer->write([ - Schema::CBC . 'Telefax' => $this->telefax - ]); - } - - if ($this->electronicMail !== null) { - $writer->write([ - Schema::CBC . 'ElectronicMail' => $this->electronicMail - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/ContractDocumentReference.php b/vendor/num-num/ubl-invoice/src/ContractDocumentReference.php deleted file mode 100644 index 5b25c0557..000000000 --- a/vendor/num-num/ubl-invoice/src/ContractDocumentReference.php +++ /dev/null @@ -1,42 +0,0 @@ -id; - } - - /** - * @param string $id - * @return ContractDocumentReference - */ - public function setId(string $id): ContractDocumentReference - { - $this->id = $id; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->id !== null) { - $writer->write([ Schema::CBC . 'ID' => $this->id ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/Country.php b/vendor/num-num/ubl-invoice/src/Country.php deleted file mode 100644 index be95722b5..000000000 --- a/vendor/num-num/ubl-invoice/src/Country.php +++ /dev/null @@ -1,69 +0,0 @@ -identificationCode; - } - - /** - * @param mixed $identificationCode - * @return Country - */ - public function setIdentificationCode(?string $identificationCode): Country - { - $this->identificationCode = $identificationCode; - return $this; - } - - /** - * @return mixed - */ - public function getListId(): ?string - { - return $this->listId; - } - - /** - * @param mixed $listId - * @return Country - */ - public function setListId(?string $listId): Country - { - $this->listId = $listId; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $attributes = []; - - if (!empty($this->listId)) { - $attributes['listID'] = 'ISO3166-1:Alpha2'; - } - - $writer->write([ - 'name' => Schema::CBC . 'IdentificationCode', - 'value' => $this->identificationCode, - 'attributes' => $attributes - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/CreditNote.php b/vendor/num-num/ubl-invoice/src/CreditNote.php deleted file mode 100644 index d0f871af8..000000000 --- a/vendor/num-num/ubl-invoice/src/CreditNote.php +++ /dev/null @@ -1,30 +0,0 @@ -invoiceLines; - } - - /** - * @param CreditNoteLine[] $creditNoteLines - * @return CreditNote - */ - public function setCreditNoteLines(array $creditNoteLines): CreditNote - { - $this->invoiceLines = $creditNoteLines; - return $this; - } -} diff --git a/vendor/num-num/ubl-invoice/src/CreditNoteLine.php b/vendor/num-num/ubl-invoice/src/CreditNoteLine.php deleted file mode 100644 index 42cda4fc9..000000000 --- a/vendor/num-num/ubl-invoice/src/CreditNoteLine.php +++ /dev/null @@ -1,27 +0,0 @@ -invoicedQuantity; - } - - /** - * @param ?float $creditedQuantity - * @return CreditNoteLine - */ - public function setCreditedQuantity(?float $creditedQuantity): CreditNoteLine - { - $this->invoicedQuantity = $creditedQuantity; - return $this; - } -} diff --git a/vendor/num-num/ubl-invoice/src/Delivery.php b/vendor/num-num/ubl-invoice/src/Delivery.php deleted file mode 100644 index cb3220e8f..000000000 --- a/vendor/num-num/ubl-invoice/src/Delivery.php +++ /dev/null @@ -1,93 +0,0 @@ -actualDeliveryDate; - } - - /** - * @param DateTime $actualDeliveryDate - * @return Delivery - */ - public function setActualDeliveryDate($actualDeliveryDate): Delivery - { - $this->actualDeliveryDate = $actualDeliveryDate; - return $this; - } - - /** - * @return Address - */ - public function getDeliveryLocation() - { - return $this->deliveryLocation; - } - - /** - * @param Address $deliveryLocation - * @return Delivery - */ - public function setDeliveryLocation($deliveryLocation): Delivery - { - $this->deliveryLocation = $deliveryLocation; - return $this; - } - - /** - * @return Party - */ - public function getDeliveryParty() - { - return $this->deliveryParty; - } - - /** - * @param Party $deliveryParty - * @return Delivery - */ - public function setDeliveryParty($deliveryParty): Delivery - { - $this->deliveryParty = $deliveryParty; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->actualDeliveryDate != null) { - $writer->write([ - Schema::CBC . 'ActualDeliveryDate' => $this->actualDeliveryDate->format('Y-m-d') - ]); - } - if ($this->deliveryLocation != null) { - $writer->write([ - Schema::CAC . 'DeliveryLocation' => [ Schema::CAC . 'Address' => $this->deliveryLocation ] - ]); - } - if ($this->deliveryParty != null) { - $writer->write([ - Schema::CAC . 'DeliveryParty' => $this->deliveryParty - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/EASCode.php b/vendor/num-num/ubl-invoice/src/EASCode.php deleted file mode 100644 index 1b9dc862a..000000000 --- a/vendor/num-num/ubl-invoice/src/EASCode.php +++ /dev/null @@ -1,109 +0,0 @@ -id; - } - - /** - * @param string $id - * @return FinancialInstitutionBranch - */ - public function setId(?string $id): FinancialInstitutionBranch - { - $this->id = $id; - return $this; - } - - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - Schema::CBC . 'ID' => $this->id - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/Generator.php b/vendor/num-num/ubl-invoice/src/Generator.php deleted file mode 100644 index f08500c79..000000000 --- a/vendor/num-num/ubl-invoice/src/Generator.php +++ /dev/null @@ -1,44 +0,0 @@ -namespaceMap = [ - 'urn:oasis:names:specification:ubl:schema:xsd:' . $invoice->xmlTagName . '-2' => '', - 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc', - 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac' - ]; - - return $xmlService->write($invoice->xmlTagName, [ - $invoice - ]); - } - - public static function creditNote(CreditNote $creditNote, $currencyId = 'EUR') - { - self::$currencyID = $currencyId; - - $xmlService = new Service(); - - $xmlService->namespaceMap = [ - 'urn:oasis:names:specification:ubl:schema:xsd:' . $creditNote->xmlTagName . '-2' => '', - 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc', - 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac' - ]; - - return $xmlService->write($creditNote->xmlTagName, [ - $creditNote - ]); - } -} \ No newline at end of file diff --git a/vendor/num-num/ubl-invoice/src/ICDCode.php b/vendor/num-num/ubl-invoice/src/ICDCode.php deleted file mode 100644 index 2b6962ee8..000000000 --- a/vendor/num-num/ubl-invoice/src/ICDCode.php +++ /dev/null @@ -1,244 +0,0 @@ -UBLVersionID; - } - - /** - * @param string $UBLVersionID - * eg. '2.0', '2.1', '2.2', ... - * @return Invoice - */ - public function setUBLVersionID(?string $UBLVersionID): Invoice - { - $this->UBLVersionID = $UBLVersionID; - return $this; - } - - /** - * @return mixed - */ - public function getId(): ?string - { - return $this->id; - } - - /** - * @param mixed $id - * @return Invoice - */ - public function setId(?string $id): Invoice - { - $this->id = $id; - return $this; - } - - /** - * @param mixed $customizationID - * @return Invoice - */ - public function setCustomizationID(?string $customizationID): Invoice - { - $this->customizationID = $customizationID; - return $this; - } - - /** - * @param mixed $profileID - * @return Invoice - */ - public function setProfileID(?string $profileID): Invoice - { - $this->profileID = $profileID; - return $this; - } - - /** - * @return bool - */ - public function isCopyIndicator(): bool - { - return $this->copyIndicator; - } - - /** - * @param bool $copyIndicator - * @return Invoice - */ - public function setCopyIndicator(bool $copyIndicator): Invoice - { - $this->copyIndicator = $copyIndicator; - return $this; - } - - /** - * @return DateTime - */ - public function getIssueDate(): ?DateTime - { - return $this->issueDate; - } - - /** - * @param DateTime $issueDate - * @return Invoice - */ - public function setIssueDate(DateTime $issueDate): Invoice - { - $this->issueDate = $issueDate; - return $this; - } - - /** - * @return DateTime - */ - public function getDueDate(): ?DateTime - { - return $this->dueDate; - } - - /** - * @param DateTime $dueDate - * @return Invoice - */ - public function setDueDate(DateTime $dueDate): Invoice - { - $this->dueDate = $dueDate; - return $this; - } - - /** - * @param mixed $currencyCode - * @return Invoice - */ - public function setDocumentCurrencyCode(string $currencyCode = 'EUR'): Invoice - { - $this->documentCurrencyCode = $currencyCode; - return $this; - } - - /** - * @return string - */ - public function getInvoiceTypeCode(): ?string - { - return $this->invoiceTypeCode; - } - - /** - * @param string $invoiceTypeCode - * See also: src/InvoiceTypeCode.php - * @return Invoice - */ - public function setInvoiceTypeCode(string $invoiceTypeCode): Invoice - { - $this->invoiceTypeCode = $invoiceTypeCode; - return $this; - } - - /** - * @return string - */ - public function getNote() - { - return $this->note; - } - - /** - * @param string $note - * @return Invoice - */ - public function setNote(string $note) - { - $this->note = $note; - return $this; - } - - /** - * @return DateTime - */ - public function getTaxPointDate(): ?DateTime - { - return $this->taxPointDate; - } - - /** - * @param DateTime $taxPointDate - * @return Invoice - */ - public function setTaxPointDate(DateTime $taxPointDate): Invoice - { - $this->taxPointDate = $taxPointDate; - return $this; - } - - /** - * @return PaymentTerms - */ - public function getPaymentTerms(): ?PaymentTerms - { - return $this->paymentTerms; - } - - /** - * @param PaymentTerms $paymentTerms - * @return Invoice - */ - public function setPaymentTerms(PaymentTerms $paymentTerms): Invoice - { - $this->paymentTerms = $paymentTerms; - return $this; - } - - /** - * @return Party - */ - public function getAccountingSupplierParty(): ?Party - { - return $this->accountingSupplierParty; - } - - /** - * @param Party $accountingSupplierParty - * @return Invoice - */ - public function setAccountingSupplierParty(Party $accountingSupplierParty): Invoice - { - $this->accountingSupplierParty = $accountingSupplierParty; - return $this; - } - - /** - * @return Party - */ - public function getSupplierAssignedAccountID(): ?string - { - return $this->supplierAssignedAccountID; - } - - /** - * @param string $supplierAssignedAccountID - * @return Invoice - */ - public function setSupplierAssignedAccountID(string $supplierAssignedAccountID): Invoice - { - $this->supplierAssignedAccountID = $supplierAssignedAccountID; - return $this; - } - - /** - * @return Party - */ - public function getAccountingCustomerParty(): ?Party - { - return $this->accountingCustomerParty; - } - - /** - * @param Party $accountingCustomerParty - * @return Invoice - */ - public function setAccountingCustomerParty(Party $accountingCustomerParty): Invoice - { - $this->accountingCustomerParty = $accountingCustomerParty; - return $this; - } - - /** - * @return ?Contact - */ - public function getAccountingCustomerPartyContact(): ?Contact - { - return $this->accountingCustomerPartyContact; - } - - /** - * @param Contact $accountingCustomerPartyContact - * @return Invoice - */ - public function setAccountingCustomerPartyContact(Contact $accountingCustomerPartyContact): Invoice - { - $this->accountingCustomerPartyContact = $accountingCustomerPartyContact; - return $this; - } - - /** - * @return Party - */ - public function getPayeeParty(): ?Party - { - return $this->payeeParty; - } - - /** - * @param Party $payeeParty - * @return Invoice - */ - public function setPayeeParty(Party $payeeParty): Invoice - { - $this->payeeParty = $payeeParty; - return $this; - } - - /** - * @return PaymentMeans[] - */ - public function getPaymentMeans(): ?array - { - return $this->paymentMeans; - } - - /** - * @param PaymentMeans[] $paymentMeans - * @return Invoice - */ - public function setPaymentMeans(array $paymentMeans): Invoice - { - $this->paymentMeans = $paymentMeans; - return $this; - } - - /** - * @return TaxTotal - */ - public function getTaxTotal(): ?TaxTotal - { - return $this->taxTotal; - } - - /** - * @param TaxTotal $taxTotal - * @return Invoice - */ - public function setTaxTotal(TaxTotal $taxTotal): Invoice - { - $this->taxTotal = $taxTotal; - return $this; - } - - /** - * @return LegalMonetaryTotal - */ - public function getLegalMonetaryTotal(): ?LegalMonetaryTotal - { - return $this->legalMonetaryTotal; - } - - /** - * @param LegalMonetaryTotal $legalMonetaryTotal - * @return Invoice - */ - public function setLegalMonetaryTotal(LegalMonetaryTotal $legalMonetaryTotal): Invoice - { - $this->legalMonetaryTotal = $legalMonetaryTotal; - return $this; - } - - /** - * @return InvoiceLine[] - */ - public function getInvoiceLines(): ?array - { - return $this->invoiceLines; - } - - /** - * @param InvoiceLine[] $invoiceLines - * @return Invoice - */ - public function setInvoiceLines(array $invoiceLines): Invoice - { - $this->invoiceLines = $invoiceLines; - return $this; - } - - /** - * @return AllowanceCharge[] - */ - public function getAllowanceCharges(): ?array - { - return $this->allowanceCharges; - } - - /** - * @param AllowanceCharge[] $allowanceCharges - * @return Invoice - */ - public function setAllowanceCharges(array $allowanceCharges): Invoice - { - $this->allowanceCharges = $allowanceCharges; - return $this; - } - - /** - * @return AdditionalDocumentReference - * @deprecated Deprecated since v1.16 - Replace implementation with setAdditionalDocumentReference or addAdditionalDocumentReference to add/set a single AdditionalDocumentReference - */ - public function getAdditionalDocumentReference(): ?AdditionalDocumentReference - { - return $this->additionalDocumentReferences[0] ?? null; - } - - /** - * @return array - */ - public function getAdditionalDocumentReferences(): array - { - return $this->additionalDocumentReferences ?? []; - } - - /** - * @param AdditionalDocumentReference $additionalDocumentReference - * @return Invoice - */ - public function setAdditionalDocumentReference(AdditionalDocumentReference $additionalDocumentReference): Invoice - { - $this->additionalDocumentReferences = [$additionalDocumentReference]; - return $this; - } - - /** - * @param AdditionalDocumentReference $additionalDocumentReference - * @return Invoice - */ - public function setAdditionalDocumentReferences(array $additionalDocumentReference): Invoice - { - $this->additionalDocumentReferences = $additionalDocumentReference; - return $this; - } - - /** - * @param AdditionalDocumentReference $additionalDocumentReference - * @return Invoice - */ - public function addAdditionalDocumentReference(AdditionalDocumentReference $additionalDocumentReference): Invoice - { - $this->additionalDocumentReferences[] = $additionalDocumentReference; - return $this; - } - - /** - * @param ProjectReference $projectReference - * @return Invoice - */ - public function setProjectReference(ProjectReference $projectReference): Invoice - { - $this->projectReference = $projectReference; - return $this; - } - - /** - * @return ProjectReference projectReference - */ - public function getProjectReference(): ?ProjectReference - { - return $this->projectReference; - } - - /** - * @param string $buyerReference - * @return Invoice - */ - public function setBuyerReference(string $buyerReference): Invoice - { - $this->buyerReference = $buyerReference; - return $this; - } - - /** - * @return string buyerReference - */ - public function getBuyerReference(): ?string - { - return $this->buyerReference; - } - - /** - * @return mixed - */ - public function getAccountingCostCode(): ?string - { - return $this->accountingCostCode; - } - - /** - * @param mixed $accountingCostCode - * @return Invoice - */ - public function setAccountingCostCode(string $accountingCostCode): Invoice - { - $this->accountingCostCode = $accountingCostCode; - return $this; - } - - /** - * @return InvoicePeriod - */ - public function getInvoicePeriod(): ?InvoicePeriod - { - return $this->invoicePeriod; - } - - /** - * @param InvoicePeriod $invoicePeriod - * @return Invoice - */ - public function setInvoicePeriod(InvoicePeriod $invoicePeriod): Invoice - { - $this->invoicePeriod = $invoicePeriod; - return $this; - } - - /** - * Get the reference to the invoice that is being credited - * - * @return ?BillingReference - */ - public function getBillingReference(): ?BillingReference - { - return $this->billingReference; - } - - /** - * Set the reference to the invoice that is being credited - * - * @return CreditNote - */ - public function setBillingReference($billingReference): CreditNote - { - $this->billingReference = $billingReference; - return $this; - } - - /** - * @return Delivery - */ - public function getDelivery(): ?Delivery - { - return $this->delivery; - } - - /** - * @param Delivery $delivery - * @return Invoice - */ - public function setDelivery(Delivery $delivery): Invoice - { - $this->delivery = $delivery; - return $this; - } - - /** - * @return OrderReference - */ - public function getOrderReference(): ?OrderReference - { - return $this->orderReference; - } - - /** - * @param OrderReference $orderReference - * @return Invoice - */ - public function setOrderReference(OrderReference $orderReference): Invoice - { - $this->orderReference = $orderReference; - return $this; - } - - /** - * @return ContractDocumentReference - */ - public function getContractDocumentReference(): ?ContractDocumentReference - { - return $this->contractDocumentReference; - } - - /** - * @param string $ContractDocumentReference - * @return Invoice - */ - public function setContractDocumentReference(ContractDocumentReference $contractDocumentReference): Invoice - { - $this->contractDocumentReference = $contractDocumentReference; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @return void - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - */ - public function validate() - { - if ($this->id === null) { - throw new InvalidArgumentException('Missing invoice id'); - } - - if (!$this->issueDate instanceof DateTime) { - throw new InvalidArgumentException('Invalid invoice issueDate'); - } - - if ($this->invoiceTypeCode === null) { - throw new InvalidArgumentException('Missing invoice invoiceTypeCode'); - } - - if ($this->accountingSupplierParty === null) { - throw new InvalidArgumentException('Missing invoice accountingSupplierParty'); - } - - if ($this->accountingCustomerParty === null) { - throw new InvalidArgumentException('Missing invoice accountingCustomerParty'); - } - - if ($this->invoiceLines === null) { - throw new InvalidArgumentException('Missing invoice lines'); - } - - if ($this->legalMonetaryTotal === null) { - throw new InvalidArgumentException('Missing invoice LegalMonetaryTotal'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([ - Schema::CBC . 'UBLVersionID' => $this->UBLVersionID, - Schema::CBC . 'CustomizationID' => $this->customizationID, - ]); - - if ($this->profileID !== null) { - $writer->write([ - Schema::CBC . 'ProfileID' => $this->profileID - ]); - } - - $writer->write([ - Schema::CBC . 'ID' => $this->id - ]); - - if ($this->copyIndicator !== null) { - $writer->write([ - Schema::CBC . 'CopyIndicator' => $this->copyIndicator ? 'true' : 'false' - ]); - } - - $writer->write([ - Schema::CBC . 'IssueDate' => $this->issueDate->format('Y-m-d'), - ]); - - if ($this->dueDate !== null && $this->xmlTagName === 'Invoice') { - $writer->write([ - Schema::CBC . 'DueDate' => $this->dueDate->format('Y-m-d') - ]); - } - - if ($this->invoiceTypeCode !== null) { - $writer->write([ - Schema::CBC . $this->xmlTagName . 'TypeCode' => $this->invoiceTypeCode - ]); - } - - if ($this->note !== null) { - $writer->write([ - Schema::CBC . 'Note' => $this->note - ]); - } - - if ($this->taxPointDate !== null) { - $writer->write([ - Schema::CBC . 'TaxPointDate' => $this->taxPointDate->format('Y-m-d') - ]); - } - - $writer->write([ - Schema::CBC . 'DocumentCurrencyCode' => $this->documentCurrencyCode, - ]); - - if ($this->accountingCostCode !== null) { - $writer->write([ - Schema::CBC . 'AccountingCostCode' => $this->accountingCostCode - ]); - } - - if ($this->buyerReference != null) { - $writer->write([ - Schema::CBC . 'BuyerReference' => $this->buyerReference - ]); - } - - if ($this->invoicePeriod != null) { - $writer->write([ - Schema::CAC . 'InvoicePeriod' => $this->invoicePeriod - ]); - } - - if ($this->orderReference != null) { - $writer->write([ - Schema::CAC . 'OrderReference' => $this->orderReference - ]); - } - - if ($this->billingReference != null) { - $writer->write([ - Schema::CAC . 'BillingReference' => $this->billingReference - ]); - } - - if ($this->contractDocumentReference !== null) { - $writer->write([ - Schema::CAC . 'ContractDocumentReference' => $this->contractDocumentReference, - ]); - } - - if (!empty($this->additionalDocumentReferences)) { - foreach ($this->additionalDocumentReferences as $additionalDocumentReference) { - $writer->write([ - Schema::CAC . 'AdditionalDocumentReference' => $additionalDocumentReference - ]); - } - } - - if ($this->projectReference != null) { - $writer->write([ - Schema::CAC . 'ProjectReference' => $this->projectReference - ]); - } - - $customerParty = array_filter([ - Schema::CBC . 'SupplierAssignedAccountID' => $this->supplierAssignedAccountID, - Schema::CAC . 'Party' => $this->accountingCustomerParty, - Schema::CAC . 'AccountingContact' => $this->accountingCustomerPartyContact, - ]); - - $writer->write([ - Schema::CAC . 'AccountingSupplierParty' => [Schema::CAC . 'Party' => $this->accountingSupplierParty], - Schema::CAC . 'AccountingCustomerParty' => $customerParty, - ]); - - if ($this->payeeParty != null) { - $writer->write([ - Schema::CAC . 'PayeeParty' => $this->payeeParty - ]); - } - - if ($this->delivery != null) { - $writer->write([ - Schema::CAC . 'Delivery' => $this->delivery - ]); - } - - if ($this->paymentMeans !== null) { - foreach($this->paymentMeans as $paymentMeans) { - $writer->write([ - Schema::CAC . $paymentMeans->xmlTagName => $paymentMeans - ]); - } - } - - if ($this->paymentTerms !== null) { - $writer->write([ - Schema::CAC . 'PaymentTerms' => $this->paymentTerms - ]); - } - - if ($this->allowanceCharges !== null) { - foreach ($this->allowanceCharges as $allowanceCharge) { - $writer->write([ - Schema::CAC . 'AllowanceCharge' => $allowanceCharge - ]); - } - } - - if ($this->taxTotal !== null) { - $writer->write([ - Schema::CAC . 'TaxTotal' => $this->taxTotal - ]); - } - - $writer->write([ - Schema::CAC . 'LegalMonetaryTotal' => $this->legalMonetaryTotal - ]); - - foreach ($this->invoiceLines as $invoiceLine) { - $writer->write([ - Schema::CAC . $invoiceLine->xmlTagName => $invoiceLine - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/InvoiceDocumentReference.php b/vendor/num-num/ubl-invoice/src/InvoiceDocumentReference.php deleted file mode 100644 index 529464030..000000000 --- a/vendor/num-num/ubl-invoice/src/InvoiceDocumentReference.php +++ /dev/null @@ -1,96 +0,0 @@ -originalInvoiceId; - } - - /** - * Set the id of the invoice that is being credited - * - * @return InvoiceDocumentReference - */ - public function setOriginalInvoiceId(string $invoiceRef): InvoiceDocumentReference - { - $this->originalInvoiceId = $invoiceRef; - return $this; - } - - /** - * Get the issue date of the original invoice that is being credited - * - * @return ?DateTime - */ - public function getIssueDate(): ?DateTime - { - return $this->issueDate; - } - - /** - * Set the issue date of the original invoice that is being credited - * - * @return InvoiceDocumentReference - */ - public function setIssueDate(DateTime $issueDate): InvoiceDocumentReference - { - $this->issueDate = $issueDate; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->originalInvoiceId === null) { - throw new InvalidArgumentException('Missing invoicedocumentreference originalinvoiceid'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([ - [ - 'name' => Schema::CBC . 'ID', - 'value' => $this->originalInvoiceId - ] - ]); - - if ($this->issueDate != null) - { - $writer->write([ - [ - 'name' => Schema::CBC . 'IssueDate', - 'value' => $this->issueDate->format('Y-m-d') - ] - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/InvoiceLine.php b/vendor/num-num/ubl-invoice/src/InvoiceLine.php deleted file mode 100644 index f34bf6e8a..000000000 --- a/vendor/num-num/ubl-invoice/src/InvoiceLine.php +++ /dev/null @@ -1,367 +0,0 @@ -id; - } - - /** - * @param string $id - * @return InvoiceLine - */ - public function setId(?string $id): InvoiceLine - { - $this->id = $id; - return $this; - } - - /** - * @return float - */ - public function getInvoicedQuantity(): ?float - { - return $this->invoicedQuantity; - } - - /** - * @param ?float $invoicedQuantity - * @return InvoiceLine - */ - public function setInvoicedQuantity(?float $invoicedQuantity): InvoiceLine - { - $this->invoicedQuantity = $invoicedQuantity; - return $this; - } - - /** - * @return float - */ - public function getLineExtensionAmount(): ?float - { - return $this->lineExtensionAmount; - } - - /** - * @param float $lineExtensionAmount - * @return InvoiceLine - */ - public function setLineExtensionAmount(?float $lineExtensionAmount): InvoiceLine - { - $this->lineExtensionAmount = $lineExtensionAmount; - return $this; - } - - /** - * @return TaxTotal - */ - public function getTaxTotal(): ?TaxTotal - { - return $this->taxTotal; - } - - /** - * @param TaxTotal $taxTotal - * @return InvoiceLine - */ - public function setTaxTotal(?TaxTotal $taxTotal): InvoiceLine - { - $this->taxTotal = $taxTotal; - return $this; - } - - /** - * @return string - */ - public function getNote(): ?string - { - return $this->note; - } - - /** - * @param string $note - * @return InvoiceLine - */ - public function setNote(?string $note): InvoiceLine - { - $this->note = $note; - return $this; - } - - /** - * @return InvoicePeriod - */ - public function getInvoicePeriod(): ?InvoicePeriod - { - return $this->invoicePeriod; - } - - /** - * @param InvoicePeriod $invoicePeriod - * @return InvoiceLine - */ - public function setInvoicePeriod(?InvoicePeriod $invoicePeriod) - { - $this->invoicePeriod = $invoicePeriod; - return $this; - } - - /** - * @return string - */ - public function getOrderLineReference(): ?OrderLineReference - { - return $this->orderLineReference; - } - - /** - * @param ?string $orderLineReference - * @return OrderLineReference - */ - public function setOrderLineReference(?OrderLineReference $orderLineReference): InvoiceLine - { - $this->orderLineReference = $orderLineReference; - return $this; - } - - /** - * @return Item - */ - public function getItem(): ?Item - { - return $this->item; - } - - /** - * @param Item $item - * @return InvoiceLine - */ - public function setItem(Item $item): InvoiceLine - { - $this->item = $item; - return $this; - } - - /** - * @return Price - */ - public function getPrice(): ?Price - { - return $this->price; - } - - /** - * @param Price $price - * @return InvoiceLine - */ - public function setPrice(?Price $price): InvoiceLine - { - $this->price = $price; - return $this; - } - - /** - * @return string - */ - public function getUnitCode(): ?string - { - return $this->unitCode; - } - - /** - * @param string $unitCode - * @return InvoiceLine - */ - public function setUnitCode(?string $unitCode): InvoiceLine - { - $this->unitCode = $unitCode; - return $this; - } - - /** - * @return string - */ - public function getUnitCodeListId(): ?string - { - return $this->unitCodeListId; - } - - /** - * @param string $unitCodeListId - * @return InvoiceLine - */ - public function setUnitCodeListId(?string $unitCodeListId) - { - $this->unitCodeListId = $unitCodeListId; - return $this; - } - - /** - * @return string - */ - public function getAccountingCostCode(): ?string - { - return $this->accountingCostCode; - } - - /** - * @param string $accountingCostCode - * @return InvoiceLine - */ - public function setAccountingCostCode(?string $accountingCostCode): InvoiceLine - { - $this->accountingCostCode = $accountingCostCode; - return $this; - } - - /** - * @return string - */ - public function getAccountingCost(): ?string - { - return $this->accountingCost; - } - - /** - * @param string $accountingCost - * @return InvoiceLine - */ - public function setAccountingCost(?string $accountingCost): InvoiceLine - { - $this->accountingCost = $accountingCost; - return $this; - } - - /** - * @return AllowanceCharge[] - */ - public function getAllowanceCharges(): ?array - { - return $this->allowanceCharges; - } - - /** - * @param AllowanceCharge[] $allowanceCharges - * @return InvoiceLine - */ - public function setAllowanceCharges(array $allowanceCharges): InvoiceLine - { - $this->allowanceCharges = $allowanceCharges; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - Schema::CBC . 'ID' => $this->id - ]); - - if (!empty($this->getNote())) { - $writer->write([ - Schema::CBC . 'Note' => $this->getNote() - ]); - } - - $invoicedQuantityAttributes = [ - 'unitCode' => $this->unitCode, - ]; - - if (!empty($this->getUnitCodeListId())) { - $invoicedQuantityAttributes['unitCodeListID'] = $this->getUnitCodeListId(); - } - - $writer->write([ - 'name' => Schema::CBC . - ($this->isCreditNoteLine ? 'CreditedQuantity' : 'InvoicedQuantity'), - 'value' => NumberFormatter::format($this->invoicedQuantity), - 'attributes' => $invoicedQuantityAttributes - ]); - - $writer->write([ - 'name' => Schema::CBC . 'LineExtensionAmount', - 'value' => NumberFormatter::format($this->lineExtensionAmount ?? 0, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ]); - - if ($this->accountingCostCode !== null) { - $writer->write([ - Schema::CBC . 'AccountingCostCode' => $this->accountingCostCode - ]); - } - if ($this->accountingCost !== null) { - $writer->write([ - Schema::CBC . 'AccountingCost' => $this->accountingCost - ]); - } - if ($this->invoicePeriod !== null) { - $writer->write([ - Schema::CAC . 'InvoicePeriod' => $this->invoicePeriod - ]); - } - if ($this->orderLineReference !== null) { - $writer->write([ - Schema::CAC . 'OrderLineReference' => $this->orderLineReference - ]); - } - if ($this->allowanceCharges !== null) { - foreach ($this->allowanceCharges as $allowanceCharge) { - $writer->write([ - Schema::CAC . 'AllowanceCharge' => $allowanceCharge - ]); - } - } - if ($this->taxTotal !== null) { - $writer->write([ - Schema::CAC . 'TaxTotal' => $this->taxTotal - ]); - } - - if ($this->item !== null) { - $writer->write([ - Schema::CAC . 'Item' => $this->item, - ]); - } - - if ($this->price !== null) { - $writer->write([ - Schema::CAC . 'Price' => $this->price - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/InvoicePeriod.php b/vendor/num-num/ubl-invoice/src/InvoicePeriod.php deleted file mode 100644 index ccc719a5c..000000000 --- a/vendor/num-num/ubl-invoice/src/InvoicePeriod.php +++ /dev/null @@ -1,109 +0,0 @@ -startDate; - } - - /** - * @param DateTime $startDate - * @return InvoicePeriod - */ - public function setStartDate(?DateTime $startDate): InvoicePeriod - { - $this->startDate = $startDate; - return $this; - } - - /** - * @return DateTime - */ - public function getEndDate(): ?DateTime - { - return $this->endDate; - } - - /** - * @param DateTime $endDate - * @return InvoicePeriod - */ - public function setEndDate(?DateTime $endDate): InvoicePeriod - { - $this->endDate = $endDate; - return $this; - } - - /** - * @return int - */ - public function getDescriptionCode(): ?int - { - return $this->descriptionCode; - } - - /** - * @param Integer $descriptionCode - * @return InvoicePeriod - */ - public function setDescriptionCode(?int $descriptionCode): InvoicePeriod - { - $this->descriptionCode = $descriptionCode; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->descriptionCode === null && ($this->startDate === null && $this->endDate === null)) { - throw new InvalidArgumentException('Missing startDate or endDate or descriptionCode'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - if ($this->startDate != null) { - $writer->write([ - Schema::CBC . 'StartDate' => $this->startDate->format('Y-m-d'), - ]); - } - if ($this->endDate != null) { - $writer->write([ - Schema::CBC . 'EndDate' => $this->endDate->format('Y-m-d'), - ]); - } - if ($this->descriptionCode !== null) { - $writer->write([ - Schema::CBC . 'DescriptionCode' => $this->descriptionCode, - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/InvoiceTypeCode.php b/vendor/num-num/ubl-invoice/src/InvoiceTypeCode.php deleted file mode 100644 index 55bbdeca1..000000000 --- a/vendor/num-num/ubl-invoice/src/InvoiceTypeCode.php +++ /dev/null @@ -1,17 +0,0 @@ -description; - } - - /** - * @param string $description - * @return Item - */ - public function setDescription(?string $description): Item - { - $this->description = $description; - return $this; - } - - /** - * @return mixed - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param mixed $name - * @return Item - */ - public function setName(?string $name): Item - { - $this->name = $name; - return $this; - } - - /** - * @return mixed - */ - public function getSellersItemIdentification(): ?string - { - return $this->sellersItemIdentification; - } - - /** - * @param mixed $sellersItemIdentification - * @return Item - */ - public function setSellersItemIdentification(?string $sellersItemIdentification): Item - { - $this->sellersItemIdentification = $sellersItemIdentification; - return $this; - } - - /** - * @return mixed - */ - public function getStandardItemIdentification(): ?string - { - return $this->standardItemIdentification; - } - - /** - * @param mixed $standardItemIdentification - * @return Item - */ - public function setStandardItemIdentification(?string $standardItemIdentification, $attributes = null): Item - { - $this->standardItemIdentification = $standardItemIdentification; - if (isset($attributes)) { - $this->standardItemIdentificationAttributes = $attributes; - } - return $this; - } - - /** - * @return CommodityClassification - */ - public function getCommodityClassification(): ?CommodityClassification - { - return $this->commodityClassification; - } - - /** - * @param mixed $commodityClassification - * @return Item - */ - public function setCommodityClassification(CommodityClassification $commodityClassification): Item - { - $this->commodityClassification = $commodityClassification; - return $this; - } - - /** - * @return mixed - */ - public function getBuyersItemIdentification(): ?string - { - return $this->buyersItemIdentification; - } - - /** - * @param mixed $buyersItemIdentification - * @return Item - */ - public function setBuyersItemIdentification(?string $buyersItemIdentification): Item - { - $this->buyersItemIdentification = $buyersItemIdentification; - return $this; - } - - /** - * @return ClassifiedTaxCategory - */ - public function getClassifiedTaxCategory(): ?ClassifiedTaxCategory - { - return $this->classifiedTaxCategory; - } - - /** - * @param ClassifiedTaxCategory $classifiedTaxCategory - * @return Item - */ - public function setClassifiedTaxCategory(?ClassifiedTaxCategory $classifiedTaxCategory): Item - { - $this->classifiedTaxCategory = $classifiedTaxCategory; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if (!empty($this->getDescription())) { - $writer->write([ - Schema::CBC . 'Description' => $this->description - ]); - } - - $writer->write([ - Schema::CBC . 'Name' => $this->name - ]); - - if (!empty($this->getBuyersItemIdentification())) { - $writer->write([ - Schema::CAC . 'BuyersItemIdentification' => [ - Schema::CBC . 'ID' => $this->buyersItemIdentification - ], - ]); - } - - if (!empty($this->getSellersItemIdentification())) { - $writer->write([ - Schema::CAC . 'SellersItemIdentification' => [ - Schema::CBC . 'ID' => $this->sellersItemIdentification - ], - ]); - } - - if (!empty($this->getStandardItemIdentification())) { - $writer->write([ - Schema::CAC . 'StandardItemIdentification' => [ - Schema::CBC . 'ID' => [ - 'value' => $this->standardItemIdentification, - 'attributes' => $this->standardItemIdentificationAttributes - ] - ] - ]); - } - - if (!empty($this->getCommodityClassification())) { - $writer->write([ - Schema::CAC . 'CommodityClassification' => $this->commodityClassification - ]); - } - - if (!empty($this->getClassifiedTaxCategory())) { - $writer->write([ - Schema::CAC . 'ClassifiedTaxCategory' => $this->classifiedTaxCategory - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/LegalEntity.php b/vendor/num-num/ubl-invoice/src/LegalEntity.php deleted file mode 100644 index 7e296b863..000000000 --- a/vendor/num-num/ubl-invoice/src/LegalEntity.php +++ /dev/null @@ -1,99 +0,0 @@ -registrationName; - } - - /** - * @param string $registrationName - * @return LegalEntity - */ - public function setRegistrationName(?string $registrationName): LegalEntity - { - $this->registrationName = $registrationName; - return $this; - } - - /** - * @return string - */ - public function getCompanyId(): ?string - { - return $this->companyId; - } - - /** - * @param string $companyId - * @return LegalEntity - */ - public function setCompanyId(?string $companyId, $attributes = null): LegalEntity - { - $this->companyId = $companyId; - if (isset($attributes)) { - $this->companyIdAttributes = $attributes; - } - return $this; - } - - /** - * - * @param string $legalForm - * @return LegalEntity - */ - public function setCompanyLegalForm(?string $legalForm, $attributes = null) : LegalEntity - { - $this->companyLegalForm = $legalForm; - if (isset($attributes)) { - $this->companyLegalFormAttributes = $attributes; - } - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - Schema::CBC . 'RegistrationName' => $this->registrationName, - ]); - if ($this->companyId !== null) { - $writer->write([ - [ - 'name' => Schema::CBC . 'CompanyID', - 'value' => $this->companyId, - 'attributes' => $this->companyIdAttributes, - ], - ]); - } - if ($this->companyLegalForm !== null) { - $writer->write([ - [ - 'name' => Schema::CBC . 'CompanyLegalForm', - 'value' => $this->companyLegalForm, - 'attributes' => $this->companyLegalFormAttributes - ] - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/LegalMonetaryTotal.php b/vendor/num-num/ubl-invoice/src/LegalMonetaryTotal.php deleted file mode 100644 index 2b6bdc917..000000000 --- a/vendor/num-num/ubl-invoice/src/LegalMonetaryTotal.php +++ /dev/null @@ -1,245 +0,0 @@ -lineExtensionAmount; - } - - /** - * @param float $lineExtensionAmount - * @return LegalMonetaryTotal - */ - public function setLineExtensionAmount(?float $lineExtensionAmount): LegalMonetaryTotal - { - $this->lineExtensionAmount = $lineExtensionAmount; - return $this; - } - - /** - * @return float - */ - public function getTaxExclusiveAmount(): ?float - { - return $this->taxExclusiveAmount; - } - - /** - * @param float $taxExclusiveAmount - * @return LegalMonetaryTotal - */ - public function setTaxExclusiveAmount(?float $taxExclusiveAmount): LegalMonetaryTotal - { - $this->taxExclusiveAmount = $taxExclusiveAmount; - return $this; - } - - /** - * @return float - */ - public function getTaxInclusiveAmount(): ?float - { - return $this->taxInclusiveAmount; - } - - /** - * @param float $taxInclusiveAmount - * @return LegalMonetaryTotal - */ - public function setTaxInclusiveAmount(?float $taxInclusiveAmount): LegalMonetaryTotal - { - $this->taxInclusiveAmount = $taxInclusiveAmount; - return $this; - } - - /** - * @return float - */ - public function getAllowanceTotalAmount(): ?float - { - return $this->allowanceTotalAmount; - } - - /** - * @param float $allowanceTotalAmount - * @return LegalMonetaryTotal - */ - public function setAllowanceTotalAmount(?float $allowanceTotalAmount): LegalMonetaryTotal - { - $this->allowanceTotalAmount = $allowanceTotalAmount; - return $this; - } - - /** - * @return float - */ - public function getChargeTotalAmount(): ?float - { - return $this->chargeTotalAmount; - } - - /** - * @param float $chargeTotalAmount - * @return LegalMonetaryTotal - */ - public function setChargeTotalAmount(?float $chargeTotalAmount): LegalMonetaryTotal - { - $this->chargeTotalAmount = $chargeTotalAmount; - return $this; - } - - /** - * @return ?float - */ - public function getPrepaidAmount(): ?float - { - return $this->prepaidAmount; - } - - /** - * @param ?float $prepaidAmount - * @return LegalMonetaryTotal - */ - public function setPrepaidAmount(?float $prepaidAmount): LegalMonetaryTotal - { - $this->prepaidAmount = $prepaidAmount; - return $this; - } - - /** - * @return float - */ - public function getPayableAmount(): ?float - { - return $this->payableAmount; - } - - /** - * @param float $payableAmount - * @return LegalMonetaryTotal - */ - public function setPayableAmount(?float $payableAmount): LegalMonetaryTotal - { - $this->payableAmount = $payableAmount; - return $this; - } - - public function getPayableRoundingAmount(): ?float - { - return $this->payableRoundingAmount; - } - - /** - * @param float|null $payableRoundingAmount - * @return LegalMonetaryTotal - */ - public function setPayableRoundingAmount(?float $payableRoundingAmount): LegalMonetaryTotal - { - $this->payableRoundingAmount = $payableRoundingAmount; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - [ - 'name' => Schema::CBC . 'LineExtensionAmount', - 'value' => NumberFormatter::format($this->lineExtensionAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - - ], - [ - 'name' => Schema::CBC . 'TaxExclusiveAmount', - 'value' => NumberFormatter::format($this->taxExclusiveAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - - ], - [ - 'name' => Schema::CBC . 'TaxInclusiveAmount', - 'value' => NumberFormatter::format($this->taxInclusiveAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - - ], - [ - 'name' => Schema::CBC . 'AllowanceTotalAmount', - 'value' => NumberFormatter::format($this->allowanceTotalAmount,2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - - ], - [ - 'name' => Schema::CBC . 'ChargeTotalAmount', - 'value' => NumberFormatter::format($this->chargeTotalAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - - ] - ]); - - if ($this->prepaidAmount !== null) { - $writer->write([ - [ - 'name' => Schema::CBC . 'PrepaidAmount', - 'value' => NumberFormatter::format($this->prepaidAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ] - ]); - } - - if ($this->payableRoundingAmount !== null) { - $writer->write([ - [ - 'name' => Schema::CBC . 'PayableRoundingAmount', - 'value' => NumberFormatter::format($this->payableRoundingAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ], - ]); - } - - $writer->write([ - [ - 'name' => Schema::CBC . 'PayableAmount', - 'value' => NumberFormatter::format($this->payableAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ], - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/NumberFormatter.php b/vendor/num-num/ubl-invoice/src/NumberFormatter.php deleted file mode 100644 index 0dff0a1e7..000000000 --- a/vendor/num-num/ubl-invoice/src/NumberFormatter.php +++ /dev/null @@ -1,33 +0,0 @@ -lineId; - } - - /** - * @param string $lineId - * @return OrderLineReference - */ - public function setLineId(?string $lineId): OrderLineReference - { - $this->lineId = $lineId; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @return void - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - */ - public function validate() - { - if ($this->lineId === null) { - throw new InvalidArgumentException('Missing OrderLineReference LineID'); - } - } - - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([ - Schema::CBC . 'LineID' => $this->lineId - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/OrderReference.php b/vendor/num-num/ubl-invoice/src/OrderReference.php deleted file mode 100644 index 4645368ee..000000000 --- a/vendor/num-num/ubl-invoice/src/OrderReference.php +++ /dev/null @@ -1,89 +0,0 @@ -id; - } - - /** - * @param string $id - * @return OrderReference - */ - public function setId(string $id): OrderReference - { - $this->id = $id; - return $this; - } - - /** - * @return string - */ - public function getSalesOrderId(): string - { - return $this->salesOrderId; - } - - /** - * @return DateTime - */ - public function getIssueDate(): ?DateTime - { - return $this->issueDate; - } - - /** - * @param DateTime $issueDate - * @return OrderReference - */ - public function setIssueDate(DateTime $issueDate): OrderReference - { - $this->issueDate = $issueDate; - return $this; - } - - /** - * @param string $salesOrderId - * @return OrderReference - */ - public function setSalesOrderId(string $salesOrderId): OrderReference - { - $this->salesOrderId = $salesOrderId; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->id !== null) { - $writer->write([Schema::CBC . 'ID' => $this->id]); - } - if ($this->salesOrderId !== null) { - $writer->write([Schema::CBC . 'SalesOrderID' => $this->salesOrderId]); - } - if ($this->issueDate !== null) { - $writer->write([ - Schema::CBC . 'IssueDate' => $this->issueDate->format('Y-m-d'), - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/Party.php b/vendor/num-num/ubl-invoice/src/Party.php deleted file mode 100644 index 2e0720389..000000000 --- a/vendor/num-num/ubl-invoice/src/Party.php +++ /dev/null @@ -1,276 +0,0 @@ -name; - } - - /** - * @param string $name - * @return Party - */ - public function setName(?string $name): Party - { - $this->name = $name; - return $this; - } - - /** - * @return string - */ - public function getPartyIdentificationId(): ?string - { - return $this->partyIdentificationId; - } - - /** - * @param string $partyIdentificationId - * @return Party - */ - public function setPartyIdentificationId(?string $partyIdentificationId): Party - { - $this->partyIdentificationId = $partyIdentificationId; - return $this; - } - - /** - * @return string - */ - public function getPartyIdentificationSchemeId(): ?string - { - return $this->partyIdentificationSchemeId; - } - - /** - * @param string $partyIdentificationSchemeId - * @return Party - */ - public function setPartyIdentificationSchemeId(?string $partyIdentificationSchemeId): Party - { - $this->partyIdentificationSchemeId = $partyIdentificationSchemeId; - return $this; - } - - /** - * @return string - */ - public function getPartyIdentificationSchemeName(): ?string - { - return $this->partyIdentificationSchemeName; - } - - /** - * @param string $partyIdentificationSchemeName - * @return Party - */ - public function setPartyIdentificationSchemeName(?string $partyIdentificationSchemeName): Party - { - $this->partyIdentificationSchemeName = $partyIdentificationSchemeName; - return $this; - } - - /** - * @return Address - */ - public function getPostalAddress(): ?Address - { - return $this->postalAddress; - } - - /** - * @param Address $postalAddress - * @return Party - */ - public function setPostalAddress(?Address $postalAddress): Party - { - $this->postalAddress = $postalAddress; - return $this; - } - - /** - * @return LegalEntity - */ - public function getLegalEntity(): ?LegalEntity - { - return $this->legalEntity; - } - - /** - * @param LegalEntity $legalEntity - * @return Party - */ - public function setLegalEntity(?LegalEntity $legalEntity): Party - { - $this->legalEntity = $legalEntity; - return $this; - } - - /** - * @return Address - */ - public function getPhysicalLocation(): ?Address - { - return $this->physicalLocation; - } - - /** - * @param Address $physicalLocation - * @return Party - */ - public function setPhysicalLocation(?Address $physicalLocation): Party - { - $this->physicalLocation = $physicalLocation; - return $this; - } - - /** - * @return PartyTaxScheme - */ - public function getPartyTaxScheme(): ?PartyTaxScheme - { - return $this->partyTaxScheme; - } - - /** - * @param PartyTaxScheme $partyTaxScheme - * @return Party - */ - public function setPartyTaxScheme(PartyTaxScheme $partyTaxScheme) - { - $this->partyTaxScheme = $partyTaxScheme; - return $this; - } - - /** - * @return Contact - */ - public function getContact(): ?Contact - { - return $this->contact; - } - - /** - * @param Contact $contact - * @return Party - */ - public function setContact(?Contact $contact): Party - { - $this->contact = $contact; - return $this; - } - - /** - * @param $endpointID - * @param int|string $schemeID See list at https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/ - * @return Party - */ - public function setEndpointID($endpointID, $schemeID): Party - { - $this->endpointID = $endpointID; - $this->endpointID_schemeID = $schemeID; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->endpointID !== null && $this->endpointID_schemeID !== null) { - $writer->write([ - [ - 'name' => Schema::CBC . 'EndpointID', - 'value' => $this->endpointID, - 'attributes' => [ - 'schemeID' => is_numeric($this->endpointID_schemeID) - ? sprintf('%04d', +$this->endpointID_schemeID) - : $this->endpointID_schemeID - ] - ] - ]); - } - - if ($this->partyIdentificationId !== null) { - $partyIdentificationAttributes = []; - - if (!empty($this->getPartyIdentificationSchemeId())) { - $partyIdentificationAttributes['schemeID'] = $this->getPartyIdentificationSchemeId(); - } - - if (!empty($this->getPartyIdentificationSchemeName())) { - $partyIdentificationAttributes['schemeName'] = $this->getPartyIdentificationSchemeName(); - } - - $writer->write([ - Schema::CAC . 'PartyIdentification' => [ - [ - 'name' => Schema::CBC . 'ID', - 'value' => $this->partyIdentificationId, - 'attributes' => $partyIdentificationAttributes - ] - ], - ]); - } - - if ($this->name !== null) { - $writer->write([ - Schema::CAC . 'PartyName' => [ - Schema::CBC . 'Name' => $this->name - ] - ]); - } - - $writer->write([ - Schema::CAC . 'PostalAddress' => $this->postalAddress - ]); - - if ($this->physicalLocation !== null) { - $writer->write([ - Schema::CAC . 'PhysicalLocation' => [Schema::CAC . 'Address' => $this->physicalLocation] - ]); - } - - if ($this->partyTaxScheme !== null) { - $writer->write([ - Schema::CAC . 'PartyTaxScheme' => $this->partyTaxScheme - ]); - } - - if ($this->legalEntity !== null) { - $writer->write([ - Schema::CAC . 'PartyLegalEntity' => $this->legalEntity - ]); - } - - if ($this->contact !== null) { - $writer->write([ - Schema::CAC . 'Contact' => $this->contact - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/PartyTaxScheme.php b/vendor/num-num/ubl-invoice/src/PartyTaxScheme.php deleted file mode 100644 index ecec3380a..000000000 --- a/vendor/num-num/ubl-invoice/src/PartyTaxScheme.php +++ /dev/null @@ -1,107 +0,0 @@ -registrationName; - } - - /** - * @param string $registrationName - * @return PartyTaxScheme - */ - public function setRegistrationName($registrationName): PartyTaxScheme - { - $this->registrationName = $registrationName; - return $this; - } - - /** - * @return string - */ - public function getCompanyId(): ?string - { - return $this->companyId; - } - - /** - * @param string $companyId - * @return PartyTaxScheme - */ - public function setCompanyId($companyId): PartyTaxScheme - { - $this->companyId = $companyId; - return $this; - } - - /** - * @param TaxScheme $taxScheme. - * @return mixed - */ - public function getTaxScheme(): ?TaxScheme - { - return $this->taxScheme; - } - - /** - * @param TaxScheme $taxScheme - * @return PartyTaxScheme - */ - public function setTaxScheme(TaxScheme $taxScheme): PartyTaxScheme - { - $this->taxScheme = $taxScheme; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @return void - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - */ - public function validate() - { - if ($this->taxScheme === null) { - throw new InvalidArgumentException('Missing TaxScheme'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->registrationName !== null) { - $writer->write([ - Schema::CBC . 'RegistrationName' => $this->registrationName - ]); - } - if ($this->companyId !== null) { - $writer->write([ - Schema::CBC . 'CompanyID' => $this->companyId - ]); - } - - $writer->write([ - Schema::CAC . 'TaxScheme' => $this->taxScheme - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/PayeeFinancialAccount.php b/vendor/num-num/ubl-invoice/src/PayeeFinancialAccount.php deleted file mode 100644 index 02e97acba..000000000 --- a/vendor/num-num/ubl-invoice/src/PayeeFinancialAccount.php +++ /dev/null @@ -1,91 +0,0 @@ -id; - } - - /** - * @param string $id - * @return PayeeFinancialAccount - */ - public function setId(?string $id): PayeeFinancialAccount - { - $this->id = $id; - return $this; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param string $name - * @return PayeeFinancialAccount - */ - public function setName(?string $name): PayeeFinancialAccount - { - $this->name = $name; - return $this; - } - - /** - * @return FinancialInstitutionBranch - */ - public function getFinancialInstitutionBranch(): ?FinancialInstitutionBranch - { - return $this->financialInstitutionBranch; - } - - /** - * @param FinancialInstitutionBranch $financialInstitutionBranch - * @return PayeeFinancialAccount - */ - public function setFinancialInstitutionBranch(?FinancialInstitutionBranch $financialInstitutionBranch): PayeeFinancialAccount - { - $this->financialInstitutionBranch = $financialInstitutionBranch; - return $this; - } - - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - 'name' => Schema::CBC . 'ID', - 'value' => $this->id, - 'attributes' => [ - //'schemeID' => 'IBAN' - ] - ]); - - if ($this->getName() !== null) { - $writer->write([ - Schema::CBC . 'Name' => $this->getName() - ]); - } - - if ($this->getFinancialInstitutionBranch() !== null) { - $writer->write([ - Schema::CAC . 'FinancialInstitutionBranch' => $this->getFinancialInstitutionBranch() - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/PaymentMeans.php b/vendor/num-num/ubl-invoice/src/PaymentMeans.php deleted file mode 100644 index a0b8c7096..000000000 --- a/vendor/num-num/ubl-invoice/src/PaymentMeans.php +++ /dev/null @@ -1,172 +0,0 @@ - 'UN/ECE 4461', - 'listName' => 'Payment Means', - 'listURI' => 'http://docs.oasis-open.org/ubl/os-UBL-2.0-update/cl/gc/default/PaymentMeansCode-2.0.gc']; - private $paymentDueDate; - private $instructionId; - private $instructionNote; - private $paymentId; - private $payeeFinancialAccount; - - /** - * @return string - */ - public function getPaymentMeansCode(): ?string - { - return $this->paymentMeansCode; - } - - /** - * @param string $paymentMeansCode - * @return PaymentMeans - */ - public function setPaymentMeansCode(?string $paymentMeansCode, $attributes = null): PaymentMeans - { - $this->paymentMeansCode = $paymentMeansCode; - if (isset($attributes)) { - $this->paymentMeansCodeAttributes = $attributes; - } - return $this; - } - - /** - * @return DateTime - */ - public function getPaymentDueDate(): ?DateTime - { - return $this->paymentDueDate; - } - - /** - * @param DateTime $paymentDueDate - * @return PaymentMeans - */ - public function setPaymentDueDate(?DateTime $paymentDueDate): PaymentMeans - { - $this->paymentDueDate = $paymentDueDate; - return $this; - } - - /** - * @return string - */ - public function getInstructionId(): ?string - { - return $this->instructionId; - } - - /** - * @param string $instructionId - * @return PaymentMeans - */ - public function setInstructionId(?string $instructionId): PaymentMeans - { - $this->instructionId = $instructionId; - return $this; - } - - /** - * @return string - */ - public function getInstructionNote(): ?string - { - return $this->instructionNote; - } - - /** - * @param string $instructionNote - * @return PaymentMeans - */ - public function setInstructionNote(?string $instructionNote): PaymentMeans - { - $this->instructionNote = $instructionNote; - return $this; - } - - /** - * @return string - */ - public function getPaymentId(): ?string - { - return $this->paymentId; - } - - /** - * @param string $paymentId - * @return PaymentMeans - */ - public function setPaymentId(?string $paymentId): PaymentMeans - { - $this->paymentId = $paymentId; - return $this; - } - - /** - * @return mixed - */ - public function getPayeeFinancialAccount(): ?PayeeFinancialAccount - { - return $this->payeeFinancialAccount; - } - - /** - * @param mixed $payeeFinancialAccount - * @return PaymentMeans - */ - public function setPayeeFinancialAccount(?PayeeFinancialAccount $payeeFinancialAccount): PaymentMeans - { - $this->payeeFinancialAccount = $payeeFinancialAccount; - return $this; - } - - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - 'name' => Schema::CBC . 'PaymentMeansCode', - 'value' => $this->paymentMeansCode, - 'attributes' => $this->paymentMeansCodeAttributes - ]); - - if ($this->getPaymentDueDate() !== null) { - $writer->write([ - Schema::CBC . 'PaymentDueDate' => $this->getPaymentDueDate()->format('Y-m-d') - ]); - } - - if ($this->getInstructionId() !== null) { - $writer->write([ - Schema::CBC . 'InstructionID' => $this->getInstructionId() - ]); - } - - if ($this->getInstructionNote() !== null) { - $writer->write([ - Schema::CBC . 'InstructionNote' => $this->getInstructionNote() - ]); - } - - if ($this->getPaymentId() !== null) { - $writer->write([ - Schema::CBC . 'PaymentID' => $this->getPaymentId() - ]); - } - - if ($this->getPayeeFinancialAccount() !== null) { - $writer->write([ - Schema::CAC . 'PayeeFinancialAccount' => $this->getPayeeFinancialAccount() - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/PaymentTerms.php b/vendor/num-num/ubl-invoice/src/PaymentTerms.php deleted file mode 100644 index 4b99e98be..000000000 --- a/vendor/num-num/ubl-invoice/src/PaymentTerms.php +++ /dev/null @@ -1,113 +0,0 @@ -note; - } - - /** - * @param string $note - * @return PaymentTerms - */ - public function setNote(?string $note): PaymentTerms - { - $this->note = $note; - return $this; - } - - /** - * @return float - */ - public function getSettlementDiscountPercent(): ?float - { - return $this->settlementDiscountPercent; - } - - /** - * @param float $settlementDiscountPercent - * @return PaymentTerms - */ - public function setSettlementDiscountPercent(?float $settlementDiscountPercent): PaymentTerms - { - $this->settlementDiscountPercent = $settlementDiscountPercent; - return $this; - } - - /** - * @return float - */ - public function getAmount(): ?float - { - return $this->amount; - } - - /** - * @param float $amount - * @return PaymentTerms - */ - public function setAmount(?float $amount): PaymentTerms - { - $this->amount = $amount; - return $this; - } - - /** - * @return SettlementPeriod - */ - public function getSettlementPeriod(): ?SettlementPeriod - { - return $this->settlementPeriod; - } - - /** - * @param SettlementPeriod $settlementPeriod - * @return PaymentTerms - */ - public function setSettlementPeriod(?SettlementPeriod $settlementPeriod): PaymentTerms - { - $this->settlementPeriod = $settlementPeriod; - return $this; - } - - public function xmlSerialize(Writer $writer): void - { - if ($this->note !== null) { - $writer->write([ Schema::CBC . 'Note' => $this->note ]); - } - - if ($this->settlementDiscountPercent !== null) { - $writer->write([ Schema::CBC . 'SettlementDiscountPercent' => $this->settlementDiscountPercent ]); - } - - if ($this->amount !== null) { - $writer->write([ - [ - 'name' => Schema::CBC . 'Amount', - 'value' => NumberFormatter::format($this->amount, 2), - 'attributes' => [ - 'currencyID' => 'EUR' - ] - ] - ]); - } - - if ($this->settlementPeriod !== null) { - $writer->write([ Schema::CAC . 'SettlementPeriod' => $this->settlementPeriod ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/Price.php b/vendor/num-num/ubl-invoice/src/Price.php deleted file mode 100644 index d454b413d..000000000 --- a/vendor/num-num/ubl-invoice/src/Price.php +++ /dev/null @@ -1,145 +0,0 @@ -priceAmount; - } - - /** - * @param float $priceAmount - * @return Price - */ - public function setPriceAmount(?float $priceAmount): Price - { - $this->priceAmount = $priceAmount; - return $this; - } - - /** - * @return float - */ - public function getBaseQuantity(): ?float - { - return $this->baseQuantity; - } - - /** - * @param float $baseQuantity - * @return Price - */ - public function setBaseQuantity(?float $baseQuantity): Price - { - $this->baseQuantity = $baseQuantity; - return $this; - } - - /** - * @return string - */ - public function getUnitCode(): ?string - { - return $this->unitCode; - } - - /** - * @param string $unitCode - * See also: src/UnitCode.php - * @return Price - */ - public function setUnitCode(?string $unitCode): Price - { - $this->unitCode = $unitCode; - return $this; - } - - - /** - * @return string - */ - public function getUnitCodeListId(): ?string - { - return $this->unitCodeListId; - } - - /** - * @param string $unitCodeListId - * @return Price - */ - public function setUnitCodeListId(?string $unitCodeListId): Price - { - $this->unitCodeListId = $unitCodeListId; - return $this; - } - - /** - * @return AllowanceCharge - */ - public function getAllowanceCharge(): ?AllowanceCharge - { - return $this->allowanceCharge; - } - - /** - * @param AllowanceCharge $allowanceCharge - * @return Price - */ - public function setAllowanceCharge(?AllowanceCharge $allowanceCharge): Price - { - $this->allowanceCharge = $allowanceCharge; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $baseQuantityAttributes = [ - 'unitCode' => $this->unitCode, - ]; - - if (!empty($this->getUnitCodeListId())) { - $baseQuantityAttributes['unitCodeListID'] = $this->getUnitCodeListId(); - } - - $writer->write([ - [ - 'name' => Schema::CBC . 'PriceAmount', - 'value' => NumberFormatter::format($this->priceAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ], - [ - 'name' => Schema::CBC . 'BaseQuantity', - 'value' => NumberFormatter::format($this->baseQuantity), - 'attributes' => $baseQuantityAttributes - ] - ]); - - if ($this->allowanceCharge !== null) { - $writer->write([ - Schema::CAC . 'AllowanceCharge' => $this->allowanceCharge, - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/ProjectReference.php b/vendor/num-num/ubl-invoice/src/ProjectReference.php deleted file mode 100644 index a6e3d16c9..000000000 --- a/vendor/num-num/ubl-invoice/src/ProjectReference.php +++ /dev/null @@ -1,43 +0,0 @@ -id; - } - - /** - * @param string $id - * @return ProjectReference - */ - public function setId(string $id): ProjectReference - { - $this->id = $id; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - if ($this->id !== null) { - $writer->write([Schema::CBC . 'ID' => $this->id]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/Schema.php b/vendor/num-num/ubl-invoice/src/Schema.php deleted file mode 100644 index 4a5097864..000000000 --- a/vendor/num-num/ubl-invoice/src/Schema.php +++ /dev/null @@ -1,9 +0,0 @@ -startDate; - } - - /** - * @param DateTime $startDate - * @return SettlementPeriod - */ - public function setStartDate(DateTime $startDate): SettlementPeriod - { - $this->startDate = $startDate; - return $this; - } - - /** - * @return DateTime - */ - public function getEndDate(): ?DateTime - { - return $this->endDate; - } - - /** - * @param DateTime $endDate - * @return SettlementPeriod - */ - public function setEndDate(DateTime $endDate): SettlementPeriod - { - $this->endDate = $endDate; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->startDate === null) { - throw new InvalidArgumentException('Missing startDate'); - } - if ($this->endDate === null) { - throw new InvalidArgumentException('Missing endDate'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([ - Schema::CBC . 'StartDate' => $this->startDate->format('Y-m-d'), - Schema::CBC . 'EndDate' => $this->endDate->format('Y-m-d'), - ]); - - $writer->write([ - [ - 'name' => Schema::CBC . 'DurationMeasure', - 'value' => $this->endDate->diff($this->startDate)->format('%d'), - 'attributes' => [ - 'unitCode' => 'DAY' - ] - ] - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/TaxCategory.php b/vendor/num-num/ubl-invoice/src/TaxCategory.php deleted file mode 100644 index a8c1c6bc4..000000000 --- a/vendor/num-num/ubl-invoice/src/TaxCategory.php +++ /dev/null @@ -1,208 +0,0 @@ - UNCL5305::UNCL5305, - 'schemeName' => 'Duty or tax or fee category' - ]; - private $name; - private $percent; - private $taxScheme; - private $taxExemptionReason; - private $taxExemptionReasonCode; - - /** - * @return string - */ - public function getId(): ?string - { - if (!empty($this->id)) { - return $this->id; - } - - // Default behaviour, overrrule by using setId() - if ($this->getPercent() !== null) { - return ($this->getPercent() > 0) - ? UNCL5305::STANDARD_RATE - : UNCL5305::ZERO_RATED_GOODS; - } - - return null; - } - - /** - * @param string $id - * @param array $attributes - * @return TaxCategory - */ - public function setId(?string $id, $attributes = null): TaxCategory - { - $this->id = $id; - if (isset($attributes)) { - $this->idAttributes = $attributes; - } - return $this; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param string $name - * @return TaxCategory - */ - public function setName(?string $name): TaxCategory - { - $this->name = $name; - return $this; - } - - /** - * @return string - */ - public function getPercent(): ?float - { - return $this->percent; - } - - /** - * @param string $percent - * @return TaxCategory - */ - public function setPercent(?float $percent): TaxCategory - { - $this->percent = $percent; - return $this; - } - - /** - * @return string - */ - public function getTaxScheme(): ?TaxScheme - { - return $this->taxScheme; - } - - /** - * @param TaxScheme $taxScheme - * @return TaxCategory - */ - public function setTaxScheme(?TaxScheme $taxScheme): TaxCategory - { - $this->taxScheme = $taxScheme; - return $this; - } - - /** - * @return string - */ - public function getTaxExemptionReason(): ?string - { - return $this->taxExemptionReason; - } - - /** - * @param string $taxExemptionReason - * @return TaxCategory - */ - public function setTaxExemptionReason(?string $taxExemptionReason): TaxCategory - { - $this->taxExemptionReason = $taxExemptionReason; - return $this; - } - - /** - * @return string - */ - public function getTaxExemptionReasonCode(): ?string - { - return $this->taxExemptionReasonCode; - } - - /** - * @param string $taxExemptionReason - * @return TaxCategory - */ - public function setTaxExemptionReasonCode(?string $taxExemptionReasonCode): TaxCategory - { - $this->taxExemptionReasonCode = $taxExemptionReasonCode; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->getId() === null) { - throw new InvalidArgumentException('Missing taxcategory id'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([ - [ - 'name' => Schema::CBC . 'ID', - 'value' => $this->getId(), - 'attributes' => $this->idAttributes, - ], - ]); - - if ($this->name !== null) { - $writer->write([ - Schema::CBC . 'Name' => $this->name, - ]); - } - if ($this->percent !== null) { - $writer->write([ - Schema::CBC . 'Percent' => number_format($this->percent, 2, '.', ''), - ]); - } - - if ($this->taxExemptionReasonCode !== null) { - $writer->write([ - Schema::CBC . 'TaxExemptionReasonCode' => $this->taxExemptionReasonCode, - ]); - } - - if ($this->taxExemptionReason !== null) { - $writer->write([ - Schema::CBC . 'TaxExemptionReason' => $this->taxExemptionReason, - ]); - } - - if ($this->taxScheme !== null) { - $writer->write([Schema::CAC . 'TaxScheme' => $this->taxScheme]); - } else { - $writer->write([ - Schema::CAC . 'TaxScheme' => null, - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/TaxScheme.php b/vendor/num-num/ubl-invoice/src/TaxScheme.php deleted file mode 100644 index 5229eb1b6..000000000 --- a/vendor/num-num/ubl-invoice/src/TaxScheme.php +++ /dev/null @@ -1,114 +0,0 @@ -id; - } - - /** - * @param string $id - * @return TaxScheme - */ - public function setId(string $id): TaxScheme - { - $this->id = $id; - return $this; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param string $name - * @return TaxScheme - */ - public function setName(?string $name) - { - $this->name = $name; - return $this; - } - - /** - * @return string - */ - public function getTaxTypeCode(): ?string - { - return $this->taxTypeCode; - } - - /** - * @param string $taxTypeCode - * @return TaxScheme - */ - public function setTaxTypeCode(?string $taxTypeCode) - { - $this->taxTypeCode = $taxTypeCode; - return $this; - } - - /** - * @return string - */ - public function getCurrencyCode(): ?string - { - return $this->currencyCode; - } - - /** - * @param string $currencyCode - * @return TaxScheme - */ - public function setCurrencyCode(?string $currencyCode) - { - $this->currencyCode = $currencyCode; - return $this; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $writer->write([ - Schema::CBC . 'ID' => $this->id - ]); - if ($this->name !== null) { - $writer->write([ - Schema::CBC . 'Name' => $this->name - ]); - } - if ($this->taxTypeCode !== null) { - $writer->write([ - Schema::CBC . 'TaxTypeCode' => $this->taxTypeCode - ]); - } - if ($this->currencyCode !== null) { - $writer->write([ - Schema::CBC . 'CurrencyCode' => $this->currencyCode - ]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/TaxSubTotal.php b/vendor/num-num/ubl-invoice/src/TaxSubTotal.php deleted file mode 100644 index 022374b83..000000000 --- a/vendor/num-num/ubl-invoice/src/TaxSubTotal.php +++ /dev/null @@ -1,146 +0,0 @@ -taxableAmount; - } - - /** - * @param mixed $taxableAmount - * @return TaxSubTotal - */ - public function setTaxableAmount(?float $taxableAmount): TaxSubTotal - { - $this->taxableAmount = $taxableAmount; - return $this; - } - - /** - * @return mixed - */ - public function getTaxAmount(): ?float - { - return $this->taxAmount; - } - - /** - * @param mixed $taxAmount - * @return TaxSubTotal - */ - public function setTaxAmount(?float $taxAmount): TaxSubTotal - { - $this->taxAmount = $taxAmount; - return $this; - } - - /** - * @return TaxCategory - */ - public function getTaxCategory(): ?TaxCategory - { - return $this->taxCategory; - } - - /** - * @param TaxCategory $taxCategory - * @return TaxSubTotal - */ - public function setTaxCategory(TaxCategory $taxCategory): TaxSubTotal - { - $this->taxCategory = $taxCategory; - return $this; - } - - /** - * @return float - */ - public function getPercent(): ?float - { - return $this->percent; - } - - /** - * @param float $percent - * @return TaxSubTotal - */ - public function setPercent(?float $percent): TaxSubTotal - { - $this->percent = $percent; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->taxableAmount === null) { - throw new InvalidArgumentException('Missing taxsubtotal taxableAmount'); - } - - if ($this->taxAmount === null) { - throw new InvalidArgumentException('Missing taxsubtotal taxamount'); - } - - if ($this->taxCategory === null) { - throw new InvalidArgumentException('Missing taxsubtotal taxcategory'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([ - [ - 'name' => Schema::CBC . 'TaxableAmount', - 'value' => NumberFormatter::format($this->taxableAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ], - [ - 'name' => Schema::CBC . 'TaxAmount', - 'value' => NumberFormatter::format($this->taxAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ] - ]); - - if ($this->percent !== null) { - $writer->write([ - Schema::CBC . 'Percent' => $this->percent - ]); - } - - $writer->write([ - Schema::CAC . 'TaxCategory' => $this->taxCategory - ]); - } -} diff --git a/vendor/num-num/ubl-invoice/src/TaxTotal.php b/vendor/num-num/ubl-invoice/src/TaxTotal.php deleted file mode 100644 index b8f37bc72..000000000 --- a/vendor/num-num/ubl-invoice/src/TaxTotal.php +++ /dev/null @@ -1,87 +0,0 @@ -taxAmount; - } - - /** - * @param mixed $taxAmount - * @return TaxTotal - */ - public function setTaxAmount(?float $taxAmount): TaxTotal - { - $this->taxAmount = $taxAmount; - return $this; - } - - /** - * @return array - */ - public function getTaxSubTotals(): array - { - return $this->taxSubTotals; - } - - /** - * @param TaxSubTotal $taxSubTotal - * @return TaxTotal - */ - public function addTaxSubTotal(TaxSubTotal $taxSubTotal): TaxTotal - { - $this->taxSubTotals[] = $taxSubTotal; - return $this; - } - - /** - * The validate function that is called during xml writing to valid the data of the object. - * - * @throws InvalidArgumentException An error with information about required data that is missing to write the XML - * @return void - */ - public function validate() - { - if ($this->taxAmount === null) { - throw new InvalidArgumentException('Missing taxtotal taxamount'); - } - } - - /** - * The xmlSerialize method is called during xml writing. - * @param Writer $writer - * @return void - */ - public function xmlSerialize(Writer $writer): void - { - $this->validate(); - - $writer->write([ - [ - 'name' => Schema::CBC . 'TaxAmount', - 'value' => NumberFormatter::format($this->taxAmount, 2), - 'attributes' => [ - 'currencyID' => Generator::$currencyID - ] - ], - ]); - - foreach ($this->taxSubTotals as $taxSubTotal) { - $writer->write([Schema::CAC . 'TaxSubtotal' => $taxSubTotal]); - } - } -} diff --git a/vendor/num-num/ubl-invoice/src/UNCL4461.php b/vendor/num-num/ubl-invoice/src/UNCL4461.php deleted file mode 100644 index 5e8038afb..000000000 --- a/vendor/num-num/ubl-invoice/src/UNCL4461.php +++ /dev/null @@ -1,93 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID') - ->setBuyersItemIdentification('BUYERID'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // Invoice Line(s) - $creditNoteLine = (new \NumNum\UBL\CreditNoteLine()) - ->setId(0) - ->setItem($productItem) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $creditNoteLines = [$creditNoteLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - $billingReference = (new \NumNum\UBL\BillingReference()) - ->setInvoiceDocumentReference((new \NumNum\UBL\InvoiceDocumentReference()) - ->setOriginalInvoiceId(1234) - ->setIssueDate(new \DateTime())); - - - // Invoice object - $creditNote = (new \NumNum\UBL\CreditNote()) - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setBillingReference($billingReference) - ->setCreditNoteLines($creditNoteLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal) - ->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::CREDIT_NOTE); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->creditNote($creditNote); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/SimpleCreditNoteTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/ContractDocumentReferenceTest.php b/vendor/num-num/ubl-invoice/tests/ContractDocumentReferenceTest.php deleted file mode 100644 index c5935f71c..000000000 --- a/vendor/num-num/ubl-invoice/tests/ContractDocumentReferenceTest.php +++ /dev/null @@ -1,128 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // Invoice Line(s) - $invoiceLine = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines = [$invoiceLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - $contractDocumentReference = (new \NumNum\UBL\ContractDocumentReference()) - ->setId("123Test"); - - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime('-31 days')) - ->setEndDate(new \DateTime()); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setUBLVersionID('2.2') - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE) - ->setDueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal) - ->setContractDocumentReference($contractDocumentReference) - ->setBuyerReference("SomeReference") - ->setInvoicePeriod($invoicePeriod); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/ContractDocumentReferenceTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/DocumentTypeTest.php b/vendor/num-num/ubl-invoice/tests/DocumentTypeTest.php deleted file mode 100644 index 1cd711206..000000000 --- a/vendor/num-num/ubl-invoice/tests/DocumentTypeTest.php +++ /dev/null @@ -1,158 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client contact node - $clientContact = (new \NumNum\UBL\Contact()) - ->setName('Client name') - ->setElectronicMail('email@client.com') - ->setTelephone('0032 472 123 456') - ->setTelefax('0032 9 1234 567'); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address) - ->setContact($clientContact); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLines = []; - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCost('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCostCode('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Attachment - $attachment = (new \NumNum\UBL\Attachment()) - ->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf'); - - $additionalDocumentReference = new \NumNum\UBL\AdditionalDocumentReference(); - $additionalDocumentReference->setId('SomeID'); - $additionalDocumentReference->setDocumentType("CommercialInvoice"); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setSupplierAssignedAccountID('10001') - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal) - ->setAdditionalDocumentReference($additionalDocumentReference); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/EmptyAttachmentTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/DueDateTest.php b/vendor/num-num/ubl-invoice/tests/DueDateTest.php deleted file mode 100644 index 6f4459ecf..000000000 --- a/vendor/num-num/ubl-invoice/tests/DueDateTest.php +++ /dev/null @@ -1,118 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // Invoice Line(s) - $invoiceLine = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines = [$invoiceLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setUBLVersionID('2.2') - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE) - ->setDueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/DueDateTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/EN16931Test.php b/vendor/num-num/ubl-invoice/tests/EN16931Test.php deleted file mode 100644 index 6be1d8d55..000000000 --- a/vendor/num-num/ubl-invoice/tests/EN16931Test.php +++ /dev/null @@ -1,202 +0,0 @@ -setId('VAT'); - - // Address country - $country = (new \NumNum\UBL\Country()) - ->setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt 1') - ->setAdditionalStreetName('Building A') - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - $financialInstitutionBranch = (new \NumNum\UBL\FinancialInstitutionBranch()) - ->setId('RABONL2U'); - - $payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount()) - ->setFinancialInstitutionBranch($financialInstitutionBranch) - ->setName('Customer Account Holder') - ->setId('NL00RABO0000000000'); - - $paymentMeans = (new \NumNum\UBL\PaymentMeans()) - ->setPayeeFinancialAccount($payeeFinancialAccount) - ->setPaymentMeansCode(UNCL4461::DEBIT_TRANSFER, []) - ->setPaymentId('our invoice 1234'); - - // Supplier company node - $supplierLegalEntity = (new \NumNum\UBL\LegalEntity()) - ->setRegistrationName('Supplier Company Name') - ->setCompanyId('BE123456789'); - - $supplierPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme()) - ->setTaxScheme($taxScheme) - ->setCompanyId('BE123456789'); - - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setLegalEntity($supplierLegalEntity) - ->setPartyTaxScheme($supplierPartyTaxScheme) - ->setPartyIdentificationId('BE123456789') - ->setPostalAddress($address); - - // Client company node - $clientLegalEntity = (new \NumNum\UBL\LegalEntity()) - ->setRegistrationName('Client Company Name') - ->setCompanyId('Client Company Registration'); - - $clientPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme()) - ->setTaxScheme($taxScheme) - ->setCompanyId('BE123456789'); - - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('Client Company Name') - ->setLegalEntity($clientLegalEntity) - ->setPartyTaxScheme($clientPartyTaxScheme) - ->setPartyIdentificationId('BE123456789') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2.1) - ->setPayableRoundingAmount(0) - ->setTaxInclusiveAmount(10 + 2.1) - ->setLineExtensionAmount(10) - ->setTaxExclusiveAmount(10); - - $classifiedTaxCategory = (new \NumNum\UBL\ClassifiedTaxCategory()) - ->setId('S') - ->setPercent(21.00) - ->setTaxScheme($taxScheme); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setClassifiedTaxCategory($classifiedTaxCategory) - ->setDescription('Product Description'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLine = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setPrice($price) - ->setInvoicePeriod($invoicePeriod) - ->setLineExtensionAmount(10) - ->setInvoicedQuantity(1); - - $invoiceLines = [$invoiceLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId('S', []) - ->setPercent(21.00) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Payment Terms - $paymentTerms = (new \NumNum\UBL\PaymentTerms()) - ->setNote('30 days net'); - - // Delivery - $deliveryLocation = (new \NumNum\UBL\Address()) - ->setCountry($country); - - $delivery = (new \NumNum\UBL\Delivery()) - ->setActualDeliveryDate(new \DateTime()) - ->setDeliveryLocation($deliveryLocation); - - $orderReference = (new \NumNum\UBL\OrderReference()) - ->setId('5009567') - ->setSalesOrderId('tRST-tKhM'); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setCustomizationID('urn:cen.eu:en16931:2017') - ->setId(1234) - ->setIssueDate(new \DateTime()) - ->setNote('invoice note') - ->setDelivery($delivery) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setPaymentTerms($paymentTerms) - ->setInvoicePeriod($invoicePeriod) - ->setPaymentMeans([$paymentMeans]) - ->setBuyerReference('BUYER_REF') - ->setOrderReference($orderReference) - ->setTaxTotal($taxTotal); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/EN16931Test.xml'); - - // $this->assertEquals(true, $dom->schemaValidate($this->schema)); - - // Use webservice at peppol.helger.com to verify the result - $wsdl = "http://peppol.helger.com/wsdvs?wsdl=1"; - $client = new \SoapClient($wsdl); - $response = $client->validate(['XML' => $outputXMLString, 'VESID' => 'eu.cen.en16931:ubl:1.3.1']); - - // Output validation warnings if present - if ($response->mostSevereErrorLevel == 'WARN' && isset($response->Result[1]->Item)) { - foreach ($response->Result[1]->Item as $responseWarning) { - // fwrite(STDERR, '*** '.$responseWarning->errorText."\n"); - fwrite(STDERR, '*** '.json_encode($responseWarning)."\n"); - } - } - - $this->assertEquals('SUCCESS', $response->mostSevereErrorLevel); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/EmptyAttachmentTest.php b/vendor/num-num/ubl-invoice/tests/EmptyAttachmentTest.php deleted file mode 100644 index 986d2209c..000000000 --- a/vendor/num-num/ubl-invoice/tests/EmptyAttachmentTest.php +++ /dev/null @@ -1,161 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client contact node - $clientContact = (new \NumNum\UBL\Contact()) - ->setName('Client name') - ->setElectronicMail('email@client.com') - ->setTelephone('0032 472 123 456') - ->setTelefax('0032 9 1234 567'); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address) - ->setContact($clientContact); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLines = []; - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCost('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCostCode('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Attachment - $attachment = (new \NumNum\UBL\Attachment()) - ->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf'); - - $additionalDocumentReference = new \NumNum\UBL\AdditionalDocumentReference(); - $additionalDocumentReference->setId('SomeID'); - $additionalDocumentReference->setDocumentTypeCode(130); - - // Not adding an attachment to AdditionalDocumentReference should not trigger an error - // $additionalDocumentReference->setAttachment($attachment); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setSupplierAssignedAccountID('10001') - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal) - ->setAdditionalDocumentReference($additionalDocumentReference); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/EmptyAttachmentTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/MultiplePaymentMeansTest.php b/vendor/num-num/ubl-invoice/tests/MultiplePaymentMeansTest.php deleted file mode 100644 index 3ed3d326c..000000000 --- a/vendor/num-num/ubl-invoice/tests/MultiplePaymentMeansTest.php +++ /dev/null @@ -1,171 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client contact node - $clientContact = (new \NumNum\UBL\Contact()) - ->setName('Client name') - ->setElectronicMail('email@client.com') - ->setTelephone('0032 472 123 456') - ->setTelefax('0032 9 1234 567'); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address) - ->setContact($clientContact); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - $commodityClassification = (new \NumNum\UBL\CommodityClassification()) - ->setItemClassificationCode('123456') - ->setItemClassificationListId('urn:ean.ucc:eanucc:2:2') - ->setItemClassificationListVersionId('16'); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID') - ->setCommodityClassification($commodityClassification); - - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLines = []; - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCost('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCostCode('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - $paymentMeans = []; - - $payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount)->setId('RO123456789012345'); - $paymentMeans[] = (new \NumNum\UBL\PaymentMeans()) - ->setPaymentMeansCode(31) - ->setPaymentDueDate(new \DateTime()) - ->setPayeeFinancialAccount($payeeFinancialAccount); - - $payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount)->setId('RO544456789067890'); - $paymentMeans[] = (new \NumNum\UBL\PaymentMeans()) - ->setPaymentMeansCode(31) - ->setPaymentDueDate(new \DateTime()) - ->setPayeeFinancialAccount($payeeFinancialAccount); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setSupplierAssignedAccountID('10001') - ->setPaymentMeans($paymentMeans) - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/MultiplePaymentMeansTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/NumberFormatterTest.php b/vendor/num-num/ubl-invoice/tests/NumberFormatterTest.php deleted file mode 100644 index c195c12d6..000000000 --- a/vendor/num-num/ubl-invoice/tests/NumberFormatterTest.php +++ /dev/null @@ -1,35 +0,0 @@ -assertEqualsCanonicalizing($formattedNumber, $result); - } - - public function formattedNumbersProvider(): array - { - return [ - [0.0, '0', null], - [0.1, '0.1', null], - [0.1200500, '0.12005', null], - [1.2345678, '1.2345678', null], - [1.236789, '1.236789', null], - [1.236789, '1.24', 2], - [1, '1.00', 2], - [1.000, '1', null], - ]; - } -} diff --git a/vendor/num-num/ubl-invoice/tests/PartyIdentificationSchemeNameTest.php b/vendor/num-num/ubl-invoice/tests/PartyIdentificationSchemeNameTest.php deleted file mode 100644 index dc5737459..000000000 --- a/vendor/num-num/ubl-invoice/tests/PartyIdentificationSchemeNameTest.php +++ /dev/null @@ -1,128 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address) - ->setPartyIdentificationSchemeName("SomeScheme"); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // Invoice Line(s) - $invoiceLine = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines = [$invoiceLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - $contractDocumentReference = (new \NumNum\UBL\ContractDocumentReference()) - ->setId("123Test"); - - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime('-31 days')) - ->setEndDate(new \DateTime()); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setUBLVersionID('2.2') - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE) - ->setDueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal) - ->setContractDocumentReference($contractDocumentReference) - ->setBuyerReference("SomeReference") - ->setInvoicePeriod($invoicePeriod); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/PartyIdentificationSchemeNameTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/ProjectReferenceTest.php b/vendor/num-num/ubl-invoice/tests/ProjectReferenceTest.php deleted file mode 100644 index 33c2dde81..000000000 --- a/vendor/num-num/ubl-invoice/tests/ProjectReferenceTest.php +++ /dev/null @@ -1,192 +0,0 @@ -setId('VAT'); - - // Address country - $country = (new \NumNum\UBL\Country()) - ->setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt 1') - ->setAdditionalStreetName('Building A') - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - $financialInstitutionBranch = (new \NumNum\UBL\FinancialInstitutionBranch()) - ->setId('RABONL2U'); - - $payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount()) - ->setFinancialInstitutionBranch($financialInstitutionBranch) - ->setName('Customer Account Holder') - ->setId('NL00RABO0000000000'); - - $paymentMeans = (new \NumNum\UBL\PaymentMeans()) - ->setPayeeFinancialAccount($payeeFinancialAccount) - ->setPaymentMeansCode(UNCL4461::DEBIT_TRANSFER, []) - ->setPaymentId('our invoice 1234'); - - // Supplier company node - $supplierLegalEntity = (new \NumNum\UBL\LegalEntity()) - ->setRegistrationName('Supplier Company Name') - ->setCompanyId('BE123456789'); - - $supplierPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme()) - ->setTaxScheme($taxScheme) - ->setCompanyId('BE123456789'); - - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setLegalEntity($supplierLegalEntity) - ->setPartyTaxScheme($supplierPartyTaxScheme) - ->setPartyIdentificationId('BE123456789') - ->setPostalAddress($address); - - // Client company node - $clientLegalEntity = (new \NumNum\UBL\LegalEntity()) - ->setRegistrationName('Client Company Name') - ->setCompanyId('Client Company Registration'); - - $clientPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme()) - ->setTaxScheme($taxScheme) - ->setCompanyId('BE123456789'); - - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('Client Company Name') - ->setLegalEntity($clientLegalEntity) - ->setPartyTaxScheme($clientPartyTaxScheme) - ->setPartyIdentificationId('BE123456789') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2.1) - ->setAllowanceTotalAmount(0) - ->setTaxInclusiveAmount(10 + 2.1) - ->setLineExtensionAmount(10) - ->setTaxExclusiveAmount(10); - - $classifiedTaxCategory = (new \NumNum\UBL\ClassifiedTaxCategory()) - ->setId('S') - ->setPercent(21.00) - ->setTaxScheme($taxScheme); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setClassifiedTaxCategory($classifiedTaxCategory) - ->setDescription('Product Description'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLine = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setPrice($price) - ->setInvoicePeriod($invoicePeriod) - ->setLineExtensionAmount(10) - ->setInvoicedQuantity(1); - - $invoiceLines = [$invoiceLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId('S', []) - ->setPercent(21.00) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Payment Terms - $paymentTerms = (new \NumNum\UBL\PaymentTerms()) - ->setNote('30 days net'); - - // Delivery - $deliveryLocation = (new \NumNum\UBL\Address()) - ->setCountry($country); - - $delivery = (new \NumNum\UBL\Delivery()) - ->setActualDeliveryDate(new \DateTime()) - ->setDeliveryLocation($deliveryLocation); - - $orderReference = (new \NumNum\UBL\OrderReference()) - ->setId('5009567') - ->setSalesOrderId('tRST-tKhM'); - - // Test Project Reference - $projectReference = (new \NumNum\UBL\ProjectReference()) - ->setId('Project1234'); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setCustomizationID('urn:cen.eu:en16931:2017') - ->setId(1234) - ->setIssueDate(new \DateTime()) - ->setNote('invoice note') - ->setDelivery($delivery) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setPaymentTerms($paymentTerms) - ->setInvoicePeriod($invoicePeriod) - ->setPaymentMeans([$paymentMeans]) - ->setBuyerReference('BUYER_REF') - ->setOrderReference($orderReference) - ->setTaxTotal($taxTotal) - ->setProjectReference($projectReference); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/ProjectReferenceTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/SampleInvoice.pdf b/vendor/num-num/ubl-invoice/tests/SampleInvoice.pdf deleted file mode 100644 index f4cbb2086..000000000 Binary files a/vendor/num-num/ubl-invoice/tests/SampleInvoice.pdf and /dev/null differ diff --git a/vendor/num-num/ubl-invoice/tests/SimpleCreditNoteTest.php b/vendor/num-num/ubl-invoice/tests/SimpleCreditNoteTest.php deleted file mode 100644 index a64745e19..000000000 --- a/vendor/num-num/ubl-invoice/tests/SimpleCreditNoteTest.php +++ /dev/null @@ -1,117 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID') - ->setBuyersItemIdentification('BUYERID'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // Invoice Line(s) - $creditNoteLine = (new \NumNum\UBL\CreditNoteLine()) - ->setId(0) - ->setItem($productItem) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $creditNoteLines = [$creditNoteLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Invoice object - $creditNote = (new \NumNum\UBL\CreditNote()) - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setCreditNoteLines($creditNoteLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal) - ->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::CREDIT_NOTE); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->creditNote($creditNote); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/SimpleCreditNoteTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/SimpleInvoiceTest.php b/vendor/num-num/ubl-invoice/tests/SimpleInvoiceTest.php deleted file mode 100644 index 69dc4dd3e..000000000 --- a/vendor/num-num/ubl-invoice/tests/SimpleInvoiceTest.php +++ /dev/null @@ -1,155 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client contact node - $clientContact = (new \NumNum\UBL\Contact()) - ->setName('Client name') - ->setElectronicMail('email@client.com') - ->setTelephone('0032 472 123 456') - ->setTelefax('0032 9 1234 567'); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address) - ->setContact($clientContact); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLines = []; - - $orderLineReference = (new \NumNum\UBL\OrderLineReference) - ->setLineId('#ABC123'); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCost('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCostCode('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setSupplierAssignedAccountID('10001') - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/SimpleInvoiceTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/SimpleInvoiceWithFilePathPdfTest.php b/vendor/num-num/ubl-invoice/tests/SimpleInvoiceWithFilePathPdfTest.php deleted file mode 100644 index db47460cb..000000000 --- a/vendor/num-num/ubl-invoice/tests/SimpleInvoiceWithFilePathPdfTest.php +++ /dev/null @@ -1,162 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client contact node - $clientContact = (new \NumNum\UBL\Contact()) - ->setName('Client name') - ->setElectronicMail('email@client.com') - ->setTelephone('0032 472 123 456') - ->setTelefax('0032 9 1234 567'); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address) - ->setContact($clientContact); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLines = []; - - $orderLineReference = (new \NumNum\UBL\OrderLineReference) - ->setLineId('#ABC123'); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCost('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCostCode('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - $attachment = (new \NumNum\UBL\Attachment()) - ->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf'); - - $additionalDocumentReference = (new \NumNum\UBL\AdditionalDocumentReference()) - ->setAttachment($attachment); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setId(1234) - ->setAdditionalDocumentReference($additionalDocumentReference) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setSupplierAssignedAccountID('10001') - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/SimpleInvoiceWithFilePathPdfTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/SimpleInvoiceWithInlinePdfTest.php b/vendor/num-num/ubl-invoice/tests/SimpleInvoiceWithInlinePdfTest.php deleted file mode 100644 index bc11eeb38..000000000 --- a/vendor/num-num/ubl-invoice/tests/SimpleInvoiceWithInlinePdfTest.php +++ /dev/null @@ -1,167 +0,0 @@ -setIdentificationCode('BE'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client contact node - $clientContact = (new \NumNum\UBL\Contact()) - ->setName('Client name') - ->setElectronicMail('email@client.com') - ->setTelephone('0032 472 123 456') - ->setTelefax('0032 9 1234 567'); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address) - ->setContact($clientContact); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description') - ->setSellersItemIdentification('SELLERID'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // InvoicePeriod - $invoicePeriod = (new \NumNum\UBL\InvoicePeriod()) - ->setStartDate(new \DateTime()); - - // Invoice Line(s) - $invoiceLines = []; - - $orderLineReference = (new \NumNum\UBL\OrderLineReference) - ->setLineId('#ABC123'); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCost('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - $invoiceLines[] = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setInvoicePeriod($invoicePeriod) - ->setPrice($price) - ->setAccountingCostCode('Product 123') - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1) - ->setOrderLineReference($orderLineReference); - - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Example if you have some inline or in-memory filestream/file contents - $fileStream = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf'); // this would be your file contents - - $base64EncodedFileStream = base64_encode($fileStream); - - $attachment = (new \NumNum\UBL\Attachment()) - ->setFileStream($base64EncodedFileStream, 'Invoice.pdf', 'application/pdf'); - - $additionalDocumentReference = (new \NumNum\UBL\AdditionalDocumentReference()) - ->setAttachment($attachment); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setId(1234) - ->setAdditionalDocumentReference($additionalDocumentReference) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setSupplierAssignedAccountID('10001') - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/SimpleInvoiceWithInlinePdfTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/num-num/ubl-invoice/tests/SimpleUBL22InvoiceTest.php b/vendor/num-num/ubl-invoice/tests/SimpleUBL22InvoiceTest.php deleted file mode 100644 index 458294c87..000000000 --- a/vendor/num-num/ubl-invoice/tests/SimpleUBL22InvoiceTest.php +++ /dev/null @@ -1,119 +0,0 @@ -setIdentificationCode('BE') - ->setListId('ISO3166-1:Alpha2'); - - // Full address - $address = (new \NumNum\UBL\Address()) - ->setStreetName('Korenmarkt') - ->setBuildingNumber(1) - ->setCityName('Gent') - ->setPostalZone('9000') - ->setCountry($country); - - // Supplier company node - $supplierCompany = (new \NumNum\UBL\Party()) - ->setName('Supplier Company Name') - ->setPhysicalLocation($address) - ->setPostalAddress($address); - - // Client company node - $clientCompany = (new \NumNum\UBL\Party()) - ->setName('My client') - ->setPostalAddress($address); - - $legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal()) - ->setPayableAmount(10 + 2) - ->setAllowanceTotalAmount(0); - - // Tax scheme - $taxScheme = (new \NumNum\UBL\TaxScheme()) - ->setId(0); - - // Product - $productItem = (new \NumNum\UBL\Item()) - ->setName('Product Name') - ->setDescription('Product Description'); - - // Price - $price = (new \NumNum\UBL\Price()) - ->setBaseQuantity(1) - ->setUnitCode(\NumNum\UBL\UnitCode::UNIT) - ->setUnitCodeListId('UNECERec20') - ->setPriceAmount(10); - - // Invoice Line tax totals - $lineTaxTotal = (new \NumNum\UBL\TaxTotal()) - ->setTaxAmount(2.1); - - // Invoice Line(s) - $invoiceLine = (new \NumNum\UBL\InvoiceLine()) - ->setId(0) - ->setItem($productItem) - ->setUnitCode('C62') - ->setUnitCodeListID('UNECERec20') - ->setPrice($price) - ->setTaxTotal($lineTaxTotal) - ->setInvoicedQuantity(1); - - $invoiceLines = [$invoiceLine]; - - // Total Taxes - $taxCategory = (new \NumNum\UBL\TaxCategory()) - ->setId(0) - ->setName('VAT21%') - ->setPercent(.21) - ->setTaxScheme($taxScheme); - - $taxSubTotal = (new \NumNum\UBL\TaxSubTotal()) - ->setTaxableAmount(10) - ->setTaxAmount(2.1) - ->setTaxCategory($taxCategory); - - $taxTotal = (new \NumNum\UBL\TaxTotal()) - ->addTaxSubTotal($taxSubTotal) - ->setTaxAmount(2.1); - - // Invoice object - $invoice = (new \NumNum\UBL\Invoice()) - ->setUBLVersionID('2.2') - ->setId(1234) - ->setCopyIndicator(false) - ->setIssueDate(new \DateTime()) - ->setAccountingSupplierParty($supplierCompany) - ->setAccountingCustomerParty($clientCompany) - ->setInvoiceLines($invoiceLines) - ->setLegalMonetaryTotal($legalMonetaryTotal) - ->setTaxTotal($taxTotal); - - // Test created object - // Use \NumNum\UBL\Generator to generate an XML string - $generator = new \NumNum\UBL\Generator(); - $outputXMLString = $generator->invoice($invoice); - - // Create PHP Native DomDocument object, that can be - // used to validate the generate XML - $dom = new \DOMDocument; - $dom->loadXML($outputXMLString); - - $dom->save('./tests/SimpleUBL22InvoiceTest.xml'); - - $this->assertEquals(true, $dom->schemaValidate($this->schema)); - } -} diff --git a/vendor/sabre/uri/LICENSE b/vendor/sabre/uri/LICENSE deleted file mode 100644 index ae2c99290..000000000 --- a/vendor/sabre/uri/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (C) 2014-2019 fruux GmbH (https://fruux.com/) - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name Sabre nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/sabre/uri/composer.json b/vendor/sabre/uri/composer.json deleted file mode 100644 index 2d26c23b1..000000000 --- a/vendor/sabre/uri/composer.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "sabre/uri", - "description": "Functions for making sense out of URIs.", - "keywords": [ - "URI", - "URL", - "rfc3986" - ], - "homepage": "http://sabre.io/uri/", - "license": "BSD-3-Clause", - "require": { - "php": "^7.4 || ^8.0" - }, - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - } - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "source": "https://github.com/fruux/sabre-uri" - }, - "autoload": { - "files" : [ - "lib/functions.php" - ], - "psr-4" : { - "Sabre\\Uri\\" : "lib/" - } - }, - "autoload-dev": { - "psr-4": { - "Sabre\\Uri\\": "tests/Uri" - } - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.64", - "phpstan/phpstan": "^1.12", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-strict-rules": "^1.6", - "phpstan/extension-installer": "^1.4", - "phpunit/phpunit" : "^9.6" - }, - "scripts": { - "phpstan": [ - "phpstan analyse lib tests" - ], - "cs-fixer": [ - "php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - }, - "config": { - "allow-plugins": { - "phpstan/extension-installer": true - } - } -} diff --git a/vendor/sabre/uri/lib/InvalidUriException.php b/vendor/sabre/uri/lib/InvalidUriException.php deleted file mode 100644 index 7f37ca54e..000000000 --- a/vendor/sabre/uri/lib/InvalidUriException.php +++ /dev/null @@ -1,19 +0,0 @@ - 0) { - // If the path starts with a slash - if ('/' === $delta['path'][0]) { - $path = $delta['path']; - } else { - // Removing last component from base path. - $path = (string) $base['path']; - $length = strrpos($path, '/'); - if (false !== $length) { - $path = substr($path, 0, $length); - } - $path .= '/'.$delta['path']; - } - } else { - $path = $base['path'] ?? '/'; - if ('' === $path) { - $path = '/'; - } - } - // Removing .. and . - $pathParts = explode('/', $path); - $newPathParts = []; - foreach ($pathParts as $pathPart) { - switch ($pathPart) { - // case '' : - case '.': - break; - case '..': - array_pop($newPathParts); - break; - default: - $newPathParts[] = $pathPart; - break; - } - } - - $path = implode('/', $newPathParts); - - // If the source url ended with a /, we want to preserve that. - $newParts['path'] = 0 === strpos($path, '/') ? $path : '/'.$path; - // From PHP 8, no "?" query at all causes 'query' to be null. - // An empty query "http://example.com/foo?" causes 'query' to be the empty string - if (null !== $delta['query'] && '' !== $delta['query']) { - $newParts['query'] = $delta['query']; - } elseif (isset($base['query']) && null === $delta['host'] && null === $delta['path']) { - // Keep the old query if host and path didn't change - $newParts['query'] = $base['query']; - } - // From PHP 8, no "#" fragment at all causes 'fragment' to be null. - // An empty fragment "http://example.com/foo#" causes 'fragment' to be the empty string - if (null !== $delta['fragment'] && '' !== $delta['fragment']) { - $newParts['fragment'] = $delta['fragment']; - } - - return build($newParts); -} - -/** - * Takes a URI or partial URI as its argument, and normalizes it. - * - * After normalizing a URI, you can safely compare it to other URIs. - * This function will for instance convert a %7E into a tilde, according to - * rfc3986. - * - * It will also change a %3a into a %3A. - * - * @throws InvalidUriException - */ -function normalize(string $uri): string -{ - $parts = parse($uri); - - if (null !== $parts['path']) { - $pathParts = explode('/', ltrim($parts['path'], '/')); - $newPathParts = []; - foreach ($pathParts as $pathPart) { - switch ($pathPart) { - case '.': - // skip - break; - case '..': - // One level up in the hierarchy - array_pop($newPathParts); - break; - default: - // Ensuring that everything is correctly percent-encoded. - $newPathParts[] = rawurlencode(rawurldecode($pathPart)); - break; - } - } - $parts['path'] = '/'.implode('/', $newPathParts); - } - - if (null !== $parts['scheme']) { - $parts['scheme'] = strtolower($parts['scheme']); - $defaultPorts = [ - 'http' => '80', - 'https' => '443', - ]; - - if (null !== $parts['port'] && isset($defaultPorts[$parts['scheme']]) && $defaultPorts[$parts['scheme']] == $parts['port']) { - // Removing default ports. - unset($parts['port']); - } - // A few HTTP specific rules. - switch ($parts['scheme']) { - case 'http': - case 'https': - if (null === $parts['path']) { - // An empty path is equivalent to / in http. - $parts['path'] = '/'; - } - break; - } - } - - if (null !== $parts['host']) { - $parts['host'] = strtolower($parts['host']); - } - - return build($parts); -} - -/** - * Parses a URI and returns its individual components. - * - * This method largely behaves the same as PHP's parse_url, except that it will - * return an array with all the array keys, including the ones that are not - * set by parse_url, which makes it a bit easier to work with. - * - * Unlike PHP's parse_url, it will also convert any non-ascii characters to - * percent-encoded strings. PHP's parse_url corrupts these characters on OS X. - * - * In the return array, key "port" is an int value. Other keys have a string value. - * "Unused" keys have value null. - * - * @return array{scheme: string|null, host: string|null, path: string|null, port: positive-int|null, user: string|null, query: string|null, fragment: string|null} - * - * @throws InvalidUriException - */ -function parse(string $uri): array -{ - // Normally a URI must be ASCII. However, often it's not and - // parse_url might corrupt these strings. - // - // For that reason we take any non-ascii characters from the uri and - // uriencode them first. - $uri = preg_replace_callback( - '/[^[:ascii:]]/u', - function ($matches) { - return rawurlencode($matches[0]); - }, - $uri - ); - - if (null === $uri) { - throw new InvalidUriException('Invalid, or could not parse URI'); - } - - $result = parse_url($uri); - if (false === $result) { - $result = _parse_fallback($uri); - } else { - // Add empty host and leading slash to Windows file paths - // file:///C:/path or file:///C:\path - // Note: the regex fragment [a-zA-Z]:[\/\\\\].* end up being - // [a-zA-Z]:[\/\\].* - // The 4 backslash in a row are the way to get 2 backslash into the actual string - // that is used as the regex. The 2 backslash are then the way to get 1 backslash - // character into the character set "a forward slash or a backslash" - if (isset($result['scheme']) && 'file' === $result['scheme'] && isset($result['path']) - && 1 === preg_match('/^(? [a-zA-Z]:([\/\\\\].*)?)$/x', $result['path'])) { - $result['path'] = '/'.$result['path']; - $result['host'] = ''; - } - } - - /* - * phpstan is not able to process all the things that happen while this function - * constructs the result array. It only understands the $result is - * non-empty-array - * - * But the detail of the returned array is correctly specified in the PHPdoc - * above the function call. - * - * @phpstan-ignore-next-line - */ - return - $result + [ - 'scheme' => null, - 'host' => null, - 'path' => null, - 'port' => null, - 'user' => null, - 'query' => null, - 'fragment' => null, - ]; -} - -/** - * This function takes the components returned from PHP's parse_url, and uses - * it to generate a new uri. - * - * @param array $parts - */ -function build(array $parts): string -{ - $uri = ''; - - $authority = ''; - if (isset($parts['host'])) { - $authority = $parts['host']; - if (isset($parts['user'])) { - $authority = $parts['user'].'@'.$authority; - } - if (isset($parts['port'])) { - $authority = $authority.':'.$parts['port']; - } - } - - if (isset($parts['scheme'])) { - // If there's a scheme, there's also a host. - $uri = $parts['scheme'].':'; - } - if ('' !== $authority || (isset($parts['scheme']) && 'file' === $parts['scheme'])) { - // No scheme, but there is a host. - $uri .= '//'.$authority; - } - - if (isset($parts['path'])) { - $uri .= $parts['path']; - } - if (isset($parts['query'])) { - $uri .= '?'.$parts['query']; - } - if (isset($parts['fragment'])) { - $uri .= '#'.$parts['fragment']; - } - - return $uri; -} - -/** - * Returns the 'dirname' and 'basename' for a path. - * - * The reason there is a custom function for this purpose, is because - * basename() is locale aware (behaviour changes if C locale or a UTF-8 locale - * is used) and we need a method that just operates on UTF-8 characters. - * - * In addition basename and dirname are platform aware, and will treat - * backslash (\) as a directory separator on Windows. - * - * This method returns the 2 components as an array. - * - * If there is no dirname, it will return an empty string. Any / appearing at - * the end of the string is stripped off. - * - * @return list - */ -function split(string $path): array -{ - $matches = []; - if (1 === preg_match('/^(?:(?:(.*)(?:\/+))?([^\/]+))(?:\/?)$/u', $path, $matches)) { - return [$matches[1], $matches[2]]; - } - - return [null, null]; -} - -/** - * This function is another implementation of parse_url, except this one is - * fully written in PHP. - * - * The reason is that the PHP bug team is not willing to admit that there are - * bugs in the parse_url implementation. - * - * This function is only called if the main parse method fails. It's pretty - * crude and probably slow, so the original parse_url is usually preferred. - * - * @return array{scheme: string|null, host: string|null, path: string|null, port: positive-int|null, user: string|null, query: string|null, fragment: string|null} - * - * @throws InvalidUriException - */ -function _parse_fallback(string $uri): array -{ - // Normally a URI must be ASCII, however. However, often it's not and - // parse_url might corrupt these strings. - // - // For that reason we take any non-ascii characters from the uri and - // uriencode them first. - $uri = preg_replace_callback( - '/[^[:ascii:]]/u', - function ($matches) { - return rawurlencode($matches[0]); - }, - $uri - ); - - if (null === $uri) { - throw new InvalidUriException('Invalid, or could not parse URI'); - } - - $result = [ - 'scheme' => null, - 'host' => null, - 'port' => null, - 'user' => null, - 'path' => null, - 'fragment' => null, - 'query' => null, - ]; - - if (1 === preg_match('% ^([A-Za-z][A-Za-z0-9+-\.]+): %x', $uri, $matches)) { - $result['scheme'] = $matches[1]; - // Take what's left. - $uri = substr($uri, strlen($result['scheme']) + 1); - if (false === $uri) { - // There was nothing left. - $uri = ''; - } - } - - // Taking off a fragment part - if (false !== strpos($uri, '#')) { - list($uri, $result['fragment']) = explode('#', $uri, 2); - } - // Taking off the query part - if (false !== strpos($uri, '?')) { - list($uri, $result['query']) = explode('?', $uri, 2); - } - - if ('///' === substr($uri, 0, 3)) { - // The triple slash uris are a bit unusual, but we have special handling - // for them. - $path = substr($uri, 2); - if (false === $path) { - throw new \RuntimeException('The string cannot be false'); - } - $result['path'] = $path; - $result['host'] = ''; - } elseif ('//' === substr($uri, 0, 2)) { - // Uris that have an authority part. - $regex = '%^ - // - (?: (? [^:@]+) (: (? [^@]+)) @)? - (? ( [^:/]* | \[ [^\]]+ \] )) - (?: : (? [0-9]+))? - (? / .*)? - $%x'; - if (1 !== preg_match($regex, $uri, $matches)) { - throw new InvalidUriException('Invalid, or could not parse URI'); - } - if (isset($matches['host']) && '' !== $matches['host']) { - $result['host'] = $matches['host']; - } - if (isset($matches['port'])) { - $port = (int) $matches['port']; - if ($port > 0) { - $result['port'] = $port; - } - } - if (isset($matches['path'])) { - $result['path'] = $matches['path']; - } - if (isset($matches['user']) && '' !== $matches['user']) { - $result['user'] = $matches['user']; - } - if (isset($matches['pass']) && '' !== $matches['pass']) { - $result['pass'] = $matches['pass']; - } - } else { - $result['path'] = $uri; - } - - return $result; -} diff --git a/vendor/sabre/xml/LICENSE b/vendor/sabre/xml/LICENSE deleted file mode 100644 index c9faf409b..000000000 --- a/vendor/sabre/xml/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/) - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name Sabre nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/sabre/xml/README.md b/vendor/sabre/xml/README.md deleted file mode 100644 index 9513a892d..000000000 --- a/vendor/sabre/xml/README.md +++ /dev/null @@ -1,26 +0,0 @@ -sabre/xml -========= - -![Build Status](https://github.com/sabre-io/xml/actions/workflows/ci.yml/badge.svg) - -The sabre/xml library is a specialized XML reader and writer. - -Documentation -------------- - -* [Introduction](http://sabre.io/xml/). -* [Installation](http://sabre.io/xml/install/). -* [Reading XML](http://sabre.io/xml/reading/). -* [Writing XML](http://sabre.io/xml/writing/). - -Major version 3 implements type declarations for input parameters, function returns, variables etc. It supports PHP 7.4 and PHP 8. When you upgrade to major version 3, if you extend classes etc., then you will need to make similar type declarations in your code. - -Support -------- - -Head over to the [SabreDAV mailing list](http://groups.google.com/group/sabredav-discuss) for any questions. - -Made at fruux -------------- - -This library is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support. diff --git a/vendor/sabre/xml/composer.json b/vendor/sabre/xml/composer.json deleted file mode 100644 index faf06b3bd..000000000 --- a/vendor/sabre/xml/composer.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "sabre/xml", - "description" : "sabre/xml is an XML library that you may not hate.", - "keywords" : [ "XML", "XMLReader", "XMLWriter", "DOM" ], - "homepage" : "https://sabre.io/xml/", - "license" : "BSD-3-Clause", - "require" : { - "php" : "^7.4 || ^8.0", - "ext-xmlwriter" : "*", - "ext-xmlreader" : "*", - "ext-dom" : "*", - "lib-libxml" : ">=2.6.20", - "sabre/uri" : ">=2.0,<4.0.0" - }, - "authors" : [ - { - "name" : "Evert Pot", - "email" : "me@evertpot.com", - "homepage" : "http://evertpot.com/", - "role" : "Developer" - }, - { - "name": "Markus Staab", - "email": "markus.staab@redaxo.de", - "role" : "Developer" - } - ], - "support" : { - "forum" : "https://groups.google.com/group/sabredav-discuss", - "source" : "https://github.com/fruux/sabre-xml" - }, - "autoload" : { - "psr-4" : { - "Sabre\\Xml\\" : "lib/" - }, - "files": [ - "lib/Deserializer/functions.php", - "lib/Serializer/functions.php" - ] - }, - "autoload-dev" : { - "psr-4" : { - "Sabre\\Xml\\" : "tests/Sabre/Xml/" - } - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.64", - "phpstan/phpstan": "^1.12", - "phpunit/phpunit" : "^9.6" - }, - "scripts": { - "phpstan": [ - "phpstan analyse" - ], - "phpstan-baseline": [ - "phpstan analyse --generate-baseline phpstan-baseline.neon" - ], - "cs-fixer": [ - "PHP_CS_FIXER_IGNORE_ENV=true php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - } -} diff --git a/vendor/sabre/xml/lib/ContextStackTrait.php b/vendor/sabre/xml/lib/ContextStackTrait.php deleted file mode 100644 index 7c082f5fb..000000000 --- a/vendor/sabre/xml/lib/ContextStackTrait.php +++ /dev/null @@ -1,116 +0,0 @@ - - */ - public array $elementMap = []; - - /** - * A contextUri pointing to the document being parsed / written. - * This uri may be used to resolve relative urls that may appear in the - * document. - * - * The reader and writer don't use this property, but as it's an extremely - * common use-case for parsing XML documents, it's added here as a - * convenience. - */ - public ?string $contextUri = null; - - /** - * This is a list of namespaces that you want to give default prefixes. - * - * You must make sure you create this entire list before starting to write. - * They should be registered on the root element. - * - * @phpstan-var array - */ - public array $namespaceMap = []; - - /** - * This is a list of custom serializers for specific classes. - * - * The writer may use this if you attempt to serialize an object with a - * class that does not implement XmlSerializable. - * - * Instead, it will look at this classmap to see if there is a custom - * serializer here. This is useful if you don't want your value objects - * to be responsible for serializing themselves. - * - * The keys in this classmap need to be fully qualified PHP class names, - * the values must be callbacks. The callbacks take two arguments. The - * writer class, and the value that must be written. - * - * function (Writer $writer, object $value) - * - * @phpstan-var array - */ - public array $classMap = []; - - /** - * Backups of previous contexts. - * - * @var list - */ - protected array $contextStack = []; - - /** - * Create a new "context". - * - * This allows you to safely modify the elementMap, contextUri or - * namespaceMap. After you're done, you can restore the old data again - * with popContext. - */ - public function pushContext(): void - { - $this->contextStack[] = [ - $this->elementMap, - $this->contextUri, - $this->namespaceMap, - $this->classMap, - ]; - } - - /** - * Restore the previous "context". - */ - public function popContext(): void - { - list( - $this->elementMap, - $this->contextUri, - $this->namespaceMap, - $this->classMap, - ) = array_pop($this->contextStack); - } -} diff --git a/vendor/sabre/xml/lib/Deserializer/functions.php b/vendor/sabre/xml/lib/Deserializer/functions.php deleted file mode 100644 index 90b943988..000000000 --- a/vendor/sabre/xml/lib/Deserializer/functions.php +++ /dev/null @@ -1,388 +0,0 @@ -value" array. - * - * For example, keyvalue will parse: - * - * - * - * value1 - * value2 - * - * - * - * Into: - * - * [ - * "{http://sabredav.org/ns}elem1" => "value1", - * "{http://sabredav.org/ns}elem2" => "value2", - * "{http://sabredav.org/ns}elem3" => null, - * ]; - * - * If you specify the 'namespace' argument, the deserializer will remove - * the namespaces of the keys that match that namespace. - * - * For example, if you call keyValue like this: - * - * keyValue($reader, 'http://sabredav.org/ns') - * - * it's output will instead be: - * - * [ - * "elem1" => "value1", - * "elem2" => "value2", - * "elem3" => null, - * ]; - * - * Attributes will be removed from the top-level elements. If elements with - * the same name appear twice in the list, only the last one will be kept. - * - * @phpstan-return array - */ -function keyValue(Reader $reader, ?string $namespace = null): array -{ - // If there's no children, we don't do anything. - if ($reader->isEmptyElement) { - $reader->next(); - - return []; - } - - if (!$reader->read()) { - $reader->next(); - - return []; - } - - if (Reader::END_ELEMENT === $reader->nodeType) { - $reader->next(); - - return []; - } - - $values = []; - - do { - if (Reader::ELEMENT === $reader->nodeType) { - if (null !== $namespace && $reader->namespaceURI === $namespace) { - $values[$reader->localName] = $reader->parseCurrentElement()['value']; - } else { - $clark = $reader->getClark(); - $values[$clark] = $reader->parseCurrentElement()['value']; - } - } else { - if (!$reader->read()) { - break; - } - } - } while (Reader::END_ELEMENT !== $reader->nodeType); - - $reader->read(); - - return $values; -} - -/** - * The 'enum' deserializer parses elements into a simple list - * without values or attributes. - * - * For example, Elements will parse: - * - * - * - * - * - * - * content - * - * - * - * Into: - * - * [ - * "{http://sabredav.org/ns}elem1", - * "{http://sabredav.org/ns}elem2", - * "{http://sabredav.org/ns}elem3", - * "{http://sabredav.org/ns}elem4", - * "{http://sabredav.org/ns}elem5", - * ]; - * - * This is useful for 'enum'-like structures. - * - * If the $namespace argument is specified, it will strip the namespace - * for all elements that match that. - * - * For example, - * - * enum($reader, 'http://sabredav.org/ns') - * - * would return: - * - * [ - * "elem1", - * "elem2", - * "elem3", - * "elem4", - * "elem5", - * ]; - * - * @return string[] - * - * @phpstan-return list - */ -function enum(Reader $reader, ?string $namespace = null): array -{ - // If there's no children, we don't do anything. - if ($reader->isEmptyElement) { - $reader->next(); - - return []; - } - if (!$reader->read()) { - $reader->next(); - - return []; - } - - if (Reader::END_ELEMENT === $reader->nodeType) { - $reader->next(); - - return []; - } - $currentDepth = $reader->depth; - - $values = []; - do { - if (Reader::ELEMENT !== $reader->nodeType) { - continue; - } - if (!is_null($namespace) && $namespace === $reader->namespaceURI) { - $values[] = $reader->localName; - } else { - $values[] = (string) $reader->getClark(); - } - } while ($reader->depth >= $currentDepth && $reader->next()); - - $reader->next(); - - return $values; -} - -/** - * The valueObject deserializer turns an XML element into a PHP object of - * a specific class. - * - * This is primarily used by the mapValueObject function from the Service - * class, but it can also easily be used for more specific situations. - * - * @template C of object - * - * @param class-string $className - * - * @phpstan-return C - */ -function valueObject(Reader $reader, string $className, string $namespace): object -{ - $valueObject = new $className(); - if ($reader->isEmptyElement) { - $reader->next(); - - return $valueObject; - } - - $defaultProperties = get_class_vars($className); - - $reader->read(); - do { - if (Reader::ELEMENT === $reader->nodeType && $reader->namespaceURI == $namespace) { - if (property_exists($valueObject, $reader->localName)) { - if (is_array($defaultProperties[$reader->localName])) { - $valueObject->{$reader->localName}[] = $reader->parseCurrentElement()['value']; - } else { - $valueObject->{$reader->localName} = $reader->parseCurrentElement()['value']; - } - } else { - // Ignore property - $reader->next(); - } - } elseif (Reader::ELEMENT === $reader->nodeType) { - // Skipping element from different namespace - $reader->next(); - } else { - if (Reader::END_ELEMENT !== $reader->nodeType && !$reader->read()) { - break; - } - } - } while (Reader::END_ELEMENT !== $reader->nodeType); - - $reader->read(); - - return $valueObject; -} - -/** - * This deserializer helps you deserialize xml structures that look like - * this:. - * - * - * ... - * ... - * ... - * - * - * Many XML documents use patterns like that, and this deserializer - * allow you to get all the 'items' as an array. - * - * In that previous example, you would register the deserializer as such: - * - * $reader->elementMap['{}collection'] = function($reader) { - * return repeatingElements($reader, '{}item'); - * } - * - * The repeatingElements deserializer simply returns everything as an array. - * - * $childElementName must either be a clark-notation element name, or if no - * namespace is used, the bare element name. - * - * @phpstan-return list - */ -function repeatingElements(Reader $reader, string $childElementName): array -{ - if ('{' !== $childElementName[0]) { - $childElementName = '{}'.$childElementName; - } - $result = []; - - foreach ($reader->parseGetElements() as $element) { - if ($element['name'] === $childElementName) { - $result[] = $element['value']; - } - } - - return $result; -} - -/** - * This deserializer helps you to deserialize structures which contain mixed content. - * - *

some text and an inline tagand even more text

- * - * The above example will return - * - * [ - * 'some text', - * [ - * 'name' => '{}extref', - * 'value' => 'and an inline tag', - * 'attributes' => [] - * ], - * 'and even more text' - * ] - * - * In strict XML documents you won't find this kind of markup but in html this is a quite common pattern. - * - * @return array - */ -function mixedContent(Reader $reader): array -{ - // If there's no children, we don't do anything. - if ($reader->isEmptyElement) { - $reader->next(); - - return []; - } - - $previousDepth = $reader->depth; - - $content = []; - $reader->read(); - while (true) { - if (Reader::ELEMENT == $reader->nodeType) { - $content[] = $reader->parseCurrentElement(); - } elseif ($reader->depth >= $previousDepth && in_array($reader->nodeType, [Reader::TEXT, Reader::CDATA, Reader::WHITESPACE])) { - $content[] = $reader->value; - $reader->read(); - } elseif (Reader::END_ELEMENT == $reader->nodeType) { - // Ensuring we are moving the cursor after the end element. - $reader->read(); - break; - } else { - $reader->read(); - } - } - - return $content; -} - -/** - * The functionCaller deserializer turns an XML element into whatever your callable returns. - * - * You can use, e.g., a named constructor (factory method) to create an object using - * this function. - * - * @return mixed whatever the 'func' callable returns - * - * @throws \InvalidArgumentException|\ReflectionException - */ -function functionCaller(Reader $reader, callable $func, string $namespace) -{ - if ($reader->isEmptyElement) { - $reader->next(); - - return null; - } - - $funcArgs = []; - if (is_array($func)) { - $ref = new \ReflectionMethod($func[0], $func[1]); - } elseif (is_string($func) && false !== strpos($func, '::')) { - // We have a string that should refer to a method that exists, like "MyClass::someMethod" - // ReflectionMethod knows how to handle that as-is - $ref = new \ReflectionMethod($func); - } elseif ($func instanceof \Closure || is_string($func)) { - // We have an actual Closure (a real function) or a string that is the name of a function - // ReflectionFunction can take either of those - $ref = new \ReflectionFunction($func); - } else { - throw new \InvalidArgumentException(__METHOD__.' unable to use func parameter with ReflectionMethod or ReflectionFunction.'); - } - - foreach ($ref->getParameters() as $parameter) { - $funcArgs[$parameter->getName()] = null; - } - - $reader->read(); - do { - if (Reader::ELEMENT === $reader->nodeType && $reader->namespaceURI == $namespace) { - if (array_key_exists($reader->localName, $funcArgs)) { - $funcArgs[$reader->localName] = $reader->parseCurrentElement()['value']; - } else { - // Ignore property - $reader->next(); - } - } else { - $reader->read(); - } - } while (Reader::END_ELEMENT !== $reader->nodeType); - $reader->read(); - - return $func(...array_values($funcArgs)); -} diff --git a/vendor/sabre/xml/lib/Element.php b/vendor/sabre/xml/lib/Element.php deleted file mode 100644 index 559eb54ea..000000000 --- a/vendor/sabre/xml/lib/Element.php +++ /dev/null @@ -1,22 +0,0 @@ -value = $value; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * Use the $writer argument to write its own xml serialization. - * - * An important note: do _not_ create a parent element. Any element - * implementing XmlSerializable should only ever write what's considered - * its 'inner xml'. - * - * The parent of the current element is responsible for writing a - * containing element. - * - * This allows serializers to be re-used for different element names. - * - * If you are opening new elements, you must also close them again. - */ - public function xmlSerialize(Xml\Writer $writer): void - { - $writer->write($this->value); - } - - /** - * The deserialize method is called during xml parsing. - * - * This method is called statically, this is because in theory this method - * may be used as a type of constructor, or factory method. - * - * Often you want to return an instance of the current class, but you are - * free to return other data as well. - * - * Important note 2: You are responsible for advancing the reader to the - * next element. Not doing anything will result in a never-ending loop. - * - * If you just want to skip parsing for this element altogether, you can - * just call $reader->next(); - * - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to - * the next element. - * - * @return array>|string|null - */ - public static function xmlDeserialize(Xml\Reader $reader) - { - $subTree = $reader->parseInnerTree(); - - return $subTree; - } -} diff --git a/vendor/sabre/xml/lib/Element/Cdata.php b/vendor/sabre/xml/lib/Element/Cdata.php deleted file mode 100644 index 8e16afbae..000000000 --- a/vendor/sabre/xml/lib/Element/Cdata.php +++ /dev/null @@ -1,57 +0,0 @@ -value = $value; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * Use the $writer argument to write its own xml serialization. - * - * An important note: do _not_ create a parent element. Any element - * implementing XmlSerializable should only ever write what's considered - * its 'inner xml'. - * - * The parent of the current element is responsible for writing a - * containing element. - * - * This allows serializers to be re-used for different element names. - * - * If you are opening new elements, you must also close them again. - */ - public function xmlSerialize(Xml\Writer $writer): void - { - $writer->writeCData($this->value); - } -} diff --git a/vendor/sabre/xml/lib/Element/Elements.php b/vendor/sabre/xml/lib/Element/Elements.php deleted file mode 100644 index 427cf35e1..000000000 --- a/vendor/sabre/xml/lib/Element/Elements.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * - * - * - * content - * - * - * - * Into: - * - * [ - * "{http://sabredav.org/ns}elem1", - * "{http://sabredav.org/ns}elem2", - * "{http://sabredav.org/ns}elem3", - * "{http://sabredav.org/ns}elem4", - * "{http://sabredav.org/ns}elem5", - * ]; - * - * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/). - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Elements implements Xml\Element -{ - /** - * Value to serialize. - * - * @var array - */ - protected array $value; - - /** - * Constructor. - * - * @param array $value - */ - public function __construct(array $value = []) - { - $this->value = $value; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * Use the $writer argument to write its own xml serialization. - * - * An important note: do _not_ create a parent element. Any element - * implementing XmlSerializable should only ever write what's considered - * its 'inner xml'. - * - * The parent of the current element is responsible for writing a - * containing element. - * - * This allows serializers to be re-used for different element names. - * - * If you are opening new elements, you must also close them again. - */ - public function xmlSerialize(Xml\Writer $writer): void - { - Serializer\enum($writer, $this->value); - } - - /** - * The deserialize method is called during xml parsing. - * - * This method is called statically, this is because in theory this method - * may be used as a type of constructor, or factory method. - * - * Often you want to return an instance of the current class, but you are - * free to return other data as well. - * - * Important note 2: You are responsible for advancing the reader to the - * next element. Not doing anything will result in a never-ending loop. - * - * If you just want to skip parsing for this element altogether, you can - * just call $reader->next(); - * - * $reader->parseSubTree() will parse the entire sub-tree, and advance to - * the next element. - * - * @return string[] - */ - public static function xmlDeserialize(Xml\Reader $reader) - { - return Deserializer\enum($reader); - } -} diff --git a/vendor/sabre/xml/lib/Element/KeyValue.php b/vendor/sabre/xml/lib/Element/KeyValue.php deleted file mode 100644 index 8e5ae055c..000000000 --- a/vendor/sabre/xml/lib/Element/KeyValue.php +++ /dev/null @@ -1,102 +0,0 @@ -value struct. - * - * Attributes will be removed, and duplicate child elements are discarded. - * Complex values within the elements will be parsed by the 'standard' parser. - * - * For example, KeyValue will parse: - * - * - * - * value1 - * value2 - * - * - * - * Into: - * - * [ - * "{http://sabredav.org/ns}elem1" => "value1", - * "{http://sabredav.org/ns}elem2" => "value2", - * "{http://sabredav.org/ns}elem3" => null, - * ]; - * - * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/). - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class KeyValue implements Xml\Element -{ - /** - * Value to serialize. - * - * @var array - */ - protected array $value; - - /** - * Constructor. - * - * @param array $value - */ - public function __construct(array $value = []) - { - $this->value = $value; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * Use the $writer argument to write its own xml serialization. - * - * An important note: do _not_ create a parent element. Any element - * implementing XmlSerializable should only ever write what's considered - * its 'inner xml'. - * - * The parent of the current element is responsible for writing a - * containing element. - * - * This allows serializers to be re-used for different element names. - * - * If you are opening new elements, you must also close them again. - */ - public function xmlSerialize(Xml\Writer $writer): void - { - $writer->write($this->value); - } - - /** - * The deserialize method is called during xml parsing. - * - * This method is called statically, this is because in theory this method - * may be used as a type of constructor, or factory method. - * - * Often you want to return an instance of the current class, but you are - * free to return other data as well. - * - * Important note 2: You are responsible for advancing the reader to the - * next element. Not doing anything will result in a never-ending loop. - * - * If you just want to skip parsing for this element altogether, you can - * just call $reader->next(); - * - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to - * the next element. - * - * @return array - */ - public static function xmlDeserialize(Xml\Reader $reader) - { - return Deserializer\keyValue($reader); - } -} diff --git a/vendor/sabre/xml/lib/Element/Uri.php b/vendor/sabre/xml/lib/Element/Uri.php deleted file mode 100644 index e54d706a9..000000000 --- a/vendor/sabre/xml/lib/Element/Uri.php +++ /dev/null @@ -1,95 +0,0 @@ -/foo/bar - * http://example.org/hi - * - * If the uri is relative, it will be automatically expanded to an absolute - * url during writing and reading, if the contextUri property is set on the - * reader and/or writer. - * - * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/). - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Uri implements Xml\Element -{ - /** - * Uri element value. - */ - protected string $value; - - /** - * Constructor. - */ - public function __construct(string $value) - { - $this->value = $value; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * Use the $writer argument to write its own xml serialization. - * - * An important note: do _not_ create a parent element. Any element - * implementing XmlSerializable should only ever write what's considered - * its 'inner xml'. - * - * The parent of the current element is responsible for writing a - * containing element. - * - * This allows serializers to be re-used for different element names. - * - * If you are opening new elements, you must also close them again. - */ - public function xmlSerialize(Xml\Writer $writer): void - { - $writer->text( - resolve( - $writer->contextUri ?? '', - $this->value - ) - ); - } - - /** - * This method is called during xml parsing. - * - * This method is called statically, this is because in theory this method - * may be used as a type of constructor, or factory method. - * - * Often you want to return an instance of the current class, but you are - * free to return other data as well. - * - * Important note 2: You are responsible for advancing the reader to the - * next element. Not doing anything will result in a never-ending loop. - * - * If you just want to skip parsing for this element altogether, you can - * just call $reader->next(); - * - * $reader->parseSubTree() will parse the entire sub-tree, and advance to - * the next element. - */ - public static function xmlDeserialize(Xml\Reader $reader) - { - return new self( - resolve( - (string) $reader->contextUri, - $reader->readText() - ) - ); - } -} diff --git a/vendor/sabre/xml/lib/Element/XmlFragment.php b/vendor/sabre/xml/lib/Element/XmlFragment.php deleted file mode 100644 index 94f745b4c..000000000 --- a/vendor/sabre/xml/lib/Element/XmlFragment.php +++ /dev/null @@ -1,144 +0,0 @@ -xml = $xml; - } - - /** - * Returns the inner XML document. - */ - public function getXml(): string - { - return $this->xml; - } - - /** - * The xmlSerialize method is called during xml writing. - * - * Use the $writer argument to write its own xml serialization. - * - * An important note: do _not_ create a parent element. Any element - * implementing XmlSerializable should only ever write what's considered - * its 'inner xml'. - * - * The parent of the current element is responsible for writing a - * containing element. - * - * This allows serializers to be re-used for different element names. - * - * If you are opening new elements, you must also close them again. - */ - public function xmlSerialize(Writer $writer): void - { - $reader = new Reader(); - - // Wrapping the xml in a container, so root-less values can still be - // parsed. - $xml = << -{$this->getXml()} -XML; - - $reader->xml($xml); - - while ($reader->read()) { - if ($reader->depth < 1) { - // Skipping the root node. - continue; - } - - switch ($reader->nodeType) { - case Reader::ELEMENT: - $writer->startElement( - (string) $reader->getClark() - ); - $empty = $reader->isEmptyElement; - while ($reader->moveToNextAttribute()) { - switch ($reader->namespaceURI) { - case '': - $writer->writeAttribute($reader->localName, $reader->value); - break; - case 'http://www.w3.org/2000/xmlns/': - // Skip namespace declarations - break; - default: - $writer->writeAttribute((string) $reader->getClark(), $reader->value); - break; - } - } - if ($empty) { - $writer->endElement(); - } - break; - case Reader::CDATA: - case Reader::TEXT: - $writer->text( - $reader->value - ); - break; - case Reader::END_ELEMENT: - $writer->endElement(); - break; - } - } - } - - /** - * The deserialize method is called during xml parsing. - * - * This method is called statically, this is because in theory this method - * may be used as a type of constructor, or factory method. - * - * Often you want to return an instance of the current class, but you are - * free to return other data as well. - * - * You are responsible for advancing the reader to the next element. Not - * doing anything will result in a never-ending loop. - * - * If you just want to skip parsing for this element altogether, you can - * just call $reader->next(); - * - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to - * the next element. - */ - public static function xmlDeserialize(Reader $reader) - { - $result = new self($reader->readInnerXml()); - $reader->next(); - - return $result; - } -} diff --git a/vendor/sabre/xml/lib/LibXMLException.php b/vendor/sabre/xml/lib/LibXMLException.php deleted file mode 100644 index 5c642a3bf..000000000 --- a/vendor/sabre/xml/lib/LibXMLException.php +++ /dev/null @@ -1,49 +0,0 @@ -errors = $errors; - parent::__construct($errors[0]->message.' on line '.$errors[0]->line.', column '.$errors[0]->column, $code, $previousException); - } - - /** - * Returns the LibXML errors. - * - * @return \LibXMLError[] - */ - public function getErrors(): array - { - return $this->errors; - } -} diff --git a/vendor/sabre/xml/lib/ParseException.php b/vendor/sabre/xml/lib/ParseException.php deleted file mode 100644 index ff6656b23..000000000 --- a/vendor/sabre/xml/lib/ParseException.php +++ /dev/null @@ -1,16 +0,0 @@ -localName) { - return null; - } - - return '{'.$this->namespaceURI.'}'.$this->localName; - } - - /** - * Reads the entire document. - * - * This function returns an array with the following three elements: - * * name - The root element name. - * * value - The value for the root element. - * * attributes - An array of attributes. - * - * This function will also disable the standard libxml error handler (which - * usually just results in PHP errors), and throw exceptions instead. - * - * @return array - */ - public function parse(): array - { - $previousEntityState = null; - $shouldCallLibxmlDisableEntityLoader = (\LIBXML_VERSION < 20900); - if ($shouldCallLibxmlDisableEntityLoader) { - $previousEntityState = libxml_disable_entity_loader(true); - } - $previousSetting = libxml_use_internal_errors(true); - - try { - while (self::ELEMENT !== $this->nodeType) { - if (!$this->read()) { - $errors = libxml_get_errors(); - libxml_clear_errors(); - if ($errors) { - throw new LibXMLException($errors); - } - } - } - $result = $this->parseCurrentElement(); - - // last line of defense in case errors did occur above - $errors = libxml_get_errors(); - libxml_clear_errors(); - if ($errors) { - throw new LibXMLException($errors); - } - } finally { - libxml_use_internal_errors($previousSetting); - if ($shouldCallLibxmlDisableEntityLoader) { - libxml_disable_entity_loader($previousEntityState); - } - } - - return $result; - } - - /** - * parseGetElements parses everything in the current sub-tree, - * and returns an array of elements. - * - * Each element has a 'name', 'value' and 'attributes' key. - * - * If the element didn't contain sub-elements, an empty array is always - * returned. If there was any text inside the element, it will be - * discarded. - * - * If the $elementMap argument is specified, the existing elementMap will - * be overridden while parsing the tree, and restored after this process. - * - * @param array|null $elementMap - * - * @return array> - */ - public function parseGetElements(?array $elementMap = null): array - { - $result = $this->parseInnerTree($elementMap); - if (!is_array($result)) { - return []; - } - - return $result; - } - - /** - * Parses all elements below the current element. - * - * This method will return a string if this was a text-node, or an array if - * there were sub-elements. - * - * If there's both text and sub-elements, the text will be discarded. - * - * If the $elementMap argument is specified, the existing elementMap will - * be overridden while parsing the tree, and restored after this process. - * - * @param array|null $elementMap - * - * @return array>|string|null - */ - public function parseInnerTree(?array $elementMap = null) - { - $text = null; - $elements = []; - - if (self::ELEMENT === $this->nodeType && $this->isEmptyElement) { - // Easy! - $this->next(); - - return null; - } - - if (!is_null($elementMap)) { - $this->pushContext(); - $this->elementMap = $elementMap; - } - - try { - if (!$this->read()) { - $errors = libxml_get_errors(); - libxml_clear_errors(); - if ($errors) { - throw new LibXMLException($errors); - } - throw new ParseException('This should never happen (famous last words)'); - } - - $keepOnParsing = true; - - while ($keepOnParsing) { - if (!$this->isValid()) { - $errors = libxml_get_errors(); - - if ($errors) { - libxml_clear_errors(); - throw new LibXMLException($errors); - } - } - - switch ($this->nodeType) { - case self::ELEMENT: - $elements[] = $this->parseCurrentElement(); - break; - case self::TEXT: - case self::CDATA: - $text .= $this->value; - $this->read(); - break; - case self::END_ELEMENT: - // Ensuring we are moving the cursor after the end element. - $this->read(); - $keepOnParsing = false; - break; - case self::NONE: - throw new ParseException('We hit the end of the document prematurely. This likely means that some parser "eats" too many elements. Do not attempt to continue parsing.'); - default: - // Advance to the next element - $this->read(); - break; - } - } - } finally { - if (!is_null($elementMap)) { - $this->popContext(); - } - } - - return $elements ?: $text; - } - - /** - * Reads all text below the current element, and returns this as a string. - */ - public function readText(): string - { - $result = ''; - $previousDepth = $this->depth; - - while ($this->read() && $this->depth != $previousDepth) { - if (in_array($this->nodeType, [\XMLReader::TEXT, \XMLReader::CDATA, \XMLReader::WHITESPACE])) { - $result .= $this->value; - } - } - - return $result; - } - - /** - * Parses the current XML element. - * - * This method returns arn array with 3 properties: - * * name - A clark-notation XML element name. - * * value - The parsed value. - * * attributes - A key-value list of attributes. - * - * @return array - */ - public function parseCurrentElement(): array - { - $name = $this->getClark(); - - $attributes = []; - - if ($this->hasAttributes) { - $attributes = $this->parseAttributes(); - } - - $value = call_user_func( - $this->getDeserializerForElementName((string) $name), - $this - ); - - return [ - 'name' => $name, - 'value' => $value, - 'attributes' => $attributes, - ]; - } - - /** - * Grabs all the attributes from the current element, and returns them as a - * key-value array. - * - * If the attributes are part of the same namespace, they will simply be - * short keys. If they are defined on a different namespace, the attribute - * name will be returned in clark-notation. - * - * @return array - */ - public function parseAttributes(): array - { - $attributes = []; - - while ($this->moveToNextAttribute()) { - if ($this->namespaceURI) { - // Ignoring 'xmlns', it doesn't make any sense. - if ('http://www.w3.org/2000/xmlns/' === $this->namespaceURI) { - continue; - } - - $name = $this->getClark(); - $attributes[$name] = $this->value; - } else { - $attributes[$this->localName] = $this->value; - } - } - $this->moveToElement(); - - return $attributes; - } - - /** - * Returns the function that should be used to parse the element identified - * by its clark-notation name. - */ - public function getDeserializerForElementName(string $name): callable - { - if (!array_key_exists($name, $this->elementMap)) { - if ('{}' == substr($name, 0, 2) && array_key_exists(substr($name, 2), $this->elementMap)) { - $name = substr($name, 2); - } else { - return ['Sabre\\Xml\\Element\\Base', 'xmlDeserialize']; - } - } - - $deserializer = $this->elementMap[$name]; - if (is_callable($deserializer)) { - return $deserializer; - } - - if (is_subclass_of($deserializer, 'Sabre\\Xml\\XmlDeserializable')) { - return [$deserializer, 'xmlDeserialize']; - } - - $type = gettype($deserializer); - if (is_string($deserializer)) { - $type .= ' ('.$deserializer.')'; - } elseif (is_object($deserializer)) { - $type .= ' ('.get_class($deserializer).')'; - } - throw new \LogicException('Could not use this type as a deserializer: '.$type.' for element: '.$name); - } -} diff --git a/vendor/sabre/xml/lib/Serializer/functions.php b/vendor/sabre/xml/lib/Serializer/functions.php deleted file mode 100644 index a6105a9ef..000000000 --- a/vendor/sabre/xml/lib/Serializer/functions.php +++ /dev/null @@ -1,207 +0,0 @@ - - * - * - * content - * - * - * @param string[] $values - */ -function enum(Writer $writer, array $values): void -{ - foreach ($values as $value) { - $writer->writeElement($value); - } -} - -/** - * The valueObject serializer turns a simple PHP object into a classname. - * - * Every public property will be encoded as an XML element with the same - * name, in the XML namespace as specified. - * - * Values that are set to null or an empty array are not serialized. To - * serialize empty properties, you must specify them as an empty string. - */ -function valueObject(Writer $writer, object $valueObject, string $namespace): void -{ - foreach (get_object_vars($valueObject) as $key => $val) { - if (is_array($val)) { - // If $val is an array, it has a special meaning. We need to - // generate one child element for each item in $val - foreach ($val as $child) { - $writer->writeElement('{'.$namespace.'}'.$key, $child); - } - } elseif (null !== $val) { - $writer->writeElement('{'.$namespace.'}'.$key, $val); - } - } -} - -/** - * This serializer helps you serialize xml structures that look like - * this:. - * - * - * ... - * ... - * ... - * - * - * In that previous example, this serializer just serializes the item element, - * and this could be called like this: - * - * repeatingElements($writer, $items, '{}item'); - * - * @param array $items - */ -function repeatingElements(Writer $writer, array $items, string $childElementName): void -{ - foreach ($items as $item) { - $writer->writeElement($childElementName, $item); - } -} - -/** - * This function is the 'default' serializer that is able to serialize most - * things, and delegates to other serializers if needed. - * - * The standardSerializer supports a wide-array of values. - * - * $value may be a string or integer, it will just write out the string as text. - * $value may be an instance of XmlSerializable or Element, in which case it - * calls it's xmlSerialize() method. - * $value may be a PHP callback/function/closure, in case we call the callback - * and give it the Writer as an argument. - * $value may be an object, and if it's in the classMap we automatically call - * the correct serializer for it. - * $value may be null, in which case we do nothing. - * - * If $value is an array, the array must look like this: - * - * [ - * [ - * 'name' => '{namespaceUri}element-name', - * 'value' => '...', - * 'attributes' => [ 'attName' => 'attValue' ] - * ] - * [, - * 'name' => '{namespaceUri}element-name2', - * 'value' => '...', - * ] - * ] - * - * This would result in xml like: - * - * - * ... - * - * - * ... - * - * - * The value property may be any value standardSerializer supports, so you can - * nest data-structures this way. Both value and attributes are optional. - * - * Alternatively, you can also specify the array using this syntax: - * - * [ - * [ - * '{namespaceUri}element-name' => '...', - * '{namespaceUri}element-name2' => '...', - * ] - * ] - * - * This is excellent for simple key->value structures, and here you can also - * specify anything for the value. - * - * You can even mix the two array syntaxes. - * - * @param string|int|float|bool|array|object $value - */ -function standardSerializer(Writer $writer, $value): void -{ - if (is_scalar($value)) { - // String, integer, float, boolean - $writer->text((string) $value); - } elseif ($value instanceof XmlSerializable) { - // XmlSerializable classes or Element classes. - $value->xmlSerialize($writer); - } elseif (is_object($value) && isset($writer->classMap[get_class($value)])) { - // It's an object which class appears in the classmap. - $writer->classMap[get_class($value)]($writer, $value); - } elseif (is_callable($value)) { - // A callback - $value($writer); - } elseif (is_array($value) && array_key_exists('name', $value)) { - // if the array had a 'name' element, we assume that this array - // describes a 'name' and optionally 'attributes' and 'value'. - - $name = $value['name']; - $attributes = isset($value['attributes']) ? $value['attributes'] : []; - $value = isset($value['value']) ? $value['value'] : null; - - $writer->startElement($name); - $writer->writeAttributes($attributes); - $writer->write($value); - $writer->endElement(); - } elseif (is_array($value)) { - foreach ($value as $name => $item) { - if (is_int($name)) { - // This item has a numeric index. We just loop through the - // array and throw it back in the writer. - standardSerializer($writer, $item); - } elseif (is_string($name) && is_array($item) && isset($item['attributes'])) { - // The key is used for a name, but $item has 'attributes' and - // possibly 'value' - $writer->startElement($name); - $writer->writeAttributes($item['attributes']); - if (isset($item['value'])) { - $writer->write($item['value']); - } - $writer->endElement(); - } elseif (is_string($name)) { - // This was a plain key-value array. - $writer->startElement($name); - $writer->write($item); - $writer->endElement(); - } else { - throw new \InvalidArgumentException('The writer does not know how to serialize arrays with keys of type: '.gettype($name)); - } - } - } elseif (is_object($value)) { - throw new \InvalidArgumentException('The writer cannot serialize objects of class: '.get_class($value)); - } elseif (!is_null($value)) { - throw new \InvalidArgumentException('The writer cannot serialize values of type: '.gettype($value)); - } -} diff --git a/vendor/sabre/xml/lib/Service.php b/vendor/sabre/xml/lib/Service.php deleted file mode 100644 index ace923f08..000000000 --- a/vendor/sabre/xml/lib/Service.php +++ /dev/null @@ -1,326 +0,0 @@ - - */ - public array $elementMap = []; - - /** - * This is a list of namespaces that you want to give default prefixes. - * - * You must make sure you create this entire list before starting to write. - * They should be registered on the root element. - * - * @phpstan-var array - */ - public array $namespaceMap = []; - - /** - * This is a list of custom serializers for specific classes. - * - * The writer may use this if you attempt to serialize an object with a - * class that does not implement XmlSerializable. - * - * Instead, it will look at this classmap to see if there is a custom - * serializer here. This is useful if you don't want your value objects - * to be responsible for serializing themselves. - * - * The keys in this classmap need to be fully qualified PHP class names, - * the values must be callbacks. The callbacks take two arguments. The - * writer class, and the value that must be written. - * - * function (Writer $writer, object $value) - * - * @phpstan-var array - */ - public array $classMap = []; - - /** - * A bitmask of the LIBXML_* constants. - */ - public int $options = 0; - - /** - * Returns a fresh XML Reader. - */ - public function getReader(): Reader - { - $r = new Reader(); - $r->elementMap = $this->elementMap; - - return $r; - } - - /** - * Returns a fresh xml writer. - */ - public function getWriter(): Writer - { - $w = new Writer(); - $w->namespaceMap = $this->namespaceMap; - $w->classMap = $this->classMap; - - return $w; - } - - /** - * Parses a document in full. - * - * Input may be specified as a string or readable stream resource. - * The returned value is the value of the root document. - * - * Specifying the $contextUri allows the parser to figure out what the URI - * of the document was. This allows relative URIs within the document to be - * expanded easily. - * - * The $rootElementName is specified by reference and will be populated - * with the root element name of the document. - * - * @param string|resource $input - * - * @return array|object|string - * - * @throws ParseException - */ - public function parse($input, ?string $contextUri = null, ?string &$rootElementName = null) - { - if (!is_string($input)) { - // Unfortunately the XMLReader doesn't support streams. When it - // does, we can optimize this. - if (is_resource($input)) { - $input = (string) stream_get_contents($input); - } else { - // Input is not a string and not a resource. - // Therefore, it has to be a closed resource. - // Effectively empty input has been passed in. - $input = ''; - } - } - - // If input is empty, then it's safe to throw an exception - if (empty($input)) { - throw new ParseException('The input element to parse is empty. Do not attempt to parse'); - } - - $r = $this->getReader(); - $r->contextUri = $contextUri; - $r->XML($input, null, $this->options); - - $result = $r->parse(); - $rootElementName = $result['name']; - - return $result['value']; - } - - /** - * Parses a document in full, and specify what the expected root element - * name is. - * - * This function works similar to parse, but the difference is that the - * user can specify what the expected name of the root element should be, - * in clark notation. - * - * This is useful in cases where you expected a specific document to be - * passed, and reduces the amount of if statements. - * - * It's also possible to pass an array of expected rootElements if your - * code may expect more than one document type. - * - * @param string|string[] $rootElementName - * @param string|resource $input - * - * @return array|object|string - * - * @throws ParseException - */ - public function expect($rootElementName, $input, ?string $contextUri = null) - { - if (!is_string($input)) { - // Unfortunately the XMLReader doesn't support streams. When it - // does, we can optimize this. - if (is_resource($input)) { - $input = (string) stream_get_contents($input); - } else { - // Input is not a string and not a resource. - // Therefore, it has to be a closed resource. - // Effectively empty input has been passed in. - $input = ''; - } - } - - // If input is empty, then it's safe to throw an exception - if (empty($input)) { - throw new ParseException('The input element to parse is empty. Do not attempt to parse'); - } - - $r = $this->getReader(); - $r->contextUri = $contextUri; - $r->XML($input, null, $this->options); - - $rootElementName = (array) $rootElementName; - - foreach ($rootElementName as &$rEl) { - if ('{' !== $rEl[0]) { - $rEl = '{}'.$rEl; - } - } - - $result = $r->parse(); - if (!in_array($result['name'], $rootElementName, true)) { - throw new ParseException('Expected '.implode(' or ', $rootElementName).' but received '.$result['name'].' as the root element'); - } - - return $result['value']; - } - - /** - * Generates an XML document in one go. - * - * The $rootElement must be specified in clark notation. - * The value must be a string, an array or an object implementing - * XmlSerializable. Basically, anything that's supported by the Writer - * object. - * - * $contextUri can be used to specify a sort of 'root' of the PHP application, - * in case the xml document is used as a http response. - * - * This allows an implementor to easily create URI's relative to the root - * of the domain. - * - * @param string|array|object|XmlSerializable $value - */ - public function write(string $rootElementName, $value, ?string $contextUri = null): string - { - $w = $this->getWriter(); - $w->openMemory(); - $w->contextUri = $contextUri; - $w->setIndent(true); - $w->startDocument(); - $w->writeElement($rootElementName, $value); - - return $w->outputMemory(); - } - - /** - * Map an XML element to a PHP class. - * - * Calling this function will automatically set up the Reader and Writer - * classes to turn a specific XML element to a PHP class. - * - * For example, given a class such as : - * - * class Author { - * public $firstName; - * public $lastName; - * } - * - * and an XML element such as: - * - * - * ... - * ... - * - * - * These can easily be mapped by calling: - * - * $service->mapValueObject('{http://example.org}author', 'Author'); - * - * @param class-string $className - */ - public function mapValueObject(string $elementName, string $className): void - { - list($namespace) = self::parseClarkNotation($elementName); - - $this->elementMap[$elementName] = function (Reader $reader) use ($className, $namespace) { - return \Sabre\Xml\Deserializer\valueObject($reader, $className, $namespace); - }; - $this->classMap[$className] = function (Writer $writer, $valueObject) use ($namespace) { - \Sabre\Xml\Serializer\valueObject($writer, $valueObject, $namespace); - }; - $this->valueObjectMap[$className] = $elementName; - } - - /** - * Writes a value object. - * - * This function largely behaves similar to write(), except that it's - * intended specifically to serialize a Value Object into an XML document. - * - * The ValueObject must have been previously registered using - * mapValueObject(). - * - * @throws \InvalidArgumentException - */ - public function writeValueObject(object $object, ?string $contextUri = null): string - { - if (!isset($this->valueObjectMap[get_class($object)])) { - throw new \InvalidArgumentException('"'.get_class($object).'" is not a registered value object class. Register your class with mapValueObject.'); - } - - return $this->write( - $this->valueObjectMap[get_class($object)], - $object, - $contextUri - ); - } - - /** - * Parses a clark-notation string, and returns the namespace and element - * name components. - * - * If the string was invalid, it will throw an InvalidArgumentException. - * - * @return array{string, string} - * - * @throws \InvalidArgumentException - */ - public static function parseClarkNotation(string $str): array - { - static $cache = []; - - if (!isset($cache[$str])) { - if (!preg_match('/^{([^}]*)}(.*)$/', $str, $matches)) { - throw new \InvalidArgumentException('\''.$str.'\' is not a valid clark-notation formatted string'); - } - - $cache[$str] = [ - $matches[1], - $matches[2], - ]; - } - - return $cache[$str]; - } - - /** - * A list of classes and which XML elements they map to. - * - * @var array - */ - protected array $valueObjectMap = []; -} diff --git a/vendor/sabre/xml/lib/Version.php b/vendor/sabre/xml/lib/Version.php deleted file mode 100644 index 340393169..000000000 --- a/vendor/sabre/xml/lib/Version.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ - protected array $adhocNamespaces = []; - - /** - * When the first element is written, this flag is set to true. - * - * This ensures that the namespaces in the namespaces map are only written - * once. - */ - protected bool $namespacesWritten = false; - - /** - * Writes a value to the output stream. - * - * The following values are supported: - * 1. Scalar values will be written as-is, as text. - * 2. Null values will be skipped (resulting in a short xml tag). - * 3. If a value is an instance of an Element class, writing will be - * delegated to the object. - * 4. If a value is an array, two formats are supported. - * - * Array format 1: - * [ - * "{namespace}name1" => "..", - * "{namespace}name2" => "..", - * ] - * - * One element will be created for each key in this array. The values of - * this array support any format this method supports (this method is - * called recursively). - * - * Array format 2: - * - * [ - * [ - * "name" => "{namespace}name1" - * "value" => "..", - * "attributes" => [ - * "attr" => "attribute value", - * ] - * ], - * [ - * "name" => "{namespace}name1" - * "value" => "..", - * "attributes" => [ - * "attr" => "attribute value", - * ] - * ] - * ] - * - * @param mixed $value PHP value to be written - */ - public function write($value): void - { - Serializer\standardSerializer($this, $value); - } - - /** - * Opens a new element. - * - * You can either just use a local element name, or you can use clark- - * notation to start a new element. - * - * Example: - * - * $writer->startElement('{http://www.w3.org/2005/Atom}entry'); - * - * Would result in something like: - * - * - * - * Note: this function doesn't have the string typehint, because PHP's - * XMLWriter::startElement doesn't either. - * From PHP 8.0 the typehint exists, so it can be added here after PHP 7.4 is dropped. - * - * @param string $name - */ - public function startElement($name): bool - { - if ('{' === $name[0]) { - list($namespace, $localName) = - Service::parseClarkNotation($name); - - if (array_key_exists($namespace, $this->namespaceMap)) { - $result = $this->startElementNS( - '' === $this->namespaceMap[$namespace] ? null : $this->namespaceMap[$namespace], - $localName, - null - ); - } else { - // An empty namespace means it's the global namespace. This is - // allowed, but it mustn't get a prefix. - if ('' === $namespace) { - $result = $this->startElement($localName); - $this->writeAttribute('xmlns', ''); - } else { - if (!isset($this->adhocNamespaces[$namespace])) { - $this->adhocNamespaces[$namespace] = 'x'.(count($this->adhocNamespaces) + 1); - } - $result = $this->startElementNS($this->adhocNamespaces[$namespace], $localName, $namespace); - } - } - } else { - $result = parent::startElement($name); - } - - if (!$this->namespacesWritten) { - foreach ($this->namespaceMap as $namespace => $prefix) { - $this->writeAttribute($prefix ? 'xmlns:'.$prefix : 'xmlns', $namespace); - } - $this->namespacesWritten = true; - } - - return $result; - } - - /** - * Write a full element tag and it's contents. - * - * This method automatically closes the element as well. - * - * The element name may be specified in clark-notation. - * - * Examples: - * - * $writer->writeElement('{http://www.w3.org/2005/Atom}author',null); - * becomes: - * - * - * $writer->writeElement('{http://www.w3.org/2005/Atom}author', [ - * '{http://www.w3.org/2005/Atom}name' => 'Evert Pot', - * ]); - * becomes: - * Evert Pot - * - * Note: this function doesn't have the string typehint, because PHP's - * XMLWriter::startElement doesn't either. - * From PHP 8.0 the typehint exists, so it can be added here after PHP 7.4 is dropped. - * - * @param string $name - * @param array|string|object|null $content - */ - public function writeElement($name, $content = null): bool - { - $this->startElement($name); - if (!is_null($content)) { - $this->write($content); - } - $this->endElement(); - - return true; - } - - /** - * Writes a list of attributes. - * - * Attributes are specified as a key->value array. - * - * The key is an attribute name. If the key is a 'localName', the current - * xml namespace is assumed. If it's a 'clark notation key', this namespace - * will be used instead. - * - * @param array $attributes - */ - public function writeAttributes(array $attributes): void - { - foreach ($attributes as $name => $value) { - $this->writeAttribute($name, $value); - } - } - - /** - * Writes a new attribute. - * - * The name may be specified in clark-notation. - * - * Returns true when successful. - * - * Note: this function doesn't have typehints, because for some reason - * PHP's XMLWriter::writeAttribute doesn't either. - * From PHP 8.0 the typehint exists, so it can be added here after PHP 7.4 is dropped. - * - * @param string $name - * @param string $value - */ - public function writeAttribute($name, $value): bool - { - if ('{' !== $name[0]) { - return parent::writeAttribute($name, $value); - } - - list( - $namespace, - $localName, - ) = Service::parseClarkNotation($name); - - if (array_key_exists($namespace, $this->namespaceMap)) { - // It's an attribute with a namespace we know - return $this->writeAttribute( - $this->namespaceMap[$namespace].':'.$localName, - $value - ); - } - - // We don't know the namespace, we must add it in-line - if (!isset($this->adhocNamespaces[$namespace])) { - $this->adhocNamespaces[$namespace] = 'x'.(count($this->adhocNamespaces) + 1); - } - - return $this->writeAttributeNS( - $this->adhocNamespaces[$namespace], - $localName, - $namespace, - $value - ); - } -} diff --git a/vendor/sabre/xml/lib/XmlDeserializable.php b/vendor/sabre/xml/lib/XmlDeserializable.php deleted file mode 100644 index 56448d17d..000000000 --- a/vendor/sabre/xml/lib/XmlDeserializable.php +++ /dev/null @@ -1,38 +0,0 @@ -next(); - * - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to - * the next element. - * - * @return mixed see comments above - */ - public static function xmlDeserialize(Reader $reader); -} diff --git a/vendor/sabre/xml/lib/XmlSerializable.php b/vendor/sabre/xml/lib/XmlSerializable.php deleted file mode 100644 index 4cd4e7f20..000000000 --- a/vendor/sabre/xml/lib/XmlSerializable.php +++ /dev/null @@ -1,34 +0,0 @@ -getXObject($id); + if (is_null($page)) { + break; + } - // @todo $xobject could be a ElementXRef object, which would then throw an error - if (\is_object($xobject) && $xobject instanceof self && !\in_array($xobject->getUniqueId(), self::$recursionStack, true)) { - // Not a circular reference. - $text[] = $xobject->getText($page); - } + $args = preg_split('/\s/s', $command[self::COMMAND]); + $id = trim(array_pop($args), '/ '); + $xobject = $page->getXObject($id); + + // Check we got a PDFObject back. + if (!$xobject instanceof self) { + break; + } + + // If the PDFObject is an image, do nothing, as images aren't text. + if ($xobject instanceof Image) { + break; + } + + // Check this is not a circular reference. + if (!\in_array($xobject->getUniqueId(), self::$recursionStack, true)) { + $text[] = $xobject->getText($page); } break;