function prepare_bug_record($group_id, &$col_list, &$record) { global $datetime_fmt; /* Prepare the column values in the bug record Input: a row from the bug table (passed by reference. Output: the same row with values transformed for export */ reset($col_list); $line = ''; while (list(, $col) = each($col_list)) { if (bug_data_is_text_field($col) || bug_data_is_text_area($col)) { // all text fields converted from HTML to ASCII $record[$col] = prepare_textarea($record[$col]); } else { if (bug_data_is_select_box($col) && $col != 'severity' && !bug_data_is_username_field($col)) { // All value_ids transformed in human readable values // except severity that remains a number and usernames // which are already in clear $record[$col] = bug_data_get_cached_field_value($col, $group_id, $record[$col]); } else { if (bug_data_is_date_field($col)) { // replace the date fields (unix time) with human readable dates that // is also accepted as a valid format in future import if ($record[$col] == '') { // if date undefined then set datetime to 0. Ideally should // NULL as well but if we pass NULL it is interpreted as a string // later in the process $record[$col] = '0'; } else { $record[$col] = format_date($datetime_fmt, $record[$col]); } } } } } $bug_id = $record['bug_id']; $record['follow_ups'] = pe_utils_format_bug_followups($group_id, $bug_id); $record['is_dependent_on_task_id'] = pe_utils_format_bug_task_dependencies($group_id, $bug_id); $record['is_dependent_on_bug_id'] = pe_utils_format_bug_bug_dependencies($group_id, $bug_id); }
function prepare_bug_history_record($group_id, &$col_list, &$record) { global $datetime_fmt; /* Prepare the column values in the bug history record Input: a row from the bug_history database (passed by reference. Output: the same row with values transformed for export */ // replace the modification date field with human readable dates $record['date'] = format_date($datetime_fmt, $record['date']); if (bug_data_is_select_box($record['field_name']) && $record['field_name'] != 'severity') { // asking for the value of a value_id for each new // history record can become a significant bottleneck // for projects with lots of bugs. A solution is to cache // the values when we get them the first time (either here // or in the bug_data_get_value function $record['old_value'] = bug_data_get_cached_field_value($record['field_name'], $group_id, $record['old_value']); } else { // Make close date human readable if ($record['field_name'] == 'close_date') { if ($record['old_value'] == 0) { $record['old_value'] = ''; } else { $record['old_value'] = format_date($datetime_fmt, $record['old_value']); } } // revert HTML entities to ASCII code in text fields if ($record['field_name'] == 'summary' || $record['field_name'] == 'details') { $record['old_value'] = prepare_textarea($record['old_value']); } } // Decode the comment type value. If null make sure there is // a blank entry in the array if (isset($record['type'])) { $record['type'] = bug_data_get_cached_field_value('comment_type_id', $group_id, $record['type']); } else { $record['type'] = ''; } }