fix getentity

This commit is contained in:
Frédéric FRANCE 2023-08-12 06:09:22 +02:00 committed by GitHub
parent 020c29d5c6
commit 4deeefe980
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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++;