Hi all,
I created a numeric float custom field like this:
My custom field was displayed like this:
but I would print this custom filed on a custom format like this:
How can I do it?
Thanks.
How to format a numeric custom field?
Moderators: Developer, Contributor
Re: How to format a numeric custom field?
I found a solution, in bug_view_inv.php:
Let me know if there is a better solution.
Thank you.
Code: Select all
# Custom Fields
if( isset( $t_issue['custom_fields'] ) ) {
foreach( $t_issue['custom_fields'] as $t_custom_field ) {
$t_def = custom_field_get_definition( $t_custom_field['field']['id'] );
echo '<tr>';
echo '<th class="bug-custom-field category" colspan="2">', string_display_line( lang_get_defaulted( $t_def['name'] ) ), '</th>';
echo '<td class="bug-custom-field" colspan="4">';
//print_custom_field_value( $t_def, $t_custom_field['field']['id'], $f_issue_id );
if($t_def['type']==2 && is_numeric ($t_custom_field['value'])){
echo number_format($t_custom_field['value'], 2, ",", ".");
}else{
print_custom_field_value( $t_def, $t_custom_field['field']['id'], $f_issue_id );
}
echo '</td></tr>';
}
Thank you.