Skip to content
Code-Schnipsel Gruppen Projekte

fix: price could not be converted to string

Zusammengeführt Michael Danielczok requested to merge next-1.x into 1.x
1 Datei
+ 9
1
Änderungen vergleichen
  • Nebeneinander
  • In der Reihe
@@ -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) === '-';
Lade