Skip to content

Commit

Permalink
Fixed #3853: Filters sometime generate an invalid query (partial fix).
Browse files Browse the repository at this point in the history
M core/filter_api.php
- If sort field is empty default it to last_updated and direction to DESC.  The root problem still has to be fixed, but this fixes the symptoms.  This is also needed to avoid SQL errors for filters saved in user dbs.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2551 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed May 18, 2004
1 parent b0e6114 commit 3b84022
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/filter_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: filter_api.php,v 1.32 2004-05-08 23:25:12 narcissus Exp $
# $Id: filter_api.php,v 1.33 2004-05-18 12:52:26 vboctor Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -305,6 +305,14 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
# Now add the rest of the criteria i.e. sorting, limit.
$c_sort = db_prepare_string( $t_filter['sort'] );

# if sort is blank then default the sort and direction. This is to fix the
# symptoms of #3953. Note that even if the main problem is fixed, we may
# have to keep this code for a while to handle filters saved with this blank field.
if ( is_blank( $c_sort ) ) {
$c_sort = 'last_updated';
$t_filter['dir'] = 'DESC';
}

if ( 'DESC' == $t_filter['dir'] ) {
$c_dir = 'DESC';
} else {
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeLog
Expand Up @@ -36,6 +36,7 @@ Mantis ChangeLog
* Fix #3840: Why strip the leading spaces from Description? (applied to all multi-line fields in issue + issue notes).
* Fix #3851: Ability to change the view status for a group of bugs
* Fix #3852: OK button in View Issues page is not localised
* Fix #3853: Filters sometime generate an invalid query (partial fix).
* 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 3b84022

Please sign in to comment.