From dc86f9528dc5689e5c3a9bc7f1c1dac9cb7c12ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Apr 2020 18:10:20 +0200 Subject: [PATCH] Fix MRP module --- htdocs/admin/const.php | 6 +++--- htdocs/product/class/product.class.php | 22 +++++++++++----------- htdocs/product/stats/card.php | 5 ++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index e228ab58e8a..59ac87a2c56 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -215,11 +215,11 @@ print "\n"; // Line to add new record print "\n"; -print ''."\n"; +print ''."\n"; print ''; -print ''; +print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8be4ae11cc4..fcadfea6ef1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3598,11 +3598,11 @@ class Product extends CommonObject // phpcs:enable global $conf, $user; - $sql = "SELECT sum(c.qty), date_format(c.date_valid, '%Y%m')"; + $sql = "SELECT sum(d.qty), date_format(d.date_valid, '%Y%m')"; if ($mode == 'bynumber') { $sql .= ", count(DISTINCT c.rowid)"; } - $sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as c LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as d LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid"; if ($filteronproducttype >= 0) { $sql .= ", ".MAIN_DB_PREFIX."product as p"; } @@ -3610,27 +3610,27 @@ class Product extends CommonObject $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql .= " WHERE c.entity IN (".getEntity('mo').")"; - $sql .= " AND c.status > 0"; + $sql .= " WHERE d.entity IN (".getEntity('mo').")"; + $sql .= " AND d.status > 0"; if ($this->id > 0) { - $sql .= " AND c.fk_product =".$this->id; + $sql .= " AND d.fk_product =".$this->id; } else { - $sql .= " AND c.fk_product > 0"; + $sql .= " AND d.fk_product > 0"; } if ($filteronproducttype >= 0) { - $sql .= " AND p.rowid = c.fk_product AND p.fk_product_type =".$filteronproducttype; + $sql .= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; } if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND d.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND d.fk_soc = ".$socid; } $sql .= $morefilter; - $sql .= " GROUP BY date_format(c.date_valid,'%Y%m')"; - $sql .= " ORDER BY date_format(c.date_valid,'%Y%m') DESC"; + $sql .= " GROUP BY date_format(d.date_valid,'%Y%m')"; + $sql .= " ORDER BY date_format(d.date_valid,'%Y%m') DESC"; return $this->_get_stats($sql, $mode, $year); } diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 8a5fc2c7c50..4600baa1597 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -104,7 +104,10 @@ if (!$id && empty($ref)) $title = $langs->trans("Statistics"); } - print load_fiche_titre($title, $mesg, 'product'); + $picto = 'product'; + if ($type == 1) $picto = 'service'; + + print load_fiche_titre($title, $mesg, $picto); } else {