/** * Get all details about an issue. * * @param string $p_username The name of the user trying to access the issue. * @param string $p_password The password of the user. * @param integer $p_issue_id The id of the issue to retrieve. * @return Array that represents an IssueData structure */ function mc_issue_get($p_username, $p_password, $p_issue_id) { $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return mci_soap_fault_login_failed(); } $t_lang = mci_get_user_lang($t_user_id); if (!bug_exists($p_issue_id)) { return new soap_fault('Client', '', 'Issue does not exist.'); } $t_project_id = bug_get_field($p_issue_id, 'project_id'); if (!mci_has_readonly_access($t_user_id, $t_project_id)) { return mci_soap_fault_access_denied($t_user_id); } $t_bug = bug_get($p_issue_id, true); $t_issue_data = array(); $t_issue_data['id'] = $p_issue_id; $t_issue_data['view_state'] = mci_enum_get_array_by_id($t_bug->view_state, 'view_state', $t_lang); $t_issue_data['last_updated'] = timestamp_to_iso8601($t_bug->last_updated); $t_issue_data['project'] = mci_project_as_array_by_id($t_bug->project_id); $t_issue_data['category'] = mci_get_category($t_bug->category_id); $t_issue_data['priority'] = mci_enum_get_array_by_id($t_bug->priority, 'priority', $t_lang); $t_issue_data['severity'] = mci_enum_get_array_by_id($t_bug->severity, 'severity', $t_lang); $t_issue_data['status'] = mci_enum_get_array_by_id($t_bug->status, 'status', $t_lang); $t_issue_data['reporter'] = mci_account_get_array_by_id($t_bug->reporter_id); $t_issue_data['summary'] = $t_bug->summary; $t_issue_data['version'] = mci_null_if_empty($t_bug->version); $t_issue_data['build'] = mci_null_if_empty($t_bug->build); $t_issue_data['platform'] = mci_null_if_empty($t_bug->platform); $t_issue_data['os'] = mci_null_if_empty($t_bug->os); $t_issue_data['os_build'] = mci_null_if_empty($t_bug->os_build); $t_issue_data['reproducibility'] = mci_enum_get_array_by_id($t_bug->reproducibility, 'reproducibility', $t_lang); $t_issue_data['date_submitted'] = timestamp_to_iso8601($t_bug->date_submitted); $t_issue_data['sponsorship_total'] = $t_bug->sponsorship_total; if (!empty($t_bug->handler_id)) { $t_issue_data['handler'] = mci_account_get_array_by_id($t_bug->handler_id); } $t_issue_data['projection'] = mci_enum_get_array_by_id($t_bug->projection, 'projection', $t_lang); $t_issue_data['eta'] = mci_enum_get_array_by_id($t_bug->eta, 'eta', $t_lang); $t_issue_data['resolution'] = mci_enum_get_array_by_id($t_bug->resolution, 'resolution', $t_lang); $t_issue_data['fixed_in_version'] = mci_null_if_empty($t_bug->fixed_in_version); $t_issue_data['target_version'] = mci_null_if_empty($t_bug->target_version); $t_issue_data['due_date'] = mci_issue_get_due_date($t_bug); $t_issue_data['description'] = $t_bug->description; $t_issue_data['steps_to_reproduce'] = mci_null_if_empty($t_bug->steps_to_reproduce); $t_issue_data['additional_information'] = mci_null_if_empty($t_bug->additional_information); $t_issue_data['attachments'] = mci_issue_get_attachments($p_issue_id); $t_issue_data['relationships'] = mci_issue_get_relationships($p_issue_id, $t_user_id); $t_issue_data['notes'] = mci_issue_get_notes($p_issue_id); $t_issue_data['custom_fields'] = mci_issue_get_custom_fields($p_issue_id); return $t_issue_data; }
/** * Get all details about an issue. * * @param string $p_username The name of the user trying to access the issue. * @param string $p_password The password of the user. * @param integer $p_issue_id The id of the issue to retrieve. * @return array that represents an IssueData structure */ function mc_issue_get($p_username, $p_password, $p_issue_id) { global $g_project_override; $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return mci_soap_fault_login_failed(); } $t_lang = mci_get_user_lang($t_user_id); if (!bug_exists($p_issue_id)) { return SoapObjectsFactory::newSoapFault('Client', 'Issue does not exist'); } $t_project_id = bug_get_field($p_issue_id, 'project_id'); $g_project_override = $t_project_id; if (!mci_has_readonly_access($t_user_id, $t_project_id)) { return mci_soap_fault_access_denied($t_user_id); } if (!access_has_bug_level(config_get('view_bug_threshold', null, null, $t_project_id), $p_issue_id, $t_user_id)) { return mci_soap_fault_access_denied($t_user_id); } log_event(LOG_WEBSERVICE, 'getting details for issue \'' . $p_issue_id . '\''); $t_bug = bug_get($p_issue_id, true); $t_issue_data = array(); $t_issue_data['id'] = $p_issue_id; $t_issue_data['view_state'] = mci_enum_get_array_by_id($t_bug->view_state, 'view_state', $t_lang); $t_issue_data['last_updated'] = SoapObjectsFactory::newDateTimeVar($t_bug->last_updated); $t_issue_data['project'] = mci_project_as_array_by_id($t_bug->project_id); $t_issue_data['category'] = mci_get_category($t_bug->category_id); $t_issue_data['priority'] = mci_enum_get_array_by_id($t_bug->priority, 'priority', $t_lang); $t_issue_data['severity'] = mci_enum_get_array_by_id($t_bug->severity, 'severity', $t_lang); $t_issue_data['status'] = mci_enum_get_array_by_id($t_bug->status, 'status', $t_lang); $t_issue_data['reporter'] = mci_account_get_array_by_id($t_bug->reporter_id); $t_issue_data['summary'] = mci_sanitize_xml_string($t_bug->summary); $t_issue_data['version'] = mci_null_if_empty($t_bug->version); $t_issue_data['build'] = mci_null_if_empty($t_bug->build); $t_issue_data['profile_id'] = mci_null_if_empty($t_bug->profile_id); $t_issue_data['platform'] = mci_null_if_empty($t_bug->platform); $t_issue_data['os'] = mci_null_if_empty($t_bug->os); $t_issue_data['os_build'] = mci_null_if_empty($t_bug->os_build); $t_issue_data['reproducibility'] = mci_enum_get_array_by_id($t_bug->reproducibility, 'reproducibility', $t_lang); $t_issue_data['date_submitted'] = SoapObjectsFactory::newDateTimeVar($t_bug->date_submitted); $t_issue_data['sticky'] = $t_bug->sticky; $t_issue_data['sponsorship_total'] = $t_bug->sponsorship_total; if (!empty($t_bug->handler_id)) { if (access_has_bug_level(config_get('view_handler_threshold', null, null, $t_project_id), $p_issue_id, $t_user_id)) { $t_issue_data['handler'] = mci_account_get_array_by_id($t_bug->handler_id); } } $t_issue_data['projection'] = mci_enum_get_array_by_id($t_bug->projection, 'projection', $t_lang); $t_issue_data['eta'] = mci_enum_get_array_by_id($t_bug->eta, 'eta', $t_lang); $t_issue_data['resolution'] = mci_enum_get_array_by_id($t_bug->resolution, 'resolution', $t_lang); $t_issue_data['fixed_in_version'] = mci_null_if_empty($t_bug->fixed_in_version); $t_issue_data['target_version'] = mci_null_if_empty($t_bug->target_version); $t_issue_data['due_date'] = mci_issue_get_due_date($t_bug); $t_issue_data['description'] = mci_sanitize_xml_string($t_bug->description); $t_issue_data['steps_to_reproduce'] = mci_null_if_empty(mci_sanitize_xml_string($t_bug->steps_to_reproduce)); $t_issue_data['additional_information'] = mci_null_if_empty(mci_sanitize_xml_string($t_bug->additional_information)); $t_issue_data['attachments'] = mci_issue_get_attachments($p_issue_id); $t_issue_data['relationships'] = mci_issue_get_relationships($p_issue_id, $t_user_id); $t_issue_data['notes'] = mci_issue_get_notes($p_issue_id); $t_issue_data['custom_fields'] = mci_issue_get_custom_fields($p_issue_id); $t_issue_data['monitors'] = mci_account_get_array_by_ids(bug_get_monitors($p_issue_id)); $t_issue_data['tags'] = mci_issue_get_tags_for_bug_id($p_issue_id, $t_user_id); return $t_issue_data; }