View Issue Details

IDProjectCategoryView StatusLast Update
0010891mantisbtcustomizationpublic2010-04-23 23:22
Reportermbariola Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
Product Version1.1.8 
Summary0010891: view_all_bug_page.php : Projection column does not correctly display language strings
Description

Hello,

I wanted to add the "projection" column to the issue list in my Mantis installation. Unfortunately, the system does not fetch the strings corresponding to the projection levels, while it correctly does so on the issue details page. Please check the attached pic.

This is what I added to my conf files:

config_inc.php:

$g_projection_enum_string = '10:none,70:major rework,90:redesign';

strings_italian.txt:

$s_projection_enum_string = "10:nessuna,70:complesso,90:molto complesso";

I don't understand the reason why the strings are also present in the config_inc.php file .. :-) but all other, similar modifications I made worked smoothly, and indeed the correct strings (nessuna, compleso, molto complesso) appear in the issue details page; they simply do not show up on the issue list page.

Am I doing something wrong?

Cheers,

M.

Steps To Reproduce

append this to config_inc.php:

$g_projection_enum_string = '10:none,70:major rework,90:redesign';

and this to strings_italian.txt:

$s_projection_enum_string = "10:nessuna,70:complesso,90:molto complesso";

visit /view_all_bug_page.php on your mantis installation

TagsNo tags attached.
Attached Files
mantis_snippet.png (21,250 bytes)   
mantis_snippet.png (21,250 bytes)   

Relationships

duplicate of 0010816 closeddhx Projection column shows integer value instead of string 

Activities

mbariola

mbariola

2009-08-31 11:26

reporter   ~0022837

Forgot this line ...

$g_view_issues_page_columns = array ( 'selection', 'edit', 'priority', 'id', 'sponsorship_total', 'bugnotes_count', 'attachment', 'category', 'severity', 'status', 'eta', 'date_submitted', 'last_updated', 'summary' );

mmoch

mmoch

2009-11-23 11:58

reporter   ~0023788

Hi! I wanted this too - I fixed this in 1.1.8 by adding a custom_function_override_print_column_value() function to custom_functions_inc.php... I've pasted the code below - I'm sure it doesn't look great but your editor should be able to help with that. ;)

function custom_function_override_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 ) {
        # this is a custom field
        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 {
        # this is NOT a custom field - resolve the function we will use
        # to print the field based on the field's name
        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 ) ) {
            # the function resolved above exists somewhere in the Mantis API
            if ( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) {
                # for CSV output
                $t_function( $p_issue_row[$p_column] );
            } else {
                # non-CSV output
                $t_function( $p_issue_row, $p_columns_target );
            }
        } else {
            # TODO get project to print

            # --------------------
            # There is no print function for this column, so
            # I had to hack this in here. Works fine.
            #  -mmoch
            if( $p_column == 'projection' ) {
                $projection = get_enum_element( $p_column, $p_issue_row[$p_column] );
                $projection = ( $projection ) ? $projection : $t_column_empty;
                echo $t_column_start . $projection . $t_column_end;
            }
            else if ( isset( $p_issue_row[$p_column] ) ) {
                echo $t_column_start . $p_issue_row[$p_column] . $t_column_end;
            } else {
                echo $t_column_start . '@' . $p_column . '@' . $t_column_end;
            }
        }
    }
}
dhx

dhx

2009-11-23 21:22

reporter   ~0023793

I believe this has already been fixed as part of 0010816

If you upgrade to 1.2.0RC2 or later you shouldn't see this problem any more. If you do, please let me know (add a note to this ticket or open a new bug report).

Thanks.