$assigned_str = "AND feature.assigned_to='{$_assigned_to}'";
} else {
    //no assigned to was chosen, so don't add it to where clause
    $assigned_str = '';
}
//if category selected, add to where clause
if ($_category && $_category != 100) {
    $category_str = "AND feature.feature_category_id='{$_category}'";
} else {
    //no assigned to was chosen, so don't add it to where clause
    $category_str = '';
}
//build page title to make bookmarking easier
//if a user was selected, add the user_name to the title
//same for status
feature_header(array('title' => 'Browse Feature Requests' . ($_assigned_to ? ' For: ' . user_getname($_assigned_to) : '') . ($_status && $_status != 100 ? ' By Status: ' . feature_data_get_status_name($_status) : '')));
//now build the query using the criteria built above
$sql = "SELECT feature.priority,feature.group_id,feature.feature_id,feature.summary," . "feature_category.category_name,feature_status.status_name," . "feature.open_date AS date,users.user_name AS submitted_by,user2.user_name AS assigned_to_user " . "FROM feature,feature_category,feature_status,users,users user2 " . "WHERE users.user_id=feature.submitted_by " . " {$status_str} {$assigned_str} {$category_str} " . "AND user2.user_id=feature.assigned_to " . "AND feature_category.feature_category_id=feature.feature_category_id " . "AND feature_status.feature_status_id=feature.feature_status_id " . "AND feature.group_id='{$group_id}'" . $order_by;
/*
        creating a custom technician box which includes "any" and "unassigned"
*/
$res_tech = feature_data_get_technicians($group_id);
$tech_id_arr = util_result_column_to_array($res_tech, 0);
$tech_id_arr[] = '0';
//this will be the 'any' row
$tech_name_arr = util_result_column_to_array($res_tech, 1);
$tech_name_arr[] = 'Any';
$tech_box = html_build_select_box_from_arrays($tech_id_arr, $tech_name_arr, '_assigned_to', $_assigned_to, true, 'Unassigned');
/*
	Show the new pop-up boxes to select assigned to and/or status
*/
function show_featurehistory($feature_id)
{
    /*
    	show the feature_history rows that are relevant to this feature_id, excluding details
    */
    global $sys_datefmt;
    $result = feature_data_get_history($feature_id);
    $rows = db_numrows($result);
    if ($rows > 0) {
        $title_arr = array();
        $title_arr[] = 'Field';
        $title_arr[] = 'Old Value';
        $title_arr[] = 'Date';
        $title_arr[] = 'By';
        echo html_build_list_table_top($title_arr);
        for ($i = 0; $i < $rows; $i++) {
            $field = db_result($result, $i, 'field_name');
            echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD>' . $field . '</TD><TD>';
            if ($field == 'feature_status_id') {
                echo feature_data_get_status_name(db_result($result, $i, 'old_value'));
            } else {
                if ($field == 'feature_category_id') {
                    echo feature_data_get_category_name(db_result($result, $i, 'old_value'));
                } else {
                    if ($field == 'assigned_to') {
                        echo user_getname(db_result($result, $i, 'old_value'));
                    } else {
                        if ($field == 'close_date') {
                            echo date($sys_datefmt, db_result($result, $i, 'old_value'));
                        } else {
                            echo db_result($result, $i, 'old_value');
                        }
                    }
                }
            }
            echo '</TD>' . '<TD>' . date($sys_datefmt, db_result($result, $i, 'date')) . '</TD>' . '<TD>' . db_result($result, $i, 'user_name') . '</TD></TR>';
        }
        echo '
		</TABLE>';
    } else {
        echo '
			<H3>No Changes Have Been Made to This Feature Request</H3>';
    }
}