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] 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 = '';