From 091966902ec0b24c8e2401665189d1df3b6b1c88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Oct 2012 22:18:31 +0200 Subject: [PATCH] Fix: for special_code=3 --- htdocs/commande/class/commande.class.php | 3 +++ htdocs/compta/facture.php | 6 +++++- htdocs/compta/facture/class/facture.class.php | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1ab079e0fc8..3d18ff816c3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2236,6 +2236,7 @@ class Commande extends CommonOrder $this->line->remise_percent=$remise_percent; $this->line->subprice=$subprice; $this->line->info_bits=$info_bits; + $this->line->special_code=0; // To remove special_code=3 coming from proposals copy $this->line->total_ht=$total_ht; $this->line->total_tva=$total_tva; $this->line->total_localtax1=$total_localtax1; @@ -3116,6 +3117,7 @@ class OrderLine if (empty($this->remise)) $this->remise=0; if (empty($this->remise_percent)) $this->remise_percent=0; if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->special_code)) $this->special_code=0; if (empty($this->product_type)) $this->product_type=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->pa_ht)) $this->pa_ht=0; @@ -3151,6 +3153,7 @@ class OrderLine $sql.= " , fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?$this->fk_fournprice:"null"); $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; $sql.= " , info_bits=".$this->info_bits; + $sql.= " , special_code=".$this->special_code; $sql.= " , date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= " , product_type=".$this->product_type; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 18364723a90..e1d50ef3057 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -994,6 +994,10 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); + // Define special_code for special lines + $special_code=0; + //if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices + // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit @@ -1135,7 +1139,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $pu_ttc, $type, -1, - 0, + $special_code, '', 0, GETPOST('fk_parent_line'), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c37e464514b..9b4fe3474ed 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2119,6 +2119,7 @@ class Facture extends CommonInvoice $this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2); $this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc); $this->line->info_bits = $info_bits; + $this->line->special_code=0; // To remove special_code=3 coming from proposals copy $this->line->product_type = $type; $this->line->fk_parent_line = $fk_parent_line; $this->line->skip_update_total = $skip_update_total; @@ -3413,6 +3414,7 @@ class FactureLigne if (empty($this->total_localtax2)) $this->total_localtax2=0; if (empty($this->remise_percent)) $this->remise_percent=0; if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->special_code)) $this->special_code=0; if (empty($this->product_type)) $this->product_type=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; @@ -3445,6 +3447,7 @@ class FactureLigne $sql.= ",date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= ",product_type=".$this->product_type; $sql.= ",info_bits='".$this->info_bits."'"; + $sql.= ",special_code='".$this->special_code."'"; if (empty($this->skip_update_total)) { $sql.= ",total_ht=".price2num($this->total_ht)."";