Index: bug_change_status_page.php
===================================================================
--- bug_change_status_page.php (revision 5213)
+++ bug_change_status_page.php (working copy)
@@ -53,6 +53,7 @@
access_denied();
}
$t_can_update_due_date = access_has_bug_level( config_get( 'due_date_update_threshold' ), $f_bug_id );
+
# get new issue handler if set, otherwise default to original handler
$f_handler_id = gpc_get_int( 'handler_id', bug_get_field( $f_bug_id, 'handler_id' ) );
@@ -162,7 +163,7 @@
-due_date ) ) {
$t_date_to_display = date( config_get( 'short_date_format' ), $t_bug->due_date );
@@ -341,7 +342,7 @@
Index: lang/strings_polish_8859-2.txt
===================================================================
--- lang/strings_polish_8859-2.txt (revision 5213)
+++ lang/strings_polish_8859-2.txt (working copy)
@@ -1336,7 +1336,12 @@
# wiki related strings
$s_wiki = 'Wiki';
-$s_due_date = "Termin realizacji";
-$s_overdue = "Przeterminowane";
+$s_due_date = 'Termin realizacji';
+$s_overdue = 'Przeterminowane';
+$s_due_days = 'Due days';
+$s_overdue_csv_yes = 'Tak';
+$s_overdue_csv_no = 'Nie';
+$s_overdue_excel_yes = 'Tak';
+$s_overdue_excel_no = 'Nie';
?>
Index: lang/strings_english.txt
===================================================================
--- lang/strings_english.txt (revision 5213)
+++ lang/strings_english.txt (working copy)
@@ -1514,10 +1514,15 @@
$s_copy_columns_to = 'Copy Columns To';
# due date
-$s_due_date = "Due Date";
-$s_overdue = "Overdue";
+$s_due_date = 'Due Date';
+$s_overdue = 'Overdue';
+$s_due_days = 'Due days';
+$s_overdue_csv_yes = 'Yes';
+$s_overdue_csv_no = 'No';
+$s_overdue_excel_yes = 'Yes';
+$s_overdue_excel_no = 'No';
# mind mapping
$s_mindmap = 'Mindmap';
$s_freemind_export = 'Freemind Export';
-?>
\ No newline at end of file
+?>
Index: lang/strings_polish.txt
===================================================================
--- lang/strings_polish.txt (revision 5213)
+++ lang/strings_polish.txt (working copy)
@@ -1336,7 +1336,11 @@
# wiki related strings
$s_wiki = 'Wiki';
-$s_due_date = "Termin realizacji";
-$s_overdue = "Przeterminowane";
-
+$s_due_date = 'Termin realizacji';
+$s_overdue = 'Przeterminowane';
+$s_due_days = 'Due days';
+$s_overdue_csv_yes = 'Tak';
+$s_overdue_csv_no = 'Nie';
+$s_overdue_excel_yes = 'Tak';
+$s_overdue_excel_no = 'Nie';
?>
Index: print_all_bug_page_word.php
===================================================================
--- print_all_bug_page_word.php (revision 5213)
+++ print_all_bug_page_word.php (working copy)
@@ -93,6 +93,9 @@
# prefix bug data with v_
# extract( $result[$j], EXTR_PREFIX_ALL, 'v' );
$t_id = $result[$j]['id'];
+
+ $t_can_view_due_date = access_has_bug_level( config_get( 'due_date_view_threshold' ), $t_id );
+ $t_overdue = bug_is_overdue( $t_id );
# display the available and selected bugs
if ( in_array( $t_id, $f_bug_arr ) || !$f_show_flag ) {
@@ -185,7 +188,27 @@
|
Index: excel_xml_export.php
===================================================================
--- excel_xml_export.php (revision 5213)
+++ excel_xml_export.php (working copy)
@@ -95,7 +95,13 @@
echo excel_format_custom_field( $t_row['id'], $t_row['project_id'], $t_custom_field );
} else {
$t_function = 'excel_format_' . $t_column;
- echo $t_function( $t_row[$t_column] );
+ if ( $t_column == 'overdue' ) {
+ echo $t_function( $t_row[ 'id' ], $t_row[ $t_column ] );
+ } else if ( $t_column == 'due_days' ) {
+ echo $t_function( $t_row[ 'due_date' ] );
+ } else {
+ echo $t_function( $t_row[ $t_column ] );
+ }
}
}
}
@@ -122,4 +128,4 @@
} while ( $t_more );
echo excel_get_footer();
-?>
\ No newline at end of file
+?>
Index: css/default.css
===================================================================
--- css/default.css (revision 5213)
+++ css/default.css (working copy)
@@ -53,6 +53,8 @@
td.right { text-align: right; }
td.category { background-color: #c8c8e8; color: #000000; font-weight: bold; vertical-align : top; }
td.overdue { background-color: #ff0000; color: #000000; font-weight: bold; }
+td.overdue2 { background-color: #ff0000; color: #000000; font-weight: bold; text-align: center}
+td.due2 { text-align: center}
td.col-1 { background-color: #d8d8d8; color: #000000; }
td.col-2 { background-color: #e8e8e8; color: #000000; }
@@ -61,6 +63,7 @@
td.small-caption { font-size: 8pt; }
td.print { font-size: 8pt; text-align: left; padding: 2px; }
td.print-category { font-size: 8pt; color: #000000; font-weight: bold; text-align: right; padding: 2px; }
+td.print-overdue { font-size: 8pt; color: #000000; font-weight: bold; padding: 2px; }
td.print-bottom { border-bottom: 1px solid #000000; }
td.print-spacer { background-color: #ffffff; color: #000000; font-size: 1pt; line-height: 0.1; padding: 0px;}
Index: config_defaults_inc.php
===================================================================
--- config_defaults_inc.php (revision 5213)
+++ config_defaults_inc.php (working copy)
@@ -528,7 +528,7 @@
# selection, edit, id, project_id, reporter_id, handler_id, priority, reproducibility, projection, eta,
# resolution, fixed_in_version, view_state, os, os_build, build (for product build), platform, version, date_submitted, attachment,
# category, sponsorship_total, severity, status, last_updated, summary, bugnotes_count, description,
- # steps_to_reproduce, additional_information
+ # steps_to_reproduce, additional_information, due_date, overdue, due_days
$g_view_issues_page_columns = array ( 'selection', 'edit', 'priority', 'id', 'sponsorship_total', 'bugnotes_count', 'attachment', 'category', 'severity', 'status', 'last_updated', 'summary' );
# The default columns to be included in the Print Issues Page.
Index: csv_export.php
===================================================================
--- csv_export.php (revision 5213)
+++ csv_export.php (working copy)
@@ -121,7 +121,13 @@
}
$t_function = 'csv_format_' . $t_column;
- echo $t_function( $t_row[ $t_column ] );
+ if ( $t_column == 'overdue' ) {
+ echo $t_function( $t_row[ 'id' ], $t_row[ $t_column ] );
+ } else if ( $t_column == 'due_days' ) {
+ echo $t_function( $t_row[ 'due_date' ] );
+ } else {
+ echo $t_function( $t_row[ $t_column ] );
+ }
}
}
Index: core/bug_api.php
===================================================================
--- core/bug_api.php (revision 5213)
+++ core/bug_api.php (working copy)
@@ -350,6 +350,8 @@
$t_now = db_unixtimestamp();
if ( $t_now > $t_due_date ) {
if ( bug_is_resolved( $p_bug_id ) ) {
+ return false;
+ } else {
return true;
}
}
@@ -1238,11 +1240,12 @@
$c_field_name = db_prepare_string( $p_field_name );
$c_status = $p_status; #generic, unknown type
+ $t_log_status = $c_status;
$h_status = bug_get_field( $p_bug_id, $p_field_name );
if ( $p_field_name == 'due_date' ) {
if ( !date_is_null( $h_status ) ) {
- $h_status = date( config_get( 'short_date_format' ), $h_status );
+ $h_status = date( config_get( 'Y-m-d' ), $h_status );
} else {
$h_status = '';
}
@@ -1251,9 +1254,11 @@
$t_tmp = strtotime( $p_status );
}
if ( !date_is_null( $t_tmp ) ) {
- $c_status = date( config_get( 'short_date_format' ), $t_tmp );
+ $c_status = date( 'Y-m-d 00:00:01', $t_tmp );
+ $t_log_status = date( config_get( 'short_date_format' ), $t_tmp );
} else {
$c_status = '';
+ $t_log_status = '';
}
$c_field_name = lang_get( 'due_date' );
}
@@ -1276,7 +1281,7 @@
# log changes except for duplicate_id which is obsolete and should be removed in
# Mantis 1.3.
if ( $p_field_name != 'duplicate_id' ) {
- history_log_event_direct( $p_bug_id, $p_field_name, $h_status, $c_status );
+ history_log_event_direct( $p_bug_id, $p_field_name, $h_status, $t_log_status );
}
bug_clear_cache( $p_bug_id );
Index: core/date_api.php
===================================================================
--- core/date_api.php (revision 5213)
+++ core/date_api.php (working copy)
@@ -25,7 +25,7 @@
# --------------------
# checks if date is null
function date_is_null( $p_date ) {
- return $p_date == date_get_null();
+ return $p_date <= date_get_null();
}
# --------------------
Index: core/csv_api.php
===================================================================
--- core/csv_api.php (revision 5213)
+++ core/csv_api.php (working copy)
@@ -249,4 +249,41 @@
function csv_format_selection( $p_duplicate_id ) {
return csv_escape_string( '' );
}
+
+ # --------------------
+ # return due_date
+ function csv_format_due_date( $p_due_date ) {
+ $t_date_to_display = '';
+ if ( !date_is_null( $p_due_date ) ) {
+ $t_date_to_display = date( config_get( 'short_date_format' ), $p_due_date );
+ }
+ return csv_escape_string( $t_date_to_display );
+ }
+
+ # --------------------
+ # return overdue
+ function csv_format_overdue( $p_bug_id, $p_due_date ) {
+ $t_date_to_display = '';
+ if ( !date_is_null( $p_due_date ) ) {
+ if ( bug_is_overdue( $p_bug_id ) ) {
+ $t_date_to_display = lang_get( 'overdue_csv_yes' );
+ } else {
+ $t_date_to_display = lang_get( 'overdue_csv_no' );
+ }
+ }
+ return csv_escape_string( $t_date_to_display );
+ }
+
+ # --------------------
+ # return due days
+ function csv_format_due_days( $p_due_date ) {
+ $t_date_to_display = '';
+
+ $t_date = number_format(floor((date("U")-$p_due_date)/86400),0);
+
+ if ( !date_is_null( $p_due_date ) ) {
+ $t_date_to_display = -(number_format(floor((date("U")-$p_due_date)/86400),0));
+ }
+ return csv_escape_string( $t_date_to_display );
+ }
?>
Index: core/excel_api.php
===================================================================
--- core/excel_api.php (revision 5213)
+++ core/excel_api.php (working copy)
@@ -423,4 +423,42 @@
// field is not linked to project
return excel_prepare_string( '' );
}
-?>
\ No newline at end of file
+
+ # --------------------
+ # return due_date
+ function excel_format_due_date( $p_due_date ) {
+ $t_date_to_display = '';
+ if ( !date_is_null( $p_due_date ) ) {
+ $t_date_to_display = date( config_get( 'short_date_format' ), $p_due_date );
+ }
+ return excel_prepare_string( $t_date_to_display );
+ }
+
+ # --------------------
+ # return overdue
+ function excel_format_overdue( $p_bug_id, $p_due_date ) {
+ $t_date_to_display = '';
+ if ( !date_is_null( $p_due_date ) ) {
+ if ( bug_is_overdue( $p_bug_id ) ) {
+ $t_date_to_display = lang_get( 'overdue_excel_yes' );
+ } else {
+ $t_date_to_display = lang_get( 'overdue_excel_no' );
+ }
+ }
+ return excel_prepare_string( $t_date_to_display );
+ }
+
+ # --------------------
+ # return due days
+ function excel_format_due_days( $p_due_date ) {
+ $t_date_to_display = '';
+
+ $t_date = number_format(floor((date("U")-$p_due_date)/86400),0);
+
+ if ( !date_is_null( $p_due_date ) ) {
+ $t_date_to_display = -(number_format(floor((date("U")-$p_due_date)/86400),0));
+ }
+ return excel_prepare_string( $t_date_to_display );
+ }
+
+?>
Index: core/custom_function_api.php
===================================================================
--- core/custom_function_api.php (revision 5213)
+++ core/custom_function_api.php (working copy)
@@ -24,6 +24,7 @@
$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
require_once( $t_core_dir . 'prepare_api.php' );
+ require_once( $t_core_dir . 'access_api.php' );
### Custom Function API ###
@@ -235,7 +236,14 @@
# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
function custom_function_default_print_column_title( $p_column, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
global $t_sort, $t_dir;
-
+
+ $t_current_user_level = current_user_get_access_level();
+ $t_view_due_date = access_compare_level($t_current_user_level, config_get( 'due_date_view_threshold' ));
+
+ if ( current_user_get_access_level() < $t_view_due_date &&
+ ( $p_column == 'due_date' || $p_column == 'overdue' || $p_column == 'due_days' ) )
+ return;
+
$t_custom_field = column_get_custom_field_name( $p_column );
if ( $t_custom_field !== null ) {
if ( COLUMNS_TARGET_CSV_PAGE != $p_columns_target ) {
@@ -281,6 +289,14 @@
# $p_row: the row from the bug table that belongs to the issue that we should print the values for.
# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
function custom_function_default_print_column_value( $p_column, $p_issue_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
+
+ $t_current_user_level = current_user_get_access_level();
+ $t_view_due_date = access_compare_level($t_current_user_level, config_get( 'due_date_view_threshold' ));
+
+ if ( current_user_get_access_level() < $t_view_due_date &&
+ ( $p_column == 'due_date' || $p_column == 'overdue' || $p_column == 'due_days' ) )
+ return;
+
if ( COLUMNS_TARGET_CSV_PAGE == $p_columns_target ) {
$t_column_start = '';
$t_column_end = '';
Index: core/columns_api.php
===================================================================
--- core/columns_api.php (revision 5213)
+++ core/columns_api.php (working copy)
@@ -56,6 +56,9 @@
'summary',
'version',
'view_state',
+ 'due_date',
+ 'overdue',
+ 'due_days'
);
# Add project custom fields to the array. Only add the ones for which the current user has at least read access.
@@ -520,39 +523,21 @@
# --------------------
# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
function print_column_edit( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
- global $t_icon_path, $t_update_bug_threshold;
- $t_is_overdue = bug_is_overdue( $p_row[ 'id' ] );
- $t_view_level = access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_row['id'] );
-
- if ( $t_is_overdue && $t_view_level ) {
- print " | ";
- } else {
+ if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) {
+ global $t_icon_path, $t_update_bug_threshold;
+
echo ' | ';
+ if ( !bug_is_readonly( $p_row['id'] )
+ && access_has_bug_level( $t_update_bug_threshold, $p_row['id'] ) ) {
+ echo '';
+ echo ' ';
+ } else {
+ echo ' ';
+ }
+ echo ' | ';
}
- if ( !bug_is_readonly( $p_row['id'] )
- && access_has_bug_level( config_get( 'update_bug_threshold' ), $p_row['id'] ) ) {
- echo '';
- echo '
';
- } else {
- echo ' ';
- }
- if ( $t_is_overdue && $t_view_level ) {
- echo '';
- echo '
';
- } else if ( ! date_is_null( $p_row[ 'due_date' ] ) && $t_view_level ) {
- echo '';
- echo '
';
- } else {
- echo ' ';
- }
-
- echo '';
}
# --------------------
@@ -775,6 +760,20 @@
, lang_get( 'private' )
);
}
+ $t_is_overdue = bug_is_overdue( $p_row[ 'id' ] );
+ $t_view_level = access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_row['id'] );
+
+ if ( $t_is_overdue && $t_view_level ) {
+ echo '';
+ echo '
';
+ } else if ( ! date_is_null( $p_row[ 'due_date' ] ) && $t_view_level ) {
+ echo '';
+ echo '
';
+ }
echo '';
}
@@ -822,4 +821,44 @@
echo '';
}
+
+ # --------------------
+ # $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
+ function print_column_due_date( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
+ $t_date_to_display = '';
+ if ( !date_is_null( $p_row['due_date'] ) ) {
+ $t_date_to_display = date( config_get( 'short_date_format' ), $p_row['due_date'] );
+ }
+ echo '', $t_date_to_display, ' | ';
+ }
+
+ # --------------------
+ # $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
+ function print_column_overdue( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
+ $t_date_to_display = '';
+ $t_cell = '';
+ if ( !date_is_null( $p_row['due_date'] ) ) {
+ if ( bug_is_overdue( $p_row['id'] ) ) {
+ $t_cell = ' | ';
+ $t_date_to_display = lang_get( 'yes' );
+ } else {
+ $t_date_to_display = lang_get( 'no' );
+ }
+ }
+ echo $t_cell, $t_date_to_display, ' | ';
+ }
+
+ # --------------------
+ # $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
+ function print_column_due_days( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
+ $t_date_to_display = '';
+
+ $t_date = number_format(floor((date("U")-$p_row['due_date'])/86400),0);
+
+ if ( !date_is_null( $p_row['due_date'] ) ) {
+ $t_date_to_display = -(number_format(floor((date("U")-$p_row['due_date'])/86400),0));
+ }
+ echo '', $t_date_to_display, ' | ';
+ }
+
?>