diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 26c2c0a0d64..b18ff15331f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -239,27 +239,30 @@ class Propal extends CommonObject return -5; } - $propalligne=new PropaleLigne($this->db); - $propalligne->fk_propal=$this->id; - $propalligne->fk_remise_except=$remise->id; - $propalligne->desc=$remise->description; // Description ligne - $propalligne->tva_tx=$remise->tva_tx; - $propalligne->subprice=-$remise->amount_ht; - $propalligne->fk_product=0; // Id produit predefini - $propalligne->qty=1; - $propalligne->remise=0; - $propalligne->remise_percent=0; - $propalligne->rang=-1; - $propalligne->info_bits=2; + $line=new PropaleLigne($this->db); + + $this->line->context = $this->context; + + $line->fk_propal=$this->id; + $line->fk_remise_except=$remise->id; + $line->desc=$remise->description; // Description ligne + $line->tva_tx=$remise->tva_tx; + $line->subprice=-$remise->amount_ht; + $line->fk_product=0; // Id produit predefini + $line->qty=1; + $line->remise=0; + $line->remise_percent=0; + $line->rang=-1; + $line->info_bits=2; // TODO deprecated - $propalligne->price=-$remise->amount_ht; + $line->price=-$remise->amount_ht; - $propalligne->total_ht = -$remise->amount_ht; - $propalligne->total_tva = -$remise->amount_tva; - $propalligne->total_ttc = -$remise->amount_ttc; + $line->total_ht = -$remise->amount_ht; + $line->total_tva = -$remise->amount_tva; + $line->total_ttc = -$remise->amount_ttc; - $result=$propalligne->insert(); + $result=$line->insert(); if ($result > 0) { $result=$this->update_price(1); @@ -276,7 +279,7 @@ class Propal extends CommonObject } else { - $this->error=$propalligne->error; + $this->error=$line->error; $this->db->rollback(); return -2; } @@ -547,6 +550,8 @@ class Propal extends CommonObject // Update line $this->line=new PropaleLigne($this->db); + $this->line->context = $this->context; + // Stock previous line records $staticline=new PropaleLigne($this->db); $staticline->fetch($rowid); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2e98f6f21de..1cdd57b1b6a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1205,6 +1205,8 @@ class Commande extends CommonOrder // Insert line $this->line=new OrderLine($this->db); + $this->line->context = $this->context; + $this->line->fk_commande=$this->id; $this->line->label=$label; $this->line->desc=$desc; @@ -1319,6 +1321,8 @@ class Commande extends CommonOrder $line=new OrderLine($this->db); + $line->context = $this->context; + $line->fk_product=$idproduct; $line->desc=$prod->description; $line->qty=$qty; @@ -2401,6 +2405,8 @@ class Commande extends CommonOrder // Update line $this->line=new OrderLine($this->db); + $this->line->context = $this->context; + // Stock previous line records $staticline=new OrderLine($this->db); $staticline->fetch($rowid); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 08f17832c42..ec41b0a99c2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2047,6 +2047,9 @@ class Facture extends CommonInvoice // Insert line $this->line=new FactureLigne($this->db); + + $this->line->context = $this->context; + $this->line->fk_facture=$this->id; $this->line->label=$label; // deprecated $this->line->desc=$desc; @@ -2185,7 +2188,9 @@ class Facture extends CommonInvoice // Update line into database $this->line=new FactureLigne($this->db); - // Stock previous line records + $this->line->context = $this->context; + + // Stock previous line records $staticline=new FactureLigne($this->db); $staticline->fetch($rowid); $this->line->oldline = $staticline; @@ -2298,6 +2303,8 @@ class Facture extends CommonInvoice $line=new FactureLigne($this->db); + $line->context = $this->context; + // For triggers $line->fetch($rowid);