r1621: Merging r1620 from trunk
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 22 Apr 2008 19:34:12 +0000 (19:34 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 22 Apr 2008 19:34:12 +0000 (19:34 +0000)
docs/changes.txt
includes/functions.php

index 19ea96022a9330bfa0b664402fff51f9dede0e2c..9ed3ca7c976df32a3cc6b90cd5690051bb46bd39 100644 (file)
@@ -1,3 +1,7 @@
+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
index da654bcc0d4e2d82aaaa7c153f96060077b96a50..06441db3f64948e64a9c21f14076ecef25ac7476 100755 (executable)
@@ -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"]));
                        }
                }
        }