View Issue Details

IDProjectCategoryView StatusLast Update
0028669mantisbtfilterspublic2021-06-21 21:53
Reportergthomas Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version2.25.1 
Summary0028669: Due date is not filterable
Description

Why can't we filter by due date - just as by last updated or created?

Additional Information

I've copied the LAST_UPDATED filter as DUE - se the attached patch.

TagsNo tags attached.

Relationships

has duplicate 0011977 closedatrol Is it possible to filter by due_date? 

Activities

gthomas

gthomas

2021-06-05 02:52

reporter  

filter_due_date.patch (19,179 bytes)   
diff --git a/core/classes/BugFilterQuery.class.php b/core/classes/BugFilterQuery.class.php
index 048ddfd67..a78d188d5 100644
--- a/core/classes/BugFilterQuery.class.php
+++ b/core/classes/BugFilterQuery.class.php
@@ -428,6 +428,9 @@ class BugFilterQuery extends DbQuery {
 				case FILTER_PROPERTY_FILTER_BY_DATE_SUBMITTED:
 					$this->build_prop_date_created();
 					break;
+				case FILTER_PROPERTY_FILTER_BY_DUE_DATE:
+					$this->build_prop_date_due();
+					break;
 				case FILTER_PROPERTY_FILTER_BY_LAST_UPDATED_DATE:
 					$this->build_prop_date_updated();
 					break;
@@ -770,6 +773,35 @@ class BugFilterQuery extends DbQuery {
 		}
 	}
 
+	/**
+	 * Build the query parts for the filter property "due date"
+	 * @return void
+	 */
+	protected function build_prop_date_due() {
+		if( ( gpc_string_to_bool( $this->filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] ) )
+				&& is_numeric( $this->filter[FILTER_PROPERTY_DUE_START_MONTH] )
+				&& is_numeric( $this->filter[FILTER_PROPERTY_DUE_START_DAY] )
+				&& is_numeric( $this->filter[FILTER_PROPERTY_DUE_START_YEAR] )
+				&& is_numeric( $this->filter[FILTER_PROPERTY_DUE_END_MONTH] )
+				&& is_numeric( $this->filter[FILTER_PROPERTY_DUE_END_DAY] )
+				&& is_numeric( $this->filter[FILTER_PROPERTY_DUE_END_YEAR] )
+				) {
+			$t_start_string = $this->filter[FILTER_PROPERTY_DUE_START_YEAR]
+					. '-' . $this->filter[FILTER_PROPERTY_DUE_START_MONTH]
+					. '-' . $this->filter[FILTER_PROPERTY_DUE_START_DAY]
+					. ' 00:00:00';
+			$t_end_string = $this->filter[FILTER_PROPERTY_DUE_END_YEAR]
+					. '-' . $this->filter[FILTER_PROPERTY_DUE_END_MONTH]
+					. '-' . $this->filter[FILTER_PROPERTY_DUE_END_DAY]
+					. ' 23:59:59';
+
+			$t_query_due_at = '{bug}.due_date BETWEEN '
+					. $this->param( strtotime( $t_start_string ) ) . ' AND '
+					. $this->param( strtotime( $t_end_string ) ) ;
+			$this->add_fixed_where( $t_query_due_at );
+		}
+	}
+
 	/**
 	 * Build the query parts for the filter property "view state"
 	 * @return void
diff --git a/core/filter_api.php b/core/filter_api.php
index f03ea5a8b..5d75aa189 100644
--- a/core/filter_api.php
+++ b/core/filter_api.php
@@ -322,6 +322,37 @@ function filter_get_url( array $p_custom_filter ) {
 		}
 	}
 
+	if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] ) ) {
+		$t_query[] = filter_encode_field_and_value(
+			FILTER_PROPERTY_FILTER_BY_DUE_DATE,
+			$p_custom_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] ? 'on' : 'off' );
+
+		# The start and end dates are only applicable if filter by date is set.
+		if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_DUE_START_DAY] ) ) {
+			$t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_DUE_START_DAY, $p_custom_filter[FILTER_PROPERTY_DUE_START_DAY] );
+		}
+
+		if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_DUE_END_DAY] ) ) {
+			$t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_DUE_END_DAY, $p_custom_filter[FILTER_PROPERTY_DUE_END_DAY] );
+		}
+
+		if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_DUE_START_MONTH] ) ) {
+			$t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_DUE_START_MONTH, $p_custom_filter[FILTER_PROPERTY_DUE_START_MONTH] );
+		}
+
+		if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_DUE_END_MONTH] ) ) {
+			$t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_DUE_END_MONTH, $p_custom_filter[FILTER_PROPERTY_DUE_END_MONTH] );
+		}
+
+		if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_DUE_START_YEAR] ) ) {
+			$t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_DUE_START_YEAR, $p_custom_filter[FILTER_PROPERTY_DUE_START_YEAR] );
+		}
+
+		if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_DUE_END_YEAR] ) ) {
+			$t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_DUE_END_YEAR, $p_custom_filter[FILTER_PROPERTY_DUE_END_YEAR] );
+		}
+	}
+
 	if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE] ) ) {
 		if( $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE] != -1 ) {
 			$t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_RELATIONSHIP_TYPE, $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE] );
@@ -899,6 +930,13 @@ function filter_get_default_array( $p_view_type = null ) {
 		FILTER_PROPERTY_LAST_UPDATED_END_DAY => date( 'd' ),
 		FILTER_PROPERTY_LAST_UPDATED_START_YEAR => date( 'Y' ),
 		FILTER_PROPERTY_LAST_UPDATED_END_YEAR => date( 'Y' ),
+		FILTER_PROPERTY_FILTER_BY_DUE_DATE => false,
+		FILTER_PROPERTY_DUE_START_MONTH => date( 'm' ),
+		FILTER_PROPERTY_DUE_END_MONTH => date( 'm' ),
+		FILTER_PROPERTY_DUE_START_DAY => 1,
+		FILTER_PROPERTY_DUE_END_DAY => date( 'd' ),
+		FILTER_PROPERTY_DUE_START_YEAR => date( 'Y' ),
+		FILTER_PROPERTY_DUE_END_YEAR => date( 'Y' ),
 		FILTER_PROPERTY_SEARCH => '',
 		FILTER_PROPERTY_VIEW_STATE => META_FILTER_ANY,
 		FILTER_PROPERTY_TAG_STRING => '',
@@ -2083,6 +2121,14 @@ function filter_gpc_get( array $p_filter = null ) {
 	$f_last_updated_end_day				= gpc_get_int( FILTER_PROPERTY_LAST_UPDATED_END_DAY, $t_filter[FILTER_PROPERTY_LAST_UPDATED_END_DAY] );
 	$f_last_updated_start_year			= gpc_get_int( FILTER_PROPERTY_LAST_UPDATED_START_YEAR, $t_filter[FILTER_PROPERTY_LAST_UPDATED_START_YEAR] );
 	$f_last_updated_end_year			= gpc_get_int( FILTER_PROPERTY_LAST_UPDATED_END_YEAR, $t_filter[FILTER_PROPERTY_LAST_UPDATED_END_YEAR] );
+	# due date values
+	$f_do_filter_by_due_date	= gpc_get_bool( FILTER_PROPERTY_FILTER_BY_DUE_DATE, $t_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] );
+	$f_due_start_month			= gpc_get_int( FILTER_PROPERTY_DUE_START_MONTH, $t_filter[FILTER_PROPERTY_DUE_START_MONTH] );
+	$f_due_end_month			= gpc_get_int( FILTER_PROPERTY_DUE_END_MONTH, $t_filter[FILTER_PROPERTY_DUE_END_MONTH] );
+	$f_due_start_day			= gpc_get_int( FILTER_PROPERTY_DUE_START_DAY, $t_filter[FILTER_PROPERTY_DUE_START_DAY] );
+	$f_due_end_day				= gpc_get_int( FILTER_PROPERTY_DUE_END_DAY, $t_filter[FILTER_PROPERTY_DUE_END_DAY] );
+	$f_due_start_year			= gpc_get_int( FILTER_PROPERTY_DUE_START_YEAR, $t_filter[FILTER_PROPERTY_DUE_START_YEAR] );
+	$f_due_end_year			= gpc_get_int( FILTER_PROPERTY_DUE_END_YEAR, $t_filter[FILTER_PROPERTY_DUE_END_YEAR] );
 
 	$f_search				= gpc_get_string( FILTER_PROPERTY_SEARCH, $t_filter[FILTER_PROPERTY_SEARCH] );
 	$f_view_state			= gpc_get_int( FILTER_PROPERTY_VIEW_STATE, $t_filter[FILTER_PROPERTY_VIEW_STATE] );
@@ -2258,6 +2304,13 @@ function filter_gpc_get( array $p_filter = null ) {
 	$t_filter_input[FILTER_PROPERTY_LAST_UPDATED_END_MONTH] 	= $f_last_updated_end_month;
 	$t_filter_input[FILTER_PROPERTY_LAST_UPDATED_END_DAY] 		= $f_last_updated_end_day;
 	$t_filter_input[FILTER_PROPERTY_LAST_UPDATED_END_YEAR] 		= $f_last_updated_end_year;
+	$t_filter_input[FILTER_PROPERTY_FILTER_BY_DUE_DATE] = $f_do_filter_by_due_date;
+	$t_filter_input[FILTER_PROPERTY_DUE_START_MONTH] 	= $f_due_start_month;
+	$t_filter_input[FILTER_PROPERTY_DUE_START_DAY] 	= $f_due_start_day;
+	$t_filter_input[FILTER_PROPERTY_DUE_START_YEAR] 	= $f_due_start_year;
+	$t_filter_input[FILTER_PROPERTY_DUE_END_MONTH] 	= $f_due_end_month;
+	$t_filter_input[FILTER_PROPERTY_DUE_END_DAY] 		= $f_due_end_day;
+	$t_filter_input[FILTER_PROPERTY_DUE_END_YEAR] 		= $f_due_end_year;
 	$t_filter_input[FILTER_PROPERTY_SEARCH] 					= $f_search;
 	$t_filter_input[FILTER_PROPERTY_HIDE_STATUS] 			= $f_hide_status;
 	$t_filter_input[FILTER_PROPERTY_RESOLUTION] 				= $f_show_resolution;
diff --git a/core/filter_constants_inc.php b/core/filter_constants_inc.php
index 37ffd1cfa..13d7d5c78 100644
--- a/core/filter_constants_inc.php
+++ b/core/filter_constants_inc.php
@@ -49,6 +49,14 @@ define( 'FILTER_PROPERTY_LAST_UPDATED_END_MONTH', 'last_updated_end_month' );
 define( 'FILTER_PROPERTY_LAST_UPDATED_END_YEAR', 'last_updated_end_year' );
 define( 'FILTER_PROPERTY_FILTER_BY_LAST_UPDATED_DATE', 'filter_by_last_updated_date' ); #do_filter_by_last_updated_date
 
+define( 'FILTER_PROPERTY_DUE_START_DAY', 'due_start_day' );
+define( 'FILTER_PROPERTY_DUE_START_MONTH', 'due_start_month' );
+define( 'FILTER_PROPERTY_DUE_START_YEAR', 'due_start_year' );
+define( 'FILTER_PROPERTY_DUE_END_DAY', 'due_end_day' );
+define( 'FILTER_PROPERTY_DUE_END_MONTH', 'due_end_month' );
+define( 'FILTER_PROPERTY_DUE_END_YEAR', 'due_end_year' );
+define( 'FILTER_PROPERTY_FILTER_BY_DUE_DATE', 'filter_by_due_date' ); #do_filter_by_due_date
+
 define( 'FILTER_PROPERTY_RELATIONSHIP_TYPE', 'relationship_type' );
 define( 'FILTER_PROPERTY_RELATIONSHIP_BUG', 'relationship_bug' );
 define( 'FILTER_PROPERTY_TAG_STRING', 'tag_string' );
diff --git a/core/filter_form_api.php b/core/filter_form_api.php
index ff051eae1..fde5b6658 100644
--- a/core/filter_form_api.php
+++ b/core/filter_form_api.php
@@ -99,6 +99,7 @@ function filter_form_get_input( array $p_filter, $p_filter_target, $p_show_input
 	# override non standard calls
 	switch( $p_filter_target ) {
 		case 'do_filter_by_date':
+		case 'do_filter_by_due_date':
 		case 'do_filter_by_last_updated_date':
 			if( $p_show_inputs ) {
 				$t_params = array( false, $p_filter );
@@ -1530,6 +1531,158 @@ function print_filter_do_filter_by_last_updated_date( $p_hide_checkbox = false,
 		<?php
 }
 
+/**
+ * Print the current value of this filter field, as visible string, and as a hidden form input.
+ * @param array $p_filter	Filter array
+ * @return void
+ */
+function print_filter_values_do_filter_by_due_date( array $p_filter ) {
+	$t_filter = $p_filter;
+	if( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] ) {
+		echo '<input type="hidden" name="', FILTER_PROPERTY_FILTER_BY_DUE_DATE, '" value="', string_attribute( $t_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] ), '" />';
+		echo '<input type="hidden" name="', FILTER_PROPERTY_DUE_START_MONTH, '" value="', string_attribute( $t_filter[FILTER_PROPERTY_DUE_START_MONTH] ), '" />';
+		echo '<input type="hidden" name="', FILTER_PROPERTY_DUE_START_DAY, '" value="', string_attribute( $t_filter[FILTER_PROPERTY_DUE_START_DAY] ), '" />';
+		echo '<input type="hidden" name="', FILTER_PROPERTY_DUE_START_YEAR, '" value="', string_attribute( $t_filter[FILTER_PROPERTY_DUE_START_YEAR] ), '" />';
+		echo '<input type="hidden" name="', FILTER_PROPERTY_DUE_END_MONTH, '" value="', string_attribute( $t_filter[FILTER_PROPERTY_DUE_END_MONTH] ), '" />';
+		echo '<input type="hidden" name="', FILTER_PROPERTY_DUE_END_DAY, '" value="', string_attribute( $t_filter[FILTER_PROPERTY_DUE_END_DAY] ), '" />';
+		echo '<input type="hidden" name="', FILTER_PROPERTY_DUE_END_YEAR, '" value="', string_attribute( $t_filter[FILTER_PROPERTY_DUE_END_YEAR] ), '" />';
+
+		$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
+		$t_time = mktime( 0, 0, 0, $t_filter[FILTER_PROPERTY_DUE_START_MONTH], $t_filter[FILTER_PROPERTY_DUE_START_DAY], $t_filter[FILTER_PROPERTY_DUE_START_YEAR] );
+		foreach( $t_chars as $t_char ) {
+			if( strcasecmp( $t_char, 'M' ) == 0 ) {
+				echo ' ';
+				echo lang_get( 'month_' . strtolower (date( 'F', $t_time ) ) );
+			}
+			if( strcasecmp( $t_char, 'D' ) == 0 ) {
+				echo ' ';
+				echo date( 'd', $t_time );
+			}
+			if( strcasecmp( $t_char, 'Y' ) == 0 ) {
+				echo ' ';
+				echo date( 'Y', $t_time );
+			}
+		}
+
+		echo ' - ';
+
+		$t_time = mktime( 0, 0, 0, $t_filter[FILTER_PROPERTY_DUE_END_MONTH], $t_filter[FILTER_PROPERTY_DUE_END_DAY], $t_filter[FILTER_PROPERTY_DUE_END_YEAR] );
+		foreach( $t_chars as $t_char ) {
+			if( strcasecmp( $t_char, 'M' ) == 0 ) {
+				echo ' ';
+				echo lang_get( 'month_' . strtolower ( date( 'F', $t_time ) ) );
+			}
+			if( strcasecmp( $t_char, 'D' ) == 0 ) {
+				echo ' ';
+				echo date( 'd', $t_time );
+			}
+			if( strcasecmp( $t_char, 'Y' ) == 0 ) {
+				echo ' ';
+				echo date( 'Y', $t_time );
+			}
+		}
+	} else {
+		echo lang_get( 'no' );
+	}
+}
+
+/**
+ * Print filter by last update date fields
+ * @global array $g_filter
+ * @param boolean $p_hide_checkbox Hide data filter checkbox.
+ * @param array $p_filter Filter array
+ * @return void
+ */
+function print_filter_do_filter_by_due_date( $p_hide_checkbox = false, array $p_filter = null ) {
+	global $g_filter;
+	if( null === $p_filter ) {
+		$p_filter = $g_filter;
+	}
+?>
+		<table cellspacing="0" cellpadding="0">
+<?php
+	$t_menu_disabled =  '';
+	if( !$p_hide_checkbox ) {
+?>
+		<tr>
+			<td colspan="2">
+				<input type="hidden" name="<?php echo FILTER_PROPERTY_FILTER_BY_DUE_DATE ?>" value="<?php echo OFF ?>" />
+				<label>
+					<input class="input-xs ace js_switch_date_inputs_trigger" type="checkbox" id="use_due_date_filters" class="input-xs"
+						name="<?php echo FILTER_PROPERTY_FILTER_BY_DUE_DATE ?>"
+						<?php check_checked( gpc_string_to_bool( $p_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] ), true ) ?> />
+					<span class="lbl padding-6 small"><?php echo lang_get( 'use_due_date_filters' )?></span>
+				</label>
+			</td>
+		</tr>
+<?php
+
+		if( ON != $p_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] ) {
+			$t_menu_disabled = ' disabled="disabled" ';
+		}
+	}
+?>
+
+		<!-- Start date -->
+		<tr>
+			<td>
+			<?php echo lang_get( 'start_date_label' )?>
+			</td>
+			<td class="nowrap">
+			<?php
+			$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
+	foreach( $t_chars as $t_char ) {
+		if( strcasecmp( $t_char, 'M' ) == 0 ) {
+			echo '<select class="input-xs" name="', FILTER_PROPERTY_DUE_START_MONTH, '"', $t_menu_disabled, '>';
+			print_month_option_list( $p_filter[FILTER_PROPERTY_DUE_START_MONTH] );
+			print "</select>\n";
+		}
+		if( strcasecmp( $t_char, 'D' ) == 0 ) {
+			echo '<select class="input-xs" name="', FILTER_PROPERTY_DUE_START_DAY, '"', $t_menu_disabled, '>';
+			print_day_option_list( $p_filter[FILTER_PROPERTY_DUE_START_DAY] );
+			print "</select>\n";
+		}
+		if( strcasecmp( $t_char, 'Y' ) == 0 ) {
+			echo '<select class="input-xs" name="', FILTER_PROPERTY_DUE_START_YEAR, '"', $t_menu_disabled, '>';
+			print_year_option_list( $p_filter[FILTER_PROPERTY_DUE_START_YEAR] );
+			print "</select>\n";
+		}
+	}
+	?>
+			</td>
+		</tr>
+		<!-- End date -->
+		<tr>
+			<td>
+			<?php echo lang_get( 'end_date_label' )?>
+			</td>
+			<td>
+			<?php
+			$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
+	foreach( $t_chars as $t_char ) {
+		if( strcasecmp( $t_char, 'M' ) == 0 ) {
+			echo '<select class="input-xs" name="', FILTER_PROPERTY_DUE_END_MONTH, '"', $t_menu_disabled, '>';
+			print_month_option_list( $p_filter[FILTER_PROPERTY_DUE_END_MONTH] );
+			print "</select>\n";
+		}
+		if( strcasecmp( $t_char, 'D' ) == 0 ) {
+			echo '<select class="input-xs" name="', FILTER_PROPERTY_DUE_END_DAY, '"', $t_menu_disabled, '>';
+			print_day_option_list( $p_filter[FILTER_PROPERTY_DUE_END_DAY] );
+			print "</select>\n";
+		}
+		if( strcasecmp( $t_char, 'Y' ) == 0 ) {
+			echo '<select class="input-xs" name="', FILTER_PROPERTY_DUE_END_YEAR, '"', $t_menu_disabled, '>';
+			print_year_option_list( $p_filter[FILTER_PROPERTY_DUE_END_YEAR] );
+			print "</select>\n";
+		}
+	}
+	?>
+			</td>
+		</tr>
+		</table>
+		<?php
+}
+
 /**
  * Print the current value of this filter field, as visible string, and as a hidden form input.
  * @param array $p_filter	Filter array
@@ -2089,6 +2242,10 @@ function print_filter_show_sort( array $p_filter = null ) {
 		echo lang_get_defaulted( 'last_updated' ) . lang_get( 'bugnote_order_desc' );
 		echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_array[]" value="last_updated" />';
 		echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_array[]" value="DESC" />';
+
+		echo lang_get_defaulted( 'due' ) . lang_get( 'bugnote_order_desc' );
+		echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_array[]" value="due" />';
+		echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_array[]" value="DESC" />';
 	}
 }
 
@@ -2547,6 +2704,13 @@ function filter_form_draw_inputs( $p_filter, $p_for_screen = true, $p_static = f
 			null /* class */,
 			'do_filter_by_last_updated_date_filter_target' /* content id */
 			));
