MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011913mantisbtapi soappublic2010-05-11 09:502010-12-17 04:37
Reporternerville 
Assigned Torombert 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.2.1 
Target Version1.2.3Fixed in Version1.2.3 
Summary0011913: [patch] Update project description, status, name of a specific project using SOAP API
DescriptionPlease find as attachment a patch to add ability to update a project description of a specific project using SOAP API.

Currently, the SOAP API in 1.2.1 is not providing such functions.

My patch (git format) include PHPUnit tests.
TagsNo tags attached.
Attached Filespatch file icon api.soap.feature.update.project.description.git.patch [^] (8,536 bytes) 2010-05-11 09:50 [Show Content]
? file icon api.soap.feature.update.project.description.git.patch2 [^] (9,485 bytes) 2010-06-03 04:59
? file icon api.soap.feature.update.project.description.git.patch3 [^] (12,578 bytes) 2010-06-03 05:08
? file icon api.soap.feature.update.project.description.git.patch4 [^] (13,915 bytes) 2010-08-17 03:28
? file icon api.soap.feature.update.project.description.git.patch5 [^] (16,089 bytes) 2010-08-18 12:05
? file icon api.soap.feature.update.project.description.git.patch6 [^] (20,102 bytes) 2010-08-23 05:35

- Relationships

-  Notes
User avatar (0025467)
dhx (developer)
2010-05-11 10:06

Robert, is this suitable for 1.2.2? I would assume so as we seem to be happy adding plugin hooks upon request so that people can develop better plugins against the 1.2.x branch.
User avatar (0025475)
rombert (developer)
2010-05-11 13:44

This is suitable for 1.2.2 as it is an addition, and breaks no existing behaviour . I'll review the patch but since we already have a successful submission from nerville I expect no problems.
User avatar (0025524)
rombert (developer)
2010-05-17 18:12

Some comments, regarding implementation only:

1. Why does the method return the project id? It's passed in as a parameter anyway.
2. Please move the unique name check higher up in the method.
3. Are you sure it's a good idea to reset values to defaults if not provided? I would suggest either reading the existing data from the database and updating only when a value is passed in or simply requiring all the fields to be filled in.
User avatar (0025578)
nerville (reporter)
2010-05-21 11:44

Hi,
Nice catch.
I will submit a new patch as soon as possible... I'm in vacation :-)
User avatar (0025579)
rombert (developer)
2010-05-21 11:45

Sure thing, enjoy your vacation :-)
User avatar (0025671)
nerville (reporter)
2010-06-03 05:04

Please dont use the patch2 file....... it's a mistake.
User avatar (0025672)
nerville (reporter)
2010-06-03 05:08

Back from vacation, I updated my patch following your advice.

Answer to 1: returns value is bool as project_update returns bool
Answer to 2: done
Answer to 3: done

The right patch is the patch3 file.
Sorry for the wrong previous upload.
User avatar (0026113)
nerville (reporter)
2010-07-21 11:41

Any update on this topic ?
User avatar (0026114)
rombert (developer)
2010-07-21 16:54

Sorry, I know it's been a long time since you posted the patch, but I'm out of time right now. I hope to take a look at it during the next month.
User avatar (0026339)
rombert (developer)
2010-08-16 17:19

Looks good, but when I run the unit tests I get

PHP Fatal error:  Call to undefined function mc_project_as_array_by_id() in /home/robert/public_html/mantisbt/tests/soap/ProjectTest.php 
on line 55


I suggest you stay away from 'internal' methods and use your own to-array conversion, if needed.
User avatar (0026342)
nerville (reporter)
2010-08-17 03:29

Hi,
my mistake.
Small fix include in patch4 :

---
 tests/soap/ProjectTest.php | 5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/soap/ProjectTest.php b/tests/soap/ProjectTest.php
index c7447de..1b4f00c 100644
--- a/tests/soap/ProjectTest.php
+++ b/tests/soap/ProjectTest.php
@@ -52,7 +52,7 @@ class ProjectTest extends SoapBase {

                $this->projectIdToDelete[] = $projectId;

- $projectArray = mc_project_as_array_by_id(
+ $projectArray = $this->client->mc_project_as_array_by_id(
                        $this->userName,
                        $this->password,
                        $projectId);
@@ -67,7 +67,7 @@ class ProjectTest extends SoapBase {
                        $projectId,
                        $projectDataStructure);

- $projectArray = mc_project_as_array_by_id(
+ $projectArray = $this->client->mc_project_as_array_by_id(
                        $this->userName,
                        $this->password,
                        $projectId);
@@ -101,4 +101,3 @@ class ProjectTest extends SoapBase {
        }

 }
User avatar (0026345)
rombert (developer)
2010-08-17 18:00

Now I get

<code>There was 1 error:

1) ProjectTest::testAddRenameDeleteProject
SoapFault: Function ("mc_project_as_array_by_id") is not a valid method for this service

/home/robert/public_html/mantisbt/tests/soap/ProjectTest.php:58</code>

If there's anything I can assist you with in running the SOAP tests cases, please let me know.
User avatar (0026352)
nerville (reporter)
2010-08-18 12:05

Ok I got the error.
The main problem here is that I didn't add in my patch the mc_project_as_array_by_id function.

This function is based on mci_project_as_array_by_id

Please find new attachment.
Any advice on this specific topic is welcome.
User avatar (0026363)
rombert (developer)
2010-08-18 17:53

Rather than adding a new SOAP function just for a unit test, couldn't you invoke mc_projects_get_user_accessible and filter the result by the already known project id?
User avatar (0026411)
nerville (reporter)
2010-08-23 05:36

I followed your advice.
Hope it works. I'm running into troubles to use soap extension here.
User avatar (0026635)
rombert (developer)
2010-09-08 17:45

Thanks!

Finally got around to applying this. Some fixes where needed for the tests, but otherwise we're fine.

If you need help running the soap tests - as I think coding in the blind is quite hard - please read http://www.mantisforge.org/dev/manual/master/en/developers.html#DEV.CONTRIB.TEST [^] and ask on the mailing list for the clarifications. I'd be happy to assist you with setting up a testing environment, as I welcome your contributions to the SOAP API.

- Related Changesets
MantisBT: master 25e8a533
Timestamp: 2010-06-03 08:59:41
Author: nerville
Committer: rombert
Details ] Diff ]
Update project description, status, name of a specific project using SOAP API

