From b3c286a673f23cc2b955a2cee80ccb2e2f02f720 Mon Sep 17 00:00:00 2001 From: Erik van Berkum Date: Sun, 5 Jan 2025 16:44:41 +0900 Subject: [PATCH] FIX units product solves issue #32495: current Empty testing for 0 results in TRUE and makes it an empty string. Testing for is_null solves the issue. this issue is connected with pull FIX #32496 --- htdocs/product/class/product.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7db4a3480b3..5264b2a1667 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1092,19 +1092,19 @@ class Product extends CommonObject $this->note_private = (isset($this->note_private) ? trim($this->note_private) : null); $this->note_public = (isset($this->note_public) ? trim($this->note_public) : null); $this->net_measure = price2num($this->net_measure); - $this->net_measure_units = (empty($this->net_measure_units) ? '' : trim($this->net_measure_units)); + $this->net_measure_units = (is_null($this->net_measure_units) ? '' : trim((string) $this->net_measure_units)); $this->weight = price2num($this->weight); - $this->weight_units = (empty($this->weight_units) ? '' : trim($this->weight_units)); + $this->weight_units = (is_null($this->weight_units) ? '' : trim((string) $this->weight_units)); $this->length = price2num($this->length); - $this->length_units = (empty($this->length_units) ? '' : trim($this->length_units)); + $this->length_units = (is_null($this->length_units) ? '' : trim((string) $this->length_units)); $this->width = price2num($this->width); - $this->width_units = (empty($this->width_units) ? '' : trim($this->width_units)); + $this->width_units = (is_null($this->width_units) ? '' : trim((string) $this->width_units)); $this->height = price2num($this->height); - $this->height_units = (empty($this->height_units) ? '' : trim($this->height_units)); + $this->height_units = (is_null($this->height_units) ? '' : trim((string) $this->height_units)); $this->surface = price2num($this->surface); - $this->surface_units = (empty($this->surface_units) ? '' : trim($this->surface_units)); + $this->surface_units = (is_null($this->surface_units) ? '' : trim((string) $this->surface_units)); $this->volume = price2num($this->volume); - $this->volume_units = (empty($this->volume_units) ? '' : trim($this->volume_units)); + $this->volume_units = (is_null($this->volume_units) ? '' : trim((string) $this->volume_units)); // set unit not defined if (is_numeric($this->length_units)) {