From 0ff29051802d477a47071e75d5ebba9744b48f99 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 6 Mar 2019 12:10:24 +0100 Subject: [PATCH 1/2] FIX : we need to keep originline special_code --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/fourn/facture/card.php | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 309230a4dcc..b0351252c0b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1386,7 +1386,7 @@ class FactureFournisseur extends CommonInvoice * * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='') + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='', $special_code='') { dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1481,7 +1481,7 @@ class FactureFournisseur extends CommonInvoice $this->line->total_localtax1=$total_localtax1; $this->line->total_localtax2=$total_localtax2; $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); - $this->line->special_code=$this->special_code; + $this->line->special_code=!empty($special_code) ? $special_code : $this->special_code; $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; $this->line->origin_id=$origin_id; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index cc9164b753f..3e7df0b27f3 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -716,7 +716,10 @@ if (empty($reshook)) 0, $lines[$i]->array_options, $lines[$i]->fk_unit, - $lines[$i]->id + $lines[$i]->id, + 0, + '', + $lines[$i]->special_code ); if ($result < 0) From e3fb228a4d148265945c5a0008019f9534b18221 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 12:28:19 +0100 Subject: [PATCH 2/2] Update fournisseur.facture.class.php --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b0351252c0b..4642c0bf753 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1481,7 +1481,7 @@ class FactureFournisseur extends CommonInvoice $this->line->total_localtax1=$total_localtax1; $this->line->total_localtax2=$total_localtax2; $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); - $this->line->special_code=!empty($special_code) ? $special_code : $this->special_code; + $this->line->special_code=((string) $special_code != '' ? $special_code : $this->special_code); $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; $this->line->origin_id=$origin_id;