From dee79d5023c488febe28a1c6a9bb4e8f4a917935 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Wed, 18 Sep 2019 14:42:27 +0200
Subject: [PATCH] fix: correct calc of weight to kg from product

---
 src/QUI/ERP/Shipping/Rules/ShippingRule.php | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/QUI/ERP/Shipping/Rules/ShippingRule.php b/src/QUI/ERP/Shipping/Rules/ShippingRule.php
index 6b2b197..35a3256 100644
--- a/src/QUI/ERP/Shipping/Rules/ShippingRule.php
+++ b/src/QUI/ERP/Shipping/Rules/ShippingRule.php
@@ -376,7 +376,7 @@ public function canUsedInOrder($Order)
                     $Weight = $Product->getField($unitId);
                     $weight = $Weight->getValue();
 
-                    if ($unitId === Fields::FIELD_WEIGHT) {
+                    if ((int)$unitId === Fields::FIELD_WEIGHT) {
                         $weight = FieldUtils::weightFieldToKilogram($Weight);
                     }
 
@@ -476,7 +476,7 @@ public function canUsedInOrder($Order)
 
                     if ($compare === false) {
                         QUI\ERP\Shipping\Debug::addLog(
-                            "{$this->getTitle()} :: weight is not valid {$articleUnits[$id]}{$term} -> {$unitValue}{$term}"
+                            "{$this->getTitle()} :: weight is not valid {$articleUnits[$id]} {$term} {$unitValue}"
                         );
 
                         return false;
@@ -492,7 +492,7 @@ public function canUsedInOrder($Order)
 
                         if ($compare2 === false) {
                             QUI\ERP\Shipping\Debug::addLog(
-                                "{$this->getTitle()} :: weight is not valid {$articleUnits[$id]}{$term2} -> {$unitValue}{$term2}"
+                                "{$this->getTitle()} :: weight is not valid {$articleUnits[$id]} {$term2} {$unitValue}"
                             );
 
                             return false;
@@ -506,7 +506,7 @@ public function canUsedInOrder($Order)
 
                 if ($compare === false) {
                     QUI\ERP\Shipping\Debug::addLog(
-                        "{$this->getTitle()} :: unit term is not valid {$articleUnits[$id]}{$term} -> {$value}{$term}"
+                        "{$this->getTitle()} :: unit term is not valid {$articleUnits[$id]} {$term} {$value}"
                     );
 
                     return false;
@@ -520,7 +520,7 @@ public function canUsedInOrder($Order)
 
                     if ($compare2 === false) {
                         QUI\ERP\Shipping\Debug::addLog(
-                            "{$this->getTitle()} :: unit term is not valid {$articleUnits[$id]}{$term} -> {$value2}{$term2}"
+                            "{$this->getTitle()} :: unit term is not valid {$articleUnits[$id]} {$term} {$value2}"
                         );
 
                         return false;
-- 
GitLab