Fix autocalculation of surface and volume.
This commit is contained in:
parent
1b1bab94ca
commit
fafe71ec52
@ -641,18 +641,18 @@ class Product extends CommonObject
|
||||
$this->height = price2num($this->height);
|
||||
$this->height_units = trim($this->height_units);
|
||||
// set unit not defined
|
||||
if (! $this->width_units && $this->length_units) $this->width_units = $this->length_units; // Not used yet
|
||||
if (! $this->height_units && $this->length_units) $this->height_units = $this->length_units; // Not used yet
|
||||
if ($this->length_units) $this->width_units = $this->length_units; // Not used yet
|
||||
if ($this->length_units) $this->height_units = $this->length_units; // Not used yet
|
||||
// Automated compute surface and volume if not filled
|
||||
if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units)
|
||||
{
|
||||
$this->surface = $this->length * $this->width;
|
||||
$this->surface_units = $this->width_units;
|
||||
if (empty($this->volume) && !empty($this->height) && $this->length_units == $this->height_units)
|
||||
{
|
||||
$this->volume = $this->surface * $this->height;
|
||||
$this->volume_units = $this->height_units;
|
||||
}
|
||||
$this->surface_units = $this->length_units + $this->width_units;
|
||||
}
|
||||
if (empty($this->volume) && !empty($this->surface_units) && !empty($this->height) && $this->length_units == $this->height_units)
|
||||
{
|
||||
$this->volume = $this->surface * $this->height;
|
||||
$this->volume_units = $this->surface_units + $this->height_units;
|
||||
}
|
||||
|
||||
$this->surface = price2num($this->surface);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user