Skip to content

Commit

Permalink
Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 24, 2019
2 parents 58caf27 + 3f07820 commit 7b2f477
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions htdocs/fourn/class/fournisseur.facture.class.php
Expand Up @@ -1700,29 +1700,33 @@ public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $f
$this->line->fk_facture_fourn=$this->id;
//$this->line->label=$label; // deprecated
$this->line->desc=$desc;
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->ref_supplier=$ref_supplier;

$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise

$this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0);
$this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0);
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];

$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
$this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1);
$this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2);
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);

$this->line->fk_product=$fk_product;
$this->line->product_type=$type;
$this->line->remise_percent=$remise_percent;
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start=$date_start;
$this->line->date_end=$date_end;
$this->line->ventil=$ventil;
$this->line->rang=$rang;
$this->line->info_bits=$info_bits;
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= $total_tva;
$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->fk_parent_line=$this->fk_parent_line;
$this->line->origin=$this->origin;
Expand Down Expand Up @@ -1891,11 +1895,11 @@ public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocal
$line->localtax2_tx = $txlocaltax2;
$line->localtax1_type = $localtaxes_type[0];
$line->localtax2_type = $localtaxes_type[2];
$line->total_ht = $total_ht;
$line->total_tva = $total_tva;
$line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht);
$line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
$line->total_localtax1 = $total_localtax1;
$line->total_localtax2 = $total_localtax2;
$line->total_ttc = $total_ttc;
$line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
$line->fk_product = $idproduct;
$line->product_type = $product_type;
$line->info_bits = $info_bits;
Expand Down

0 comments on commit 7b2f477

Please sign in to comment.