Ajout d'un filtre dans fetch_lignes pour ne lire que les produits

This commit is contained in:
Rodolphe Quiedeville 2003-11-27 11:04:50 +00:00
parent 471f4761e0
commit 51d7db52d9

View File

@ -440,11 +440,20 @@ class Commande
* *
* *
*/ */
Function fetch_lignes() Function fetch_lignes($only_product=0)
{ {
$this->lignes = array(); $this->lignes = array();
$sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice";
if ($only_product==1)
{
$sql .= " FROM llx_commandedet as l LEFT JOIN llx_product as p ON (p.rowid = l.fk_product) WHERE l.fk_commande = ".$this->id." AND p.fk_product_type <> 1 ORDER BY l.rowid";
}
else
{
$sql .= " FROM llx_commandedet as l WHERE l.fk_commande = $this->id ORDER BY l.rowid"; $sql .= " FROM llx_commandedet as l WHERE l.fk_commande = $this->id ORDER BY l.rowid";
}
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)