diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php
index a39372c4ca5..02eab4db893 100644
--- a/htdocs/core/admin_extrafields.inc.php
+++ b/htdocs/core/admin_extrafields.inc.php
@@ -80,6 +80,33 @@ if ($action == 'add')
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
$action = 'create';
}
+ if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
+ {
+ // Construct array for parameter (value of select list)
+ $parameters = GETPOST('param');
+ $parameters_array = explode("\r\n",$parameters);
+ foreach($parameters_array as $param_ligne)
+ {
+ if (!empty($param_ligne)) {
+ if (preg_match_all('/,/',$param_ligne,$matches))
+ {
+ if (count($matches[0])>1) {
+ $error++;
+ $langs->load("errors");
+ $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
+ $action = 'create';
+ }
+ }
+ else
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
+ $action = 'create';
+ }
+ }
+ }
+ }
if (! $error)
{
@@ -152,6 +179,54 @@ if ($action == 'update')
$mesg[]=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint);
$action = 'edit';
}
+ if (GETPOST('type')=='select' && !GETPOST('param'))
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg[]=$langs->trans("ErrorNoValueForSelectType");
+ $action = 'edit';
+ }
+ if (GETPOST('type')=='checkbox' && !GETPOST('param'))
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg[]=$langs->trans("ErrorNoValueForCheckBoxType");
+ $action = 'edit';
+ }
+ if (GETPOST('type')=='radio' && !GETPOST('param'))
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg[]=$langs->trans("ErrorNoValueForRadioType");
+ $action = 'edit';
+ }
+ if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
+ {
+ // Construct array for parameter (value of select list)
+ $parameters = GETPOST('param');
+ $parameters_array = explode("\r\n",$parameters);
+ foreach($parameters_array as $param_ligne)
+ {
+ if (!empty($param_ligne)) {
+ if (preg_match_all('/,/',$param_ligne,$matches))
+ {
+ if (count($matches[0])>1) {
+ $error++;
+ $langs->load("errors");
+ $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
+ $action = 'edit';
+ }
+ }
+ else
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
+ $action = 'edit';
+ }
+ }
+ }
+ }
if (! $error)
{
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
index c2112b636f2..181fcd55bbc 100644
--- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
@@ -55,7 +55,7 @@ $required=$extrafields->attribute_required[$attrname];
$pos=$extrafields->attribute_pos[$attrname];
$param=$extrafields->attribute_param[$attrname];
-if($type == 'select' && is_array($param))
+if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_array($param))
{
$param_chain = '';
foreach ($param['options'] as $key => $value)
@@ -80,7 +80,7 @@ if($type == 'select' && is_array($param))
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index cefedc89f41..48795ba2ce7 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -61,6 +61,7 @@ ErrorSizeTooLongForVarcharType=Size too long for string type (%s chars maximum)
ErrorNoValueForSelectType=Please fill value for select list
ErrorNoValueForCheckBoxType=Please fill value for checkbox list
ErrorNoValueForRadioType=Please fill value for radio list
+ErrorBadFormatValueList=The list value cannot have more than one come : %s, but need at least one: llave,valores
ErrorFieldCanNotContainSpecialCharacters=Field %s must not contains special characters.
ErrorNoAccountancyModuleLoaded=No accountancy module activated
ErrorExportDuplicateProfil=This profil name already exists for this export set.
diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang
index 72c5a778f6f..a3fa3a004e4 100644
--- a/htdocs/langs/es_ES/errors.lang
+++ b/htdocs/langs/es_ES/errors.lang
@@ -62,6 +62,7 @@ ErrorSizeTooLongForVarcharType=Longitud del campo demasiado largo para el tipo c
ErrorNoValueForSelectType=Los valores de la lista deben ser indicados
ErrorNoValueForCheckBoxType=Los valores de la lista deben ser indicados
ErrorNoValueForRadioType=Los valores de la lista deben ser indicados
+ErrorBadFormatValueList=Los valores de la lista no peudo contener mas de una coma : %s, pero necessita una: llave,valores
ErrorFieldCanNotContainSpecialCharacters=El campo %s no debe contener carácteres especiales
ErrorNoAccountancyModuleLoaded=Módulo de contabilidad no activado
ErrorExportDuplicateProfil=El nombre del perfil ya existe para este lote de exportación
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 57e78230682..d1add32c505 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -355,7 +355,7 @@ ExtrafieldPrice = Prix
ExtrafieldMail = Email
ExtrafieldSelect = Liste de sélection
ExtrafieldSeparator = Séparateur de champ
-ExtrafieldCheckBox=Case a cochée
+ExtrafieldCheckBox=Case à cocher
ExtrafieldRadio=Case d'option
ExtrafieldParamHelp=La liste doit être de la forme clef,valeur
par exemple :
1,valeur1
2,valeur2
3,valeur3
...
LibraryToBuildPDF=Bibliothèque utilisée pour la génération des PDF
diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang
index 1d8857deedc..f1316e03d13 100644
--- a/htdocs/langs/fr_FR/errors.lang
+++ b/htdocs/langs/fr_FR/errors.lang
@@ -62,6 +62,7 @@ ErrorSizeTooLongForVarcharType=Longueur de champ trop longue pour le type chaine
ErrorNoValueForSelectType=Les valeurs de la liste de selection doivent être renseignées
ErrorNoValueForCheckBoxType=Les valeurs de la liste de case a cochées doivent être renseignées
ErrorNoValueForRadioType=Les valeurs de la liste d'options doivent être renseignées
+ErrorBadFormatValueList=Les valeurs de la liste ne peuvent pas contenir plus d'une virgule : %s, mais doivent en avoir au moins une: clef,valeur
ErrorFieldCanNotContainSpecialCharacters=Le champ %s ne peut contenir de caractères spéciaux.
ErrorNoAccountancyModuleLoaded=Aucun module de comptabilité activé
ErrorExportDuplicateProfil=Ce nom de profil existe déjà pour ce lot d'export.