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

fix: candyman-gmbh/projektplanung#121 - consider order creation -> discount...

fix: candyman-gmbh/projektplanung#121 - consider order creation -> discount check during creation is disabled
Übergeordneter 123297df
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -109,11 +109,29 @@ public static function onQuiqqerOrderBasketToOrder(
return;
}
if (empty($coupons)) {
return;
}
$PriceFactors = $Products->getPriceFactors();
$products = $Products->toArray();
$productCount = $Products->count();
$subSum = $products['calculations']['subSum'];
$checkRedeemable = !$Order->isSuccessful(); // if order is successful we dont need a check
$OrderInProcess = $Order->getAttribute('OrderInProcess');
$added = false;
if ($Order->getAttribute('inOrderCreation')) {
$checkRedeemable = false;
}
if ($OrderInProcess instanceof QUI\ERP\Order\OrderInProcess
&& $OrderInProcess->getAttribute('inOrderCreation')
) {
$checkRedeemable = false;
}
foreach ($coupons as $coupon) {
/* @var $Coupon CouponCode */
try {
......@@ -123,7 +141,7 @@ public static function onQuiqqerOrderBasketToOrder(
}
// coupon check
if (!$Coupon->isRedeemable($Order->getCustomer())) {
if ($checkRedeemable && !$Coupon->isRedeemable($Order->getCustomer())) {
continue;
}
......@@ -165,14 +183,17 @@ public static function onQuiqqerOrderBasketToOrder(
continue;
}
$added = true;
$PriceFactors->addToEnd($PriceFactor);
}
}
try {
$Products->recalculation();
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
if ($added) {
try {
$Products->recalculation();
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
}
}
}
......
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