/** * Get all visible notes for a specific issue * * @param integer $p_issue_id The id of the issue to retrieve the notes for. * @return array that represents an SOAP IssueNoteData structure */ function mci_issue_get_notes($p_issue_id) { $t_user_id = auth_get_current_user_id(); $t_lang = mci_get_user_lang($t_user_id); $t_project_id = bug_get_field($p_issue_id, 'project_id'); $t_user_bugnote_order = 'ASC'; # always get the notes in ascending order for consistency to the calling application. $t_has_time_tracking_access = access_has_bug_level(config_get('time_tracking_view_threshold'), $p_issue_id); $t_result = array(); foreach (bugnote_get_all_visible_bugnotes($p_issue_id, $t_user_bugnote_order, 0) as $t_value) { $t_bugnote = array(); $t_bugnote['id'] = $t_value->id; $t_bugnote['reporter'] = mci_account_get_array_by_id($t_value->reporter_id); $t_bugnote['date_submitted'] = SoapObjectsFactory::newDateTimeString($t_value->date_submitted); $t_bugnote['last_modified'] = SoapObjectsFactory::newDateTimeString($t_value->last_modified); $t_bugnote['text'] = mci_sanitize_xml_string($t_value->note); $t_bugnote['view_state'] = mci_enum_get_array_by_id($t_value->view_state, 'view_state', $t_lang); $t_bugnote['time_tracking'] = $t_has_time_tracking_access ? $t_value->time_tracking : 0; $t_bugnote['note_type'] = $t_value->note_type; $t_bugnote['note_attr'] = $t_value->note_attr; $t_result[] = $t_bugnote; } return count($t_result) == 0 ? null : $t_result; }