keep where but remove join
This commit is contained in:
parent
b8b30a9af6
commit
80af5e2216
@ -231,8 +231,6 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
|
||||
if ($selected_cat === -2) { // Without any category
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
||||
} elseif ($selected_cat) { // Into a specific category
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON (cp.fk_product = p.rowid) INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON (cp.fk_categorie = c.rowid)";
|
||||
}
|
||||
$sql .= " WHERE l.fk_facture = f.rowid";
|
||||
$sql .= " AND f.fk_statut in (1,2)";
|
||||
@ -263,10 +261,13 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " AND (p.rowid IN ";
|
||||
$sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE ";
|
||||
$sql .= " AND ";
|
||||
|
||||
if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")";
|
||||
else $sql .= "cp.fk_categorie = ".$selected_cat;
|
||||
$sql .= "))";
|
||||
|
||||
}
|
||||
if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user