From 93f6f1819263c4fca7583049338b2387bb751341 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 12 Feb 2007 04:40:00 +0000 Subject: [PATCH] r1395: - Searching of custom fields now works, but we break all saved searches - All the custom field templates no longer need the custom array naming scheme because everything uses the form "custom" --- search.php | 23 +++++++++-------------- templates/bugfield_input_checkbox.tpl | 2 +- templates/bugfield_input_text.tpl | 2 +- templates/bugfield_select_single.tpl | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/search.php b/search.php index c976aaa..8c5a070 100644 --- a/search.php +++ b/search.php @@ -23,6 +23,7 @@ $fetchtemplates = array( 'search', 'search_results', 'search_update', + 'search_save', 'trackerhome_bits', 'list_head', 'pagenav_bit', @@ -231,20 +232,20 @@ if ($_REQUEST['do'] == 'process') ); while ($field = $bugsys->db->fetch_array($fields_fetch)) { - if (!empty($bugsys->in["field$field[fieldid]"]) OR ($field['type'] == 'select_single' AND isset($bugsys->in["field$field[fieldid]"]))) + if (!empty($bugsys->in["custom$field[fieldid]"]) OR ($field['type'] == 'select_single' AND isset($bugsys->in["custom$field[fieldid]"]))) { - if ($field['type'] == 'input_checkbox' AND $bugsys->input_clean("field$field[fieldid]", TYPE_INT) != 0) + if ($field['type'] == 'input_checkbox' AND $bugsys->input_clean("custom$field[fieldid]", TYPE_INT) != 0) { - $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = " . (($bugsys->in["field$field[fieldid]"] > 0) ? 1 : 0); + $querybuild[] = "AND bug.custom$field[fieldid] = " . ($bugsys->in["custom$field[fieldid]"] > 0 ? 1 : 0); } else if ($field['type'] == 'input_text') { - $querybuild[] = "AND bugfieldvalue.field$field[fieldid] LIKE '%" . $bugsys->in["field$field[fieldid]"] . "%'"; + $querybuild[] = "AND bug.custom$field[fieldid] LIKE '%" . $bugsys->in["custom$field[fieldid]"] . "%'"; } - else if ($field['type'] == 'select_single' AND $bugsys->in["field$field[fieldid]"] != -1) + else if ($field['type'] == 'select_single' AND $bugsys->in["custom$field[fieldid]"] != -1) { $temp = unserialize($field['selects']); - $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = '" . trim($temp[ intval($bugsys->in["field$field[fieldid]"]) ]) . "'"; + $querybuild[] = "AND bug.custom$field[fieldid] = '" . trim($temp[ intval($bugsys->in["custom$field[fieldid]"]) ]) . "'"; } } } @@ -263,8 +264,6 @@ if ($_REQUEST['do'] == 'process') FROM " . TABLE_PREFIX . "bug AS bug LEFT JOIN " . TABLE_PREFIX . "comment AS comment ON (bug.bugid = comment.bugid) - LEFT JOIN " . TABLE_PREFIX . "bugvaluefill AS bugfieldvalue - ON (bug.bugid = bugfieldvalue.bugid) WHERE bug.bugid <> 0 AND bug.product IN (#<'ONBITS:VIEW'>#) AND (!bug.hidden OR (bug.hidden AND bug.product IN (#<'ONBITS:HIDDEN'>#))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $bugsys->userinfo['userid'] . " AND bug.product IN (#<'ONBITS:OWNHIDDEN'>#))" : "") . ") @@ -491,9 +490,7 @@ if ($_POST['do'] == 'doupdate') { continue; } - - // TODO - need to add logging for custom fields - + $api = new BugApi($bugsys); $log = new Logging(); $log->set_bugid($bug['bugid']); @@ -529,7 +526,7 @@ if ($_POST['do'] == 'doupdate') $log->add_data(false, $api->values, $log->getCommonFields()); - process_custom_fields($bug['bugid'], $message); + process_custom_fields($api, $message); $api->update(); $log->update_history(); @@ -642,8 +639,6 @@ if ($_REQUEST['do'] == 'save') $message->error_permission(); } - $message- - eval('$template->flush("' . $template->fetch('search_save') . '");'); } diff --git a/templates/bugfield_input_checkbox.tpl b/templates/bugfield_input_checkbox.tpl index 5045a99..acad0e0 100644 --- a/templates/bugfield_input_checkbox.tpl +++ b/templates/bugfield_input_checkbox.tpl @@ -1,6 +1,6 @@
$field[name] $help[field$field[fieldid]] -
custom[$field[fieldid]]custom$field[fieldid]" type="checkbox" value="1"$selected />
+
\ No newline at end of file diff --git a/templates/bugfield_input_text.tpl b/templates/bugfield_input_text.tpl index 69da9d0..b321b1e 100644 --- a/templates/bugfield_input_text.tpl +++ b/templates/bugfield_input_text.tpl @@ -1,6 +1,6 @@
$field[name] $help[field$field[fieldid]] -
custom[$field[fieldid]]custom$field[fieldid]" type="text" value="$value" size="35"maxlength="$field[maxlength] />
+
maxlength="$field[maxlength] />
diff --git a/templates/bugfield_select_single.tpl b/templates/bugfield_select_single.tpl index 80dd971..919adab 100644 --- a/templates/bugfield_select_single.tpl +++ b/templates/bugfield_select_single.tpl @@ -1,6 +1,6 @@
$field[name] $help[field$field[fieldid]] -
+
\ No newline at end of file -- 2.43.5