2
0
forked from Wavyzz/dolibarr

user inner join

This commit is contained in:
atm-greg
2023-09-08 11:18:59 +02:00
parent b8455430af
commit aa34f800c2

View File

@@ -246,8 +246,8 @@ class CommandeStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from;
$sql .= " LEFT JOIN ".$this->from_line." ON c.rowid = tl.fk_commande ";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
$sql .= " INNER JOIN ".$this->from_line." ON c.rowid = tl.fk_commande ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}