Skip to content

Commit

Permalink
Add category field to time tracking exports
Browse files Browse the repository at this point in the history
Fixes #20783
  • Loading branch information
Luke authored and vboctor committed Apr 8, 2016
1 parent 2e0e143 commit c67c88b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions billing_export_to_csv.php
Expand Up @@ -56,6 +56,7 @@

echo csv_escape_string( lang_get( 'issue_id' ) ) . $t_separator;
echo csv_escape_string( lang_get( 'project_name' ) ) . $t_separator;
echo csv_escape_string( lang_get( 'category' ) ) . $t_separator;
echo csv_escape_string( lang_get( 'summary' ) ) . $t_separator;

if( $t_show_realname ) {
Expand All @@ -78,6 +79,7 @@
foreach( $t_billing_rows as $t_billing ) {
echo csv_escape_string( bug_format_id( $t_billing['bug_id'] ) ) . $t_separator;
echo csv_escape_string( $t_billing['project_name'] ) . $t_separator;
echo csv_escape_string( $t_billing['bug_category'] ) . $t_separator;
echo csv_escape_string( $t_billing['bug_summary'] ) . $t_separator;

if( $t_show_realname ) {
Expand Down
2 changes: 2 additions & 0 deletions billing_export_to_excel.php
Expand Up @@ -58,6 +58,7 @@
echo excel_get_start_row();
echo excel_format_column_title( lang_get( 'issue_id' ) );
echo excel_format_column_title( lang_get( 'project_name' ) );
echo excel_format_column_title( lang_get( 'category' ) );
echo excel_format_column_title( lang_get( 'summary' ) );

if( $t_show_realname ) {
Expand All @@ -81,6 +82,7 @@
echo "\n<Row>\n";
echo excel_prepare_number( $t_billing['bug_id'] );
echo excel_prepare_string( $t_billing['project_name'] );
echo excel_prepare_string( $t_billing['bug_category'] );
echo excel_prepare_string( $t_billing['bug_summary'] );

if( $t_show_realname ) {
Expand Down
7 changes: 4 additions & 3 deletions core/billing_api.php
Expand Up @@ -93,9 +93,9 @@ function billing_get_for_project( $p_project_id, $p_from, $p_to, $p_cost_per_hou
$t_results = array();

$t_query = 'SELECT bn.id id, bn.time_tracking minutes, bn.date_submitted as date_submitted, bnt.note note,
u.realname realname, b.project_id project_id, b.summary bug_summary, bn.bug_id bug_id, bn.reporter_id reporter_id
FROM {user} u, {bugnote} bn, {bug} b, {bugnote_text} bnt
WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id AND bnt.id = bn.bugnote_text_id
u.realname realname, b.project_id project_id, c.name bug_category, b.summary bug_summary, bn.bug_id bug_id, bn.reporter_id reporter_id
FROM {user} u, {bugnote} bn, {bug} b, {bugnote_text} bnt, {category} c
WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id AND bnt.id = bn.bugnote_text_id AND c.id=b.category_id
' . $t_project_where . $t_from_where . $t_to_where . '
ORDER BY bn.id';
$t_result = db_query( $t_query, $t_params );
Expand Down Expand Up @@ -242,6 +242,7 @@ function billing_rows_to_array( $p_bugnotes ) {
$t_row['project_id'] = $t_note['project_id'];
$t_row['project_name'] = project_get_name( $t_note['project_id'] );
$t_row['bug_summary'] = $t_note['bug_summary'];
$t_row['bug_category'] = $t_note['bug_category'];
$t_row['cost'] = $t_note['cost'];

$t_billing_rows[] = $t_row;
Expand Down

0 comments on commit c67c88b

Please sign in to comment.