Skip to content

Commit 131f26d

Browse files
author
atisne
committed
Add the ability to enable the ITS when linking it with a project
1 parent 5e27b9f commit 131f26d

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

lib/api/xmlrpc/v1/xmlrpc.class.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ class TestlinkXMLRPCServer extends IXR_Server {
216216
public static $testCaseVersionParamName = "tcversion";
217217
public static $itsNameParamName = "itsname";
218218
public static $itsEnabledParamName = "itsenabled";
219-
public static $itsTypeParamName = "itstype";
220-
public static $itsCfgParamName = "itscfg";
219+
public static $itsTypeParamName = "type";
220+
public static $itsCfgParamName = "cfg";
221221
public static $itsIDParamName ="itsid";
222222

223223
public static $copyTestersFromBuildParamName = "copytestersfrombuild";
@@ -8364,6 +8364,8 @@ public function updateIssueTrackerSystem($args) {
83648364
* @param string $args["devKey"]
83658365
* @param string $args["itsid"] ITS ID
83668366
* @param string $args["testprojectid"] Project ID
8367+
* @param boolean $args["itsEnabled"] Enabled the ITS or not
8368+
* OPTIONAL
83678369
* @access public
83688370
*/
83698371
public function setTestProjectITS($args) {
@@ -8378,16 +8380,34 @@ public function setTestProjectITS($args) {
83788380
return $this->errors;
83798381
}
83808382

8383+
$itsID = $this->args[self::$itsIDParamName];
83818384
if ($this->args[self::$itsIDParamName] != "") {
83828385
if(is_null( $this->itsMgr )) {
83838386
$this->itsMgr = new tlIssueTracker( $this->dbObj );
83848387
}
83858388

8386-
$this->itsMgr->link($this->args[self::$itsIDParamName], $this->args[self::$testProjectIDParamName]);
8389+
$projectID = $this->args[self::$testProjectIDParamName];
8390+
$this->itsMgr->link($itsID, $projectID);
83878391
$resultInfo = array();
8388-
$resultInfo[]= array("operation" => __FUNCTION__,
8389-
"additionalInfo" => null,
8390-
"status" => true, "id" => $this->args[self::$testProjectIDParamName], "message" => GENERAL_SUCCESS_STR);
8392+
$resultInfo[]= array("operation" => "link ITS",
8393+
"additionalInfo" => "ITS ID " . $itsID,
8394+
"status" => true,
8395+
"id" => $projectID, "message" => GENERAL_SUCCESS_STR);
8396+
8397+
// enable the ITS if needed
8398+
$isEnabled = false;
8399+
if ($this->_isParamPresent(self::$itsEnabledParamName)) {
8400+
$isEnabled = ($this->args[self::$itsEnabledParamName] > 0);
8401+
}
8402+
8403+
if ($isEnabled) {
8404+
$this->tprojectMgr->enableIssueTracker($projectID);
8405+
$resultInfo[]= array("operation" => "enable ITS",
8406+
"additionalInfo" => null,
8407+
"status" => true,
8408+
"id" => $projectID, "message" => GENERAL_SUCCESS_STR);
8409+
}
8410+
83918411
return $resultInfo;
83928412
} else {
83938413
$this->errors[] = new IXR_Error(NO_ITSID, $messagePrefix . NO_ITSID_STR);

locale/en_GB/strings.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3162,7 +3162,7 @@ $TLS_API_NO_TESTSUITEID = "No testsuiteid provided.";
31623162
$TLS_API_NO_TPID = "No testplan ID (testplanid) provided.";
31633163
$TLS_API_NO_TCID = "No testcase ID (testcaseid) provided.";
31643164
$TLS_API_NO_PLATFORMID = "No Platform ID (platformid) provided.";
3165-
$TLS_API_NO_ITSID = "NO ITS ID (itsid) provided.";
3165+
$TLS_API_NO_ITSID = "No Issue Tracker System ID (itsid) provided.";
31663166

31673167

31683168
$TLS_API_INVALID_TCASEID = "The Test Case ID (testcaseid: %s) provided does not exist!";

0 commit comments

Comments
 (0)