View Issue Details

IDProjectCategoryView StatusLast Update
0012237mantisbtcustom fieldspublic2011-08-05 02:15
ReporterJoeZhu Assigned Toatrol  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionduplicate 
Product Version1.2.1 
Summary0012237: bug of Validate the custom fields
Description

Note "a necessary field *** was empty" when the the custom field is Enumeration type and NOT Required On Report.
If the custom field is string, it's OK.

Steps To Reproduce

1 Define a custom field as Enumeration type
Read Access/Write Access:manager
NOT Required On Report
2 Use an account whose permission is reporter to report an issue
Reporter cannot see the custom field but when click 'submit report' button, there is a note "a necessary field *** was empty.pls recheck your input ..."

Additional Information

The following code in bug_report.php may be wrong

# Validate the custom fields before adding the bug.
$t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id );
foreach( $t_related_custom_field_ids as $t_id ) {
    $t_def = custom_field_get_definition( $t_id );

    # Produce an error if the field is required but wasn't posted
    if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) &&
        ( $t_def['require_report'] ||
            $t_def['type'] == CUSTOM_FIELD_TYPE_ENUM ||
            $t_def['type'] == CUSTOM_FIELD_TYPE_LIST ||
            $t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST ||
            $t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) {
        error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
        trigger_error( ERROR_EMPTY_FIELD, ERROR );
    }
    if ( !custom_field_validate( $t_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ) ){
        error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
        trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
    }
}
TagsNo tags attached.

Relationships

duplicate of 0011684 closedvboctor Incorrect error "A necessary field "MyField" was empty. Please recheck your inputs." when submitting new issue 

Activities

There are no notes attached to this issue.