From fb1569d263f85bbc6ea5466355f85ad90470c22b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 17 Mar 2007 23:23:54 +0000 Subject: [PATCH] r1484: Fixing the automation system for custom fields; this probably got all borked up when we moved the storage location of custom field data --- admin/automation.php | 16 ++++++++-------- docs/changes.txt | 2 ++ editreport.php | 2 +- includes/functions.php | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/admin/automation.php b/admin/automation.php index ec294a8..4d938e4 100644 --- a/admin/automation.php +++ b/admin/automation.php @@ -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; diff --git a/docs/changes.txt b/docs/changes.txt index 44b8d46..a465935 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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 =============================== diff --git a/editreport.php b/editreport.php index 8effe31..da691b8 100644 --- a/editreport.php +++ b/editreport.php @@ -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; } } } diff --git a/includes/functions.php b/includes/functions.php index 3e40132..3e4e4da 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -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; } -- 2.43.5