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/discount
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (11)
werden angezeigt mit 214 Ergänzungen und 169 Löschungen
tools/
phpstan.neon
.phpunit.result.cache
phpunit.xml
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.67" installed="1.10.67" location="./tools/phpstan" copy="false"/>
</phive>
...@@ -9,13 +9,16 @@ ...@@ -9,13 +9,16 @@
* *
* @param integer $discountId - Discount-ID * @param integer $discountId - Discount-ID
*/ */
use QUI\ERP\Discount\Discount;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_discount_ajax_activate', 'package_quiqqer_discount_ajax_activate',
function ($discountId) { function ($discountId) {
$Handler = new QUI\ERP\Discount\Handler(); $Handler = new QUI\ERP\Discount\Handler();
$Discount = $Handler->getChild($discountId); $Discount = $Handler->getChild($discountId);
/* @var $Discount \QUI\ERP\Discount\Discount */ /* @var $Discount Discount */
$Discount->setAttribute('active', 1); $Discount->setAttribute('active', 1);
$Discount->update(); $Discount->update();
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_discount_ajax_create', 'package_quiqqer_discount_ajax_create',
function ($params) { function ($params) {
$params = json_decode($params, true); $params = json_decode($params, true);
$Discounts = new QUI\ERP\Discount\Handler(); $Discounts = new QUI\ERP\Discount\Handler();
if (!isset($params['active'])) { if (!isset($params['active'])) {
......
...@@ -9,13 +9,16 @@ ...@@ -9,13 +9,16 @@
* *
* @param integer $discountId - Discount-ID * @param integer $discountId - Discount-ID
*/ */
use QUI\ERP\Discount\Discount;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_discount_ajax_deactivate', 'package_quiqqer_discount_ajax_deactivate',
function ($discountId) { function ($discountId) {
$Handler = new QUI\ERP\Discount\Handler(); $Handler = new QUI\ERP\Discount\Handler();
$Discount = $Handler->getChild($discountId); $Discount = $Handler->getChild($discountId);
/* @var $Discount \QUI\ERP\Discount\Discount */ /* @var $Discount Discount */
$Discount->setAttribute('active', 0); $Discount->setAttribute('active', 0);
$Discount->update(); $Discount->update();
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
'package_quiqqer_discount_ajax_deleteChild', 'package_quiqqer_discount_ajax_deleteChild',
function ($discountId) { function ($discountId) {
$Discounts = new QUI\ERP\Discount\Handler(); $Discounts = new QUI\ERP\Discount\Handler();
$Discount = $Discounts->getChild($discountId); $Discount = $Discounts->getChild($discountId);
$Discount->delete(); $Discount->delete();
}, },
['discountId'], ['discountId'],
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_discount_ajax_deleteChildren', 'package_quiqqer_discount_ajax_deleteChildren',
function ($discountIds) { function ($discountIds) {
$discountIds = json_decode($discountIds, true); $discountIds = json_decode($discountIds, true);
$Discounts = new QUI\ERP\Discount\Handler(); $Discounts = new QUI\ERP\Discount\Handler();
$ExceptionStack = new QUI\ExceptionStack(); $ExceptionStack = new QUI\ExceptionStack();
foreach ($discountIds as $discountId) { foreach ($discountIds as $discountId) {
......
...@@ -11,14 +11,17 @@ ...@@ -11,14 +11,17 @@
* *
* @return array * @return array
*/ */
use QUI\ERP\Discount\Discount;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_discount_ajax_get', 'package_quiqqer_discount_ajax_get',
function ($id) { function ($id) {
$Discounts = new QUI\ERP\Discount\Handler(); $Discounts = new QUI\ERP\Discount\Handler();
$Discount = $Discounts->getChild($id); $Discount = $Discounts->getChild($id);
$attributes = $Discount->getAttributes(); $attributes = $Discount->getAttributes();
/* @var $Discount \QUI\ERP\Discount\Discount */ /* @var $Discount Discount */
$attributes['title'] = $Discount->getTitle(); $attributes['title'] = $Discount->getTitle();
return $attributes; return $attributes;
......
...@@ -20,7 +20,7 @@ function ($params) { ...@@ -20,7 +20,7 @@ function ($params) {
$Locale = QUI::getLocale(); $Locale = QUI::getLocale();
// search // search
$params = $Grid->parseDBParams(\json_decode($params, true)); $params = $Grid->parseDBParams(json_decode($params, true));
$params['where'] = [ $params['where'] = [
'hidden' => 0 'hidden' => 0
......
...@@ -9,13 +9,16 @@ ...@@ -9,13 +9,16 @@
* *
* @param integer $discountId - Discount-ID * @param integer $discountId - Discount-ID
*/ */
use QUI\ERP\Discount\Discount;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_discount_ajax_toggle', 'package_quiqqer_discount_ajax_toggle',
function ($discountId) { function ($discountId) {
$Handler = new QUI\ERP\Discount\Handler(); $Handler = new QUI\ERP\Discount\Handler();
$Discount = $Handler->getChild($discountId); $Discount = $Handler->getChild($discountId);
/* @var $Discount \QUI\ERP\Discount\Discount */ /* @var $Discount Discount */
if ($Discount->isActive()) { if ($Discount->isActive()) {
$Discount->setAttribute('active', 0); $Discount->setAttribute('active', 0);
} else { } else {
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
'package_quiqqer_discount_ajax_update', 'package_quiqqer_discount_ajax_update',
function ($discountId, $params) { function ($discountId, $params) {
$Discounts = new QUI\ERP\Discount\Handler(); $Discounts = new QUI\ERP\Discount\Handler();
$Discount = $Discounts->getChild($discountId); $Discount = $Discounts->getChild($discountId);
$params = json_decode($params, true); $params = json_decode($params, true);
$Discount->setAttributes($params); $Discount->setAttributes($params);
$Discount->update(); $Discount->update();
......
{ {
"name": "quiqqer\/discount", "name": "quiqqer/discount",
"type": "quiqqer-plugin", "type": "quiqqer-plugin",
"description": "Create discounts for user groups, specific users as well as time controlled.", "description": "Create discounts for user groups, specific users as well as time controlled.",
"license": [ "license": [
...@@ -9,25 +9,25 @@ ...@@ -9,25 +9,25 @@
{ {
"name": "Henning Leutz", "name": "Henning Leutz",
"email": "leutz@pcsg.de", "email": "leutz@pcsg.de",
"homepage": "http:\/\/www.pcsg.de", "homepage": "https://www.pcsg.de",
"role": "Developer" "role": "Developer"
} }
], ],
"support": { "support": {
"email": "support@pcsg.de", "email": "support@pcsg.de",
"url": "http:\/\/www.pcsg.de" "url": "https://www.pcsg.de"
}, },
"require": { "require": {
"php": ">=5.3", "php": "^8.2",
"quiqqer\/quiqqer": "*@dev", "quiqqer/core": "^2",
"quiqqer\/areas": "*@dev", "quiqqer/areas": "^2",
"quiqqer\/products": "^1.6|*@dev", "quiqqer/products": "^2",
"quiqqer\/tax": "*@dev" "quiqqer/tax": "^2"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"QUI\\ERP\\Discount\\": "src\/QUI\/ERP\/Discount", "QUI\\ERP\\Discount\\": "src/QUI/ERP/Discount",
"QUITests\\ERP\\Discount\\": "tests\/QUITests\/ERP\/Discount" "QUITests\\ERP\\Discount\\": "tests/QUITests/ERP/Discount"
} }
} }
} }
includes:
- phpstan-baseline.neon
parameters:
level: 1
paths:
- src
- ajax
bootstrapFiles:
- tests/phpstan-bootstrap.php
\ No newline at end of file
...@@ -7,12 +7,25 @@ ...@@ -7,12 +7,25 @@
namespace QUI\ERP\Discount; namespace QUI\ERP\Discount;
use QUI; use QUI;
use QUI\Database\Exception;
use QUI\ERP\Order\OrderInterface; use QUI\ERP\Order\OrderInterface;
use QUI\ERP\Products\Interfaces\PriceFactorInterface;
use QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface;
use QUI\ERP\Products\Utils\PriceFactor;
use QUI\Users\User; use QUI\Users\User;
use QUI\Permissions\Permission; use QUI\Permissions\Permission;
use QUI\Utils\Security\Orthos; use QUI\Utils\Security\Orthos;
use QUI\ERP\Areas\Utils as AreaUtils; use QUI\ERP\Areas\Utils as AreaUtils;
use function array_key_exists;
use function explode;
use function implode;
use function is_array;
use function is_numeric;
use function is_string;
use function strtotime;
use function time;
/** /**
* Class Discount * Class Discount
* @package QUI\ERP\Discount * @package QUI\ERP\Discount
...@@ -24,6 +37,7 @@ class Discount extends QUI\CRUD\Child ...@@ -24,6 +37,7 @@ class Discount extends QUI\CRUD\Child
* *
* @param int $id * @param int $id
* @param Handler $Factory * @param Handler $Factory
* @throws Exception
*/ */
public function __construct($id, Handler $Factory) public function __construct($id, Handler $Factory)
{ {
...@@ -61,7 +75,7 @@ public function __construct($id, Handler $Factory) ...@@ -61,7 +75,7 @@ public function __construct($id, Handler $Factory)
// cleanup user group save // cleanup user group save
$cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('user_groups')); $cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('user_groups'));
$cleanup = \implode(',', $cleanup); $cleanup = implode(',', $cleanup);
if (!empty($cleanup)) { if (!empty($cleanup)) {
$cleanup = ',' . $cleanup . ','; $cleanup = ',' . $cleanup . ',';
...@@ -72,7 +86,7 @@ public function __construct($id, Handler $Factory) ...@@ -72,7 +86,7 @@ public function __construct($id, Handler $Factory)
// cleanup product(s) // cleanup product(s)
$cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('articles')); $cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('articles'));
$cleanup = \implode(',', $cleanup); $cleanup = implode(',', $cleanup);
if (!empty($cleanup)) { if (!empty($cleanup)) {
$cleanup = ',' . $cleanup . ','; $cleanup = ',' . $cleanup . ',';
...@@ -83,7 +97,7 @@ public function __construct($id, Handler $Factory) ...@@ -83,7 +97,7 @@ public function __construct($id, Handler $Factory)
// cleanup user group save // cleanup user group save
$cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('user_groups')); $cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('user_groups'));
$cleanup = \implode(',', $cleanup); $cleanup = implode(',', $cleanup);
if (!empty($cleanup)) { if (!empty($cleanup)) {
$cleanup = ',' . $cleanup . ','; $cleanup = ',' . $cleanup . ',';
...@@ -94,7 +108,7 @@ public function __construct($id, Handler $Factory) ...@@ -94,7 +108,7 @@ public function __construct($id, Handler $Factory)
// cleanup product(s) // cleanup product(s)
$cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('articles')); $cleanup = QUI\Utils\ArrayHelper::cleanup($this->getAttribute('articles'));
$cleanup = \implode(',', $cleanup); $cleanup = implode(',', $cleanup);
if (!empty($cleanup)) { if (!empty($cleanup)) {
$cleanup = ',' . $cleanup . ','; $cleanup = ',' . $cleanup . ',';
...@@ -203,29 +217,29 @@ public function __construct($id, Handler $Factory) ...@@ -203,29 +217,29 @@ public function __construct($id, Handler $Factory)
} }
/** /**
* @param string $key * @param string $name
* @param array|bool|object|string $value * @param mixed $value
* @return QUI\QDOM|void * @return void
*/ */
public function setAttribute($key, $value) public function setAttribute(string $name, mixed $value): void
{ {
if ($key === 'lastSumDiscount' && empty($value)) { if ($name === 'lastSumDiscount' && empty($value)) {
$value = null; $value = null;
} }
if ($key === 'lastProductDiscount' && empty($value)) { if ($name === 'lastProductDiscount' && empty($value)) {
$value = null; $value = null;
} }
if ( if (
$key === 'scope' || $name === 'scope' ||
$key === 'discount_type' || $name === 'discount_type' ||
$key === 'usage_type' $name === 'usage_type'
) { ) {
$value = (int)$value; $value = (int)$value;
} }
parent::setAttribute($key, $value); parent::setAttribute($name, $value);
} }
/** /**
...@@ -234,7 +248,7 @@ public function setAttribute($key, $value) ...@@ -234,7 +248,7 @@ public function setAttribute($key, $value)
* @param null|QUI\Locale $Locale - optional, locale object * @param null|QUI\Locale $Locale - optional, locale object
* @return string * @return string
*/ */
public function getTitle($Locale = null) public function getTitle(QUI\Locale $Locale = null): string
{ {
if (!$Locale) { if (!$Locale) {
$Locale = QUI::getLocale(); $Locale = QUI::getLocale();
...@@ -251,9 +265,9 @@ public function getTitle($Locale = null) ...@@ -251,9 +265,9 @@ public function getTitle($Locale = null)
* *
* @return boolean * @return boolean
*/ */
public function isActive() public function isActive(): bool
{ {
return $this->getAttribute('active') ? true : false; return (bool)$this->getAttribute('active');
} }
/** /**
...@@ -262,7 +276,7 @@ public function isActive() ...@@ -262,7 +276,7 @@ public function isActive()
* @param Discount $Discount * @param Discount $Discount
* @return bool * @return bool
*/ */
public function canCombinedWith(Discount $Discount) public function canCombinedWith(Discount $Discount): bool
{ {
$combine = $this->getAttribute('combine'); $combine = $this->getAttribute('combine');
...@@ -270,16 +284,10 @@ public function canCombinedWith(Discount $Discount) ...@@ -270,16 +284,10 @@ public function canCombinedWith(Discount $Discount)
return false; return false;
} }
$combine = \implode($combine, ','); $combine = implode($combine, ',');
if (!\is_array($combine)) { if (in_array($Discount->getId(), (array)$combine)) {
return false; return true;
}
foreach ($combine as $combineId) {
if ($Discount->getId() == $combineId) {
return true;
}
} }
return false; return false;
...@@ -291,7 +299,7 @@ public function canCombinedWith(Discount $Discount) ...@@ -291,7 +299,7 @@ public function canCombinedWith(Discount $Discount)
* @param QUI\Interfaces\Users\User $User * @param QUI\Interfaces\Users\User $User
* @return boolean * @return boolean
*/ */
public function canUsedBy(QUI\Interfaces\Users\User $User) public function canUsedBy(QUI\Interfaces\Users\User $User): bool
{ {
if ($this->isActive() === false) { if ($this->isActive() === false) {
return false; return false;
...@@ -300,13 +308,13 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) ...@@ -300,13 +308,13 @@ public function canUsedBy(QUI\Interfaces\Users\User $User)
// usage definitions / limits // usage definitions / limits
$dateFrom = $this->getAttribute('date_from'); $dateFrom = $this->getAttribute('date_from');
$dateUntil = $this->getAttribute('date_until'); $dateUntil = $this->getAttribute('date_until');
$now = \time(); $now = time();
if ($dateFrom && \strtotime($dateFrom) > $now) { if ($dateFrom && strtotime($dateFrom) > $now) {
return false; return false;
} }
if ($dateUntil && \strtotime($dateUntil) < $now) { if ($dateUntil && strtotime($dateUntil) < $now) {
return false; return false;
} }
...@@ -314,7 +322,7 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) ...@@ -314,7 +322,7 @@ public function canUsedBy(QUI\Interfaces\Users\User $User)
$userGroupValue = $this->getAttribute('user_groups'); $userGroupValue = $this->getAttribute('user_groups');
$areasValue = $this->getAttribute('areas'); $areasValue = $this->getAttribute('areas');
// if groups and areas are empty, everbody is allowed // if groups and areas are empty, everybody is allowed
if (empty($userGroupValue) && empty($areasValue)) { if (empty($userGroupValue) && empty($areasValue)) {
return true; return true;
} }
...@@ -336,6 +344,10 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) ...@@ -336,6 +344,10 @@ public function canUsedBy(QUI\Interfaces\Users\User $User)
if ($User->getId() == $uid) { if ($User->getId() == $uid) {
return true; return true;
} }
if ($User->getUUID() == $uid) {
return true;
}
} }
// group checking // group checking
...@@ -344,7 +356,11 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) ...@@ -344,7 +356,11 @@ public function canUsedBy(QUI\Interfaces\Users\User $User)
/* @var $Group QUI\Groups\Group */ /* @var $Group QUI\Groups\Group */
foreach ($discountGroups as $gid) { foreach ($discountGroups as $gid) {
foreach ($groupsOfUser as $Group) { foreach ($groupsOfUser as $Group) {
if ($Group->getId() == $gid) { if ($Group->getUsers() == $gid) {
return true;
}
if ($Group->getUUID() == $gid) {
return true; return true;
} }
} }
...@@ -359,26 +375,26 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) ...@@ -359,26 +375,26 @@ public function canUsedBy(QUI\Interfaces\Users\User $User)
* @param QUI\ERP\Products\Interfaces\ProductInterface $Product * @param QUI\ERP\Products\Interfaces\ProductInterface $Product
* @return boolean * @return boolean
*/ */
public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Product) public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Product): bool
{ {
if ($this->isActive() === false) { if ($this->isActive() === false) {
return false; return false;
} }
// coupon // coupon
if ($Product->getId() === '-') { if ($Product->getId() === -1) {
return false; return false;
} }
$articles = $this->getAttribute('articles'); $articles = $this->getAttribute('articles');
$categories = $this->getAttribute('categories'); $categories = $this->getAttribute('categories');
if (\is_string($articles)) { if (is_string($articles)) {
$articles = \explode(',', $articles); $articles = explode(',', $articles);
} }
if (\is_string($categories)) { if (is_string($categories)) {
$categories = \explode(',', $categories); $categories = explode(',', $categories);
} }
...@@ -388,9 +404,9 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc ...@@ -388,9 +404,9 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc
} }
// article / product check // article / product check
if (\is_array($articles)) { if (is_array($articles)) {
foreach ($articles as $articleId) { foreach ($articles as $articleId) {
if ((int)$Product->getId() === (int)$articleId) { if ($Product->getId() === (int)$articleId) {
return true; return true;
} }
} }
...@@ -401,7 +417,7 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc ...@@ -401,7 +417,7 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc
return true; return true;
} }
if (!\is_array($categories)) { if (!is_array($categories)) {
return false; return false;
} }
...@@ -410,7 +426,7 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc ...@@ -410,7 +426,7 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc
foreach ($productCategories as $Category) { foreach ($productCategories as $Category) {
/* @var $Category QUI\ERP\Products\Category\Category */ /* @var $Category QUI\ERP\Products\Category\Category */
if ((int)$Category->getId() === (int)$category) { if ($Category->getId() === (int)$category) {
return true; return true;
} }
} }
...@@ -424,7 +440,7 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc ...@@ -424,7 +440,7 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc
* @param OrderInterface $Order * @param OrderInterface $Order
* @return bool * @return bool
*/ */
public function canUsedInOrder(OrderInterface $Order) public function canUsedInOrder(OrderInterface $Order): bool
{ {
if ($this->isActive() === false) { if ($this->isActive() === false) {
return false; return false;
...@@ -436,7 +452,7 @@ public function canUsedInOrder(OrderInterface $Order) ...@@ -436,7 +452,7 @@ public function canUsedInOrder(OrderInterface $Order)
/* @var $Article QUI\ERP\Accounting\Article */ /* @var $Article QUI\ERP\Accounting\Article */
$id = $Article->getId(); $id = $Article->getId();
if (!\is_numeric($id)) { if (!is_numeric($id)) {
continue; continue;
} }
...@@ -446,7 +462,7 @@ public function canUsedInOrder(OrderInterface $Order) ...@@ -446,7 +462,7 @@ public function canUsedInOrder(OrderInterface $Order)
if ($this->canUsedWith($Product)) { if ($this->canUsedWith($Product)) {
return true; return true;
} }
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
continue; continue;
} }
} }
...@@ -460,7 +476,7 @@ public function canUsedInOrder(OrderInterface $Order) ...@@ -460,7 +476,7 @@ public function canUsedInOrder(OrderInterface $Order)
* @param Discount $Discount * @param Discount $Discount
* @throws QUI\ERP\Discount\Exception * @throws QUI\ERP\Discount\Exception
*/ */
public function verifyCombinationWith(Discount $Discount) public function verifyCombinationWith(Discount $Discount): void
{ {
if ($this->canCombinedWith($Discount) === false) { if ($this->canCombinedWith($Discount) === false) {
throw new QUI\ERP\Discount\Exception([ throw new QUI\ERP\Discount\Exception([
...@@ -480,7 +496,7 @@ public function verifyCombinationWith(Discount $Discount) ...@@ -480,7 +496,7 @@ public function verifyCombinationWith(Discount $Discount)
* @param User $User * @param User $User
* @throws QUI\ERP\Discount\Exception * @throws QUI\ERP\Discount\Exception
*/ */
public function verifyUser(User $User) public function verifyUser(User $User): void
{ {
if ($this->canUsedBy($User) === false) { if ($this->canUsedBy($User) === false) {
throw new QUI\ERP\Discount\Exception([ throw new QUI\ERP\Discount\Exception([
...@@ -488,7 +504,7 @@ public function verifyUser(User $User) ...@@ -488,7 +504,7 @@ public function verifyUser(User $User)
'exception.discount.user.cant.use.discount', 'exception.discount.user.cant.use.discount',
[ [
'id' => $this->getId(), 'id' => $this->getId(),
'userId' => $User->getId() 'userId' => $User->getUUID()
] ]
]); ]);
} }
...@@ -497,13 +513,15 @@ public function verifyUser(User $User) ...@@ -497,13 +513,15 @@ public function verifyUser(User $User)
/** /**
* Parse the discount to a price factor * Parse the discount to a price factor
* *
* @param null|QUI\Locale $Locale - optional, locale object * @param null $Locale - optional, locale object
* @param null|QUI\Interfaces\Users\User $Customer - optional, * @param null $Customer - optional,
* *
* @return QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface|QUI\ERP\Products\Interfaces\PriceFactorInterface * @return PriceFactorInterface|PriceFactorWithVatInterface|PriceFactor
*/ */
public function toPriceFactor($Locale = null, $Customer = null) public function toPriceFactor(
{ $Locale = null,
$Customer = null
): QUI\ERP\Products\Interfaces\PriceFactorInterface|QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface|QUI\ERP\Products\Utils\PriceFactor {
switch ($this->getAttribute('discount_type')) { switch ($this->getAttribute('discount_type')) {
case QUI\ERP\Accounting\Calc::CALCULATION_PERCENTAGE: case QUI\ERP\Accounting\Calc::CALCULATION_PERCENTAGE:
$calculation = QUI\ERP\Accounting\Calc::CALCULATION_PERCENTAGE; $calculation = QUI\ERP\Accounting\Calc::CALCULATION_PERCENTAGE;
...@@ -515,14 +533,10 @@ public function toPriceFactor($Locale = null, $Customer = null) ...@@ -515,14 +533,10 @@ public function toPriceFactor($Locale = null, $Customer = null)
break; break;
} }
switch ($this->getAttribute('price_calculation_basis')) { $basis = match ($this->getAttribute('price_calculation_basis')) {
case QUI\ERP\Accounting\Calc::CALCULATION_BASIS_NETTO: QUI\ERP\Accounting\Calc::CALCULATION_BASIS_NETTO => QUI\ERP\Accounting\Calc::CALCULATION_BASIS_NETTO,
$basis = QUI\ERP\Accounting\Calc::CALCULATION_BASIS_NETTO; default => QUI\ERP\Accounting\Calc::CALCULATION_BASIS_CURRENTPRICE,
break; };
default:
$basis = QUI\ERP\Accounting\Calc::CALCULATION_BASIS_CURRENTPRICE;
}
// check calculation basis VAT // check calculation basis VAT
$useAuto = $this->getAttribute('consider_vat') === 'auto' $useAuto = $this->getAttribute('consider_vat') === 'auto'
...@@ -542,7 +556,7 @@ public function toPriceFactor($Locale = null, $Customer = null) ...@@ -542,7 +556,7 @@ public function toPriceFactor($Locale = null, $Customer = null)
$Config = $Plugin->getConfig(); $Config = $Plugin->getConfig();
$hideDiscounts = (int)$Config->getValue('products', 'hideDiscounts'); $hideDiscounts = (int)$Config->getValue('products', 'hideDiscounts');
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
$hideDiscounts = false; $hideDiscounts = false;
} }
...@@ -562,7 +576,7 @@ public function toPriceFactor($Locale = null, $Customer = null) ...@@ -562,7 +576,7 @@ public function toPriceFactor($Locale = null, $Customer = null)
'calculation' => $calculation, 'calculation' => $calculation,
'basis' => $basis, 'basis' => $basis,
'value' => $this->getAttribute('discount') * -1, 'value' => $this->getAttribute('discount') * -1,
'visible' => $hideDiscounts ? false : true, 'visible' => !$hideDiscounts,
'vat' => $this->getAttribute('vat') 'vat' => $this->getAttribute('vat')
]); ]);
} }
...@@ -577,7 +591,6 @@ public function toPriceFactor($Locale = null, $Customer = null) ...@@ -577,7 +591,6 @@ public function toPriceFactor($Locale = null, $Customer = null)
'calculation' => $calculation, 'calculation' => $calculation,
'basis' => $basis, 'basis' => $basis,
'value' => $this->getAttribute('discount') * -1, 'value' => $this->getAttribute('discount') * -1,
'visible' => $hideDiscounts ? false : true
]); ]);
} }
...@@ -586,7 +599,7 @@ public function toPriceFactor($Locale = null, $Customer = null) ...@@ -586,7 +599,7 @@ public function toPriceFactor($Locale = null, $Customer = null)
* *
* @throws QUI\ExceptionStack|QUI\Exception * @throws QUI\ExceptionStack|QUI\Exception
*/ */
public function update() public function update(): void
{ {
$this->Events->fireEvent('saveBegin'); $this->Events->fireEvent('saveBegin');
$this->Events->fireEvent('updateBegin'); $this->Events->fireEvent('updateBegin');
...@@ -595,18 +608,16 @@ public function update() ...@@ -595,18 +608,16 @@ public function update()
$savedData = []; $savedData = [];
foreach ($needles as $needle) { foreach ($needles as $needle) {
if (!\array_key_exists($needle, $this->attributes)) { if (!array_key_exists($needle, $this->attributes)) {
continue; continue;
} }
$value = $this->getAttribute($needle); $value = $this->getAttribute($needle);
switch ($needle) { if ($needle == 'user_groups') {
case 'user_groups': if (!empty($value)) {
if (!empty($value)) { $value = ',' . $value . ',';
$value = ',' . $value . ','; }
}
break;
} }
$savedData[$needle] = $value; $savedData[$needle] = $value;
......
...@@ -7,11 +7,15 @@ ...@@ -7,11 +7,15 @@
namespace QUI\ERP\Discount; namespace QUI\ERP\Discount;
use QUI; use QUI;
use QUI\Database\Exception;
use QUI\ERP\Accounting\Calc as ErpCalc; use QUI\ERP\Accounting\Calc as ErpCalc;
use QUI\ERP\Products\Product\UniqueProduct; use QUI\ERP\Products\Product\UniqueProduct;
use QUI\ERP\Products\Utils\Calc; use QUI\ERP\Products\Utils\Calc;
use QUI\ERP\Products\Product\ProductList; use QUI\ERP\Products\Product\ProductList;
use function array_filter;
use function explode;
/** /**
* Class EventHandling * Class EventHandling
* *
...@@ -20,19 +24,19 @@ ...@@ -20,19 +24,19 @@
class EventHandling class EventHandling
{ {
/** /**
* @var null * @var Handler|null
*/ */
protected static $Handler = null; protected static ?Handler $Handler = null;
/** /**
* @var array * @var array
*/ */
protected static $userDiscounts = []; protected static array $userDiscounts = [];
/** /**
* Return the global * Return the global
* *
* @return Handler * @return Handler|null
*/ */
protected static function getHandler(): ?Handler protected static function getHandler(): ?Handler
{ {
...@@ -48,16 +52,17 @@ protected static function getHandler(): ?Handler ...@@ -48,16 +52,17 @@ protected static function getHandler(): ?Handler
* *
* @param QUI\Interfaces\Users\User $User * @param QUI\Interfaces\Users\User $User
* @return array * @return array
* @throws Exception
*/ */
protected static function getUserDiscounts(QUI\Interfaces\Users\User $User): array protected static function getUserDiscounts(QUI\Interfaces\Users\User $User): array
{ {
if (isset(self::$userDiscounts[$User->getId()])) { if (isset(self::$userDiscounts[$User->getUUID()])) {
return self::$userDiscounts[$User->getId()]; return self::$userDiscounts[$User->getUUID()];
} }
self::$userDiscounts[$User->getId()] = Utils::getActiveUserDiscounts($User); self::$userDiscounts[$User->getUUID()] = Utils::getActiveUserDiscounts($User);
return self::$userDiscounts[$User->getId()]; return self::$userDiscounts[$User->getUUID()];
} }
/** /**
...@@ -65,10 +70,10 @@ protected static function getUserDiscounts(QUI\Interfaces\Users\User $User): arr ...@@ -65,10 +70,10 @@ protected static function getUserDiscounts(QUI\Interfaces\Users\User $User): arr
* - Einkaufsmengeprüfung * - Einkaufsmengeprüfung
* *
* @param Discount $Discount * @param Discount $Discount
* @param integer|double $quantity * @param double|integer $quantity
* @return bool * @return bool
*/ */
public static function isDiscountUsableWithQuantity(Discount $Discount, $quantity): bool public static function isDiscountUsableWithQuantity(Discount $Discount, float|int $quantity): bool
{ {
$purchaseQuantityFrom = $Discount->getAttribute('purchase_quantity_from'); $purchaseQuantityFrom = $Discount->getAttribute('purchase_quantity_from');
$purchaseQuantityUntil = $Discount->getAttribute('purchase_quantity_until'); $purchaseQuantityUntil = $Discount->getAttribute('purchase_quantity_until');
...@@ -93,14 +98,14 @@ public static function isDiscountUsableWithQuantity(Discount $Discount, $quantit ...@@ -93,14 +98,14 @@ public static function isDiscountUsableWithQuantity(Discount $Discount, $quantit
} }
/** /**
* Discount pirchase value check for usage * Discount purchase value check for usage
* - Einkaufswertprüfung * - Einkaufswertprüfung
* *
* @param Discount $Discount * @param Discount $Discount
* @param integer|double $value * @param float|integer $value
* @return bool * @return bool
*/ */
public static function isDiscountUsableWithPurchaseValue(Discount $Discount, $value): bool public static function isDiscountUsableWithPurchaseValue(Discount $Discount, float|int $value): bool
{ {
$purchaseValueFrom = $Discount->getAttribute('purchase_value_from'); $purchaseValueFrom = $Discount->getAttribute('purchase_value_from');
$purchaseValueUntil = $Discount->getAttribute('purchase_value_until'); $purchaseValueUntil = $Discount->getAttribute('purchase_value_until');
...@@ -136,18 +141,19 @@ public static function isDiscountUsableWithPurchaseValue(Discount $Discount, $va ...@@ -136,18 +141,19 @@ public static function isDiscountUsableWithPurchaseValue(Discount $Discount, $va
* *
* @param QUI\ERP\Products\Utils\Calc $Calc * @param QUI\ERP\Products\Utils\Calc $Calc
* @param UniqueProduct $Product * @param UniqueProduct $Product
* @throws Exception
*/ */
public static function onQuiqqerProductsCalcListProduct( public static function onQuiqqerProductsCalcListProduct(
Calc $Calc, Calc $Calc,
UniqueProduct $Product UniqueProduct $Product
) { ): void {
$userDiscounts = self::getUserDiscounts($Calc->getUser()); $userDiscounts = self::getUserDiscounts($Calc->getUser());
if (!\is_array($userDiscounts) || empty($userDiscounts)) { if (empty($userDiscounts)) {
return; return;
} }
$userDiscounts = \array_filter($userDiscounts, function ($Discount) { $userDiscounts = array_filter($userDiscounts, function ($Discount) {
/* @var $Discount Discount */ /* @var $Discount Discount */
// don't use manuel usage type // don't use manuel usage type
...@@ -158,18 +164,11 @@ public static function onQuiqqerProductsCalcListProduct( ...@@ -158,18 +164,11 @@ public static function onQuiqqerProductsCalcListProduct(
return (int)$Discount->getAttribute('scope') === Handler::DISCOUNT_SCOPE_EVERY_PRODUCT; return (int)$Discount->getAttribute('scope') === Handler::DISCOUNT_SCOPE_EVERY_PRODUCT;
}); });
if (!\is_array($userDiscounts) || empty($userDiscounts)) { if (empty($userDiscounts)) {
return;
}
try {
$attributes = $Product->getAttributes();
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
return; return;
} }
$attributes = $Product->getAttributes();
$PriceFactors = $Product->getPriceFactors(); $PriceFactors = $Product->getPriceFactors();
$productQuantity = $Product->getQuantity(); $productQuantity = $Product->getQuantity();
$productNettoSum = $attributes['calculated_nettoSum']; $productNettoSum = $attributes['calculated_nettoSum'];
...@@ -184,7 +183,7 @@ public static function onQuiqqerProductsCalcListProduct( ...@@ -184,7 +183,7 @@ public static function onQuiqqerProductsCalcListProduct(
continue; continue;
} }
// check if Pricefactor is already in // check if price factor is already in
$factors = $PriceFactors->toArray(); $factors = $PriceFactors->toArray();
$Factor = $Discount->toPriceFactor( $Factor = $Discount->toPriceFactor(
$Calc->getUser()->getLocale(), $Calc->getUser()->getLocale(),
...@@ -210,20 +209,17 @@ public static function onQuiqqerProductsCalcListProduct( ...@@ -210,20 +209,17 @@ public static function onQuiqqerProductsCalcListProduct(
* *
* @param Calc $Calc * @param Calc $Calc
* @param ProductList $List * @param ProductList $List
* @param integer|double $nettoSum * @param float|integer $nettoSum
* @throws Exception
*/ */
public static function onQuiqqerProductsCalcList( public static function onQuiqqerProductsCalcList(
Calc $Calc, Calc $Calc,
ProductList $List, ProductList $List,
$nettoSum float|int $nettoSum
) { ): void {
$userDiscounts = self::getUserDiscounts($Calc->getUser()); $userDiscounts = self::getUserDiscounts($Calc->getUser());
if (!\is_array($userDiscounts)) { $userDiscounts = array_filter($userDiscounts, function ($Discount) {
return;
}
$userDiscounts = \array_filter($userDiscounts, function ($Discount) {
/* @var $Discount Discount */ /* @var $Discount Discount */
// don't use manuel usage type // don't use manuel usage type
...@@ -234,10 +230,6 @@ public static function onQuiqqerProductsCalcList( ...@@ -234,10 +230,6 @@ public static function onQuiqqerProductsCalcList(
return (int)$Discount->getAttribute('scope') == Handler::DISCOUNT_SCOPE_TOTAL; return (int)$Discount->getAttribute('scope') == Handler::DISCOUNT_SCOPE_TOTAL;
}); });
if (!\is_array($userDiscounts)) {
return;
}
$listQuantity = $List->getQuantity(); $listQuantity = $List->getQuantity();
$products = $List->getProducts(); $products = $List->getProducts();
$PriceFactors = $List->getPriceFactors(); $PriceFactors = $List->getPriceFactors();
...@@ -256,7 +248,7 @@ public static function onQuiqqerProductsCalcList( ...@@ -256,7 +248,7 @@ public static function onQuiqqerProductsCalcList(
$productIds = $Discount->getAttribute('articles'); $productIds = $Discount->getAttribute('articles');
if ($productIds) { if ($productIds) {
$productIds = \explode(',', $productIds); $productIds = explode(',', $productIds);
// product id check // product id check
$existProductIdInList = function ($products, $productIds) { $existProductIdInList = function ($products, $productIds) {
...@@ -281,7 +273,7 @@ public static function onQuiqqerProductsCalcList( ...@@ -281,7 +273,7 @@ public static function onQuiqqerProductsCalcList(
$categories = $Discount->getAttribute('categories'); $categories = $Discount->getAttribute('categories');
if ($categories) { if ($categories) {
$categories = \explode(',', $categories); $categories = explode(',', $categories);
// product category check // product category check
$existCategoryInList = function ($products, $categories) { $existCategoryInList = function ($products, $categories) {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace QUI\ERP\Discount; namespace QUI\ERP\Discount;
use QUI; use QUI;
use QUI\Database\Exception;
use QUI\Permissions\Permission; use QUI\Permissions\Permission;
/** /**
...@@ -49,7 +50,7 @@ class Handler extends QUI\CRUD\Factory ...@@ -49,7 +50,7 @@ class Handler extends QUI\CRUD\Factory
const DISCOUNT_SCOPE_GRAND_TOTAL = 4; const DISCOUNT_SCOPE_GRAND_TOTAL = 4;
/** /**
* pricefactor discount type * price factor discount type
*/ */
const DISCOUNT_PRICEFACTOR_TYPE = 'DISCOUNT_PRICE_FACTOR'; const DISCOUNT_PRICEFACTOR_TYPE = 'DISCOUNT_PRICE_FACTOR';
...@@ -163,7 +164,7 @@ public function __construct() ...@@ -163,7 +164,7 @@ public function __construct()
* *
* @return string * @return string
*/ */
public function getDataBaseTableName() public function getDataBaseTableName(): string
{ {
return QUI::getDBTableName('discounts'); return QUI::getDBTableName('discounts');
} }
...@@ -173,7 +174,7 @@ public function getDataBaseTableName() ...@@ -173,7 +174,7 @@ public function getDataBaseTableName()
* *
* @return string * @return string
*/ */
public function getChildClass() public function getChildClass(): string
{ {
return 'QUI\ERP\Discount\Discount'; return 'QUI\ERP\Discount\Discount';
} }
...@@ -183,7 +184,7 @@ public function getChildClass() ...@@ -183,7 +184,7 @@ public function getChildClass()
* *
* @return array * @return array
*/ */
public function getChildAttributes() public function getChildAttributes(): array
{ {
return [ return [
'active', 'active',
...@@ -217,8 +218,9 @@ public function getChildAttributes() ...@@ -217,8 +218,9 @@ public function getChildAttributes()
* *
* @param array $queryParams * @param array $queryParams
* @return array - [Child, Child, Child] * @return array - [Child, Child, Child]
* @throws Exception
*/ */
public function getChildrenData($queryParams = []) public function getChildrenData(array $queryParams = []): array
{ {
if (!isset($queryParams['order'])) { if (!isset($queryParams['order'])) {
$queryParams['order'] = 'priority ASC'; $queryParams['order'] = 'priority ASC';
......
...@@ -10,22 +10,18 @@ ...@@ -10,22 +10,18 @@
/** /**
* Class PriceFactor * Class PriceFactor
* This pricefactors is used by Handler::DISCOUNT_SCOPE_TOTAL * This price factor is used by Handler::DISCOUNT_SCOPE_TOTAL
* *
* @package QUI\ERP\Discount * @package QUI\ERP\Discount
*/ */
class PriceFactor extends QUI\ERP\Products\Utils\PriceFactor implements QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface class PriceFactor extends QUI\ERP\Products\Utils\PriceFactor implements
QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface
{ {
/** /**
* @var string * @var string
*/ */
protected string $type = Handler::DISCOUNT_PRICEFACTOR_TYPE; protected string $type = Handler::DISCOUNT_PRICEFACTOR_TYPE;
/**
* @var string|null
*/
protected $vat = null;
/** /**
* PriceFactor constructor. * PriceFactor constructor.
* @param array $params * @param array $params
...@@ -45,7 +41,7 @@ public function __construct(array $params) ...@@ -45,7 +41,7 @@ public function __construct(array $params)
* @return QUI\ERP\Tax\TaxType * @return QUI\ERP\Tax\TaxType
* @throws QUI\Exception * @throws QUI\Exception
*/ */
public function getVatType() public function getVatType(): QUI\ERP\Tax\TaxType
{ {
if (!$this->vat) { if (!$this->vat) {
return QUI\ERP\Tax\Utils::getShopTaxType(); return QUI\ERP\Tax\Utils::getShopTaxType();
...@@ -61,7 +57,7 @@ public function getVatType() ...@@ -61,7 +57,7 @@ public function getVatType()
$Handler = new QUI\ERP\Tax\Handler(); $Handler = new QUI\ERP\Tax\Handler();
return $Handler->getTaxType($standardTax[1]); return $Handler->getTaxType($standardTax[1]);
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
} }
return QUI\ERP\Tax\Utils::getShopTaxType(); return QUI\ERP\Tax\Utils::getShopTaxType();
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
use QUI\Utils\UserGroups; use QUI\Utils\UserGroups;
use QUI\Interfaces\Users\User as UserInterface; use QUI\Interfaces\Users\User as UserInterface;
use function array_filter;
use function array_merge;
use function str_replace;
/** /**
* Class Utils * Class Utils
* *
...@@ -20,7 +24,7 @@ class Utils ...@@ -20,7 +24,7 @@ class Utils
/** /**
* Return all discounts which are usable by the user * Return all discounts which are usable by the user
* *
* @param \QUI\Interfaces\Users\User $User * @param UserInterface $User
* @return array * @return array
* *
* @throws \QUI\Database\Exception * @throws \QUI\Database\Exception
...@@ -28,7 +32,7 @@ class Utils ...@@ -28,7 +32,7 @@ class Utils
public static function getUserDiscounts(UserInterface $User): array public static function getUserDiscounts(UserInterface $User): array
{ {
$guString = UserGroups::getUserGroupStringFromUser($User); $guString = UserGroups::getUserGroupStringFromUser($User);
$guString = ',' . \str_replace(',', ',|,', $guString) . ','; $guString = ',' . str_replace(',', ',|,', $guString) . ',';
$result = []; $result = [];
$Discounts = new Handler(); $Discounts = new Handler();
...@@ -50,11 +54,11 @@ public static function getUserDiscounts(UserInterface $User): array ...@@ -50,11 +54,11 @@ public static function getUserDiscounts(UserInterface $User): array
if (!empty($personalDiscounts)) { if (!empty($personalDiscounts)) {
$result = \array_merge($personalDiscounts, $result); $result = array_merge($personalDiscounts, $result);
} }
if (!empty($discounts)) { if (!empty($discounts)) {
$result = \array_merge($discounts, $result); $result = array_merge($discounts, $result);
} }
return $result; return $result;
...@@ -90,11 +94,11 @@ public static function getProductDiscounts(Product $Product): array ...@@ -90,11 +94,11 @@ public static function getProductDiscounts(Product $Product): array
if (!empty($productDiscounts)) { if (!empty($productDiscounts)) {
$result = \array_merge($productDiscounts, $result); $result = array_merge($productDiscounts, $result);
} }
if (!empty($discounts)) { if (!empty($discounts)) {
$result = \array_merge($discounts, $result); $result = array_merge($discounts, $result);
} }
return $result; return $result;
...@@ -103,7 +107,7 @@ public static function getProductDiscounts(Product $Product): array ...@@ -103,7 +107,7 @@ public static function getProductDiscounts(Product $Product): array
/** /**
* Return all active discounts which are usable by the user * Return all active discounts which are usable by the user
* *
* @param \QUI\Interfaces\Users\User $User * @param UserInterface $User
* @return array * @return array
* *
* @throws \QUI\Database\Exception * @throws \QUI\Database\Exception
...@@ -111,7 +115,7 @@ public static function getProductDiscounts(Product $Product): array ...@@ -111,7 +115,7 @@ public static function getProductDiscounts(Product $Product): array
public static function getActiveUserDiscounts(UserInterface $User): array public static function getActiveUserDiscounts(UserInterface $User): array
{ {
$guString = UserGroups::getUserGroupStringFromUser($User); $guString = UserGroups::getUserGroupStringFromUser($User);
$guString = ',' . \str_replace(',', ',|,', $guString) . ','; $guString = ',' . str_replace(',', ',|,', $guString) . ',';
$result = []; $result = [];
$Discounts = new Handler(); $Discounts = new Handler();
...@@ -140,19 +144,19 @@ public static function getActiveUserDiscounts(UserInterface $User): array ...@@ -140,19 +144,19 @@ public static function getActiveUserDiscounts(UserInterface $User): array
] ]
]); ]);
$discounts = \array_merge($discounts, $discountsNULL); $discounts = array_merge($discounts, $discountsNULL);
if (!empty($personalDiscounts)) { if (!empty($personalDiscounts)) {
$result = \array_merge($personalDiscounts, $result); $result = array_merge($personalDiscounts, $result);
} }
if (!empty($discounts)) { if (!empty($discounts)) {
$result = \array_merge($discounts, $result); $result = array_merge($discounts, $result);
} }
$alreadyAttached = []; $alreadyAttached = [];
$result = \array_filter($result, function ($Discount) use (&$alreadyAttached) { return array_filter($result, function ($Discount) use (&$alreadyAttached) {
/* @var $Discount Discount */ /* @var $Discount Discount */
$id = $Discount->getId(); $id = $Discount->getId();
...@@ -164,15 +168,12 @@ public static function getActiveUserDiscounts(UserInterface $User): array ...@@ -164,15 +168,12 @@ public static function getActiveUserDiscounts(UserInterface $User): array
return true; return true;
}); });
return $result;
} }
/** /**
* Return all active and usable discounts which are usable by the user * Return all active and usable discounts which are usable by the user
* *
* @param \QUI\Interfaces\Users\User $User * @param UserInterface $User
* @return array * @return array
* *
* @throws \QUI\Database\Exception * @throws \QUI\Database\Exception
......
<?php
if (!defined('QUIQQER_SYSTEM')) {
define('QUIQQER_SYSTEM', true);
}
if (!defined('QUIQQER_AJAX')) {
define('QUIQQER_AJAX', true);
}
putenv("QUIQQER_OTHER_AUTOLOADERS=KEEP");
require_once __DIR__ . '/../../../../bootstrap.php';