Fixes 0011913

Signed-off-by: Robert Munteanu <robert.munteanu@gmail.com>
mod - tests/soap/AllTests.php Diff ] File ]
add - tests/soap/ProjectTest.php Diff ] File ]
mod - api/soap/mantisconnect.php Diff ] File ]
mod - api/soap/mc_project_api.php Diff ] File ]
MantisBT: master-1.2.x da9a8eff
Timestamp: 2010-06-03 08:59:41
Author: nerville
Committer: rombert
Details ] Diff ]
Update project description, status, name of a specific project using SOAP API

Fixes 0011913

Signed-off-by: Robert Munteanu <robert.munteanu@gmail.com>
mod - api/soap/mc_project_api.php Diff ] File ]
add - tests/soap/ProjectTest.php Diff ] File ]
mod - api/soap/mantisconnect.php Diff ] File ]
mod - tests/soap/AllTests.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2010-05-11 09:50 nerville New Issue
2010-05-11 09:50 nerville File Added: api.soap.feature.update.project.description.git.patch
2010-05-11 10:04 dhx Status new => acknowledged
2010-05-11 10:06 dhx Note Added: 0025467
2010-05-11 10:06 dhx Target Version => 1.2.2
2010-05-11 13:43 rombert Assigned To => rombert
2010-05-11 13:43 rombert Status acknowledged => assigned
2010-05-11 13:44 rombert Note Added: 0025475
2010-05-17 18:12 rombert Note Added: 0025524
2010-05-17 18:12 rombert Status assigned => feedback
2010-05-21 11:44 nerville Note Added: 0025578
2010-05-21 11:44 nerville Status feedback => assigned
2010-05-21 11:45 rombert Note Added: 0025579
2010-05-21 11:45 rombert Status assigned => feedback
2010-06-03 04:59 nerville File Added: api.soap.feature.update.project.description.git.patch2
2010-06-03 05:04 nerville Note Added: 0025671
2010-06-03 05:04 nerville Status feedback => assigned
2010-06-03 05:08 nerville File Added: api.soap.feature.update.project.description.git.patch3
2010-06-03 05:08 nerville Note Added: 0025672
2010-07-21 11:41 nerville Note Added: 0026113
2010-07-21 16:54 rombert Note Added: 0026114
2010-07-21 16:54 rombert Description Updated View Revisions
2010-07-29 10:41 jreese Target Version 1.2.2 => 1.2.3
2010-08-16 17:19 rombert Note Added: 0026339
2010-08-16 17:19 rombert Status assigned => feedback
2010-08-17 03:28 nerville File Added: api.soap.feature.update.project.description.git.patch4
2010-08-17 03:29 nerville Note Added: 0026342
2010-08-17 03:29 nerville Status feedback => assigned
2010-08-17 18:00 rombert Note Added: 0026345
2010-08-18 12:05 nerville Note Added: 0026352
2010-08-18 12:05 nerville File Added: api.soap.feature.update.project.description.git.patch5
2010-08-18 17:53 rombert Note Added: 0026363
2010-08-18 17:53 rombert Status assigned => feedback
2010-08-23 05:35 nerville File Added: api.soap.feature.update.project.description.git.patch6
2010-08-23 05:36 nerville Note Added: 0026411
2010-08-23 05:36 nerville Status feedback => assigned
2010-09-08 17:42 rombert Changeset attached => MantisBT master 25e8a533
2010-09-08 17:42 rombert Changeset attached => MantisBT master-1.2.x da9a8eff
2010-09-08 17:42 rombert Resolution open => fixed
2010-09-08 17:42 rombert Fixed in Version => 1.2.3
2010-09-08 17:45 rombert Note Added: 0026635
2010-09-08 17:45 rombert Status assigned => resolved
2010-12-17 04:37 rombert Status resolved => closed


MantisBT 1.2.16dev master-1.2.x-8c2bd07 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.1353 seconds.
memory usage: 2,926 KB
Powered by Mantis Bugtracker