Exemplo n.º 1
0
function mc_project_get_issue_headers($p_username, $p_password, $p_project_id, $p_page_number, $p_per_page)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (!project_exists($p_project_id)) {
        return new soap_fault('Client', '', "Project '{$p_project_id}' does not exist.");
    }
    if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    $t_page_count = 0;
    $t_bug_count = 0;
    $t_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, null, $p_project_id);
    $t_result = array();
    foreach ($t_rows as $t_issue_data) {
        $t_id = $t_issue_data->id;
        $t_issue = array();
        $t_issue['id'] = $t_id;
        $t_issue['view_state'] = $t_issue_data->view_state;
        $t_issue['last_updated'] = timestamp_to_iso8601($t_issue_data->last_updated);
        $t_issue['project'] = $t_issue_data->project_id;
        $t_issue['category'] = mci_get_category($t_issue_data->category_id);
        $t_issue['priority'] = $t_issue_data->priority;
        $t_issue['severity'] = $t_issue_data->severity;
        $t_issue['status'] = $t_issue_data->status;
        $t_issue['reporter'] = $t_issue_data->reporter_id;
        $t_issue['summary'] = $t_issue_data->summary;
        if (!empty($t_issue_data->handler_id)) {
            $t_issue['handler'] = $t_issue_data->handler_id;
        }
        $t_issue['resolution'] = $t_issue_data->resolution;
        $t_issue['attachments_count'] = count(mci_issue_get_attachments($t_issue_data->id));
        $t_issue['notes_count'] = count(mci_issue_get_notes($t_issue_data->id));
        $t_result[] = $t_issue;
    }
    return $t_result;
}
Exemplo n.º 2
0
/**
 * Returns an array for SOAP encoding from a BugData object
 *
 * @param BugData $p_issue_data A BugData object to process.
 * @return array The issue header data as an array
 */
function mci_issue_data_as_header_array(BugData $p_issue_data)
{
    $t_issue = array();
    $t_id = $p_issue_data->id;
    $t_issue['id'] = $t_id;
    $t_issue['view_state'] = $p_issue_data->view_state;
    $t_issue['last_updated'] = SoapObjectsFactory::newDateTimeVar($p_issue_data->last_updated);
    $t_issue['project'] = $p_issue_data->project_id;
    $t_issue['category'] = mci_get_category($p_issue_data->category_id);
    $t_issue['priority'] = $p_issue_data->priority;
    $t_issue['severity'] = $p_issue_data->severity;
    $t_issue['status'] = $p_issue_data->status;
    $t_issue['reporter'] = $p_issue_data->reporter_id;
    $t_issue['summary'] = mci_sanitize_xml_string($p_issue_data->summary);
    if (!empty($p_issue_data->handler_id)) {
        $t_issue['handler'] = $p_issue_data->handler_id;
    } else {
        $t_issue['handler'] = null;
    }
    $t_issue['resolution'] = $p_issue_data->resolution;
    $t_issue['attachments_count'] = count(mci_issue_get_attachments($p_issue_data->id));
    $t_issue['notes_count'] = count(mci_issue_get_notes($p_issue_data->id));
    return $t_issue;
}
Exemplo n.º 3
0
/**
 * Returns an array for SOAP encoding from a BugData object
 *
 * @param BugData $p_issue_data
 * @param int $p_user_id
 * @param string $p_lang
 * @return array The issue as an array
 */
function mci_issue_data_as_array( $p_issue_data, $p_user_id, $p_lang ) {

		$t_id = $p_issue_data->id;

		$t_issue = array();
		$t_issue['id'] = $t_id;
		$t_issue['view_state'] = mci_enum_get_array_by_id( $p_issue_data->view_state, 'view_state', $p_lang );
		$t_issue['last_updated'] = timestamp_to_iso8601( $p_issue_data->last_updated );

		$t_issue['project'] = mci_project_as_array_by_id( $p_issue_data->project_id );
		$t_issue['category'] = mci_get_category( $p_issue_data->category_id );
		$t_issue['priority'] = mci_enum_get_array_by_id( $p_issue_data->priority, 'priority', $p_lang );
		$t_issue['severity'] = mci_enum_get_array_by_id( $p_issue_data->severity, 'severity', $p_lang );
		$t_issue['status'] = mci_enum_get_array_by_id( $p_issue_data->status, 'status', $p_lang );

		$t_issue['reporter'] = mci_account_get_array_by_id( $p_issue_data->reporter_id );
		$t_issue['summary'] = $p_issue_data->summary;
		$t_issue['version'] = mci_null_if_empty( $p_issue_data->version );
		$t_issue['build'] = mci_null_if_empty( $p_issue_data->build );
		$t_issue['platform'] = mci_null_if_empty( $p_issue_data->platform );
		$t_issue['os'] = mci_null_if_empty( $p_issue_data->os );
		$t_issue['os_build'] = mci_null_if_empty( $p_issue_data->os_build );
		$t_issue['reproducibility'] = mci_enum_get_array_by_id( $p_issue_data->reproducibility, 'reproducibility', $p_lang );
		$t_issue['date_submitted'] = timestamp_to_iso8601( $p_issue_data->date_submitted );
		$t_issue['sponsorship_total'] = $p_issue_data->sponsorship_total;

		if( !empty( $p_issue_data->handler_id ) ) {
			$t_issue['handler'] = mci_account_get_array_by_id( $p_issue_data->handler_id );
		}
		$t_issue['projection'] = mci_enum_get_array_by_id( $p_issue_data->projection, 'projection', $p_lang );
		$t_issue['eta'] = mci_enum_get_array_by_id( $p_issue_data->eta, 'eta', $p_lang );

		$t_issue['resolution'] = mci_enum_get_array_by_id( $p_issue_data->resolution, 'resolution', $p_lang );
		$t_issue['fixed_in_version'] = mci_null_if_empty( $p_issue_data->fixed_in_version );
		$t_issue['target_version'] = mci_null_if_empty( $p_issue_data->target_version );

		$t_issue['description'] = bug_get_text_field( $t_id, 'description' );

		$t_steps_to_reproduce = bug_get_text_field( $t_id, 'steps_to_reproduce' );
		$t_issue['steps_to_reproduce'] = mci_null_if_empty( $t_steps_to_reproduce );

		$t_additional_information = bug_get_text_field( $t_id, 'additional_information' );
		$t_issue['additional_information'] = mci_null_if_empty( $t_additional_information );

		$t_issue['attachments'] = mci_issue_get_attachments( $p_issue_data->id );
		$t_issue['relationships'] = mci_issue_get_relationships( $p_issue_data->id, $p_user_id );
		$t_issue['notes'] = mci_issue_get_notes( $p_issue_data->id );
		$t_issue['custom_fields'] = mci_issue_get_custom_fields( $p_issue_data->id );

		return $t_issue;
}
Exemplo n.º 4
0
/**
 * Get the issue headers that match the specified filter and paging details.
 *
 * @param string $p_username  The name of the user trying to access the filters.
 * @param string $p_password  The password of the user.
 * @param integer $p_filter_id  The id of the filter to apply.
 * @param integer $p_page_number  Start with the given page number (zero-based)
 * @param integer $p_per_page  Number of issues to display per page
 * @return Array that represents an IssueDataArray structure
 */
