Skip to content

Commit ecf3eb7

Browse files
committedDec 6, 2011
Allow mc_project_get_{issues,issue_headers} to work with ALL_PROJECTS
Fixes #13526: It is not possible to retrieve issues for 'All Projects'
1 parent f58911e commit ecf3eb7

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed
 

‎api/soap/mc_project_api.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function mc_project_get_issues( $p_username, $p_password, $p_project_id, $p_page
1414

1515
$t_lang = mci_get_user_lang( $t_user_id );
1616

17-
if( !project_exists( $p_project_id ) ) {
17+
if( $p_project_id != ALL_PROJECTS && !project_exists( $p_project_id ) ) {
1818
return new soap_fault( 'Client', '', "Project '$p_project_id' does not exist." );
1919
}
2020

@@ -854,7 +854,7 @@ function mc_project_get_issue_headers( $p_username, $p_password, $p_project_id,
854854
if( $t_user_id === false ) {
855855
return mci_soap_fault_login_failed();
856856
}
857-
if( !project_exists( $p_project_id ) ) {
857+
if( $p_project_id != ALL_PROJECTS && !project_exists( $p_project_id ) ) {
858858
return new soap_fault( 'Client', '', "Project '$p_project_id' does not exist." );
859859
}
860860

‎tests/soap/FilterTest.php

+65
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,43 @@ public function testGetIssuesPaged() {
235235
$this->doTestGetPages('mc_project_get_issues');
236236
}
237237

238+
public function testGetAllProjectsIssues() {
239+
240+
$initialIssues = $this->getAllProjectsIssues();
241+
242+
$issueToAdd = $this->getIssueToAdd( 'FilterTest.testGetAllProjectsIssues' );
243+
244+
$issueId = $this->client->mc_issue_add(
245+
$this->userName,
246+
$this->password,
247+
$issueToAdd);
248+
249+
$this->deleteAfterRun( $issueId );
250+
251+
$projectIssues = $this->getAllProjectsIssues();
252+
253+
$this->assertEquals( 1, count( $projectIssues ) - count( $initialIssues ), "count(projectIssues) - count(initialIssues)");
254+
$this->assertEquals( $issueId, $projectIssues[0]->id, "issueId");
255+
}
256+
257+
public function testGetAllProjectsIssueHeaders() {
258+
259+
$initialIssues = $this->getAllProjectsIssueHeaders();
260+
261+
$issueToAdd = $this->getIssueToAdd( 'FilterTest.testGetProjectIssueHeaders' );
262+
263+
$issueId = $this->client->mc_issue_add(
264+
$this->userName,
265+
$this->password,
266+
$issueToAdd);
267+
268+
$this->deleteAfterRun( $issueId );
269+
270+
$projectIssues = $this->getAllProjectsIssueHeaders();
271+
272+
$this->assertEquals( 1, count( $projectIssues ) - count( $initialIssues ), "count(projectIssues) - count(initialIssues)" );
273+
$this->assertEquals( $issueId, $projectIssues[0]->id, "issueId" );
274+
}
238275

239276
/**
240277
*
@@ -249,6 +286,20 @@ private function getProjectIssues() {
249286
0,
250287
self::ISSUES_TO_RETRIEVE);
251288
}
289+
290+
/**
291+
*
292+
* @return Array the project issues
293+
*/
294+
private function getAllProjectsIssues() {
295+
296+
return $this->client->mc_project_get_issues(
297+
$this->userName,
298+
$this->password,
299+
0,
300+
0,
301+
self::ISSUES_TO_RETRIEVE);
302+
}
252303

253304
/**
254305
*
@@ -263,4 +314,18 @@ private function getProjectIssueHeaders() {
263314
0,
264315
self::ISSUES_TO_RETRIEVE);
265316
}
317+
318+
/**
319+
*
320+
* @return Array the project issues
321+
*/
322+
private function getAllProjectsIssueHeaders() {
323+
324+
return $this->client->mc_project_get_issue_headers(
325+
$this->userName,
326+
$this->password,
327+
0,
328+
0,
329+
self::ISSUES_TO_RETRIEVE);
330+
}
266331
}

0 commit comments

Comments
 (0)