Skip to content
Code-Schnipsel Gruppen Projekte
Commit eefbf9a0 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: allow null user type in setuser methods and improve type hinting

This commit includes changes made to both the Article.php and ArticleList.php classes in the
QUI\ERP\Accounting directory. The setUser methods now accept a null type for the 'User' parameter,
giving more flexibility when calculating user details.

Type hinting was also improved in the ArticleList class. The variable type indicators were changed
from 'int|float' to 'int | float', and from 'Factor|QUI\\ERP\\Products\\Utils\\PriceFactor' to
'Factor | QUI\\ERP\\Products\\Utils\\PriceFactor', improving readability and clarity of code.

Lastly, the 'template' and 'articleTemplate' parameters in the 'toHTMLWithCSS' method now support
both 'bool' and 'string' types, adding flexibility to template usage.
Übergeordneter 6748a193
No related branches found
No related tags found
2 Merge Requests!174Update 'next-4.x' with latest changes from 'main',!173fix: allow null user type in setuser methods and improve type hinting
Pipeline #15642 bestanden mit Phase
in 2 Minuten und 33 Sekunden
......@@ -499,9 +499,9 @@ public function getUser(): ?QUI\Interfaces\Users\User
/**
* Set the user to the product, this user will be used for the calculation
*
* @param QUI\Interfaces\Users\User $User
* @param null|QUI\Interfaces\Users\User $User
*/
public function setUser(QUI\Interfaces\Users\User $User): void
public function setUser(null | QUI\Interfaces\Users\User $User): void
{
$this->calculated = false;
$this->User = $User;
......
......@@ -34,17 +34,17 @@ class ArticleList extends ArticleListUnique implements IteratorAggregate
/**
* @var int|float
*/
protected int|float $sum;
protected int | float $sum;
/**
* @var int|float
*/
protected int|float $grandSubSum;
protected int | float $grandSubSum;
/**
* @var ?QUI\Interfaces\Users\User
*/
protected QUI\Interfaces\Users\User|null $User = null;
protected QUI\Interfaces\Users\User | null $User = null;
/**
* @var ?QUI\ERP\Order\AbstractOrder
......@@ -59,17 +59,17 @@ class ArticleList extends ArticleListUnique implements IteratorAggregate
/**
* @var int|float
*/
protected int|float $subSum;
protected int | float $subSum;
/**
* @var int|float
*/
protected int|float $nettoSum;
protected int | float $nettoSum;
/**
* @var int|float
*/
protected int|float $nettoSubSum;
protected int | float $nettoSubSum;
/**
* key 19% value[sum] = sum value[text] = text value[display_sum] formatted
......@@ -140,9 +140,9 @@ public function __construct(array $attributes = [])
* Set the user for the list
* User for calculation
*
* @param QUI\Interfaces\Users\User $User
* @param null|QUI\Interfaces\Users\User $User
*/
public function setUser(QUI\Interfaces\Users\User $User): void
public function setUser(null | QUI\Interfaces\Users\User $User): void
{
if ($this->User === $User) {
return;
......@@ -486,7 +486,7 @@ public function importPriceFactors(QUI\ERP\Accounting\PriceFactors\FactorList $P
*
* @throws Exception
*/
public function addPriceFactor(Factor|QUI\ERP\Products\Utils\PriceFactor $PriceFactor): void
public function addPriceFactor(Factor | QUI\ERP\Products\Utils\PriceFactor $PriceFactor): void
{
if ($PriceFactor instanceof QUI\ERP\Products\Utils\PriceFactor) {
$isNetto = $this->isNetto;
......@@ -550,8 +550,8 @@ public function renderForMail(): string
}
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 {
return $this->toUniqueList()->toHTMLWithCSS($template, $articleTemplate, $Engine);
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren