Merge remote-tracking branch 'origin/3.8' into 3.9

Conflicts:
	htdocs/core/modules/askpricesupplier/doc/pdf_aurore.modules.php
	htdocs/core/modules/commande/doc/pdf_proforma.modules.php
This commit is contained in:
Laurent Destailleur 2016-03-18 11:06:41 +01:00
commit 7fa71214bc
8 changed files with 26 additions and 15 deletions

View File

@ -2780,6 +2780,8 @@ class Propal extends CommonObject
*/ */
function getLinesArray() 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 = '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.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,'; $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,';

View File

@ -1674,7 +1674,7 @@ class Commande extends CommonOrder
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
$sql.= ' WHERE l.fk_commande = '.$this->id; $sql.= ' WHERE l.fk_commande = '.$this->id;
if ($only_product) $sql .= ' AND p.fk_product_type = 0'; 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); dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -3212,12 +3212,14 @@ class Commande extends CommonOrder
} }
/** /**
* Return an array of order lines * Create an array of order lines
* *
* @return array Lines of order * @return int >0 if OK, <0 if KO
*/ */
function getLinesArray() function getLinesArray()
{ {
return $this->fetch_lines();
/*
$lines = array(); $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, '; $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(); $this->error=$this->db->error();
return -1; return -1;
} }*/
} }
/** /**

View File

@ -1075,7 +1075,7 @@ class Facture extends CommonInvoice
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= ' WHERE l.fk_facture = '.$this->id; $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); dol_syslog(get_class($this).'::fetch_lines', LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -3441,6 +3441,8 @@ class Facture extends CommonInvoice
*/ */
function getLinesArray() 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 = '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.fk_remise_except, l.localtax1_tx, l.localtax2_tx,';
$sql .= ' l.situation_percent, l.fk_prev_id,'; $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]->description = $obj->description;
$this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->ref = $obj->product_ref; $this->lines[$i]->ref = $obj->product_ref;
$this->lines[$i]->entity = $obj->entity; // Product entity $this->lines[$i]->product_ref = $obj->product_ref;
$this->lines[$i]->product_label = $obj->product_label; $this->lines[$i]->product_label = $obj->product_label;
$this->lines[$i]->product_desc = $obj->product_desc; $this->lines[$i]->product_desc = $obj->product_desc;
$this->lines[$i]->fk_product_type = $obj->fk_product_type; $this->lines[$i]->fk_product_type = $obj->fk_product_type;
$this->lines[$i]->product_type = $obj->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]->qty = $obj->qty;
$this->lines[$i]->subprice = $obj->subprice; $this->lines[$i]->subprice = $obj->subprice;
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except; $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_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_ttc = $obj->total_ttc; $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]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->situation_percent = $obj->situation_percent; $this->lines[$i]->situation_percent = $obj->situation_percent;
$this->lines[$i]->fk_prev_id = $obj->fk_prev_id; $this->lines[$i]->fk_prev_id = $obj->fk_prev_id;
@ -3511,7 +3518,7 @@ class Facture extends CommonInvoice
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }*/
} }
/** /**

View File

@ -911,7 +911,7 @@ class pdf_einstein extends ModelePDFCommandes
// VAT // VAT
foreach($this->tva as $tvakey => $tvaval) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;

View File

@ -57,7 +57,6 @@ class pdf_proforma extends pdf_einstein
} }
/** /**
* Show top header of page. * Show top header of page.
* *

View File

@ -1109,7 +1109,7 @@ class pdf_crabe extends ModelePDFFactures
// VAT // VAT
foreach($this->tva as $tvakey => $tvaval) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;

View File

@ -1073,7 +1073,7 @@ class pdf_azur extends ModelePDFPropales
// VAT // VAT
foreach($this->tva as $tvakey => $tvaval) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;

View File

@ -48,6 +48,7 @@ $price_level = GETPOST('price_level', 'int');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$price_by_qty_rowid = GETPOST('pbq', 'int'); $price_by_qty_rowid = GETPOST('pbq', 'int');
$finished = GETPOST('finished', 'int');
/* /*
* View * View
@ -180,7 +181,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
$form = new Form($db); $form = new Form($db);
if (empty($mode) || $mode == 1) { 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) { } elseif ($mode == 2) {
$arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, $socid); $arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, $socid);
} }