diff --git a/composer.json b/composer.json index d9f20c7b961b84641891186ac575d29f6264ab9d..ed6f796d409d05787442bca74476f3fb860ded59 100644 --- a/composer.json +++ b/composer.json @@ -18,11 +18,11 @@ "url": "http:\/\/www.pcsg.de" }, "require": { - "php": ">=5.3", - "quiqqer\/quiqqer": "*@dev", - "quiqqer\/areas": "*@dev", - "quiqqer\/products": "^1.6|*@dev", - "quiqqer\/tax": "*@dev" + "php": "^8.2", + "quiqqer\/quiqqer": "^2", + "quiqqer\/areas": "^1", + "quiqqer\/products": "^2", + "quiqqer\/tax": "^1" }, "autoload": { "psr-4": { diff --git a/src/QUI/ERP/Discount/Discount.php b/src/QUI/ERP/Discount/Discount.php index b155d59debe8867ca555ced8e03732c4d21487b5..adf171711633a4a75e4e822ab987b380aceba69a 100644 --- a/src/QUI/ERP/Discount/Discount.php +++ b/src/QUI/ERP/Discount/Discount.php @@ -219,17 +219,17 @@ public function __construct($id, Handler $Factory) /** * @param string $name - * @param mixed $val + * @param mixed $value * @return void */ - public function setAttribute(string $name, mixed $val): void + public function setAttribute(string $name, mixed $value): void { - if ($name === 'lastSumDiscount' && empty($val)) { - $val = null; + if ($name === 'lastSumDiscount' && empty($value)) { + $value = null; } - if ($name === 'lastProductDiscount' && empty($val)) { - $val = null; + if ($name === 'lastProductDiscount' && empty($value)) { + $value = null; } if ( @@ -237,10 +237,10 @@ public function setAttribute(string $name, mixed $val): void $name === 'discount_type' || $name === 'usage_type' ) { - $val = (int)$val; + $value = (int)$value; } - parent::setAttribute($name, $val); + parent::setAttribute($name, $value); } /** @@ -357,7 +357,7 @@ public function canUsedBy(QUI\Interfaces\Users\User $User): bool /* @var $Group QUI\Groups\Group */ foreach ($discountGroups as $gid) { foreach ($groupsOfUser as $Group) { - if ($Group->getId() == $gid) { + if ($Group->getUsers() == $gid) { return true; } @@ -383,7 +383,7 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc } // coupon - if ($Product->getId() === '-') { + if ($Product->getId() === -1) { return false; } diff --git a/src/QUI/ERP/Discount/EventHandling.php b/src/QUI/ERP/Discount/EventHandling.php index 2adb56dd6fcaf3f061aee1c74f9e5766a4658b07..34a6d433184b229164d8e528d8d04f5451696f73 100644 --- a/src/QUI/ERP/Discount/EventHandling.php +++ b/src/QUI/ERP/Discount/EventHandling.php @@ -168,14 +168,7 @@ public static function onQuiqqerProductsCalcListProduct( return; } - try { - $attributes = $Product->getAttributes(); - } catch (QUI\Exception $Exception) { - QUI\System\Log::writeDebugException($Exception); - - return; - } - + $attributes = $Product->getAttributes(); $PriceFactors = $Product->getPriceFactors(); $productQuantity = $Product->getQuantity(); $productNettoSum = $attributes['calculated_nettoSum']; @@ -190,7 +183,7 @@ public static function onQuiqqerProductsCalcListProduct( continue; } - // check if Pricefactor is already in + // check if price factor is already in $factors = $PriceFactors->toArray(); $Factor = $Discount->toPriceFactor( $Calc->getUser()->getLocale(), diff --git a/src/QUI/ERP/Discount/Handler.php b/src/QUI/ERP/Discount/Handler.php index 293106b58dff322c409b174b0ed65c34603398b2..a2f58611c513f7e73ea10695a18f379548be4fb3 100644 --- a/src/QUI/ERP/Discount/Handler.php +++ b/src/QUI/ERP/Discount/Handler.php @@ -23,7 +23,7 @@ class Handler extends QUI\CRUD\Factory const DISCOUNT_TYPE_PERCENT = 1; /** - * discount type -> crrency + * discount type -> currency */ const DISCOUNT_TYPE_CURRENCY = 2; @@ -50,7 +50,7 @@ class Handler extends QUI\CRUD\Factory const DISCOUNT_SCOPE_GRAND_TOTAL = 4; /** - * pricefactor discount type + * price factor discount type */ const DISCOUNT_PRICEFACTOR_TYPE = 'DISCOUNT_PRICE_FACTOR'; diff --git a/src/QUI/ERP/Discount/PriceFactor.php b/src/QUI/ERP/Discount/PriceFactor.php index b2481db6664b6d9636a0633a0931c4d028f7991b..c18cdb2bc519e1891f46b97ce27636445e3d91fe 100644 --- a/src/QUI/ERP/Discount/PriceFactor.php +++ b/src/QUI/ERP/Discount/PriceFactor.php @@ -22,11 +22,6 @@ class PriceFactor extends QUI\ERP\Products\Utils\PriceFactor implements */ protected string $type = Handler::DISCOUNT_PRICEFACTOR_TYPE; - /** - * @var string|null - */ - protected $vat = null; - /** * PriceFactor constructor. * @param array $params