+	$t_row2->add_item( new TableFieldsItem(
+			$get_field_header( 'do_filter_by_due_date_filter', lang_get( 'use_due_date_filters' ) ),
+			filter_form_get_input( $t_filter, 'do_filter_by_due_date', $t_show_inputs ),
+			2 /* colspan */,
+			null /* class */,
+			'do_filter_by_due_date_filter_target' /* content id */
+			));
 	if( FILTER_VIEW_TYPE_ADVANCED == $t_view_type ) {
 		$t_row2->add_item( new TableFieldsItem(
 				$get_field_header( 'project_id_filter', lang_get( 'email_project' ) ),
diff --git a/lang/strings_english.txt b/lang/strings_english.txt
index 017721546..17dab319a 100644
--- a/lang/strings_english.txt
+++ b/lang/strings_english.txt
@@ -1207,6 +1207,7 @@ $s_start_date_label = 'Start Date:';
 $s_end_date_label = 'End Date:';
 $s_use_date_filters = 'Filter by Date Submitted';
 $s_use_last_updated_date_filters = 'Filter by Last Updated Date';
+$s_use_due_date_filters = 'Filter by Due Date';
 $s_yes = 'Yes';
 $s_no = 'No';
 $s_open_filters = 'Change Filter';
diff --git a/lang/strings_hungarian.txt b/lang/strings_hungarian.txt
index f3029ecdb..57ccc61c8 100644
--- a/lang/strings_hungarian.txt
+++ b/lang/strings_hungarian.txt
@@ -911,6 +911,7 @@ $s_start_date_label = 'Kezdődátum:';
 $s_end_date_label = 'Záródátum:';
 $s_use_date_filters = 'Szűrés a beküldés dátuma szerint';
 $s_use_last_updated_date_filters = 'Szűrés a frissítés dátuma szerint';
+$s_use_due_date_filters = 'Szűrés az esedékesség dátuma szerint';
 $s_yes = 'Igen';
 $s_no = 'Nem';
 $s_open_filters = 'Szűrő megváltoztatása';
diff --git a/search.php b/search.php
index a320b191e..713ada421 100644
--- a/search.php
+++ b/search.php
@@ -115,6 +115,14 @@ $t_my_filter[FILTER_PROPERTY_LAST_UPDATED_START_YEAR] = gpc_get_int( FILTER_PROP
 $t_my_filter[FILTER_PROPERTY_LAST_UPDATED_END_MONTH] = gpc_get_int( FILTER_PROPERTY_LAST_UPDATED_END_MONTH, META_FILTER_ANY );
 $t_my_filter[FILTER_PROPERTY_LAST_UPDATED_END_DAY] = gpc_get_int( FILTER_PROPERTY_LAST_UPDATED_END_DAY, META_FILTER_ANY );
 $t_my_filter[FILTER_PROPERTY_LAST_UPDATED_END_YEAR] = gpc_get_int( FILTER_PROPERTY_LAST_UPDATED_END_YEAR, META_FILTER_ANY );
+# Due Date
+$t_my_filter[FILTER_PROPERTY_FILTER_BY_DUE_DATE] = gpc_get_bool( FILTER_PROPERTY_FILTER_BY_DUE_DATE );
+$t_my_filter[FILTER_PROPERTY_DUE_START_MONTH] = gpc_get_int( FILTER_PROPERTY_DUE_START_MONTH, META_FILTER_ANY );
+$t_my_filter[FILTER_PROPERTY_DUE_START_DAY] = gpc_get_int( FILTER_PROPERTY_DUE_START_DAY, META_FILTER_ANY );
+$t_my_filter[FILTER_PROPERTY_DUE_START_YEAR] = gpc_get_int( FILTER_PROPERTY_DUE_START_YEAR, META_FILTER_ANY );
+$t_my_filter[FILTER_PROPERTY_DUE_END_MONTH] = gpc_get_int( FILTER_PROPERTY_DUE_END_MONTH, META_FILTER_ANY );
+$t_my_filter[FILTER_PROPERTY_DUE_END_DAY] = gpc_get_int( FILTER_PROPERTY_DUE_END_DAY, META_FILTER_ANY );
+$t_my_filter[FILTER_PROPERTY_DUE_END_YEAR] = gpc_get_int( FILTER_PROPERTY_DUE_END_YEAR, META_FILTER_ANY );
 
 $t_my_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE] = gpc_get_int( FILTER_PROPERTY_RELATIONSHIP_TYPE, -1 );
 $t_my_filter[FILTER_PROPERTY_RELATIONSHIP_BUG] = gpc_get_int( FILTER_PROPERTY_RELATIONSHIP_BUG, 0 );
filter_due_date.patch (19,179 bytes)   
dregad

dregad

2021-06-05 12:03

developer   ~0065602

Patch submitted as PR https://github.com/mantisbt/mantisbt/pull/1755 to facilitate review.

@gthomas next time if you could, please submit a PR instead of posting a patch here.

vboctor

vboctor

2021-06-06 20:45

manager   ~0065604

Filtering by due date is a much needed feature. Thanks for the contribution.

Ideally, it would be possible to create an “Upcoming” filter that shows all issues with due date less than today + one month. That would require support for relative date filters. Having said that, it is not a blocker for basic filtering.