Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/erp
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (8)
  • Henning Leutz's avatar
    fix(phpstan): added exception handling for missing html2pdf module in OutputTemplate · 4fbeb229
    verfasst von Henning Leutz
    In OutputTemplate.php, a check has been added to ensure the existence of the
    'QUI\\HtmlToPdf\\Document' class before using it. If the class does not exist, an error message is
    logged, and an exception is thrown indicating that the html2pdf module is missing. This fix is
    aimed at avoiding potential errors that may occur due to the absence of the required module.
    4fbeb229
  • Henning Leutz's avatar
    fix: update payment status constants in calc.php · 1d048c81
    verfasst von Henning Leutz
    Changed the constants 'TYPE_INVOICE_REVERSAL' and 'TYPE_INVOICE_CANCEL' to 'PAYMENT_STATUS_ERROR'
    and 'PAYMENT_STATUS_CANCELED' respectively. This will ensure that the payment status are correctly
    identified and processed.
    1d048c81
  • Henning Leutz's avatar
    fix(phpstan): php8.4 null deprecated · dba1b6d6
    verfasst von Henning Leutz
    Related: #103
    dba1b6d6
  • Henning Leutz's avatar
    fix(phpstan): price calculation, logging, and file handling improvements · 511794c3
    verfasst von Henning Leutz
    In this commit, several enhancements are made in the ajax price calculation PHP files including
    more verbose error logging and minor refactoring of the calculation itself. Instead of adding an
    error message in QUI, we now add detailed error handling using QUI\System\Log.
    
    Additionally, we have improved file handling in `ajax/output/sendMail.php` by ensuring the file is
    an instance of `QUI\Projects\Media\File` or `QUI\Projects\Media\Image` before attaching it.
    
    Lastly, we added an option for parsing in method getCustomerFiles of the ErpEntityInterface. This
    commit will make the scripts more efficient and robust against errors.
    511794c3
  • Henning Leutz's avatar
    fix(phpstan): optimize attribute checks and method calls in erp classes · 9233e394
    verfasst von Henning Leutz
    In this commit, several changes have been made to streamline the Manufacturer and Process classes
    within the ERP module:
    
    - Replaced the non-empty check for 'firstname' and 'lastname' attributes in the User class with an
    `empty()` function, resulting in cleaner code without changing the functionality.
    - Replaced the argument in `User->activate()` from `false` to `''` for consistency.
    - Removed unnecessary annotations and some unused `protected` properties from the Process class.
    - Altered the procedure to retrieve `salesOrder` from the Entity in the Process class. Now, the
    method first tries to retrieve it via `getPaymentDataEntry()`, and if unavailable, it attempts to
    fetch it using `getCustomDataEntry()`. This ensures a more robust and reliable retrieval of the
    'salesOrder' property.
    - Added `@phpstan-ignore-next-line` in the Processes class to prevent phpstan from throwing
    unwarranted warnings regarding the following code line in s...
    9233e394
  • Henning Leutz's avatar
    refactor: ignore phpstan warnings in calc.php · 23b6910c
    verfasst von Henning Leutz
    Updated calcArticleList method in Calc.php to ignore PHPStan warnings using the
    `@phpstan-ignore-line` and `@phpstan-ignore-next-line` directives. Also, added a TODO comment
    regarding net calculations.
    23b6910c
  • Henning Leutz's avatar
    chore(phpstan): address unknown classes for PHPStan analysis · 81afaecb
    verfasst von Henning Leutz
    This commit addresses the issue of PHPStan not recognizing certain classes for type validation
    within our PHP codebase. This is done by adding these classes to the PHPStan configuration as
    ignored errors. This ensures accuracy in our static analysis for errors and warnings. Key classes
    such as QUI\\ERP\\Process, QUI\\ERP\\Accounting\\Calc and QUI\\ERP\\Accounting\\ArticleList have
    been catered to.
    81afaecb
  • Henning Leutz's avatar
    Merge branch 'next-3.x' into 'main' · 2810542c
    verfasst von Henning Leutz
    fix(phpstan): added exception handling for missing html2pdf module in OutputTemplate
    
    See merge request !169
    2810542c
werden angezeigt mit 264 Ergänzungen und 464 Löschungen
<?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"/>
......
......@@ -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);
}
......
......@@ -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) {
......
......@@ -16,6 +16,7 @@
'package_quiqqer_erp_ajax_customerFiles_getFiles',
function ($hash) {
$Entity = (new Processes())->getEntity($hash);
return $Entity->getCustomerFiles(true);
},
['hash']
......
......@@ -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);
}
......
Dieser Diff ist reduziert.
......@@ -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;
......
......@@ -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);
}
......
......@@ -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();
}
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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();
......
......@@ -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();
......
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......
......@@ -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());
......
......@@ -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);
......