diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 27fb4a4c11c..1999a6f9c4a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -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);