From 02c73dd3ba1b2f60977ccde6f64e89d782e6003c Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 22 Apr 2008 19:19:17 +0000 Subject: [PATCH] r1620: Custom, mandatory select fields didn't accept the first option as valid. Fixes bug 121. * includes/functions.php: (process_custom_fields) --- docs/changes.txt | 4 ++++ includes/functions.php | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5894035..22ae6ab 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -2,6 +2,10 @@ =============================== - Enhancement: Custom columns can now be displayed on the bug listings (bug://report/73) +1.2.3 +=============================== +- Fixed: Custom select field that is mandatory doesn't accept the first option as a valid entry (bug://report/121) + 1.2.2 =============================== - Fixed: A "Call-time pass-by-reference has been deprecated" on search.php diff --git a/includes/functions.php b/includes/functions.php index da654bc..06441db 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -392,6 +392,11 @@ function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode = $bugapi->set($fieldname, intval($inputdata["$fieldname"])); continue; } + else if ($field['type'] == 'select_single') + { + $temp = unserialize($field['selects']); + $inputdata[$fieldname] = $temp[intval($inputdata["$fieldname"])] . ''; // make it a string so isset() doesn't catch + } // field data wasn't passed, so skip it if (!isset($inputdata["$fieldname"])) @@ -426,7 +431,7 @@ function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode = } else { - if ($inputdata["$fieldname"] == -1) + if (empty($inputdata["$fieldname"])) { if (!$searchMode) { @@ -435,8 +440,7 @@ function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode = continue; } - $temp = unserialize($field['selects']); - $bugapi->set($fieldname, trim($temp[ intval($inputdata["$fieldname"]) ]));; + $bugapi->set($fieldname, trim($inputdata["$fieldname"])); } } } -- 2.43.5