From 529007483bf8baa99504f9434d70abe2fab7f31b Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 9 Apr 2019 11:59:31 -0600 Subject: [PATCH] Admin - allow empty values (=Select one) as first option for custom select --- admin/inc/class.admin_customfields.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/inc/class.admin_customfields.inc.php b/admin/inc/class.admin_customfields.inc.php index 808fc3f1be..b05b0a477a 100644 --- a/admin/inc/class.admin_customfields.inc.php +++ b/admin/inc/class.admin_customfields.inc.php @@ -349,14 +349,14 @@ class admin_customfields } else { - foreach(explode("\n",trim($content['cf_values'])) as $line) + foreach(explode("\n",trim($content['cf_values'])) as $idx => $line) { list($var_raw,$value) = explode('=',trim($line),2); $var = trim($var_raw); - if (!preg_match(self::CHECK_MULTISELCT_VALUE, $var)) + if (!preg_match(self::CHECK_MULTISELCT_VALUE, $var) && !($idx == 0 && !$var && $value)) { Api\Etemplate::set_validation_error('cf_values', - lang('Invalide value "%1", use only:', $var)."\n". + lang('Invalid value "%1", use only:', $var)."\n". preg_replace('/^.*\[([^]]+)\].*$/', '$1', self::CHECK_MULTISELCT_VALUE)); $action = 'apply'; // do not close the window to show validation error if (!$cf_id) break 2; // only stop storing of new CFs