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
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
1 Merge Request!149fix: price could not be converted to string
Pipeline-Nr. 12072 mit Warnungen bestanden
...@@ -64,6 +64,10 @@ class Price ...@@ -64,6 +64,10 @@ class Price
*/ */
public function __construct($price, QUI\ERP\Currency\Currency $Currency, $User = false) public function __construct($price, QUI\ERP\Currency\Currency $Currency, $User = false)
{ {
if ($price instanceof Price) {
$price = $price->getPrice();
}
$this->price = $price; $this->price = $price;
$this->Currency = $Currency; $this->Currency = $Currency;
...@@ -192,10 +196,14 @@ public function getCurrency(): QUI\ERP\Currency\Currency ...@@ -192,10 +196,14 @@ public function getCurrency(): QUI\ERP\Currency\Currency
*/ */
public static function validatePrice($value, $Locale = null) 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()); return round($value, QUI\ERP\Defaults::getPrecision());
} }
if ($value instanceof Price) {
$value = $value->getPrice();
}
$value = (string)$value; $value = (string)$value;
$isNegative = substr($value, 0, 1) === '-'; $isNegative = substr($value, 0, 1) === '-';
......
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