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

fix: erp price validation can now handle normal data as well -> 4.4 || 4,4

Übergeordneter 94e44365
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -8,6 +8,7 @@
use QUI;
use QUI\ERP\Discount\Discount;
use function GuzzleHttp\Psr7\str;
/**
* Class Price
......@@ -210,20 +211,12 @@ public static function validatePrice($value)
return \round(\floatval($value), 4) * $negativeTurn;
}
if ($thousands !== false && $decimal === false) {
if (\mb_substr($value, -4, 1) === $thousandSeparator) {
$value = \str_replace($thousandSeparator, '', $value);
}
}
if ($thousands === false && $decimal !== false) {
$value = \str_replace($decimalSeparator, '.', $value);
if (\strpos($value, $decimalSeparator) !== false && \strpos($value, $thousandSeparator) !== false) {
$value = \str_replace($decimalSeparator, '', $value);
}
if ($thousands !== false && $decimal !== false) {
$value = \str_replace($thousandSeparator, '', $value);
$value = \str_replace($decimalSeparator, '.', $value);
}
$value = \str_replace($thousandSeparator, '.', $value);
$value = \floatval($value);
return \round(\floatval($value), 4) * $negativeTurn;
}
......
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