Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
0207191202
@ -1010,7 +1010,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
$id,
|
$id,
|
||||||
$desc,
|
$desc,
|
||||||
|
|||||||
@ -1854,13 +1854,13 @@ class Facture extends CommonObject
|
|||||||
|
|
||||||
// TODO A virer
|
// TODO A virer
|
||||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||||
$price = $pu;
|
//$price = $pu;
|
||||||
$remise = 0;
|
//$remise = 0;
|
||||||
if ($remise_percent > 0)
|
//if ($remise_percent > 0)
|
||||||
{
|
//{
|
||||||
$remise = round(($pu * $remise_percent / 100),2);
|
// $remise = round(($pu * $remise_percent / 100),2);
|
||||||
$price = ($pu - $remise);
|
// $price = ($pu - $remise);
|
||||||
}
|
//}
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
if ($fk_product)
|
if ($fk_product)
|
||||||
@ -1874,33 +1874,33 @@ class Facture extends CommonObject
|
|||||||
$this->line=new FactureLigne($this->db);
|
$this->line=new FactureLigne($this->db);
|
||||||
$this->line->fk_facture=$facid;
|
$this->line->fk_facture=$facid;
|
||||||
$this->line->desc=$desc;
|
$this->line->desc=$desc;
|
||||||
$this->line->qty=$qty;
|
$this->line->qty= ($this->type==2?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||||
$this->line->tva_tx=$txtva;
|
$this->line->tva_tx=$txtva;
|
||||||
$this->line->localtax1_tx=$txlocaltax1;
|
$this->line->localtax1_tx=$txlocaltax1;
|
||||||
$this->line->localtax2_tx=$txlocaltax2;
|
$this->line->localtax2_tx=$txlocaltax2;
|
||||||
$this->line->fk_product=$fk_product;
|
$this->line->fk_product=$fk_product;
|
||||||
$this->line->product_type=$product_type;
|
$this->line->product_type=$product_type;
|
||||||
$this->line->remise_percent=$remise_percent;
|
$this->line->remise_percent=$remise_percent;
|
||||||
$this->line->subprice= ($this->type==2?-1:1)*abs($pu_ht);
|
$this->line->subprice= ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||||
$this->line->date_start=$date_start;
|
$this->line->date_start=$date_start;
|
||||||
$this->line->date_end=$date_end;
|
$this->line->date_end=$date_end;
|
||||||
$this->line->ventil=$ventil;
|
$this->line->ventil=$ventil;
|
||||||
$this->line->rang=$rangtouse;
|
$this->line->rang=$rangtouse;
|
||||||
$this->line->info_bits=$info_bits;
|
$this->line->info_bits=$info_bits;
|
||||||
$this->line->fk_remise_except=$fk_remise_except;
|
$this->line->fk_remise_except=$fk_remise_except;
|
||||||
$this->line->total_ht= ($this->type==2?-1:1)*abs($total_ht);
|
$this->line->total_ht= (($this->type==2||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_tva= ($this->type==2?-1:1)*abs($total_tva);
|
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
|
||||||
$this->line->total_localtax1=($this->type==2?-1:1)*abs($total_localtax1);
|
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
|
||||||
$this->line->total_localtax2=($this->type==2?-1:1)*abs($total_localtax2);
|
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
|
||||||
$this->line->total_ttc= ($this->type==2?-1:1)*abs($total_ttc);
|
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||||
$this->line->special_code=$special_code;
|
$this->line->special_code=$special_code;
|
||||||
$this->line->fk_parent_line=$fk_parent_line;
|
$this->line->fk_parent_line=$fk_parent_line;
|
||||||
$this->line->origin=$origin;
|
$this->line->origin=$origin;
|
||||||
$this->line->origin_id=$origin_id;
|
$this->line->origin_id=$origin_id;
|
||||||
|
|
||||||
// TODO Ne plus utiliser
|
// TODO Ne plus utiliser
|
||||||
$this->line->price=($this->type==2?-1:1)*abs($price);
|
//$this->line->price=($this->type==2?-1:1)*abs($price);
|
||||||
$this->line->remise=($this->type==2?-1:1)*abs($remise);
|
//$this->line->remise=($this->type==2?-1:1)*abs($remise);
|
||||||
|
|
||||||
$result=$this->line->insert();
|
$result=$this->line->insert();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -2014,19 +2014,19 @@ class Facture extends CommonObject
|
|||||||
|
|
||||||
$this->line->rowid = $rowid;
|
$this->line->rowid = $rowid;
|
||||||
$this->line->desc = $desc;
|
$this->line->desc = $desc;
|
||||||
$this->line->qty = $qty;
|
$this->line->qty= ($this->type==2?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||||
$this->line->tva_tx = $txtva;
|
$this->line->tva_tx = $txtva;
|
||||||
$this->line->localtax1_tx = $txlocaltax1;
|
$this->line->localtax1_tx = $txlocaltax1;
|
||||||
$this->line->localtax2_tx = $txlocaltax2;
|
$this->line->localtax2_tx = $txlocaltax2;
|
||||||
$this->line->remise_percent = $remise_percent;
|
$this->line->remise_percent = $remise_percent;
|
||||||
$this->line->subprice = ($this->type==2?-1:1)*abs($pu);
|
$this->line->subprice= ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||||
$this->line->date_start = $date_start;
|
$this->line->date_start = $date_start;
|
||||||
$this->line->date_end = $date_end;
|
$this->line->date_end = $date_end;
|
||||||
$this->line->total_ht = ($this->type==2?-1:1)*abs($total_ht);
|
$this->line->total_ht= (($this->type==2||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_tva = ($this->type==2?-1:1)*abs($total_tva);
|
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
|
||||||
$this->line->total_localtax1 = ($this->type==2?-1:1)*abs($total_localtax1);
|
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
|
||||||
$this->line->total_localtax2 = ($this->type==2?-1:1)*abs($total_localtax2);
|
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
|
||||||
$this->line->total_ttc = ($this->type==2?-1:1)*abs($total_ttc);
|
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||||
$this->line->info_bits = $info_bits;
|
$this->line->info_bits = $info_bits;
|
||||||
$this->line->product_type = $type;
|
$this->line->product_type = $type;
|
||||||
$this->line->fk_parent_line = $fk_parent_line;
|
$this->line->fk_parent_line = $fk_parent_line;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user