From c80f130ee025330dcbf0338e8a33d5f715a6225b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 13 Dec 2006 03:22:51 +0000 Subject: [PATCH] r1368: - Input checkboxes for custom fields should have an Ignore,Yes,No option on searches - Change the favorite status option values for searches to match that of the input checkboxes --- includes/functions.php | 4 ++-- search.php | 13 +++++++------ templates/bugfield_input_checkbox.tpl | 2 +- templates/search.tpl | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 01e5428..f64674d 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -192,7 +192,7 @@ function construct_datastore_select($datastore, $labelname, $valuename, $selecte } // ################## Start construct_custom_fields ################## -function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefault = false) +function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefault = false, $searchMode = false) { global $bugsys; static $fields; @@ -249,7 +249,7 @@ function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefau break; case 'input_checkbox': - $selected = (($value) ? ' checked="checked"' : ''); + $selected = ($value ? ' checked="checked"' : ''); eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_checkbox') . '";'); break; diff --git a/search.php b/search.php index a590548..9cfcf82 100644 --- a/search.php +++ b/search.php @@ -183,15 +183,16 @@ if ($_REQUEST['do'] == 'process') } // ------------------------------------------------------------------- - // favoritess - if (($bugsys->in['favorite'] == 1 OR $bugsys->in['favorite'] == 0) AND $bugsys->userinfo['userid']) + // favorites + $bugsys->input_clean('favorite', TYPE_INT); + if ($bugsys->in['favorite'] != 0 AND $bugsys->userinfo['userid']) { $favorites = $db->query("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid']); while ($favorite = $db->fetch_array($favorites)) { $ids[] = $favorite['bugid']; } - $querybuild['favorites'] = "AND bug.bugid " . ($bugsys->in['favorite'] == 0 ? "NOT IN" : "IN") . " (" . implode(', ', $ids) . ")"; + $querybuild['favorites'] = "AND bug.bugid " . ($bugsys->in['favorite'] > 0 ? "IN" : "NOT IN") . " (" . implode(', ', $ids) . ")"; } // ------------------------------------------------------------------- @@ -227,9 +228,9 @@ if ($_REQUEST['do'] == 'process') { if (!empty($bugsys->in["field$field[fieldid]"]) OR ($field['type'] == 'select_single' AND isset($bugsys->in["field$field[fieldid]"]))) { - if ($field['type'] == 'input_checkbox') + if ($field['type'] == 'input_checkbox' AND $bugsys->input_clean("field$field[fieldid]", TYPE_INT) != 0) { - $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = " . (($bugsys->in["field$field[fieldid]"] == 1) ? 0 : 1); + $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = " . (($bugsys->in["field$field[fieldid]"] > 0) ? 1 : 0); } else if ($field['type'] == 'input_text') { @@ -357,7 +358,7 @@ if ($_REQUEST['do'] == 'search') // ------------------------------------------------------------------- // custom fields - $fields = construct_custom_fields(null, true); + $fields = construct_custom_fields(null, true, false, true); $i = 0; foreach ($fields AS $field) { diff --git a/templates/bugfield_input_checkbox.tpl b/templates/bugfield_input_checkbox.tpl index 9abd4bc..d6dd245 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]]field$field[fieldid]" type="checkbox" value="1"$selected />
+
custom[$field[fieldid]]field$field[fieldid]" type="checkbox" value="1"$selected />
\ No newline at end of file diff --git a/templates/search.tpl b/templates/search.tpl index 0fcead1..0d2631f 100644 --- a/templates/search.tpl +++ b/templates/search.tpl @@ -153,9 +153,9 @@ $header {@"Favorite"}
-- 2.22.5