Fix some php warning (#30753)
* Fix php warning on send email * Fix php warning on getTotalWeightVolume when no lines. * Fix totalOrdered totalToShip should be int
This commit is contained in:
parent
c03617d5b7
commit
a8ddeff35c
2 changed files with 4 additions and 10 deletions
|
|
@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue