diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5a45d884e09..2babeea3118 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2780,6 +2780,8 @@ class Propal extends CommonObject */ function getLinesArray() { + // For other object, here we call fetch_lines. But fetch_lines does not exists on proposal + $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9302c702ff1..f1ab2070ef2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1674,7 +1674,7 @@ class Commande extends CommonOrder $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql.= ' WHERE l.fk_commande = '.$this->id; if ($only_product) $sql .= ' AND p.fk_product_type = 0'; - $sql .= ' ORDER BY l.rang'; + $sql .= ' ORDER BY l.rang, l.rowid'; dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $result = $this->db->query($sql); @@ -3212,12 +3212,14 @@ class Commande extends CommonOrder } /** - * Return an array of order lines - * - * @return array Lines of order + * Create an array of order lines + * + * @return int >0 if OK, <0 if KO */ function getLinesArray() { + return $this->fetch_lines(); + /* $lines = array(); $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.price, l.qty, l.tva_tx, '; @@ -3287,7 +3289,7 @@ class Commande extends CommonOrder { $this->error=$this->db->error(); return -1; - } + }*/ } /** diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0f41620bd89..96abdf7c38c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1065,7 +1065,7 @@ class Facture extends CommonInvoice $this->lines=array(); $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, '; - $sql .= ' l.situation_percent, l.fk_prev_id,'; + $sql.= ' l.situation_percent, l.fk_prev_id,'; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.rang, l.special_code,'; $sql.= ' l.date_start as date_start, l.date_end as date_end,'; @@ -1075,7 +1075,7 @@ class Facture extends CommonInvoice $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; $sql.= ' WHERE l.fk_facture = '.$this->id; - $sql.= ' ORDER BY l.rang'; + $sql.= ' ORDER BY l.rang, l.rowid'; dol_syslog(get_class($this).'::fetch_lines', LOG_DEBUG); $result = $this->db->query($sql); @@ -3441,6 +3441,8 @@ class Facture extends CommonInvoice */ function getLinesArray() { + return $this->fetch_lines(); + /* $sql = 'SELECT l.rowid, l.label as custom_label, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,'; $sql.= ' l.fk_remise_except, l.localtax1_tx, l.localtax2_tx,'; $sql .= ' l.situation_percent, l.fk_prev_id,'; @@ -3473,11 +3475,12 @@ class Facture extends CommonInvoice $this->lines[$i]->description = $obj->description; $this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->ref = $obj->product_ref; - $this->lines[$i]->entity = $obj->entity; // Product entity - $this->lines[$i]->product_label = $obj->product_label; + $this->lines[$i]->product_ref = $obj->product_ref; + $this->lines[$i]->product_label = $obj->product_label; $this->lines[$i]->product_desc = $obj->product_desc; $this->lines[$i]->fk_product_type = $obj->fk_product_type; $this->lines[$i]->product_type = $obj->product_type; + $this->lines[$i]->entity = $obj->entity; // Product entity $this->lines[$i]->qty = $obj->qty; $this->lines[$i]->subprice = $obj->subprice; $this->lines[$i]->fk_remise_except = $obj->fk_remise_except; @@ -3487,6 +3490,10 @@ class Facture extends CommonInvoice $this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_ttc = $obj->total_ttc; + $this->lines[$i]->localtax1_tx = $obj->localtax1_tx; + $this->lines[$i]->localtax2_tx = $obj->localtax2_tx; + $this->lines[$i]->localtax1_type = $obj->localtax1_type; + $this->lines[$i]->localtax2_type = $obj->localtax2_type; $this->lines[$i]->fk_parent_line = $obj->fk_parent_line; $this->lines[$i]->situation_percent = $obj->situation_percent; $this->lines[$i]->fk_prev_id = $obj->fk_prev_id; @@ -3511,7 +3518,7 @@ class Facture extends CommonInvoice { $this->error=$this->db->error(); return -1; - } + }*/ } /** diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 593e4616fd0..36f62be3833 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -911,7 +911,7 @@ class pdf_einstein extends ModelePDFCommandes // VAT foreach($this->tva as $tvakey => $tvaval) { - if ($tvakey > 0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { $this->atleastoneratenotnull++; diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 4fc8f9ea67a..1434399d225 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -57,7 +57,6 @@ class pdf_proforma extends pdf_einstein } - /** * Show top header of page. * diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index c627da68418..910d8d6c562 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1109,7 +1109,7 @@ class pdf_crabe extends ModelePDFFactures // VAT foreach($this->tva as $tvakey => $tvaval) { - if ($tvakey > 0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { $this->atleastoneratenotnull++; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 12b0615701e..152291c56e2 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1073,7 +1073,7 @@ class pdf_azur extends ModelePDFPropales // VAT foreach($this->tva as $tvakey => $tvaval) { - if ($tvakey > 0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { $this->atleastoneratenotnull++; diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 0d4cbda9fc2..c17fdb65aea 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -48,6 +48,7 @@ $price_level = GETPOST('price_level', 'int'); $action = GETPOST('action', 'alpha'); $id = GETPOST('id', 'int'); $price_by_qty_rowid = GETPOST('pbq', 'int'); +$finished = GETPOST('finished', 'int'); /* * View @@ -180,7 +181,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) $form = new Form($db); if (empty($mode) || $mode == 1) { - $arrayresult = $form->select_produits_list("", $htmlname, $type, "", $price_level, $searchkey, $status, 2, $outjson, $socid); + $arrayresult = $form->select_produits_list("", $htmlname, $type, "", $price_level, $searchkey, $status, $finished, $outjson, $socid); } elseif ($mode == 2) { $arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, $socid); }