From 7b1a705be4e7e4347342b08e1d9fe97311736fb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Aug 2018 13:50:58 +0200 Subject: [PATCH] Clean duplicate code --- htdocs/comm/propal/class/propal.class.php | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index cc918b5b9f1..955ee29845e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -49,22 +49,22 @@ class Propal extends CommonObject * @var string ID to identify managed object */ public $element='propal'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='propal'; - + public $table_element_line='propaldet'; public $fk_element='fk_propal'; public $picto='propal'; - + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int */ public $ismultientitymanaged = 1; - + /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -1574,10 +1574,10 @@ class Propal extends CommonObject $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; $sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,'; $sql.= ' d.fk_unit,'; - $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; + $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobach as product_batch,'; $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units,'; - $sql.= ' d.date_start, d.date_end'; - $sql.= ' ,d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; + $sql.= ' d.date_start, d.date_end,'; + $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as d'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)'; $sql.= ' WHERE d.fk_propal = '.$this->id; @@ -1639,7 +1639,8 @@ class Propal extends CommonObject $line->libelle = $objp->product_label; // TODO deprecated $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; // Description produit - $line->fk_product_type = $objp->fk_product_type; + $line->product_tobatch = $objp->product_tobatch; + $line->fk_product_type = $objp->fk_product_type; // TODO deprecated $line->fk_unit = $objp->fk_unit; $line->weight = $objp->weight; $line->weight_units = $objp->weight_units; @@ -3201,7 +3202,7 @@ class Propal extends CommonObject { $response->nbtodo++; $response->total+=$obj->total_ht; - + if ($mode == 'opened') { $datelimit = $this->db->jdate($obj->datefin); @@ -3511,8 +3512,8 @@ class Propal extends CommonObject */ function getLinesArray() { - // TODO Duplicate with fetch_lines ? Wich one to keep ? - + return $this->fetch_lines(); + /* $this->lines = array(); $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; @@ -3601,7 +3602,7 @@ class Propal extends CommonObject { $this->error=$this->db->error(); return -1; - } + }*/ } /** @@ -3665,7 +3666,7 @@ class PropaleLigne extends CommonObjectLine * @var string ID to identify managed object */ public $element='propaldet'; - + /** * @var string Name of table without prefix where object is stored */