2
0
forked from Wavyzz/dolibarr

FIX #4809 - Duplicate functions with different content

This commit is contained in:
Laurent Destailleur
2016-03-14 14:38:30 +01:00
parent 0727ee88e6
commit 08c5fd2e36
3 changed files with 21 additions and 10 deletions

View File

@@ -2803,6 +2803,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,';

View File

@@ -1702,7 +1702,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);
@@ -3233,12 +3233,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, ';
@@ -3308,7 +3310,7 @@ class Commande extends CommonOrder
{
$this->error=$this->db->error();
return -1;
}
}*/
}
/**

View File

@@ -1097,7 +1097,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,';
@@ -1107,7 +1107,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);
@@ -3474,6 +3474,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,';
@@ -3506,11 +3508,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;
@@ -3520,6 +3523,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;
@@ -3544,7 +3551,7 @@ class Facture extends CommonInvoice
{
$this->error=$this->db->error();
return -1;
}
}*/
}
/**