From e0cb09bd651210d22ba10dbca3a0a11246b2986a Mon Sep 17 00:00:00 2001 From: BENKE Charles <charles.fr@benke.fr> Date: Wed, 10 Apr 2013 22:38:45 +0300 Subject: [PATCH] Update admin_extrafields.inc.php $default_value not initialised new type : sellist --- htdocs/core/admin_extrafields.inc.php | 55 +++++++++++++++++---------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 02eab4db893..0b608a1e736 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -66,6 +66,13 @@ if ($action == 'add') $mesg[]=$langs->trans("ErrorNoValueForSelectType"); $action = 'create'; } + if (GETPOST('type')=='sellist' && !GETPOST('param')) + { + $error++; + $langs->load("errors"); + $mesg[]=$langs->trans("ErrorNoValueForSelectListType"); + $action = 'create'; + } if (GETPOST('type')=='checkbox' && !GETPOST('param')) { $error++; @@ -82,30 +89,30 @@ if ($action == 'add') } 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 - { + // 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) @@ -114,6 +121,7 @@ if ($action == 'add') if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { // Construct array for parameter (value of select list) + $default_value = GETPOST('default_value'); $parameters = GETPOST('param'); $parameters_array = explode("\r\n",$parameters); foreach($parameters_array as $param_ligne) @@ -186,6 +194,13 @@ if ($action == 'update') $mesg[]=$langs->trans("ErrorNoValueForSelectType"); $action = 'edit'; } + if (GETPOST('type')=='sellist' && !GETPOST('param')) + { + $error++; + $langs->load("errors"); + $mesg[]=$langs->trans("ErrorNoValueForSelectListType"); + $action = 'edit'; + } if (GETPOST('type')=='checkbox' && !GETPOST('param')) { $error++; @@ -291,4 +306,4 @@ if ($action == 'delete') } } -?> \ No newline at end of file +?> -- GitLab