Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1338525

Browse files
committedJan 6, 2013
filter_api: apply all project_where_clauses first
where_clauses and project_where_clauses must not be mixed, since the where_params are expected to be held in order - first for the project_where_clauses and then for the where_clauses. Fixes #15320: Date filters broken since 1.2.12
1 parent 8756bb4 commit 1338525

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed
 

‎core/filter_api.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,17 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
12391239
log_event( LOG_FILTERING, 'project query = ' . $t_project_query );
12401240
array_push( $t_project_where_clauses, $t_project_query );
12411241
}
1242+
1243+
# date filter
1244+
if(( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_MONTH] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_DAY] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_YEAR] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_MONTH] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_DAY] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_YEAR] ) ) {
1245+
1246+
$t_start_string = $t_filter[FILTER_PROPERTY_START_YEAR] . "-" . $t_filter[FILTER_PROPERTY_START_MONTH] . "-" . $t_filter[FILTER_PROPERTY_START_DAY] . " 00:00:00";
1247+
$t_end_string = $t_filter[FILTER_PROPERTY_END_YEAR] . "-" . $t_filter[FILTER_PROPERTY_END_MONTH] . "-" . $t_filter[FILTER_PROPERTY_END_DAY] . " 23:59:59";
1248+
1249+
$t_where_params[] = strtotime( $t_start_string );
1250+
$t_where_params[] = strtotime( $t_end_string );
1251+
array_push( $t_project_where_clauses, "($t_bug_table.date_submitted BETWEEN " . db_param() . " AND " . db_param() . " )" );
1252+
}
12421253

12431254
# view state
12441255
$t_view_state = db_prepare_int( $t_filter[FILTER_PROPERTY_VIEW_STATE_ID] );
@@ -1618,17 +1629,6 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
16181629
}
16191630
}
16201631

1621-
# date filter
1622-
if(( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_MONTH] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_DAY] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_YEAR] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_MONTH] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_DAY] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_YEAR] ) ) {
1623-
1624-
$t_start_string = $t_filter[FILTER_PROPERTY_START_YEAR] . "-" . $t_filter[FILTER_PROPERTY_START_MONTH] . "-" . $t_filter[FILTER_PROPERTY_START_DAY] . " 00:00:00";
1625-
$t_end_string = $t_filter[FILTER_PROPERTY_END_YEAR] . "-" . $t_filter[FILTER_PROPERTY_END_MONTH] . "-" . $t_filter[FILTER_PROPERTY_END_DAY] . " 23:59:59";
1626-
1627-
$t_where_params[] = strtotime( $t_start_string );
1628-
$t_where_params[] = strtotime( $t_end_string );
1629-
array_push( $t_project_where_clauses, "($t_bug_table.date_submitted BETWEEN " . db_param() . " AND " . db_param() . " )" );
1630-
}
1631-
16321632
# fixed in version
16331633
if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION] ) ) {
16341634
$t_clauses = array();

0 commit comments

Comments
 (0)
Please sign in to comment.