Skip to content

Commit

Permalink
Fix #3937: Custom field filters now only show those values relevant t…
Browse files Browse the repository at this point in the history
…o the selected project.

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2605 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
narcissus committed Jun 15, 2004
1 parent 37be438 commit 0481e8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions core/custom_field_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: custom_field_api.php,v 1.32 2004-04-08 22:44:59 prescience Exp $
# $Id: custom_field_api.php,v 1.33 2004-06-15 07:27:15 narcissus Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -774,10 +774,12 @@ function custom_field_validate( $p_field_id, $p_value ) {

# --------------------
# Get All Possible Values for a Field.
function custom_field_distinct_values( $p_field_id ) {
function custom_field_distinct_values( $p_field_id, $p_project_id = ALL_PROJECTS ) {
$c_field_id = db_prepare_int( $p_field_id );
$c_project_id = db_prepare_int( $p_project_id );
$t_custom_field_string_table = config_get( 'mantis_custom_field_string_table' );
$t_custom_field_table = config_get( 'mantis_custom_field_table' );
$t_mantis_bug_table = config_get( 'mantis_bug_table' );
$t_return_arr = array();

$query = "SELECT type, possible_values
Expand All @@ -799,9 +801,14 @@ function custom_field_distinct_values( $p_field_id ) {
array_push( $t_return_arr, $t_option );
}
} else {
$query2 = "SELECT value FROM $t_custom_field_string_table
WHERE field_id='$c_field_id'
GROUP BY value";
$t_where = '';
if ( ALL_PROJECTS != $p_project_id ) {
$t_where = " AND $t_mantis_bug_table.id = $t_custom_field_string_table.bug_id AND
$t_mantis_bug_table.project_id = '$p_project_id'";
}
$query2 = "SELECT $t_custom_field_string_table.value FROM $t_custom_field_string_table, $t_mantis_bug_table
WHERE $t_custom_field_string_table.field_id='$c_field_id' $t_where
GROUP BY $t_custom_field_string_table.value";
$result2 = db_query( $query2 );
$t_row_count = db_num_rows( $result2 );
if ( 0 == $t_row_count ) {
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeLog
Expand Up @@ -60,6 +60,7 @@ Mantis ChangeLog
* Fix #3924: Graphs did not show query counts when flag was set.
* Fix #3926: "Copy Issue" reset date submitted.
* Fix #3928: "Copy Issue" did not copy attachments (plus other values).
* Fix #3937: Custom field filters now only show those values relevant to the selected project.
* New Config: set_view_status_threshold (default REPORTER) - threshold needed to set the view status while reporting a bug / bugnote.
* New Config: change_view_status_threshold (default UPDATER) - threshold needed to update the view status while updating a bug / bugnote.
* New Config: view_handler_threshold (default VIEWER) - threshold needed to view the bug handler (now works for emails only).
Expand Down

0 comments on commit 0481e8c

Please sign in to comment.