From e9eb22f8f0a8667873e13cafca87723002a28d0d Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 10 Jan 2025 11:17:06 +0100 Subject: [PATCH 1/4] zero could be a value --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 9d265d0240d..3536ec55be5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2076,7 +2076,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = empty($obj->$value) ? '' : $obj->$value; + $valuetoshow = !isset($obj->$value) ? '' : $obj->$value; $titletoshow = ''; if ($value == 'entity') { From a34d760a88cfd7a96b00864180aed06cde2d4c5c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 10 Jan 2025 11:28:46 +0100 Subject: [PATCH 2/4] fix edit : display zero value instead of nothing --- htdocs/admin/dict.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3536ec55be5..e1a38d4c750 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2445,7 +2445,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) { - $hidden = (!empty($obj->{$value}) ? $obj->{$value}:''); + $hidden = (isset($obj->{$value}) ? $obj->{$value}:''); print ''; print ''; print $langs->trans($hidden); @@ -2558,7 +2558,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } elseif ($value == 'price' || preg_match('/^amount/i', $value)) { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { - print ''; + print ''; } elseif ($value == 'unit') { print ''; $units = array( From d04ac67ecdc70fa84189ade0490560598840d65a Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 11 Feb 2025 00:31:59 +0100 Subject: [PATCH 3/4] backport 20.0 solution --- htdocs/admin/dict.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e1a38d4c750..c9f44885d2c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2004,6 +2004,11 @@ if ($id > 0) { $canbemodified = 1; } + if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) { + $canbedisabled = 0; + $canbemodified = 0; + $iserasable = 0; + } // Build Url. The table is id=, the id of line is rowid= $rowidcol = $tabrowid[$id]; // If rowidcol not defined From 94eaf5d0891320bbf94a975295ff8fc7fe946f23 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 11 Feb 2025 00:32:57 +0100 Subject: [PATCH 4/4] cancel first idea --- htdocs/admin/dict.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c9f44885d2c..859ef271a85 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2081,7 +2081,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = !isset($obj->$value) ? '' : $obj->$value; + $valuetoshow = empty($obj->$value) ? '' : $obj->$value; $titletoshow = ''; if ($value == 'entity') { @@ -2450,7 +2450,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) { - $hidden = (isset($obj->{$value}) ? $obj->{$value}:''); + $hidden = (!empty($obj->{$value}) ? $obj->{$value}:''); print ''; print ''; print $langs->trans($hidden); @@ -2563,7 +2563,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } elseif ($value == 'price' || preg_match('/^amount/i', $value)) { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { - print ''; + print ''; } elseif ($value == 'unit') { print ''; $units = array(