From 51d7db52d96c5dc8c81eb6bac4ed6b05053d78a2 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 27 Nov 2003 11:04:50 +0000 Subject: [PATCH] Ajout d'un filtre dans fetch_lignes pour ne lire que les produits --- htdocs/commande/commande.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index f7b4a0cdc51..775b1366a58 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -440,12 +440,21 @@ class Commande * * */ - Function fetch_lignes() + Function fetch_lignes($only_product=0) { $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 .= " FROM llx_commandedet as l WHERE l.fk_commande = $this->id ORDER BY l.rowid"; - + + 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"; + } + $result = $this->db->query($sql); if ($result) {