From 65011c28771601aab882785dd0b1621a6c1f994d Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Mon, 11 May 2020 15:11:23 +0200 Subject: [PATCH 1/3] Fixed the product unit translation --- htdocs/product/card.php | 2 +- htdocs/product/class/product.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 87e86e8e0bc..d58e5f8f742 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2099,7 +2099,7 @@ else print ''.$langs->trans('DefaultUnitToShow').''; if ($unit !== '') { - print $langs->trans($unit); + print $unit; } print ''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8f2e0973ab3..44fb0865682 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5387,11 +5387,11 @@ class Product extends CommonObject $label_type = 'short_label'; } - $sql = 'select '.$label_type.' from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit; + $sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit; $resql = $this->db->query($sql); if ($resql && $this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); - $label = $res[$label_type]; + $label = $label_type == 'short' ? $res[$label_type] : $langs->trans('unit' . $res['code']); $this->db->free($resql); return $label; } From d459f9902c7bbc601cf4eda76a4803d65bc3f194 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 May 2020 03:06:30 +0200 Subject: [PATCH 2/3] Update card.php --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d58e5f8f742..87e86e8e0bc 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2099,7 +2099,7 @@ else print ''.$langs->trans('DefaultUnitToShow').''; if ($unit !== '') { - print $unit; + print $langs->trans($unit); } print ''; } From a0998583852dd9ff3a946703210be6aaed326399 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 May 2020 03:07:23 +0200 Subject: [PATCH 3/3] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 44fb0865682..2a56131bdd5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5391,7 +5391,7 @@ class Product extends CommonObject $resql = $this->db->query($sql); if ($resql && $this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); - $label = $label_type == 'short' ? $res[$label_type] : $langs->trans('unit' . $res['code']); + $label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']); $this->db->free($resql); return $label; }