View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011124 | mantisbt | filters | public | 2009-11-04 19:17 | 2014-09-23 18:05 |
Reporter | brianstv | Assigned To | dhx | ||
Priority | urgent | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.0rc2 | ||||
Target Version | 1.2.9 | Fixed in Version | 1.2.9 | ||
Summary | 0011124: The 'sticky_issues' value stored in the mantis_filter_table is not always stored correctly. | ||||
Description | The 'sticky_issues' value stored in the saved filter in the mantis_filter_table should be stored as Have discovered that it can default to the following, which is incorrect | ||||
Steps To Reproduce | Symptom is that sticky issues are not displayed with the gray bar after them in the view_issues page when the "sticky_issues" value is not stored in the filter correctly. This can happen when in the view_issues page and changing the Current Project dropdown to a project that the user does not have a saved filter for. | ||||
Additional Information | This seems to happen when the default for filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] is taken from config_get('show_sticky_issues') and is not saved as 'on' or 'off'. Problem found in core/filter_api.php, view_all_set.php and search.php doesn't even set a default if a value is not already present. | ||||
Tags | patch | ||||
Attached Files | 11124.patch (2,161 bytes)
From a039351ac2857424e4a890192d5ce96b48709ec2 Mon Sep 17 00:00:00 2001 From: Victor Boctor <vboctor@gmail.com> Date: Wed, 4 Nov 2009 19:33:20 -0800 Subject: [PATCH] Fixes #11124: The 'sticky_issues' value stored in the mantis_filter_table is not always stored correctly. --- core/filter_api.php | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/filter_api.php b/core/filter_api.php index 503643c..0194aa9 100644 --- a/core/filter_api.php +++ b/core/filter_api.php @@ -459,7 +459,7 @@ function filter_ensure_valid_filter( $p_filter_arr ) { $p_filter_arr[FILTER_PROPERTY_HIGHLIGHT_CHANGED] = config_get( 'default_show_changed' ); } if( !isset( $p_filter_arr[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ) ) { - $p_filter_arr[FILTER_PROPERTY_SHOW_STICKY_ISSUES] = config_get( 'show_sticky_issues' ); + $p_filter_arr[FILTER_PROPERTY_SHOW_STICKY_ISSUES] = gpc_string_to_bool( config_get( 'show_sticky_issues' ) ); } if( !isset( $p_filter_arr[FILTER_PROPERTY_SORT_FIELD_NAME] ) ) { $p_filter_arr[FILTER_PROPERTY_SORT_FIELD_NAME] = "last_updated"; @@ -899,7 +899,7 @@ function filter_get_query_sort_data( &$p_filter, $p_show_sticky, $p_query_clause $t_sort_fields = explode( ',', $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME] ); $t_dir_fields = explode( ',', $p_filter[FILTER_PROPERTY_SORT_DIRECTION] ); - if(( 'on' == $p_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ) && ( NULL !== $p_show_sticky ) ) { + if ( gpc_string_to_bool( $p_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ) && ( NULL !== $p_show_sticky ) ) { $p_query_clauses['order'][] = "sticky DESC"; } @@ -3722,7 +3722,7 @@ function print_filter_view_state() { function print_filter_sticky_issues() { global $t_filter; ?><!-- Show or hide sticky bugs --> - <input type="checkbox" name="<?php echo FILTER_PROPERTY_SHOW_STICKY_ISSUES;?>" <?php check_checked( gpc_string_to_bool( $t_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ), 'on' );?> /> + <input type="checkbox" name="<?php echo FILTER_PROPERTY_SHOW_STICKY_ISSUES;?>" <?php check_checked( gpc_string_to_bool( $t_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ), true );?> /> <?php } -- 1.6.4.2 | ||||
@brianstv, please verify the attached patch. |
|
Thanks brianstv and Victor! I've been experiencing this problem for quite some time and haven't had a chance to properly look at the cause (or work out how filters work in Mantis). I can confirm that the patch works, so I committed it. @brianstv, if you were expecting something else, please reopen this bug. Thanks again for your help in fixing this! |
|
Patch didn't fully work for me. Making the following changes fixed it for me. In core/filter_api.php
In search.php
In view_all_set.php these are only single values, even when doing advanced filtering
|
|
I still have something messed up, as now I can't set Show Sticky Issues to 'no' in the view_issues page. |
|
Found my problem: Disregard the change to view_all_set.php |
|
So what you're saying is that your diff above (disregarding the changes to view_all_set.php) is required to properly fix this issue? Or is everything OK as-is? |
|
The changes to core/filter_api.php and search.php are needed to pick up the default from the config_get when the user doesn't have a current filter in the mantis_filters_table. In core/filter_api.php
And in search.php
|
|
gpc_string_to_bool( config_get( 'show_sticky_issues' )) is redundant because config_get will return a boolean (either ON = 1 or OFF = 0) that can be directly evaluated. Also can someone (this is not directed to anyone in particular) explain why we're using strings 'on' and 'off' internally within Mantis? I can understand using them to make permalinks look pretty, but everywhere else it seems to just be unwanted extra complexity. |
|
Update meta data. Showstopper 1.2.0 |
|
We shouldn't be using 'on' and 'off' in the database. The patch I checked in removed these and replaced them with true / false. I've targeted for 1.3.x, unless someone fixes it earlier. |
|
This should now be fixed (hopefully) as part of changes made in 0013937. You'll need to reset the filter for your current user to see any effect. 'on' and 'off' have been completely replaced with true/false. Type checking has also been performed. |
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
MantisBT: master-1.2.x 9025cc67 2009-11-04 22:33 Committer: dhx Details Diff |
Fixes 0011124: The 'sticky_issues' value stored in the mantis_filter_table is not always stored correctly. Signed-off-by: David Hicks <hickseydr@optusnet.com.au> |
Affected Issues 0011124 |
|
mod - core/filter_api.php | Diff File | ||
MantisBT: master 9d2ebf2f 2009-11-04 22:33 Committer: dhx Details Diff |
Fixes 0011124: The 'sticky_issues' value stored in the mantis_filter_table is not always stored correctly. Signed-off-by: David Hicks <hickseydr@optusnet.com.au> |
Affected Issues 0011124 |
|
mod - core/filter_api.php | Diff File |