From 4deeefe9807c35ff4b9e9751a442dcc48cbb330a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 12 Aug 2023 06:09:22 +0200 Subject: [PATCH] fix getentity --- htdocs/core/lib/order.lib.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 7606abcb05c..349e3179f93 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -243,15 +243,15 @@ function getCustomerOrderPieChart($socid = 0) $sql = "SELECT count(c.rowid) as nb, c.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande as c"; - if (empty($user->rights->societe->client->voir) && !$socid) { + if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE c.fk_soc = s.rowid"; - $sql .= " AND c.entity IN (".getEntity('societe').")"; + $sql .= " AND c.entity IN (".getEntity($commandestatic->element).")"; if ($user->socid) { $sql .= ' AND c.fk_soc = '.((int) $user->socid); } - if (empty($user->rights->societe->client->voir) && !$socid) { + if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " GROUP BY c.fk_statut"; @@ -270,14 +270,11 @@ function getCustomerOrderPieChart($socid = 0) while ($i < $num) { $row = $db->fetch_row($resql); if ($row) { - //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) - { if (!isset($vals[$row[1]])) { $vals[$row[1]] = 0; } - $vals[$row[1]] += $row[0]; - $totalinprocess += $row[0]; - } + $vals[$row[1]] += $row[0]; + $totalinprocess += $row[0]; $total += $row[0]; } $i++;