diff --git a/.phive/phars.xml b/.phive/phars.xml index 5bfa092bfad10dad9d23240281a5a2041acb815b..cccdab55e6792f5161b502854bef53c1667a4add 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <phive xmlns="https://phar.io/phive"> - <phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/> + <phar name="phpstan" version="1.*" installed="1.12.13" location="./tools/phpstan" copy="false"/> <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/> <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/> <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/> diff --git a/ajax/calcBruttoPrice.php b/ajax/calcBruttoPrice.php index 53f952898e09c5ec0b8afc5e6f741746815357f0..28acb8923b5fb9b5330677bc1af1130303c5ba95 100644 --- a/ajax/calcBruttoPrice.php +++ b/ajax/calcBruttoPrice.php @@ -7,6 +7,7 @@ use QUI\ERP\Tax\TaxEntry; use QUI\ERP\Tax\TaxType; use QUI\ERP\Tax\Utils as TaxUtils; +use QUI\System\Log; /** * Calculate the netto price @@ -20,18 +21,22 @@ QUI::$Ajax->registerFunction( 'package_quiqqer_erp_ajax_calcBruttoPrice', function ($price, $formatted, $vat) { - $price = QUI\ERP\Money\Price::validatePrice($price); + $price = QUI\ERP\Money\Price::validatePrice($price); $Currency = QUI\ERP\Defaults::getCurrency(); if (empty($vat)) { - $Area = QUI\ERP\Defaults::getArea(); - $TaxType = TaxUtils::getTaxTypeByArea($Area); + $Area = QUI\ERP\Defaults::getArea(); - if ($TaxType instanceof TaxType) { + try { + $TaxType = TaxUtils::getTaxTypeByArea($Area); $TaxEntry = TaxUtils::getTaxEntry($TaxType, $Area); - } elseif ($TaxType instanceof TaxEntry) { - $TaxEntry = $TaxType; - } else { + } catch (QUI\Exception $e) { + Log::addError($e->getMessage(), [ + 'ajax' => 'package_quiqqer_erp_ajax_calcBruttoPrice', + 'price' => $price, + 'vat' => $vat + ]); + if (isset($formatted) && $formatted) { return $Currency->format($price); } diff --git a/ajax/calcNettoPrice.php b/ajax/calcNettoPrice.php index bd21e216ab1b7624f77a5d3dc256d9bcada70f20..5b19cf787651d72a5cea7e3ee3e5035dc2482a3d 100644 --- a/ajax/calcNettoPrice.php +++ b/ajax/calcNettoPrice.php @@ -7,6 +7,7 @@ use QUI\ERP\Tax\TaxEntry; use QUI\ERP\Tax\TaxType; use QUI\ERP\Tax\Utils as TaxUtils; +use QUI\System\Log; /** * Calculate the netto price @@ -35,21 +36,15 @@ function ($price, $formatted, $vat) { try { $TaxType = TaxUtils::getTaxTypeByArea($Area); + $TaxEntry = TaxUtils::getTaxEntry($TaxType, $Area); } catch (QUI\Exception $Exception) { - QUI::getMessagesHandler()->addError($Exception->getMessage()); - - if (isset($formatted) && $formatted) { - return QUI\ERP\Defaults::getCurrency()->format($price); - } + Log::addError($Exception->getMessage(), [ + 'price' => $price, + 'formatted' => $formatted, + 'vat' => $vat, + 'ajax' => 'package_quiqqer_erp_ajax_calcNettoPrice' + ]); - return $price; - } - - if ($TaxType instanceof TaxType) { - $TaxEntry = TaxUtils::getTaxEntry($TaxType, $Area); - } elseif ($TaxType instanceof TaxEntry) { - $TaxEntry = $TaxType; - } else { if (isset($formatted) && $formatted) { return QUI\ERP\Defaults::getCurrency()->format($price); } @@ -68,7 +63,7 @@ function ($price, $formatted, $vat) { $precision = QUI\ERP\Defaults::getPrecision(); $bruttoInput = round($price, $precision); - $decimalParts = explode('.', $bruttoInput); + $decimalParts = explode('.', (string)$bruttoInput); $inputPrecision = isset($decimalParts[1]) ? strlen($decimalParts[1]) : 0; $brutto = round($netto, $precision) * $vat; @@ -80,7 +75,7 @@ function ($price, $formatted, $vat) { if ($brutto != $bruttoInput) { for ($i = 0; $i < 10; $i++) { - $nettoCheck = substr($netto, 0, -$precision); + $nettoCheck = (float)substr((string)$netto, 0, -$precision); $bruttoCheck = round($nettoCheck * $vat, $inputPrecision); if ($bruttoCheck == $bruttoInput) { diff --git a/ajax/customerFiles/getFiles.php b/ajax/customerFiles/getFiles.php index 4da6b0dda9ff32a9232e99f4932a70ef5740bcfa..c63b684c5d8ad62a986bff8cd28f03d04ff407a0 100644 --- a/ajax/customerFiles/getFiles.php +++ b/ajax/customerFiles/getFiles.php @@ -16,6 +16,7 @@ 'package_quiqqer_erp_ajax_customerFiles_getFiles', function ($hash) { $Entity = (new Processes())->getEntity($hash); + return $Entity->getCustomerFiles(true); }, ['hash'] diff --git a/ajax/output/sendMail.php b/ajax/output/sendMail.php index 1dab545d16cd58a603ab80819b77777742c6ea2d..f00aea55997e6f66fda3d8cf7aac2c27d585606d 100644 --- a/ajax/output/sendMail.php +++ b/ajax/output/sendMail.php @@ -64,7 +64,11 @@ function ( } try { - $attachedMediaFiles[] = $Media->get((int)$fileId); + $File = $Media->get((int)$fileId); + + if ($File instanceof QUI\Projects\Media\File || $File instanceof QUI\Projects\Media\Image) { + $attachedMediaFiles[] = $File; + } } catch (Exception $Exception) { QUI\System\Log::writeException($Exception); } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 03a5e5e0db9da28cd4d1114d41973c77e059d3fb..8a31c96232db2ddb1e42368b0ec52312938695e2 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,351 +1,137 @@ parameters: - ignoreErrors: - - - message: "#^Else branch is unreachable because previous condition is always true\\.$#" - count: 1 - path: ajax/calcBruttoPrice.php - - - - message: "#^Elseif branch is unreachable because previous condition is always true\\.$#" - count: 1 - path: ajax/calcBruttoPrice.php - - - - message: "#^Instanceof between \\*NEVER\\* and QUI\\\\ERP\\\\Tax\\\\TaxEntry will always evaluate to false\\.$#" - count: 1 - path: ajax/calcBruttoPrice.php - - - - message: "#^Binary operation \"\\*\" between string and \\(float\\|int\\) results in an error\\.$#" - count: 1 - path: ajax/calcNettoPrice.php - - - - message: "#^Else branch is unreachable because previous condition is always true\\.$#" - count: 1 - path: ajax/calcNettoPrice.php - - - - message: "#^Elseif branch is unreachable because previous condition is always true\\.$#" - count: 1 - path: ajax/calcNettoPrice.php - - - - message: "#^Instanceof between \\*NEVER\\* and QUI\\\\ERP\\\\Tax\\\\TaxEntry will always evaluate to false\\.$#" - count: 1 - path: ajax/calcNettoPrice.php - - - - message: "#^Parameter \\#1 \\$string of function substr expects string, float given\\.$#" - count: 1 - path: ajax/calcNettoPrice.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, float given\\.$#" - count: 1 - path: ajax/calcNettoPrice.php - - - - message: "#^Method QUI\\\\ERP\\\\ErpEntityInterface\\:\\:getCustomerFiles\\(\\) invoked with 1 parameter, 0 required\\.$#" - count: 1 - path: ajax/customerFiles/getFiles.php - - - - message: "#^Parameter \\#9 \\$attachedMediaFiles of static method QUI\\\\ERP\\\\Output\\\\Output\\:\\:sendPdfViaMail\\(\\) expects array\\<QUI\\\\Projects\\\\Media\\\\File\\|QUI\\\\Projects\\\\Media\\\\Image\\>, array\\<int\\<0, max\\>, QUI\\\\Interfaces\\\\Projects\\\\Media\\\\File\\> given\\.$#" - count: 1 - path: ajax/output/sendMail.php - - - - message: "#^Method QUI\\\\ERP\\\\Accounting\\\\ArticleList\\:\\:getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" - count: 2 - path: src/QUI/ERP/Accounting/ArticleList.php - - - - message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Accounting\\\\ArticleList\\:\\:setOrder\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" - count: 2 - path: src/QUI/ERP/Accounting/ArticleList.php - - - - message: "#^Property QUI\\\\ERP\\\\Accounting\\\\ArticleList\\:\\:\\$Order has unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder as its type\\.$#" - count: 2 - path: src/QUI/ERP/Accounting/ArticleList.php - - - - message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" - count: 1 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Call to method getDeliveryAddress\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" - count: 1 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Class QUI\\\\ERP\\\\Order\\\\AbstractOrder not found\\.$#" - count: 1 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Offset 0 on array\\<string, mixed\\> in isset\\(\\) does not exist\\.$#" - count: 1 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Offset 0 on array\\<string, string\\> in isset\\(\\) does not exist\\.$#" - count: 1 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Accounting\\\\Calc\\:\\:calculateInvoicePayments\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" - count: 2 - path: src/QUI/ERP/Accounting/Calc.php - - - - message: "#^Parameter \\$Transaction of method QUI\\\\ERP\\\\ErpTransactionsInterface\\:\\:addTransaction\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" - count: 1 - path: src/QUI/ERP/ErpTransactionsInterface.php - - - - message: "#^Parameter \\$Transaction of method QUI\\\\ERP\\\\ErpTransactionsInterface\\:\\:linkTransaction\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" - count: 1 - path: src/QUI/ERP/ErpTransactionsInterface.php - - - - message: "#^Parameter \\#1 \\$code of method QUI\\\\Interfaces\\\\Users\\\\User\\:\\:activate\\(\\) expects string, false given\\.$#" - count: 1 - path: src/QUI/ERP/Manufacturers.php - - - - message: "#^Strict comparison using \\=\\=\\= between mixed and '' will always evaluate to false\\.$#" - count: 2 - path: src/QUI/ERP/Manufacturers.php - - - - message: "#^Call to method createPDF\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#" - count: 1 - path: src/QUI/ERP/Output/Output.php - - - - message: "#^Method QUI\\\\ERP\\\\Output\\\\Output\\:\\:getDocumentPdf\\(\\) has invalid return type QUI\\\\HtmlToPdf\\\\Document\\.$#" - count: 2 - path: src/QUI/ERP/Output/Output.php - - - - message: "#^Call to method setContentHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#" - count: 1 - path: src/QUI/ERP/Output/OutputTemplate.php - - - - message: "#^Call to method setFooterHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#" - count: 1 - path: src/QUI/ERP/Output/OutputTemplate.php - - - - message: "#^Call to method setHeaderHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#" - count: 1 - path: src/QUI/ERP/Output/OutputTemplate.php - - - - message: "#^Instantiated class QUI\\\\HtmlToPdf\\\\Document not found\\.$#" - count: 1 - path: src/QUI/ERP/Output/OutputTemplate.php - - - - message: "#^Method QUI\\\\ERP\\\\Output\\\\OutputTemplate\\:\\:getPDFDocument\\(\\) has invalid return type QUI\\\\HtmlToPdf\\\\Document\\.$#" - count: 2 - path: src/QUI/ERP/Output/OutputTemplate.php - - - - message: "#^Call to method getAmountFormatted\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getDate\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getHash\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" - count: 3 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getHash\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" - count: 2 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getPrefixedNumber\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getPrefixedNumber\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getUUID\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" - count: 2 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to method getUUID\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" - count: 2 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Handler\\.$#" - count: 3 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#" - count: 2 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to static method getSalesOrder\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\Handler\\.$#" - count: 2 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to static method getTableSalesOrders\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice not found\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary not found\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getInvoices\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getInvoices\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getOffers\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\Order\\.$#" - count: 2 - path: src/QUI/ERP/Process.php - - - - message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\OrderInProcess\\.$#" - count: 2 - path: src/QUI/ERP/Process.php - - - - message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getTransactions\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" - count: 1 - path: src/QUI/ERP/Process.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Processes.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Processes.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Processes.php - - - - message: "#^Call to static method getTableSalesOrders\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Processes.php - - - - message: "#^Call to static method table\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Factory\\.$#" - count: 1 - path: src/QUI/ERP/Processes.php - - - - message: "#^Dead catch \\- Exception is never thrown in the try block\\.$#" - count: 2 - path: src/QUI/ERP/Processes.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Utils/Process.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#" - count: 1 - path: src/QUI/ERP/Utils/Process.php - - - - message: "#^Call to static method getInvoiceByString\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Utils\\\\Invoice\\.$#" - count: 1 - path: src/QUI/ERP/Utils/Process.php + ignoreErrors: + - + message: "#^Property QUI\\\\ERP\\\\Accounting\\\\ArticleList::\\$Order has unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder as its type\\.$#" + path: src/QUI/ERP/Accounting/ArticleList.php + - + message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Accounting\\\\ArticleList::setOrder\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" + path: src/QUI/ERP/Accounting/ArticleList.php + - + message: "#^Method QUI\\\\ERP\\\\Accounting\\\\ArticleList::getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" + path: src/QUI/ERP/Accounting/ArticleList.php + - + message: "#^Call to method getDeliveryAddress\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" + path: src/QUI/ERP/Accounting/Calc.php + - + message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Accounting\\\\Calc::calculateInvoicePayments\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" + path: src/QUI/ERP/Accounting/Calc.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#" + path: src/QUI/ERP/Accounting/Calc.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#" + path: src/QUI/ERP/Accounting/Calc.php + - + message: "#^Class QUI\\\\ERP\\\\Order\\\\AbstractOrder not found\\.$#" + path: src/QUI/ERP/Accounting/Calc.php + - + message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#" + path: src/QUI/ERP/Accounting/Calc.php + - + message: "#^Parameter \\$Transaction of method QUI\\\\ERP\\\\ErpTransactionsInterface::linkTransaction\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" + path: src/QUI/ERP/ErpTransactionsInterface.php + - + message: "#^Parameter \\$Transaction of method QUI\\\\ERP\\\\ErpTransactionsInterface::addTransaction\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" + path: src/QUI/ERP/ErpTransactionsInterface.php + - + message: "#^Call to method getPrefixedNumber\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getPrefixedNumber\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getUUID\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getUUID\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice not found\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary not found\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Method QUI\\\\ERP\\\\Process::getInvoices\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Method QUI\\\\ERP\\\\Process::getInvoices\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Method QUI\\\\ERP\\\\Process::getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\Order\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Method QUI\\\\ERP\\\\Process::getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\OrderInProcess\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getHash\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Method QUI\\\\ERP\\\\Process::getOffers\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Handler\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getHash\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getAmountFormatted\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to method getDate\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Method QUI\\\\ERP\\\\Process::getTransactions\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#" + path: src/QUI/ERP/Process.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#" + path: src/QUI/ERP/Processes.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#" + path: src/QUI/ERP/Processes.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Handler\\.$#" + path: src/QUI/ERP/Processes.php + - + message: "#^Call to static method getTableSalesOrders\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\Handler\\.$#" + path: src/QUI/ERP/Processes.php + - + message: "#^Call to static method table\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Factory\\.$#" + path: src/QUI/ERP/Processes.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#" + path: src/QUI/ERP/Utils/Process.php + - + message: "#^Call to static method getInvoiceByString\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Utils\\\\Invoice\\.$#" + path: src/QUI/ERP/Utils/Process.php + - + message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#" + path: src/QUI/ERP/Utils/Process.php \ No newline at end of file diff --git a/src/QUI/ERP/Accounting/Article.php b/src/QUI/ERP/Accounting/Article.php index 457140cd369f5b636f01dd8b7c4b95f820a8a902..6410d40d90630f5efb2cdbe08205d6349e308dad 100644 --- a/src/QUI/ERP/Accounting/Article.php +++ b/src/QUI/ERP/Accounting/Article.php @@ -63,35 +63,35 @@ class Article implements ArticleInterface /** * @var float|int */ - protected float|int $price; + protected float | int $price; /** * @var float|int */ - protected float|int $basisPrice; + protected float | int $basisPrice; /** * @var float|int|null */ - protected float|int|null $nettoPriceNotRounded = null; + protected float | int | null $nettoPriceNotRounded = null; /** * @var float|int */ - protected float|int $sum; + protected float | int $sum; /** * The calculated netto sum with quantity and discount * @var float|int */ - protected float|int $nettoSum = 0; + protected float | int $nettoSum = 0; /** * Sum from the article, without discount and with quantity * * @var float|int */ - protected float|int $nettoSubSum = 0; + protected float | int $nettoSubSum = 0; /** * The article netto price, without discount, without quantity @@ -99,7 +99,7 @@ class Article implements ArticleInterface * * @var float|int */ - protected float|int $nettoPrice = 0; + protected float | int $nettoPrice = 0; /** * The article netto price, without discount, without quantity @@ -107,7 +107,7 @@ class Article implements ArticleInterface * * @var float|int */ - protected float|int $nettoBasisPrice = 0; + protected float | int $nettoBasisPrice = 0; /** * @var array @@ -285,7 +285,7 @@ public function getProductSetParentUuid(): ?string * * @return int|string */ - public function getArticleNo(): int|string + public function getArticleNo(): int | string { if (isset($this->attributes['articleNo'])) { return $this->attributes['articleNo']; @@ -439,7 +439,7 @@ public function getSum(): Price * * @return float|int */ - public function getVat(): float|int + public function getVat(): float | int { if (isset($this->attributes['vat']) && $this->attributes['vat'] !== '') { return (float)$this->attributes['vat']; @@ -532,7 +532,7 @@ public function setCurrency(QUI\ERP\Currency\Currency $Currency): void * * @return float|int|bool */ - public function getQuantity(): float|int|bool + public function getQuantity(): float | int | bool { if (isset($this->attributes['quantity'])) { return $this->attributes['quantity']; @@ -547,7 +547,7 @@ public function getQuantity(): float|int|bool * @param null|QUI\Locale $Locale * @return string */ - public function getQuantityUnit(QUI\Locale $Locale = null): string + public function getQuantityUnit(null | QUI\Locale $Locale = null): string { if ($Locale === null) { $Locale = QUI::getLocale(); @@ -607,7 +607,7 @@ public function displayPrice(): bool * * @todo überdenken, ganzer artikel ist eigentlich nicht änderbar */ - public function setDiscount(float|int $discount, int $discountType = Calc::CALCULATION_COMPLEMENT): void + public function setDiscount(float | int $discount, int $discountType = Calc::CALCULATION_COMPLEMENT): void { switch ($discountType) { case Calc::CALCULATION_PERCENTAGE: @@ -649,7 +649,7 @@ public function hasDiscount(): bool * @param null|Calc|QUI\ERP\User $Instance * @return self */ - public function calc(Calc|QUI\ERP\User $Instance = null): Article + public function calc(null | Calc | QUI\ERP\User $Instance = null): Article { if ($this->calculated) { return $this; diff --git a/src/QUI/ERP/Accounting/ArticleListUnique.php b/src/QUI/ERP/Accounting/ArticleListUnique.php index 853c445fa81c1387c3e16c3beb3ae9d7407a8249..d72f4494e612819338da5cf2ef34c43ecfe7d4bf 100644 --- a/src/QUI/ERP/Accounting/ArticleListUnique.php +++ b/src/QUI/ERP/Accounting/ArticleListUnique.php @@ -86,7 +86,7 @@ class ArticleListUnique implements IteratorAggregate * @param ?QUI\Interfaces\Users\User $User * @throws QUI\ERP\Exception|QUI\Exception */ - public function __construct(array $attributes = [], QUI\Interfaces\Users\User $User = null) + public function __construct(array $attributes = [], null | QUI\Interfaces\Users\User $User = null) { $this->Locale = QUI::getLocale(); @@ -271,7 +271,7 @@ public function setLocale(QUI\Locale $Locale): void * * @throws QUI\Exception */ - public static function unserialize(array|string $data): ArticleListUnique + public static function unserialize(array | string $data): ArticleListUnique { if (is_string($data)) { $data = json_decode($data, true); @@ -391,8 +391,8 @@ public function setExchangeRate(float $rate): void * @throws Exception */ public function toHTML( - bool|string $template = false, - bool|string $articleTemplate = false, + bool | string $template = false, + bool | string $articleTemplate = false, ?QUI\Interfaces\Template\EngineInterface $Engine = null ): string { if ($Engine === null) { @@ -556,8 +556,8 @@ public function toMailHTML(): string * @throws Exception */ public function toHTMLWithCSS( - bool|string $template = false, - bool|string $articleTemplate = false, + bool | string $template = false, + bool | string $articleTemplate = false, ?QUI\Interfaces\Template\EngineInterface $Engine = null ): string { $style = '<style>'; @@ -577,8 +577,8 @@ public function toHTMLWithCSS( * @throws Exception */ public function render( - bool|string $template = false, - bool|string $articleTemplate = false + bool | string $template = false, + bool | string $articleTemplate = false ): string { return $this->toHTMLWithCSS($template, $articleTemplate); } @@ -620,7 +620,7 @@ public function getPriceFactors(): ErpFactorList * * @return ArrayIterator|Traversable */ - public function getIterator(): Traversable|ArrayIterator + public function getIterator(): Traversable | ArrayIterator { return new ArrayIterator($this->articles); } diff --git a/src/QUI/ERP/Accounting/Calc.php b/src/QUI/ERP/Accounting/Calc.php index 8a3f3ea61509aa9894893de61ca42a65a8453e1a..4a3dc60e9ce9299fa5ba8f8c31bde34f27a7ab43 100644 --- a/src/QUI/ERP/Accounting/Calc.php +++ b/src/QUI/ERP/Accounting/Calc.php @@ -126,7 +126,7 @@ public function __construct(?UserInterface $User = null) * @param UserInterface|null $User - optional * @return Calc */ - public static function getInstance(UserInterface $User = null): Calc + public static function getInstance(null | UserInterface $User = null): Calc { if (!$User && QUI::isBackend()) { $User = QUI::getUsers()->getSystemUser(); @@ -200,7 +200,7 @@ public function getCurrency(): ?QUI\ERP\Currency\Currency * @param callable|boolean $callback - optional, callback function for the data array * @return ArticleList */ - public function calcArticleList(ArticleList $List, callable|bool $callback = false): ArticleList + public function calcArticleList(ArticleList $List, callable | bool $callback = false): ArticleList { // calc data if (!is_callable($callback)) { @@ -414,11 +414,11 @@ public function calcArticleList(ArticleList $List, callable|bool $callback = fal } // delete 0 % vat, 0% vat is allowed to calculate more easily - if (isset($vatText[0])) { + if (isset($vatText[0])) { // @phpstan-ignore-line unset($vatText[0]); } - if (isset($vatArray[0])) { + if (isset($vatArray[0])) { // @phpstan-ignore-line unset($vatArray[0]); } @@ -475,6 +475,9 @@ public function calcArticleList(ArticleList $List, callable|bool $callback = fal // counterbalance - gegenrechnung // works only for one vat entry + + // @todo: check -> wegen is netto, müsste eigentlich nach dem if + // @phpstan-ignore-next-line if (count($vatArray) === 1 && $isNetto) { $vat = key($vatArray); $netto = $bruttoSum / ((float)$vat / 100 + 1); @@ -687,25 +690,28 @@ public function calcArticlePrice(Article $Article, $callback = false) * @param string|int|float $value * @return float */ - public function round($value): float + public function round(string | int | float $value): float { $decimalSeparator = $this->getUser()->getLocale()->getDecimalSeparator(); $groupingSeparator = $this->getUser()->getLocale()->getGroupingSeparator(); $precision = QUI\ERP\Defaults::getPrecision(); + if (is_int($value) || is_float($value)) { + return round($value, $precision); + } + if (strpos($value, $decimalSeparator) && $decimalSeparator != '.') { $value = str_replace($groupingSeparator, '', $value); } $value = str_replace(',', '.', $value); $value = floatval($value); - $value = round($value, $precision); - return $value; + return round($value, $precision); } /** - * Return the tax message for an user + * Return the tax message for a user * * @return string */ @@ -731,9 +737,9 @@ public function getVatTextByUser(): string * @return string */ public static function getVatText( - float|int $vat, + float | int $vat, UserInterface $User, - QUI\Locale $Locale = null + null | QUI\Locale $Locale = null ): string { if ($Locale === null) { $Locale = QUI::getLocale(); @@ -1015,8 +1021,8 @@ public static function calculatePayments($ToCalculate): array ) { // Leave everything as it is because a subscription plan order can never be set to "paid" } elseif ( - $ToCalculate->getAttribute('paid_status') === QUI\ERP\Constants::TYPE_INVOICE_REVERSAL - || $ToCalculate->getAttribute('paid_status') === QUI\ERP\Constants::TYPE_INVOICE_CANCEL + $ToCalculate->getAttribute('paid_status') === QUI\ERP\Constants::PAYMENT_STATUS_ERROR + || $ToCalculate->getAttribute('paid_status') === QUI\ERP\Constants::PAYMENT_STATUS_CANCELED || $ToCalculate->getAttribute('paid_status') === QUI\ERP\Constants::PAYMENT_STATUS_DEBIT ) { // Leave everything as it is @@ -1071,13 +1077,13 @@ public static function isAllowedForCalculation(mixed $ToCalculate): bool * @param QUI\ERP\Currency\Currency|null $Currency * @return array */ - public static function calculateTotal(array $invoiceList, QUI\ERP\Currency\Currency $Currency = null): array + public static function calculateTotal(array $invoiceList, null | QUI\ERP\Currency\Currency $Currency = null): array { if ($Currency === null) { try { $currency = json_decode($invoiceList[0]['currency_data'], true); $Currency = QUI\ERP\Currency\Handler::getCurrency($currency['code']); - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { $Currency = QUI\ERP\Defaults::getCurrency(); } } diff --git a/src/QUI/ERP/Accounting/CalculationValue.php b/src/QUI/ERP/Accounting/CalculationValue.php index 80017eb59713fe08fafd8440288aa3239d966b5a..1d7c769bd8b7d3e45b79e676bcce84e2b18df723 100644 --- a/src/QUI/ERP/Accounting/CalculationValue.php +++ b/src/QUI/ERP/Accounting/CalculationValue.php @@ -21,9 +21,9 @@ class CalculationValue { protected QUI\ERP\Currency\Currency $Currency; - protected int|float $number = 0; + protected int | float $number = 0; - protected int|float $precision = 8; + protected int | float $precision = 8; /** * CalculationValue constructor. @@ -32,8 +32,11 @@ class CalculationValue * @param QUI\ERP\Currency\Currency|null $Currency * @param bool|int $precision - The optional number of decimal digits to round to. */ - public function __construct($number, QUI\ERP\Currency\Currency $Currency = null, bool|int $precision = false) - { + public function __construct( + $number, + null | QUI\ERP\Currency\Currency $Currency = null, + bool | int $precision = false + ) { if (!is_numeric($number)) { return; } @@ -60,7 +63,7 @@ public function __construct($number, QUI\ERP\Currency\Currency $Currency = null, /** * @return float|int */ - public function value(): float|int + public function value(): float | int { return $this->number; } @@ -90,7 +93,7 @@ public function precision(bool $precision = false): CalculationValue * @param null|QUI\Locale $Locale - optional, Locale object for the formatting * @return string */ - public function formatted(QUI\Locale $Locale = null): string + public function formatted(null | QUI\Locale $Locale = null): string { return $this->Currency->format($this->number, $Locale); } diff --git a/src/QUI/ERP/Accounting/CalculationVatValue.php b/src/QUI/ERP/Accounting/CalculationVatValue.php index cc05581b7d15feecdfe06ec3867e8adabf9635e3..33d9cf25248770d21d316b73efae77dbe9eabd81 100644 --- a/src/QUI/ERP/Accounting/CalculationVatValue.php +++ b/src/QUI/ERP/Accounting/CalculationVatValue.php @@ -38,11 +38,11 @@ class CalculationVatValue extends CalculationValue * @param bool|int $precision - The optional number of decimal digits to round to. */ public function __construct( - int|float $number, + int | float $number, string $text, - float|int $vat, - QUI\ERP\Currency\Currency $Currency = null, - bool|int $precision = false + float | int $vat, + null | QUI\ERP\Currency\Currency $Currency = null, + bool | int $precision = false ) { parent::__construct($number, $Currency, $precision); diff --git a/src/QUI/ERP/Address.php b/src/QUI/ERP/Address.php index b36b408cb2f601741fe392730ca78f103f928af6..0ab03dd5210a409aebeb3255b664f25cb3269259 100644 --- a/src/QUI/ERP/Address.php +++ b/src/QUI/ERP/Address.php @@ -26,7 +26,7 @@ class Address extends QUI\Users\Address * @param array|null $data * @param QUIUserInterface|null $User */ - public function __construct(?array $data = [], QUI\Interfaces\Users\User $User = null) + public function __construct(?array $data = [], null | QUI\Interfaces\Users\User $User = null) { if ($User) { $this->User = $User; diff --git a/src/QUI/ERP/Api/NumberRangeInterface.php b/src/QUI/ERP/Api/NumberRangeInterface.php index d4b7274f24741f74f25c39f3eeb7a2a3dad16c1b..2f06f27e0129b58264462a90f11a215f32bb27a6 100644 --- a/src/QUI/ERP/Api/NumberRangeInterface.php +++ b/src/QUI/ERP/Api/NumberRangeInterface.php @@ -21,7 +21,7 @@ interface NumberRangeInterface * @param null|QUI\Locale $Locale * @return string */ - public function getTitle(QUI\Locale $Locale = null): string; + public function getTitle(null | QUI\Locale $Locale = null): string; /** * Return the current start of the range diff --git a/src/QUI/ERP/Dashboard/ErpDashboard.php b/src/QUI/ERP/Dashboard/ErpDashboard.php index 8a1438e3cefb3b80176eb3e092874a5a5191c60d..99bf293bb81973d4f8655b258fde3ac780542283 100644 --- a/src/QUI/ERP/Dashboard/ErpDashboard.php +++ b/src/QUI/ERP/Dashboard/ErpDashboard.php @@ -17,7 +17,7 @@ class ErpDashboard implements DashboardInterface * @param Locale|null $Locale * @return string */ - public function getTitle(QUI\Locale $Locale = null): string + public function getTitle(null | QUI\Locale $Locale = null): string { if ($Locale === null) { $Locale = QUI::getLocale(); diff --git a/src/QUI/ERP/Defaults.php b/src/QUI/ERP/Defaults.php index de420bbcd24205dacaaa08e694c51fe75f1236a3..59ac400d5daa1c4f225076951f1ea021e1446a51 100644 --- a/src/QUI/ERP/Defaults.php +++ b/src/QUI/ERP/Defaults.php @@ -38,7 +38,7 @@ class Defaults * @param string $key * @return array|bool|string */ - public static function conf(string $section, string $key): bool|array|string + public static function conf(string $section, string $key): bool | array | string { try { $Package = QUI::getPackage('quiqqer/erp'); @@ -110,7 +110,7 @@ public static function getCurrency(): Currency\Currency * @param QUI\Interfaces\Users\User|null $User * @return Currency\Currency|null */ - public static function getUserCurrency(QUI\Interfaces\Users\User $User = null): ?Currency\Currency + public static function getUserCurrency(null | QUI\Interfaces\Users\User $User = null): ?Currency\Currency { if (self::$userRelatedCurrency !== null) { if (self::$userRelatedCurrency) { @@ -191,7 +191,7 @@ public static function getPrecision(): int * @param bool|string $lang - language of the wanted timestamp * @return int|null|string */ - public static function getTimestampFormat(bool|string $lang = false): int|string|null + public static function getTimestampFormat(bool | string $lang = false): int | string | null { if ($lang === false) { $lang = QUI::getLocale()->getCurrent(); @@ -227,7 +227,7 @@ public static function getTimestampFormat(bool|string $lang = false): int|string * @param bool|string $lang * @return string */ - public static function getDateFormat(bool|string $lang = false): string + public static function getDateFormat(bool | string $lang = false): string { if ($lang === false) { $lang = QUI::getLocale()->getCurrent(); diff --git a/src/QUI/ERP/ErpCopyInterface.php b/src/QUI/ERP/ErpCopyInterface.php index 8ae4c239804311529f4bc1dfabb0fa184992c68c..35d2b8683ae7ac201377631178a69ce76215289c 100644 --- a/src/QUI/ERP/ErpCopyInterface.php +++ b/src/QUI/ERP/ErpCopyInterface.php @@ -20,7 +20,7 @@ interface ErpCopyInterface * @return ErpEntityInterface */ public function copy( - User $PermissionUser = null, - bool|string $globalProcessId = false + null | User $PermissionUser = null, + bool | string $globalProcessId = false ): ErpEntityInterface; } diff --git a/src/QUI/ERP/ErpEntityInterface.php b/src/QUI/ERP/ErpEntityInterface.php index 66378dbf6ce07423651e903537b8d0e9d9769298..03832b264f3f2598b46fd9f70414e830b65be3bf 100644 --- a/src/QUI/ERP/ErpEntityInterface.php +++ b/src/QUI/ERP/ErpEntityInterface.php @@ -70,7 +70,7 @@ public function getCurrency(): QUI\ERP\Currency\Currency; * * @return ArticleList|ArticleListUnique */ - public function getArticles(): ArticleList|ArticleListUnique; + public function getArticles(): ArticleList | ArticleListUnique; /** * Get the price calculation object of the erp entity @@ -91,7 +91,7 @@ public function getDeliveryAddress(): ?ErpAddress; * * @param array|User $User */ - public function setCustomer(array|QUI\Interfaces\Users\User $User); + public function setCustomer(array | QUI\Interfaces\Users\User $User); /** * Returns the erp entity as an array @@ -110,12 +110,12 @@ public function toArray(): array; */ public function reversal( string $reason = '', - QUI\Interfaces\Users\User $PermissionUser = null + null | QUI\Interfaces\Users\User $PermissionUser = null ): ?ErpEntityInterface; public function addCustomerFile(string $fileHash, array $options = []): void; public function clearCustomerFiles(): void; - public function getCustomerFiles(): array; + public function getCustomerFiles(bool $parsing = false): array; } diff --git a/src/QUI/ERP/Manufacturers.php b/src/QUI/ERP/Manufacturers.php index 33073a2773693f8cf6f72b8719251f3f5e993272..9b64886880b24533794d355e73474581f4c65e65 100644 --- a/src/QUI/ERP/Manufacturers.php +++ b/src/QUI/ERP/Manufacturers.php @@ -159,11 +159,11 @@ public static function createManufacturer( $Address->save(); - if (!$User->getAttribute('firstname') || $User->getAttribute('firstname') === '') { + if (empty($User->getAttribute('firstname'))) { $User->setAttribute('firstname', $address['firstname']); } - if (!$User->getAttribute('lastname') || $User->getAttribute('lastname') === '') { + if (empty($User->getAttribute('lastname'))) { $User->setAttribute('lastname', $address['lastname']); } } @@ -183,7 +183,7 @@ public static function createManufacturer( // Set random password and activate $User->setPassword(QUI\Security\Password::generateRandom(), $SystemUser); - $User->activate(false, $SystemUser); + $User->activate('', $SystemUser); return $User; } diff --git a/src/QUI/ERP/Money/Price.php b/src/QUI/ERP/Money/Price.php index b9f4e7d28c53ccd4d42cf8f23b51eb792130b7a0..05079e4f4980a9fdae95aa9fd853cb0089191928 100644 --- a/src/QUI/ERP/Money/Price.php +++ b/src/QUI/ERP/Money/Price.php @@ -31,7 +31,7 @@ class Price * Netto Price * @var float|int */ - protected float|int $price; + protected float | int $price; /** * Price currency @@ -64,9 +64,9 @@ class Price * @param User|null $User - optional, if no user, session user are used */ public function __construct( - float|int|null $price, + float | int | null $price, QUI\ERP\Currency\Currency $Currency, - QUI\Interfaces\Users\User $User = null + null | QUI\Interfaces\Users\User $User = null ) { if (!$price) { $price = 0; @@ -102,7 +102,7 @@ public function toArray(): array * * @return float|int|null */ - public function getPrice(): float|int|null + public function getPrice(): float | int | null { return $this->validatePrice($this->price); } @@ -112,7 +112,7 @@ public function getPrice(): float|int|null * * @return float|int|null */ - public function value(): float|int|null + public function value(): float | int | null { return $this->getPrice(); } @@ -122,7 +122,7 @@ public function value(): float|int|null * * @return float|int|null */ - public function getValue(): float|int|null + public function getValue(): float | int | null { return $this->getPrice(); } @@ -198,7 +198,7 @@ public function getCurrency(): QUI\ERP\Currency\Currency * @param QUI\Locale|null $Locale - based locale, in which the price is * @return float|int|null */ - public static function validatePrice(mixed $value, QUI\Locale $Locale = null): float|int|null + public static function validatePrice(mixed $value, null | QUI\Locale $Locale = null): float | int | null { if (is_float($value) || is_int($value)) { return round($value, QUI\ERP\Defaults::getPrecision()); diff --git a/src/QUI/ERP/Output/Output.php b/src/QUI/ERP/Output/Output.php index 76cf712ba87e4e629ba30365e2d30ee64bd13a00..cd0619bb4242e543a4bbcd16e9ef39413ed42d9e 100644 --- a/src/QUI/ERP/Output/Output.php +++ b/src/QUI/ERP/Output/Output.php @@ -32,7 +32,7 @@ class Output * @param string $package * @return OutputProviderInterface|false - OutputProvider class (static) or false if none found */ - public static function getOutputProviderByPackage(string $package): bool|OutputProviderInterface + public static function getOutputProviderByPackage(string $package): bool | OutputProviderInterface { foreach (self::getAllOutputProviders() as $outputProvider) { if ($outputProvider['package'] === $package) { @@ -49,7 +49,7 @@ public static function getOutputProviderByPackage(string $package): bool|OutputP * @param string $entityType * @return string|false - OutputProvider class (static) or false if none found */ - public static function getOutputProviderByEntityType(string $entityType): bool|string + public static function getOutputProviderByEntityType(string $entityType): bool | string { foreach (self::getAllOutputProviders() as $outputProvider) { $class = $outputProvider['class']; @@ -77,11 +77,11 @@ public static function getOutputProviderByEntityType(string $entityType): bool|s * @throws QUI\Exception */ public static function getDocumentHtml( - int|string $entityId, + int | string $entityId, string $entityType, - OutputProviderInterface $OutputProvider = null, - OutputTemplateProviderInterface $TemplateProvider = null, - string $template = null, + null | OutputProviderInterface $OutputProvider = null, + null | OutputTemplateProviderInterface $TemplateProvider = null, + null | string $template = null, bool $preview = false ): string { if (empty($OutputProvider)) { @@ -125,11 +125,11 @@ public static function getDocumentHtml( * @throws QUI\Exception */ public static function getDocumentPdf( - int|string $entityId, + int | string $entityId, string $entityType, - OutputProviderInterface $OutputProvider = null, - OutputTemplateProviderInterface $TemplateProvider = null, - string $template = null + null | OutputProviderInterface $OutputProvider = null, + null | OutputTemplateProviderInterface $TemplateProvider = null, + null | string $template = null ): QUI\HtmlToPdf\Document { if (empty($OutputProvider)) { $OutputProvider = self::getOutputProviderByEntityType($entityType); @@ -158,7 +158,7 @@ public static function getDocumentPdf( * * @return string */ - public static function getDocumentPdfDownloadUrl(int|string $entityId, string $entityType): string + public static function getDocumentPdfDownloadUrl(int | string $entityId, string $entityType): string { $url = URL_OPT_DIR . 'quiqqer/erp/bin/output/frontend/download.php?'; $url .= http_build_query([ @@ -187,14 +187,14 @@ public static function getDocumentPdfDownloadUrl(int|string $entityId, string $e * @throws QUI\Exception|\PHPMailer\PHPMailer\Exception */ public static function sendPdfViaMail( - int|string $entityId, + int | string $entityId, string $entityType, - OutputProviderInterface $OutputProvider = null, - OutputTemplateProviderInterface $TemplateProvider = null, - string $template = null, - string $recipientEmail = null, - string $mailSubject = null, - string $mailContent = null, + null | OutputProviderInterface $OutputProvider = null, + null | OutputTemplateProviderInterface $TemplateProvider = null, + null | string $template = null, + null | string $recipientEmail = null, + null | string $mailSubject = null, + null | string $mailContent = null, array $attachedMediaFiles = [] ): void { if (empty($OutputProvider)) { @@ -310,7 +310,7 @@ public static function getOutputTemplateProviderByPackage(string $package): ?Out * @param string|null $entityType (optional) - Restrict to templates of $entityType [default: fetch templates for all entity types] * @return array */ - public static function getTemplates(string $entityType = null): array + public static function getTemplates(null | string $entityType = null): array { $templates = []; $outputProviders = []; @@ -419,7 +419,7 @@ public static function getDefaultOutputTemplateForEntityType(string $entityType) * @param string $entityType * @return string|false */ - public static function getDefaultOutputTemplateProviderForEntityType(string $entityType): string|bool + public static function getDefaultOutputTemplateProviderForEntityType(string $entityType): string | bool { $defaultEntityTypeTemplate = self::getDefaultOutputTemplateForEntityType($entityType); diff --git a/src/QUI/ERP/Output/OutputProviderInterface.php b/src/QUI/ERP/Output/OutputProviderInterface.php index 8e2a9f495968d5dcf2989786833b27bdb5519f99..1737d2b93a14d47017a326869ee437f55b7c27ca 100644 --- a/src/QUI/ERP/Output/OutputProviderInterface.php +++ b/src/QUI/ERP/Output/OutputProviderInterface.php @@ -28,7 +28,7 @@ public static function getEntityType(): string; * @param Locale|null $Locale $Locale (optional) - If omitted use \QUI::getLocale() * @return mixed */ - public static function getEntityTypeTitle(Locale $Locale = null): mixed; + public static function getEntityTypeTitle(null | Locale $Locale = null): mixed; /** * Get the entity the output is created for @@ -36,7 +36,7 @@ public static function getEntityTypeTitle(Locale $Locale = null): mixed; * @param int|string $entityId * @return mixed */ - public static function getEntity(int|string $entityId): mixed; + public static function getEntity(int | string $entityId): mixed; /** * Get download filename (without file extension) @@ -44,7 +44,7 @@ public static function getEntity(int|string $entityId): mixed; * @param int|string $entityId * @return string */ - public static function getDownloadFileName(int|string $entityId): string; + public static function getDownloadFileName(int | string $entityId): string; /** * Get output Locale by entity @@ -52,7 +52,7 @@ public static function getDownloadFileName(int|string $entityId): string; * @param int|string $entityId * @return Locale */ - public static function getLocale(int|string $entityId): Locale; + public static function getLocale(int | string $entityId): Locale; /** * Fill the OutputTemplate with appropriate entity data @@ -60,7 +60,7 @@ public static function getLocale(int|string $entityId): Locale; * @param int|string $entityId * @return array */ - public static function getTemplateData(int|string $entityId): array; + public static function getTemplateData(int | string $entityId): array; /** * Checks if $User has permission to download the document of $entityId @@ -69,7 +69,7 @@ public static function getTemplateData(int|string $entityId): array; * @param User $User * @return bool */ - public static function hasDownloadPermission(int|string $entityId, User $User): bool; + public static function hasDownloadPermission(int | string $entityId, User $User): bool; /** * Get e-mail address of the document recipient @@ -77,7 +77,7 @@ public static function hasDownloadPermission(int|string $entityId, User $User): * @param int|string $entityId * @return string|false - E-Mail address or false if no e-mail address available */ - public static function getEmailAddress(int|string $entityId): bool|string; + public static function getEmailAddress(int | string $entityId): bool | string; /** * Get e-mail subject when document is sent via mail @@ -85,7 +85,7 @@ public static function getEmailAddress(int|string $entityId): bool|string; * @param int|string $entityId * @return string */ - public static function getMailSubject(int|string $entityId): string; + public static function getMailSubject(int | string $entityId): string; /** * Get e-mail body when document is sent via mail @@ -93,5 +93,5 @@ public static function getMailSubject(int|string $entityId): string; * @param int|string $entityId * @return string */ - public static function getMailBody(int|string $entityId): string; + public static function getMailBody(int | string $entityId): string; } diff --git a/src/QUI/ERP/Output/OutputTemplate.php b/src/QUI/ERP/Output/OutputTemplate.php index 8e7fc3154a9fa6ab00634a70d799e212bb624006..6299f9ef5a7b151b35397ff29089528b8013d7ab 100644 --- a/src/QUI/ERP/Output/OutputTemplate.php +++ b/src/QUI/ERP/Output/OutputTemplate.php @@ -17,17 +17,17 @@ class OutputTemplate /** * @var string|OutputTemplateProviderInterface */ - protected string|OutputTemplateProviderInterface $TemplateProvider; + protected string | OutputTemplateProviderInterface $TemplateProvider; /** * @var string|OutputProviderInterface */ - protected string|OutputProviderInterface $OutputProvider; + protected string | OutputProviderInterface $OutputProvider; /** * @var string|null */ - protected string|null $template; + protected string | null $template; /** * @var QUI\Interfaces\Template\EngineInterface @@ -42,7 +42,7 @@ class OutputTemplate /** * @var string|int */ - protected string|int $entityId; + protected string | int $entityId; /** * The entity the output is created for @@ -66,11 +66,11 @@ class OutputTemplate * @param string|null $template (optional) - Template identifier (from template provider) */ public function __construct( - OutputTemplateProviderInterface|string $TemplateProvider, - OutputProviderInterface|string $OutputProvider, - int|string $entityId, + OutputTemplateProviderInterface | string $TemplateProvider, + OutputProviderInterface | string $OutputProvider, + int | string $entityId, string $entityType, - string $template = null + null | string $template = null ) { $this->Engine = QUI::getTemplateManager()->getEngine(); $this->TemplateProvider = $TemplateProvider; @@ -168,6 +168,14 @@ public function getHTML(bool $preview = false): string */ public function getPDFDocument(): QUI\HtmlToPdf\Document { + if (!class_exists('QUI\HtmlToPdf\Document')) { + QUI\System\Log::addError('Missing html2pdf module. Please install the html2pdf module.'); + + throw new QUI\Exception( + 'An error has occurred. Please try again or contact support if the issue persists.' + ); + } + $Locale = $this->OutputProvider::getLocale($this->entityId); QUI::getLocale()->setTemporaryCurrent($Locale->getCurrent()); @@ -216,7 +224,7 @@ public function getEngine(): QUI\Interfaces\Template\EngineInterface /** * @return OutputTemplateProviderInterface|string */ - public function getTemplateProvider(): OutputTemplateProviderInterface|string + public function getTemplateProvider(): OutputTemplateProviderInterface | string { if (is_string($this->TemplateProvider)) { return $this->TemplateProvider; diff --git a/src/QUI/ERP/Output/OutputTemplateProviderInterface.php b/src/QUI/ERP/Output/OutputTemplateProviderInterface.php index cbafd9c01e7f6646717d0729a4b4a01ba47f4134..012ee4d80cfc3d1423caff83220d226360e8a21a 100644 --- a/src/QUI/ERP/Output/OutputTemplateProviderInterface.php +++ b/src/QUI/ERP/Output/OutputTemplateProviderInterface.php @@ -34,7 +34,10 @@ public static function getTemplates(string $entityType): array; * @param Locale|null $Locale $Locale (optional) - If omitted use \QUI::getLocale() * @return string */ - public static function getTemplateTitle(int|string $templateId, Locale $Locale = null): string; + public static function getTemplateTitle( + int | string $templateId, + null | Locale $Locale = null + ): string; /** * Get HTML for document header area @@ -46,11 +49,11 @@ public static function getTemplateTitle(int|string $templateId, Locale $Locale = * @return string|false */ public static function getHeaderHtml( - int|string $templateId, + int | string $templateId, string $entityType, EngineInterface $Engine, mixed $Entity - ): bool|string; + ): bool | string; /** * Get HTML for document body area @@ -62,11 +65,11 @@ public static function getHeaderHtml( * @return string|false */ public static function getBodyHtml( - int|string $templateId, + int | string $templateId, string $entityType, EngineInterface $Engine, mixed $Entity - ): bool|string; + ): bool | string; /** * Get HTML for document footer area @@ -78,9 +81,9 @@ public static function getBodyHtml( * @return string|false */ public static function getFooterHtml( - int|string $templateId, + int | string $templateId, string $entityType, EngineInterface $Engine, mixed $Entity - ): bool|string; + ): bool | string; } diff --git a/src/QUI/ERP/Process.php b/src/QUI/ERP/Process.php index cddd76a58a778a62ae2392246211a90ba053afb5..dcf28e61e83561d79cce22d272768cf3b3ea1620 100644 --- a/src/QUI/ERP/Process.php +++ b/src/QUI/ERP/Process.php @@ -31,19 +31,8 @@ class Process */ const PROCESS_ACTIVE_DATE = '2024-08-01 00:00:00'; - /** - * @var string - */ protected string $processId; - - /** - * @var null|array - */ protected ?array $transactions = null; - - /** - * @var null|QUI\ERP\Comments - */ protected ?Comments $History = null; /** @@ -166,7 +155,11 @@ class_exists('QUI\ERP\Accounting\Invoice\Invoice') $groups[$uuid][] = $Entity; if (class_exists('QUI\ERP\SalesOrders\Handler')) { - $salesOrder = $Entity->getPaymentData('salesOrder'); + $salesOrder = $Entity->getPaymentDataEntry('salesOrder'); + + if (empty($salesOrder)) { + $salesOrder = $Entity->getCustomDataEntry('salesOrder'); + } if ($salesOrder) { try { diff --git a/src/QUI/ERP/Processes.php b/src/QUI/ERP/Processes.php index ecb9a8666ff47268397e785bf7d9f8922b0111a2..a7c66bb3ba39ea276c879d7039b22a4c2da10956 100644 --- a/src/QUI/ERP/Processes.php +++ b/src/QUI/ERP/Processes.php @@ -43,6 +43,7 @@ public function getEntity($entityHash, $entityPlugin = false): ErpEntityInterfac if ($entityPlugin === false || $entityPlugin === 'quiqqer/booking') { try { // @todo quiqqer/booking + // @phpstan-ignore-next-line } catch (\Exception) { } } @@ -70,6 +71,7 @@ public function getEntity($entityHash, $entityPlugin = false): ErpEntityInterfac if ($entityPlugin === false || $entityPlugin === 'quiqqer/delivery-notes') { try { // @todo quiqqer/delivery-notes + // @phpstan-ignore-next-line } catch (\Exception) { } } diff --git a/src/QUI/ERP/User.php b/src/QUI/ERP/User.php index ae6476af592ab30530fe3c88ca2b84cdb07fb726..64d5d75484a88985d71f9dd9577fd28dc11e14c8 100644 --- a/src/QUI/ERP/User.php +++ b/src/QUI/ERP/User.php @@ -292,7 +292,7 @@ public static function convertUserDataToErpUser(array $user): User /** * @deprecated use getUUID() */ - public function getId(): int|false + public function getId(): int | false { return $this->id; } @@ -433,7 +433,7 @@ public function getStatus(): int * @param int|string $id - only for the interface, has no effect * @return Address */ - public function getAddress(int|string $id = 0): QUI\Users\Address + public function getAddress(int | string $id = 0): QUI\Users\Address { return new Address($this->address, $this); } @@ -514,7 +514,7 @@ public function isSU(): bool return false; } - public function isInGroup(int|string $groupId): bool + public function isInGroup(int | string $groupId): bool { return false; } @@ -541,7 +541,7 @@ public function deactivate(?UserInterface $PermissionUser = null): bool return true; } - public function disable(UserInterface|null $PermissionUser = null): bool + public function disable(UserInterface | null $PermissionUser = null): bool { return true; } @@ -561,7 +561,7 @@ public function delete(?UserInterface $PermissionUser = null): bool /** * This user has nowhere permissions */ - public function getPermission(string $right, bool|array|string|callable $ruleset = false): bool + public function getPermission(string $right, bool | array | string | callable $ruleset = false): bool { return false; } @@ -571,7 +571,7 @@ public function getStandardAddress(): Address return $this->getAddress(); } - public function addAddress(array $params = [], QUI\Interfaces\Users\User $ParentUser = null): ?Address + public function addAddress(array $params = [], null | QUI\Interfaces\Users\User $ParentUser = null): ?Address { return null; } @@ -579,7 +579,7 @@ public function addAddress(array $params = [], QUI\Interfaces\Users\User $Parent /** * Does nothing */ - public function setGroups(array|string $groups) + public function setGroups(array | string $groups) { } @@ -632,12 +632,15 @@ public function getAvatar(): ?QUI\Projects\Media\Image /** * Does nothing */ - public function setPassword(string $new, ?UserInterface $PermissionUser = null) + public function setPassword(string $new, null | UserInterface $PermissionUser = null) { } - public function changePassword(string $newPassword, string $oldPassword, UserInterface $ParentUser = null): void - { + public function changePassword( + string $newPassword, + string $oldPassword, + null | UserInterface $ParentUser = null + ): void { } /** @@ -672,14 +675,14 @@ public function setCompanyStatus(bool $status) /** * Does nothing */ - public function addToGroup(int|string $groupId) + public function addToGroup(int | string $groupId) { } /** * Does nothing */ - public function removeGroup(Group|int|string $Group) + public function removeGroup(Group | int | string $Group) { } @@ -743,7 +746,7 @@ public function getAuthenticator(string $authenticator): AuthenticatorInterface ); } - public function enableAuthenticator(string $authenticator, UserInterface $ParentUser = null): void + public function enableAuthenticator(string $authenticator, null | UserInterface $ParentUser = null): void { throw new QUI\Users\Exception( ['quiqqer/core', 'exception.authenticator.not.found'], @@ -751,7 +754,7 @@ public function enableAuthenticator(string $authenticator, UserInterface $Parent ); } - public function disableAuthenticator(string $authenticator, UserInterface $ParentUser = null): void + public function disableAuthenticator(string $authenticator, null | UserInterface $ParentUser = null): void { throw new QUI\Users\Exception( ['quiqqer/core', 'exception.authenticator.not.found'], diff --git a/src/QUI/ERP/Utils/Sites.php b/src/QUI/ERP/Utils/Sites.php index 3bb74e5faf1392fd17589906e9839186b55d2afe..fe9f6528d81c0f83741e304df08276076dab9ddb 100644 --- a/src/QUI/ERP/Utils/Sites.php +++ b/src/QUI/ERP/Utils/Sites.php @@ -15,7 +15,7 @@ class Sites * @param QUI\Locale|null $Locale - in which language the page should be * @return QUI\Projects\Site|null */ - public static function getTermsAndConditions(QUI\Locale $Locale = null): ?QUI\Projects\Site + public static function getTermsAndConditions(null | QUI\Locale $Locale = null): ?QUI\Projects\Site { if ($Locale === null) { $Locale = QUI::getLocale(); @@ -43,7 +43,7 @@ public static function getTermsAndConditions(QUI\Locale $Locale = null): ?QUI\Pr * @param QUI\Locale|null $Locale - in which language the page should be * @return QUI\Projects\Site|null */ - public static function getRevocation(QUI\Locale $Locale = null): ?QUI\Projects\Site + public static function getRevocation(null | QUI\Locale $Locale = null): ?QUI\Projects\Site { if ($Locale === null) { $Locale = QUI::getLocale(); @@ -71,7 +71,7 @@ public static function getRevocation(QUI\Locale $Locale = null): ?QUI\Projects\S * @param QUI\Locale|null $Locale - in which language the page should be * @return QUI\Projects\Site|null */ - public static function getPrivacyPolicy(QUI\Locale $Locale = null): ?QUI\Projects\Site + public static function getPrivacyPolicy(null | QUI\Locale $Locale = null): ?QUI\Projects\Site { if ($Locale === null) { $Locale = QUI::getLocale(); diff --git a/src/QUI/ERP/Utils/User.php b/src/QUI/ERP/Utils/User.php index 28db19f26b963cd31b7b369660420d1ff94fdc85..28262f2765e2675d6ffe860a07ff7964e37bbf46 100644 --- a/src/QUI/ERP/Utils/User.php +++ b/src/QUI/ERP/Utils/User.php @@ -227,7 +227,7 @@ public static function isNettoUser(UserInterface $User): bool * @return bool|QUI\ERP\Areas\Area * @throws QUI\Exception */ - public static function getUserArea(UserInterface $User): bool|QUI\ERP\Areas\Area + public static function getUserArea(UserInterface $User): bool | QUI\ERP\Areas\Area { $CurrentAddress = $User->getAttribute('CurrentAddress'); @@ -276,7 +276,7 @@ public static function getUserArea(UserInterface $User): bool|QUI\ERP\Areas\Area * @throws Exception * @throws QUI\Permissions\Exception */ - public static function getUserERPAddress(UserInterface $User): null|Address|array + public static function getUserERPAddress(UserInterface $User): null | Address | array { if (!QUI::getUsers()->isUser($User)) { throw new QUI\Exception([