View Issue Details

IDProjectCategoryView StatusLast Update
0007928mantisbtbugtrackerpublic2007-08-02 02:28
Reporterdeboutv Assigned Tovboctor  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.1.0a2 
Fixed in Version1.1.0a4 
Summary0007928: print_column_eta function missing
Description

The function print_column_eta is missing so if user add 'eta' in the $g_view_issues_page_columns configuration value, eta is displayed as number.

Steps To Reproduce

Workaround:

In the custom_functions_inc.php file (create it if not exists) add the following function:


function custom_function_default_print_column_value( $p_column, $p_issue_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
if ( COLUMNS_TARGET_CSV_PAGE == $p_columns_target ) {
$t_column_start = '';
$t_column_end = '';
$t_column_empty = '';
} else {
$t_column_start = '<td>';
$t_column_end = '</td>';
$t_column_empty = ' ';
}

    if ( strpos( $p_column, 'custom_' ) === 0 ) {
        echo $t_column_start;
        $t_custom_field = substr( $p_column, 7 );

        $t_field_id = custom_field_get_id_from_name( $t_custom_field );
        if ( $t_field_id === false ) {
            echo '@', $t_custom_field, '@';
        } else {
            $t_issue_id = $p_issue_row['id'];
            $t_project_id = $p_issue_row['project_id'];

            if ( custom_field_is_linked( $t_field_id, $t_project_id ) ) {
                $t_def = custom_field_get_definition( $t_field_id );
                print_custom_field_value( $t_def, $t_field_id, $t_issue_id );
            } else {
                // field is not linked to project
                echo $t_column_empty;
            }
        }
        echo $t_column_end;
    } else {
        if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) {
            $t_function = 'print_column_' . $p_column;
        } else {
            $t_function = 'csv_format_' . $p_column;
        }

        if ( function_exists( $t_function ) ) {
            if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) {
                $t_function( $p_issue_row, $p_columns_target );
            } else {
                $t_function( $p_issue_row[$p_column] );
            }
        } else {
            if ( isset( $p_issue_row[$p_column] ) ) {
                if ( $p_column == 'eta' ) {
                    echo '<td class="center">', get_enum_element( 'eta', $p_row['eta'] ), '</td>';
                } else {
                    echo $t_column_start . $p_issue_row[$p_column] . $t_column_end;
                }
            } else {
                echo $t_column_start . '@' . $p_column . '@' . $t_column_end;
            }
        }
    }
}

TagsNo tags attached.

Activities

deboutv

deboutv

2007-05-01 17:03

reporter   ~0014411

Last edited: 2007-05-01 17:13

The name of the function must be customfunctionoverride_print_column_value instead of custom_function_default_print_column_value and
echo $t_column_start . get_enumelement( 'eta', $pissue_row['eta'] ) . $t_column_end;
instead of
echo '<td class="center">', get_enum_element( 'eta', $p_row['eta'] ), '</td>';

vboctor

vboctor

2007-05-02 01:12

manager   ~0014416

Last edited: 2007-05-02 01:16

This is confirmed on the latest code. The fix should be to add a function like the following to core/columns_api.php

# --------------------
# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
function print_column_eta( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
    if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) {
        echo '<td class="center">', get_enum_element( 'eta', $p_row['eta'] ), '</td>';
    } else {
        echo get_enum_element( 'eta', $p_row['eta'] );
    }
}

I haven't verified this yet. If you get a chance to verify it, then please add a comment to the issue.

The columns_api.php other print function should be verified to make sure they handle the CSV case as appropriate since in this case we shouldn't be generating TD HTML tags. For example, see print_column_id() and print_column_resolution().

deboutv

deboutv

2007-05-04 04:31

reporter   ~0014429

Yes it works fine (for view, print and CSV).