From 56afefd6ad4528ebefc8e1f0f7c610c8c7d7ae05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 12 Jun 2021 07:12:45 +0200 Subject: [PATCH] fix warnings --- htdocs/product/class/product.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1afd1e74e23..18b0529a5da 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2666,14 +2666,14 @@ class Product extends CommonObject $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bom_bomline as bl ON bl.fk_bom=b.rowid"; $sql .= " WHERE "; $sql .= " b.entity IN (".getEntity('bom').")"; - $sql .= " AND b.fk_product =".$this->id; + $sql .= " AND b.fk_product =".((int) $this->id); $sql .= " GROUP BY b.rowid"; $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_bom['nb_toproduce'] = $obj->nb_toproduce ? $obj->nb_toproduce : 0; - $this->stats_bom['qty_toproduce'] = $obj->qty_toproduce ? price2num($obj->qty_toproduce) : 0; + $this->stats_bom['nb_toproduce'] = !empty($obj->nb_toproduce) ? $obj->nb_toproduce : 0; + $this->stats_bom['qty_toproduce'] = !empty($obj->qty_toproduce) ? price2num($obj->qty_toproduce) : 0; } else { $this->error = $this->db->error(); $error++; @@ -2685,13 +2685,13 @@ class Product extends CommonObject $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bom_bomline as bl ON bl.fk_bom=b.rowid"; $sql .= " WHERE "; $sql .= " b.entity IN (".getEntity('bom').")"; - $sql .= " AND bl.fk_product =".$this->id; + $sql .= " AND bl.fk_product =".((int) $this->id); $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_bom['nb_toconsume'] = $obj->nb_toconsume ? $obj->nb_toconsume : 0; - $this->stats_bom['qty_toconsume'] = $obj->qty_toconsume ? price2num($obj->qty_toconsume) : 0; + $this->stats_bom['nb_toconsume'] = !empty($obj->nb_toconsume) ? $obj->nb_toconsume : 0; + $this->stats_bom['qty_toconsume'] = !empty($obj->qty_toconsume) ? price2num($obj->qty_toconsume) : 0; } else { $this->error = $this->db->error(); $error++;