Skip to content

Commit

Permalink
Fix #13132: Print the time tracking information sorted by username
Browse files Browse the repository at this point in the history
Previously the list was printed in whatever order returned by the SQL
  • Loading branch information
dregad committed Jul 13, 2011
1 parent c4c0a01 commit c4378b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions billing_inc.php
Expand Up @@ -126,16 +126,24 @@

<?php
if ( !is_blank( $f_get_bugnote_stats_button ) ) {
# Retrieve time tracking information
$t_from = "$t_bugnote_stats_from_y-$t_bugnote_stats_from_m-$t_bugnote_stats_from_d";
$t_to = "$t_bugnote_stats_to_y-$t_bugnote_stats_to_m-$t_bugnote_stats_to_d";
$t_bugnote_stats = bugnote_stats_get_project_array( $f_project_id, $t_from, $t_to, $f_bugnote_cost );

# Sort the array by bug_id, user/real name
if ( ON == config_get( 'show_realname' ) ) {
$t_name_field = 'realname';
}
else {
$t_name_field = 'username';
}
foreach ( $t_bugnote_stats as $t_key => $t_item ) {
$t_sort_bug[$t_key] = $t_item['bug_id'];
$t_sort_name[$t_key] = $t_item[$t_name_field];
}
array_multisort( $t_sort_bug, SORT_NUMERIC, $t_sort_name, $t_bugnote_stats );
unset( $t_sort_bug, $t_sort_name );

if ( is_blank( $f_bugnote_cost ) || ( (double)$f_bugnote_cost == 0 ) ) {
$t_cost_col = false;
Expand Down
6 changes: 6 additions & 0 deletions bugnote_stats_inc.php
Expand Up @@ -112,12 +112,18 @@
$t_to = "$t_bugnote_stats_to_y-$t_bugnote_stats_to_m-$t_bugnote_stats_to_d";
$t_bugnote_stats = bugnote_stats_get_events_array( $f_bug_id, $t_from, $t_to );

# Sort the array by user/real name
if ( ON == config_get( 'show_realname' ) ) {
$t_name_field = 'realname';
}
else {
$t_name_field = 'username';
}
foreach ( $t_bugnote_stats as $t_key => $t_item ) {
$t_sort_name[$t_key] = $t_item[$t_name_field];
}
array_multisort( $t_sort_name, $t_bugnote_stats );
unset( $t_sort_name );
?>
<br />
<table border=0 class="width100" cellspacing="0">
Expand Down

0 comments on commit c4378b8

Please sign in to comment.