r1484: Fixing the automation system for custom fields; this probably got all borked...
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 17 Mar 2007 23:23:54 +0000 (23:23 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 17 Mar 2007 23:23:54 +0000 (23:23 +0000)
admin/automation.php
docs/changes.txt
editreport.php
includes/functions.php

index ec294a819e5460ebea6fbcfc6de7c32c01c7b395..4d938e470955136427ede8d4c6fcad05dbdb9b2c 100644 (file)
@@ -80,7 +80,7 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update')
        {
                foreach ($bugsys->in['fields']['custom'] AS $key => $value)
                {
-                       if (!empty($value) AND $value != -1)
+                       if ($value != '' AND $value != -1)
                        {
                                $deltas['custom']["$key"] = $value;
                        }
@@ -113,8 +113,8 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update')
 
 if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit')
 {
-       $add = (($_REQUEST['do'] == 'add') ? true : false);
-       $edit = (($add) ? false : true);
+       $add = ($_REQUEST['do'] == 'add');
+       $edit = !$add;
        
        if ($edit)
        {
@@ -187,20 +187,20 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit')
                        break;
                        
                        case 'input_checkbox':
-                               $admin->list_item('', 0, ((!$action->objdata['fields']['custom']["$field[fieldid]"]) ? true : false));
-                               $admin->list_item(_('Checked'), 1, (($action->objdata['fields']['custom']["$field[fieldid]"] == 1) ? true : false));
-                               $admin->list_item(_('Un-Checked'), 2, (($action->objdata['fields']['custom']["$field[fieldid]"] == 2) ? true : false));
+                               $admin->list_item('', -1, (!$action->objdata['fields']['custom']["$field[fieldid]"] OR $action->objdata['fields']['custom']["$field[fieldid]"] == -1));
+                               $admin->list_item(_('Checked'), 1, ($action->objdata['fields']['custom']["$field[fieldid]"] == 1));
+                               $admin->list_item(_('Un-Checked'), 0, (isset($action->objdata['fields']['custom']["$field[fieldid]"]) AND $action->objdata['fields']['custom']["$field[fieldid]"] == 0));
                                $admin->row_list($field['name'], "fields[custom][$field[fieldid]]");
                        break;
                        
                        case 'select_single':
                                $selectopts = unserialize($field['selects']);
                                
-                               $admin->list_item('', -1, ((!$action->objdata['fields']['custom']["$field[fieldid]"]) ? true : false));
+                               $admin->list_item('', -1, (!isset($action->objdata['fields']['custom']["$field[fieldid]"]) OR $action->objdata['fields']['custom']["$field[fieldid]"] == -1));
                                
                                foreach ($selectopts AS $id => $select)
                                {
-                                       $admin->list_item(stripslashes($select), $id, (($action->objdata['fields']['custom']["$field[fieldid]"] == $id AND $edit) ? true : false));
+                                       $admin->list_item(stripslashes($select), $id, (isset($action->objdata['fields']['custom']["$field[fieldid]"]) AND $action->objdata['fields']['custom']["$field[fieldid]"] == $id));
                                }
                                $admin->row_list($field['name'], "fields[custom][$field[fieldid]]");
                        break;
index 44b8d46b0e45a46583b21ade2ae5b0fae1c993bb..a4659356841edbff854f4cdb27b3eb51ebb0cb48 100644 (file)
@@ -7,6 +7,8 @@
 - Fixed: Email notifications would be essentially empty in all circumstances
 - Change: Removed the stylevars system in place of additional CSS classes for formatting of tables and alternate row colors
 - Fixed: Defining the NO_VERSION_CHECK constant wouldn't work due to a typo in admin/index.php
+- Fixed: Automations wouldn't properly save custom field changes in the admin section
+- Fixed: Automations would have no effect on custom fields when running them from the edit screen
 
 1.2.0 Beta 1
 ===============================
index 8effe3196a3a4eb6169806a01f50ba05e8b65bde..da691b8a63d05b3409b20080b353f31d58019055 100644 (file)
@@ -121,7 +121,7 @@ if ($_POST['do'] == 'update')
                        {
                                foreach ($automation['fields']['custom'] AS $field => $value)
                                {
-                                       $bugsys->in["field$field"] = $value;
+                                       $bugsys->in["custom$field"] = $value;
                                }
                        }
                }
index 3e40132bbb734324192700ee80dbd83b68a51bf7..3e4e4dab4aeb0c55eca6475c8ed37278c6ccfef2 100755 (executable)
@@ -367,7 +367,7 @@ function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode =
                        {
                                continue;
                        }
-                       $bugapi->set($fieldname, intval(isset($inputdata["$fieldname"])));
+                       $bugapi->set($fieldname, intval($inputdata["$fieldname"]));
                        continue;
                }