/** * Print an input field * $p_field_def contains the definition of the custom field (including it's field id * $p_bug_id contains the bug where this field belongs to. If it's left * away, it'll default to 0 and thus belongs to a new (i.e. non-existant) bug * NOTE: This probably belongs in the print_api.php * @param array $p_field_def Custom field definition. * @param integer $p_bug_id A bug identifier. * @return void * @access public */ function print_custom_field_input(array $p_field_def, $p_bug_id = null) { if (null === $p_bug_id) { $t_custom_field_value = custom_field_default_to_value($p_field_def['default_value'], $p_field_def['type']); } else { $t_custom_field_value = custom_field_get_value($p_field_def['id'], $p_bug_id); # If the custom field value is undefined and the field cannot hold a null value, use the default value instead if ($t_custom_field_value === null && ($p_field_def['type'] == CUSTOM_FIELD_TYPE_ENUM || $p_field_def['type'] == CUSTOM_FIELD_TYPE_LIST || $p_field_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || $p_field_def['type'] == CUSTOM_FIELD_TYPE_RADIO)) { $t_custom_field_value = custom_field_default_to_value($p_field_def['default_value'], $p_field_def['type']); } } global $g_custom_field_type_definition; if (isset($g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'])) { call_user_func($g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'], $p_field_def, $t_custom_field_value); } else { trigger_error(ERROR_CUSTOM_FIELD_INVALID_DEFINITION, ERROR); } }
function ERP_print_custom_field_input($p_sel_value, $p_field_def) { if ($p_sel_value === NULL) { $t_custom_field_value = custom_field_default_to_value($p_field_def['default_value'], $p_field_def['type']); } else { $t_custom_field_value = $p_sel_value; } global $g_custom_field_type_definition; if (isset($g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'])) { call_user_func($g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'], $p_field_def, $t_custom_field_value); } else { trigger_error(ERROR_CUSTOM_FIELD_INVALID_DEFINITION, ERROR); } }