From 0c18d5a1dee2609e5c26add4f697510e0c68c573 Mon Sep 17 00:00:00 2001
From: Michael Danielczok <michael@pcsg.de>
Date: Mon, 14 Oct 2024 11:49:16 +0000
Subject: [PATCH] fix: adoption from v1 - price object fix

---
 src/QUI/ERP/Money/Price.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/QUI/ERP/Money/Price.php b/src/QUI/ERP/Money/Price.php
index a6dc5ce..b9f4e7d 100644
--- a/src/QUI/ERP/Money/Price.php
+++ b/src/QUI/ERP/Money/Price.php
@@ -200,10 +200,14 @@ public function getCurrency(): QUI\ERP\Currency\Currency
      */
     public static function validatePrice(mixed $value, QUI\Locale $Locale = null): float|int|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 = str_starts_with($value, '-');
 
-- 
GitLab