From b713f645d4f4c7b5be884c8dd12f6e4ba9481267 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Tue, 29 Nov 2022 20:35:43 +0100 Subject: [PATCH 1/5] Update extrafields.class.php error message adapt error message for radio buttons --- htdocs/core/class/extrafields.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a65a750a37b..79bea567406 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2017 Nicolas ZABOURI * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2022 Antonin MARCHAL * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1709,7 +1710,11 @@ class ExtraFields dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); } } elseif ($type == 'radio') { - $value = $langs->trans($param['options'][$value]); + if(!isset($param['options'][$value])){ + $value = $langs->trans('ErrorNoValueForRadioType'); + } else { + $value = $langs->trans($param['options'][$value]); + } } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); $value = ''; From 1394208de3529fd98fd130d4274c78435b23b9e9 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Tue, 29 Nov 2022 20:39:40 +0100 Subject: [PATCH 2/5] Update card.php add errors on langs errors added to langs object to improve error messages --- htdocs/commande/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 586cf98d606..49f8c93922a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -14,6 +14,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2022 Antonin MARCHAL * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,7 +61,7 @@ if (!empty($conf->variants->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other')); +$langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other', 'errors')); if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } From 87526194c56bd5fd8ea025c4cb05d367134060b5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 29 Nov 2022 19:44:44 +0000 Subject: [PATCH 3/5] Fixing style errors. --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 79bea567406..0096e0f8cd9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1710,7 +1710,7 @@ class ExtraFields dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); } } elseif ($type == 'radio') { - if(!isset($param['options'][$value])){ + if (!isset($param['options'][$value])) { $value = $langs->trans('ErrorNoValueForRadioType'); } else { $value = $langs->trans($param['options'][$value]); From f1132ef8bab77779749ab51dc329bb61a389e9c7 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 30 Nov 2022 10:42:44 +0100 Subject: [PATCH 4/5] Revert add 'errors' on $langs->load Revert add 'errors' on $langs->load --- htdocs/commande/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 49f8c93922a..586cf98d606 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -14,7 +14,6 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2022 Antonin MARCHAL * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,7 +60,7 @@ if (!empty($conf->variants->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other', 'errors')); +$langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other')); if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } From ef065967edafe7118c0a2149230412417097342a Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 30 Nov 2022 10:44:10 +0100 Subject: [PATCH 5/5] Add $langs->load('errors') before radioError Add $langs->load('errors') before radioError --- htdocs/core/class/extrafields.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 0096e0f8cd9..1d5bd8dc7ef 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1711,6 +1711,7 @@ class ExtraFields } } elseif ($type == 'radio') { if (!isset($param['options'][$value])) { + $langs->load('errors'); $value = $langs->trans('ErrorNoValueForRadioType'); } else { $value = $langs->trans($param['options'][$value]);