From: Victor B. <vb...@us...> - 2004-05-18 12:52:38
|
Update of /cvsroot/mantisbt/mantisbt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19394/core Modified Files: filter_api.php Log Message: Fixed #3853: Filters sometime generate an invalid query (partial fix). 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. Index: filter_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- filter_api.php 8 May 2004 23:25:12 -0000 1.32 +++ filter_api.php 18 May 2004 12:52:26 -0000 1.33 @@ -305,6 +305,14 @@ # 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 { |