Skip to content
Code-Schnipsel Gruppen Projekte
Commit 9289fdee erstellt von Patrick Müller's avatar Patrick Müller
Dateien durchsuchen

fix: purchase quantity from/to validation

Übergeordneter f8a6f865
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
...@@ -142,29 +142,28 @@ public function __construct($id, Handler $Factory) ...@@ -142,29 +142,28 @@ public function __construct($id, Handler $Factory)
$purchaseValueFrom = $this->getAttribute('purchase_value_from'); $purchaseValueFrom = $this->getAttribute('purchase_value_from');
$purchaseValueUntil = $this->getAttribute('purchase_value_until'); $purchaseValueUntil = $this->getAttribute('purchase_value_until');
if ($purchaseQuantityFrom !== '' && ($purchaseQuantityFrom === false || $purchaseQuantityFrom < 0)) {
if ($purchaseQuantityFrom === false || $purchaseQuantityFrom < 0) {
throw new QUI\ERP\Discount\Exception([ throw new QUI\ERP\Discount\Exception([
'quiqqer/discount', 'quiqqer/discount',
'exception.discount.purchase_quantity_from.wrong' 'exception.discount.purchase_quantity_from.wrong'
]); ]);
} }
if ($purchaseQuantityUntil === false || $purchaseQuantityUntil < 0) { if ($purchaseQuantityUntil !== '' && ($purchaseQuantityUntil === false || $purchaseQuantityUntil < 0)) {
throw new QUI\ERP\Discount\Exception([ throw new QUI\ERP\Discount\Exception([
'quiqqer/discount', 'quiqqer/discount',
'exception.discount.purchase_quantity_until.wrong' 'exception.discount.purchase_quantity_until.wrong'
]); ]);
} }
if ($purchaseValueFrom === false || $purchaseValueFrom < 0) { if ($purchaseValueFrom !== '' && ($purchaseValueFrom === false || $purchaseValueFrom < 0)) {
throw new QUI\ERP\Discount\Exception([ throw new QUI\ERP\Discount\Exception([
'quiqqer/discount', 'quiqqer/discount',
'exception.discount.purchase_value_from.wrong' 'exception.discount.purchase_value_from.wrong'
]); ]);
} }
if ($purchaseValueUntil === false || $purchaseValueUntil < 0) { if ($purchaseValueUntil !== '' && ($purchaseValueUntil === false || $purchaseValueUntil < 0)) {
throw new QUI\ERP\Discount\Exception([ throw new QUI\ERP\Discount\Exception([
'quiqqer/discount', 'quiqqer/discount',
'exception.discount.purchase_value_until.wrong' 'exception.discount.purchase_value_until.wrong'
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren