View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0013177 | mantisbt | filters | public | 2011-07-26 08:34 | 2018-03-31 19:58 |
Reporter | sagrawal | Assigned To | cproensa | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.5 | ||||
Target Version | 2.13.0 | Fixed in Version | 2.13.0 | ||
Summary | 0013177: On ‘View Issues’ Page the filter does not allow user to select ‘blank’ ('No Category') Category | ||||
Description | Even if (No category) is allowed through configuration $g_allow_no_category = ON and some issues are opened with 'no category', filtering on those issues are not supported by existing category filter. The item '(No Category)' is not available in the drop down of category filter. | ||||
Tags | No tags attached. | ||||
Attached Files | category.patch (3,466 bytes)
diff -Naur mantisbt-1.2.5/bug_actiongroup.php mantisbt-1.2.5-patch/bug_actiongroup.php --- mantisbt-1.2.5/bug_actiongroup.php 2011-04-05 23:54:17.000000000 +0530 +++ mantisbt-1.2.5-patch/bug_actiongroup.php 2011-07-15 16:05:59.000000000 +0530 @@ -199,7 +199,7 @@ case 'UP_CATEGORY': $f_category_id = gpc_get_int( 'category' ); if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { - if ( category_exists( $f_category_id ) ) { + if ( category_exists( $f_category_id ) || $f_category_id === 0) { /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ bug_set_field( $t_bug_id, 'category_id', $f_category_id ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); diff -Naur mantisbt-1.2.5/core/filter_api.php mantisbt-1.2.5-patch/core/filter_api.php --- mantisbt-1.2.5/core/filter_api.php 2011-04-05 23:54:17.000000000 +0530 +++ mantisbt-1.2.5-patch/core/filter_api.php 2011-07-15 16:29:36.000000000 +0530 @@ -1307,22 +1307,36 @@ if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_CATEGORY] ) ) { $t_clauses = array(); + $no_category = lang_get( 'no_category' ); + foreach( $t_filter[FILTER_PROPERTY_CATEGORY] as $t_filter_member ) { if( !filter_field_is_none( $t_filter_member ) ) { array_push( $t_clauses, $t_filter_member ); } } - if( 1 < count( $t_clauses ) ) { $t_where_tmp = array(); foreach( $t_clauses as $t_clause ) { + if($t_clause === $no_category){ + $t_where_params[] = '0'; + continue; + } $t_where_tmp[] = db_param(); $t_where_params[] = $t_clause; + } + if(in_array($no_category, $t_clauses)){ + array_push( $t_where_clauses, "( $t_bug_table.category_id=".db_param()." or $t_bug_table.category_id in ( SELECT id FROM $t_category_table WHERE name in (" . implode( ', ', $t_where_tmp ) . ") ) )" ); + }else { + array_push( $t_where_clauses, "( $t_bug_table.category_id in ( SELECT id FROM $t_category_table WHERE name in (" . implode( ', ', $t_where_tmp ) . ") ) )" ); + } + } else { + if($t_clauses[0] === $no_category){ + $t_where_params[] = '0'; + array_push( $t_where_clauses, "( $t_bug_table.category_id=".db_param()." )"); + }else { + $t_where_params[] = $t_clauses[0]; + array_push( $t_where_clauses, "( $t_bug_table.category_id in ( SELECT id FROM $t_category_table WHERE name=" . db_param() . ") )" ); } - array_push( $t_where_clauses, "( $t_bug_table.category_id in ( SELECT id FROM $t_category_table WHERE name in (" . implode( ', ', $t_where_tmp ) . ") ) )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.category_id in ( SELECT id FROM $t_category_table WHERE name=" . db_param() . ") )" ); } } @@ -3558,6 +3572,9 @@ <!-- Category --> <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_CATEGORY;?>[]"> <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_CATEGORY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option> + <?php if (config_get('allow_no_category') == ON){?> + <option value="<?php echo lang_get( 'no_category' )?>"><?php echo lang_get( 'no_category' )?></option> + <?php }?> <?php print_category_filter_option_list( $t_filter[FILTER_PROPERTY_CATEGORY] )?> </select> <?php | ||||