function mc_filter_get_issue_headers($p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    $t_page_count = 0;
    $t_bug_count = 0;
    $t_filter = filter_db_get_filter($p_filter_id);
    $t_filter_detail = explode('#', $t_filter, 2);
    if (!isset($t_filter_detail[1])) {
        return new soap_fault('Server', '', 'Invalid Filter');
    }
    $t_filter = unserialize($t_filter_detail[1]);
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_result = array();
    $t_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id);
    foreach ($t_rows as $t_issue_data) {
        $t_id = $t_issue_data->id;
        $t_issue = array();
        $t_issue['id'] = $t_id;
        $t_issue['view_state'] = $t_issue_data->view_state;
        $t_issue['last_updated'] = timestamp_to_iso8601($t_issue_data->last_updated);
        $t_issue['project'] = $t_issue_data->project_id;
        $t_issue['category'] = mci_get_category($t_issue_data->category_id);
        $t_issue['priority'] = $t_issue_data->priority;
        $t_issue['severity'] = $t_issue_data->severity;
        $t_issue['status'] = $t_issue_data->status;
        $t_issue['reporter'] = $t_issue_data->reporter_id;
        $t_issue['summary'] = $t_issue_data->summary;
        if (!empty($t_issue_data->handler_id)) {
            $t_issue['handler'] = $t_issue_data->handler_id;
        }
        $t_issue['resolution'] = $t_issue_data->resolution;
        $t_issue['attachments_count'] = count(mci_issue_get_attachments($t_issue_data->id));
        $t_issue['notes_count'] = count(mci_issue_get_notes($t_issue_data->id));
        $t_result[] = $t_issue;
    }
    return $t_result;
}
Exemplo n.º 5
0
/**
 * 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);
    $t_lang = mci_get_user_lang($t_user_id);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    if (!bug_exists($p_issue_id)) {
        return new soap_fault('Server', '', '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 new soap_fault('Client', '', 'Access Denied');
    }
    $t_bug = get_object_vars(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_null_if_empty($t_bug['category']);
    $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['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;
}
Exemplo n.º 6
0
/**
 * Returns an array for SOAP encoding from a BugData object
 * 
 * @param BugData $p_issue_data
 * @return array The issue header data as an array
 */
function mci_issue_data_as_header_array($p_issue_data)
{
    $t_issue = array();
    $t_id = $p_issue_data->id;
    $t_issue['id'] = $t_id;
    $t_issue['view_state'] = $p_issue_data->view_state;
    $t_issue['last_updated'] = timestamp_to_iso8601($p_issue_data->last_updated, false);
    $t_issue['project'] = $p_issue_data->project_id;
    $t_issue['category'] = mci_get_category($p_issue_data->category_id);
    $t_issue['priority'] = $p_issue_data->priority;
    $t_issue['severity'] = $p_issue_data->severity;
    $t_issue['status'] = $p_issue_data->status;
    $t_issue['reporter'] = $p_issue_data->reporter_id;
    $t_issue['summary'] = $p_issue_data->summary;
    if (!empty($p_issue_data->handler_id)) {
        $t_issue['handler'] = $p_issue_data->handler_id;
    }
    $t_issue['resolution'] = $p_issue_data->resolution;
    $t_issue['attachments_count'] = count(mci_issue_get_attachments($p_issue_data->id));
    $t_issue['notes_count'] = count(mci_issue_get_notes($p_issue_data->id));
    return $t_issue;
}