Skip to content
Code-Schnipsel Gruppen Projekte
Commit e55a61d8 erstellt von Michael Danielczok's avatar Michael Danielczok
Dateien durchsuchen

Merge branch 'next-1.x' into '1.x'

fix: price could not be converted to string

See merge request !149
Übergeordnete d473f3a7 fe5e97af
No related branches found
No related tags found
1 Merge Request!149fix: price could not be converted to string
Pipeline #12072 mit Warnungen bestanden mit Phasen
in 1 Minute und 1 Sekunde
......@@ -64,6 +64,10 @@ class Price
*/
public function __construct($price, QUI\ERP\Currency\Currency $Currency, $User = false)
{
if ($price instanceof Price) {
$price = $price->getPrice();
}
$this->price = $price;
$this->Currency = $Currency;
......@@ -192,10 +196,14 @@ public function getCurrency(): QUI\ERP\Currency\Currency
*/
public static function validatePrice($value, $Locale = null)
{
if (is_float($value)) {
if (is_float($value) || is_int($value)) {
return round($value, QUI\ERP\Defaults::getPrecision());
}
if ($value instanceof Price) {
$value = $value->getPrice();
}
$value = (string)$value;
$isNegative = substr($value, 0, 1) === '-';
......
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