View Issue Details

IDProjectCategoryView StatusLast Update
0032918mantisbtcustom fieldspublic2023-09-22 16:23
Reportersara_claudia Assigned Todregad  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionwon't fix 
Product Version2.25.2 
Summary0032918: Custom field empty should not be shown on view page
Description

Hello everyone,

I have a question:

I have this custom field called 'ACE' that is sometimes filled and sometimes not. When it's empty, I don't want it to appear on the bug view page at all. Currently, 'ACE' is displayed along with an empty line, but I would like it to be hidden when it's empty.

Thank you so much.

TagsNo tags attached.

Activities

dregad

dregad

2023-09-06 09:30

developer   ~0068073

You mean not showing the line with the custom field (as shown on screenshot) in view.php at all when it's not set ?

If so, this is currently not feasible, and TBH I'm not sure this is desirable, as it would make the user interface unpredictable.

Anyway, you could achieve this by modifying (at your own risk) the foreach loop in bug_view_inc.php line 641, skipping the loop if the custom field value is not set, like this (not tested):

 # Custom Fields
 if( isset( $t_issue['custom_fields'] ) ) {
        foreach( $t_issue['custom_fields'] as $t_custom_field ) {
+               if( custom_field_get_value( $t_custom_field['field']['id'], $f_bug_id ) === null ) {
+                       continue;
+               }
                $t_def = custom_field_get_definition( $t_custom_field['field']['id'] );
                $t_class = $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? ' cfdef-textarea' : '';
image.png (32,661 bytes)   
image.png (32,661 bytes)