diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 60247186734179ebd4b8fd1769b5857e8a6e9426..f2e8f75f7967e3494959bab421635b45333eec44 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2953,24 +2953,31 @@ abstract class CommonObject
      */
     function getTotalWeightVolume()
     {
-        $weightUnit=0;
-        $volumeUnit=0;
-        $totalWeight = '';
-        $totalVolume = '';
-        $totalOrdered = '';     // defined for shipment only
-        $totalToShip = '';      // defined for shipment only
+        $totalWeight = 0;
+        $totalVolume = 0;
+	    // defined for shipment only
+        $totalOrdered = 0;
+	    // defined for shipment only
+        $totalToShip = 0;
 
         foreach ($this->lines as $line)
         {
 
-            $totalOrdered+=$line->qty_asked;    // defined for shipment only
-            $totalToShip+=$line->qty_shipped;   // defined for shipment only
+            $totalOrdered+=$line->qty_asked ?: 0;    // defined for shipment only
+            $totalToShip+= $line->qty_shipped ?: 0;   // defined for shipment only
+
+	        // Define qty, weight, volume, weight_units, volume_units
+	        if ($this->element == 'shipping') {
+		        // for shipments
+		        $qty = $line->qty_shipped ?: 0;
+	        }
+	        else {
+		        $qty = $line->qty ?: 0;
+	        }
+
+            $weight = $line->weight ?: 0;
+            $volume = $line->volume ?: 0;
 
-            // Define qty, weight, volume, weight_units, volume_units
-            if ($this->element == 'shipping') $qty=$line->qty_shipped;     // for shipments
-            else $qty=$line->qty;
-            $weight=$line->weight;
-            $volume=$line->volume;
             $weight_units=$line->weight_units;
             $volume_units=$line->volume_units;