diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 47eb0cd3ece..b7005ffb076 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -579,7 +579,7 @@ class CMailFile if (!empty($this->atleastonefile)) { foreach ($filename_list as $i => $val) { $content = file_get_contents($filename_list[$i]); - $smtps->setAttachment($content, $mimefilename_list[$i], $mimetype_list[$i], $cid_list[$i]); + $smtps->setAttachment($content, $mimefilename_list[$i], $mimetype_list[$i], (empty($cid_list[$i]) ? '' : $cid_list[$i])); } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ce78539d749..a0789afe0c9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4970,25 +4970,19 @@ abstract class CommonObject $totalWeight = 0; $totalVolume = 0; // defined for shipment only - $totalOrdered = ''; + $totalOrdered = 0; // defined for shipment only - $totalToShip = ''; + $totalToShip = 0; if (empty($this->lines)) { - return array(); + return array('weight' => $totalWeight, 'volume' => $totalVolume, 'ordered' => $totalOrdered, 'toship' => $totalToShip); } foreach ($this->lines as $line) { if (isset($line->qty_asked)) { - if (empty($totalOrdered)) { - $totalOrdered = 0; // Avoid warning because $totalOrdered is '' - } $totalOrdered += $line->qty_asked; // defined for shipment only } if (isset($line->qty_shipped)) { - if (empty($totalToShip)) { - $totalToShip = 0; // Avoid warning because $totalToShip is '' - } $totalToShip += $line->qty_shipped; // defined for shipment only } elseif ($line->element == 'commandefournisseurdispatch' && isset($line->qty)) { if (empty($totalToShip)) {