View Issue Details

IDProjectCategoryView StatusLast Update
0009320mantisbtapi soappublic2009-01-15 11:26
Reporterlukasschroeder Assigned Tovboctor  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.2.0a1 
Fixed in Version1.2.0a3 
Summary0009320: mc_filter_get broken after refactoring api/soap/mc_filter_api.php for 1.2.0a1 [patch]
Description
  1. mci_issue_get_relationships should not get t_issue_id but t_user_id (right?)

  2. mci_filter_db_get_available_queries did not work exactly the same way filter_db_get_available_queries does, as the comment states:
    /**

    • Basically this is a copy of core/filter_api.php#filter_db_get_available_queries().
    • The only difference is that the result of this function is not an array of filter
    • names but an array of filter structures.
      */

the patch keeps the refactoring, e.g. does not reintroduce the mci_ version, but refactors filter_dbget....() and its users.

patch applies to v1.2.0a1

Tagspatch
Attached Files
mantis_120a1_mconnect_filter_get.diff (3,758 bytes)   
Index: query_store_page.php
===================================================================
--- query_store_page.php	(revision 4)
+++ query_store_page.php	(working copy)
@@ -43,9 +43,9 @@
 
 	# Let's just see if any of the current filters are the
 	# same as the one we're about the try and save
-	foreach( $t_query_arr as $t_id => $t_name ) {
-		if ( filter_db_get_filter( $t_id ) == $t_query_to_store ) {
-			print lang_get( 'query_exists' ) . ' (' . $t_name . ')<br />';
+	foreach( $t_query_arr as $t_query_row ) {
+		if ( filter_db_get_filter( $t_query_row["id"] ) == $t_query_to_store ) {
+			print lang_get( 'query_exists' ) . ' (' . $t_query_row["name"] . ')<br />';
 		}
 	}
 
Index: query_store.php
===================================================================
--- query_store.php	(revision 4)
+++ query_store.php	(working copy)
@@ -49,8 +49,8 @@
 	# Check and make sure they don't already have a
 	# query with the same name
 	$t_query_arr = filter_db_get_available_queries();
-	foreach( $t_query_arr as $t_id => $t_name )	{
-		if ( $f_query_name == $t_name ) {
+	foreach( $t_query_arr as $t_query_row )	{
+		if ( $f_query_name == $t_query_row["name"] ) {
 			$t_query_redirect_url = $t_query_redirect_url . '?error_msg='
 				. urlencode( lang_get( 'query_dupe_name' ) );
 			print_header_redirect( $t_query_redirect_url );
Index: api/soap/mc_filter_api.php
===================================================================
--- api/soap/mc_filter_api.php	(revision 4)
+++ api/soap/mc_filter_api.php	(working copy)
@@ -116,7 +116,7 @@
 			$t_issue['additional_information'] = mci_null_if_empty( $t_additional_information );
 
 			$t_issue['attachments'] = mci_issue_get_attachments( $t_issue_data['id'] );
-			$t_issue['relationships'] = mci_issue_get_relationships( $t_issue_data['id'], $t_issue_id );
+			$t_issue['relationships'] = mci_issue_get_relationships( $t_issue_data['id'], $t_user_id );
 			$t_issue['notes'] = mci_issue_get_notes( $t_issue_data['id'] );
 			$t_issue['custom_fields'] = mci_issue_get_custom_fields( $t_issue_data['id'] );
 
Index: core/filter_api.php
===================================================================
--- core/filter_api.php	(revision 4)
+++ core/filter_api.php	(working copy)
@@ -2845,8 +2845,8 @@
 					<option value="-1"><?php PRINT '[' . lang_get( 'reset_query' ) . ']' ?></option>
 					<option value="-1"></option>
 					<?php
-					foreach( $t_stored_queries_arr as $t_query_id => $t_query_name ) {
-						PRINT '<option value="' . $t_query_id . '">' . $t_query_name . '</option>';
+					foreach( $t_stored_queries_arr as $t_query_row ) {
+						PRINT '<option value="' . $t_query_row["id"] . '">' . $t_query_row["name"] . '</option>';
 					}
 					?>
 					</select>
@@ -3138,12 +3138,12 @@
 		for ( $i = 0; $i < $query_count; $i++ ) {
 			$row = db_fetch_array( $result );
 			if ( ( $row['user_id'] == $t_user_id ) || db_prepare_bool( $row['is_public'] ) ) {
-				$t_overall_query_arr[$row['id']] = $row['name'];
+				$t_overall_query_arr[$row['name']] = $row;
 			}
 		}
 
-		$t_overall_query_arr = array_unique( $t_overall_query_arr );
-		asort( $t_overall_query_arr );
+		ksort( $t_overall_query_arr );
+		$t_overall_query_arr = array_values( $t_overall_query_arr );
 
 		return $t_overall_query_arr;
 	}
Index: query_view_page.php
===================================================================
--- query_view_page.php	(revision 4)
+++ query_view_page.php	(working copy)
@@ -55,7 +55,9 @@
 	$t_column_count = 0;
 	$t_max_column_count = 2;
 
-	foreach( $t_query_arr as $t_id => $t_name ) {
+	foreach( $t_query_arr as $t_row ) {
+		$t_id = $t_row["id"];
+		$t_name = $t_row["name"];
 		if ( $t_column_count == 0 ) {
 			print '<tr ' . helper_alternate_class() . '>';
 		}

Activities

lukasschroeder

lukasschroeder

2008-07-01 10:43

reporter   ~0018259

...there seems to be even more broken with 1.2.0a1 and at least the eclipse plugin. i cannot successfully load query results with 1.2.0a1

lukasschroeder

lukasschroeder

2008-07-01 17:07

reporter   ~0018265

api/soap/mc_issue_api.php not recactored in line with interface change of bugnote_get_all_visible_bugnotes(...)

Index: api/soap/mc_issue_api.php

--- api/soap/mc_issue_api.php (revision 10)
+++ api/soap/mc_issue_api.php (revision 11)
@@ -259,7 +259,7 @@
$t_user_bugnote_order = 'ASC'; // always get the notes in ascending order for consistency to the calling application.

    $t_result = array();
  • foreach( bugnote_get_all_visible_bugnotes( $p_issue_id, $t_user_access_level, $t_user_bugnote_order, 0 ) as $t_value ) {
  • 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 );
grangeway

grangeway

2008-11-29 19:35

reporter   ~0020136

Hello,

From what I can tell having just been over this patch, the issues that this patch fixes (ignoring formatting changes) have already been commited to git.mantisbt.org

Thanks
Paul