Merge pull request #24073 from hregis/fix_multicompany_compatibility2

TODO remise_percent is a deprecated field for object parent
This commit is contained in:
Laurent Destailleur
2023-03-02 16:31:51 +01:00
committed by GitHub
15 changed files with 72 additions and 43 deletions

View File

@@ -210,7 +210,11 @@ class Commande extends CommonOrder
*/
public $fk_remise_except;
/**
* @deprecated
*/
public $remise_percent;
public $remise_absolue;
public $info_bits;
public $rang;
@@ -320,7 +324,7 @@ class Commande extends CommonOrder
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
//'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
//'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
@@ -974,7 +978,7 @@ class Commande extends CommonOrder
$sql .= ", ".(!empty($this->shipping_method_id) && $this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : 'NULL');
$sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? ((int) $this->warehouse_id) : 'NULL');
$sql .= ", ".($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL');
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0);
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0); // TODO deprecated
$sql .= ", ".(int) $this->fk_incoterms;
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
$sql .= ", ".setEntity($this);
@@ -1920,7 +1924,7 @@ class Commande extends CommonOrder
$this->date_validation = $this->db->jdate($obj->date_valid);
$this->date_modification = $this->db->jdate($obj->tms);
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_percent = $obj->remise_percent; // TODO deprecated
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
$this->billed = $obj->billed;
@@ -2458,6 +2462,7 @@ class Commande extends CommonOrder
* @param float $remise Discount (percent)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
* @deprecated remise_percent is a deprecated field for object parent
*/
public function setDiscount($user, $remise, $notrigger = 0)
{