Example #1
0
/**
 * Gets the formatted value for the specified issue id, project and custom field.
 * @param $p_issue_id The issue id.
 * @param $p_project_id The project id.
 * @param $p_custom_field The custom field name (without 'custom_' prefix).
 * @returns The custom field value.
 */
function excel_format_custom_field($p_issue_id, $p_project_id, $p_custom_field)
{
    $t_field_id = custom_field_get_id_from_name($p_custom_field);
    if ($t_field_id === false) {
        return excel_prepare_string('@' . $p_custom_field . '@');
    }
    if (custom_field_is_linked($t_field_id, $p_project_id)) {
        $t_def = custom_field_get_definition($t_field_id);
        return excel_prepare_string(string_custom_field_value($t_def, $t_field_id, $p_issue_id));
    }
    // field is not linked to project
    return excel_prepare_string('');
}
Example #2
0
/**
 * Print a custom field value for display
 * NOTE: This probably belongs in the print_api.php
 * @param array   $p_def      Contains the definition of the custom field.
 * @param integer $p_field_id Contains the id of the field.
 * @param integer $p_bug_id   Contains the bug id to display the custom field value for.
 * @return void
 * @access public
 */
function print_custom_field_value(array $p_def, $p_field_id, $p_bug_id)
{
    echo string_custom_field_value($p_def, $p_field_id, $p_bug_id);
}
Example #3
0
/**
 * Gets the formatted value for the specified issue id, project and custom field.
 * @param integer $p_issue_id     The issue id.
 * @param integer $p_project_id   The project id.
 * @param string  $p_custom_field The custom field name (without 'custom_' prefix).
 * @return string The custom field value.
 */
function excel_format_custom_field($p_issue_id, $p_project_id, $p_custom_field)
{
    $t_field_id = custom_field_get_id_from_name($p_custom_field);
    if ($t_field_id === false) {
        return excel_prepare_string('@' . $p_custom_field . '@');
    }
    if (custom_field_is_linked($t_field_id, $p_project_id)) {
        $t_def = custom_field_get_definition($t_field_id);
        if ($t_def['type'] == CUSTOM_FIELD_TYPE_NUMERIC) {
            return excel_prepare_number(string_custom_field_value($t_def, $t_field_id, $p_issue_id));
        }
        return excel_prepare_string(string_custom_field_value($t_def, $t_field_id, $p_issue_id));
    }
    # field is not linked to project
    return excel_prepare_string('');
}