diff --git a/lib/issuetrackerintegration/redminerestInterface.class.php b/lib/issuetrackerintegration/redminerestInterface.class.php index 3c4c0296ef..7e4a7751d5 100644 --- a/lib/issuetrackerintegration/redminerestInterface.class.php +++ b/lib/issuetrackerintegration/redminerestInterface.class.php @@ -23,29 +23,28 @@ class redminerestInterface extends issueTrackerInterface * @param str $type (see tlIssueTracker.class.php $systems property) * @param xml $cfg **/ - function __construct($type,$config,$name) - { - $this->name = $name; - $this->interfaceViaDB = false; - $this->methodOpt['buildViewBugLink'] = array('addSummary' => true, 'colorByStatus' => false); - - $this->defaultResolvedStatus = array(); - $this->defaultResolvedStatus[] = array('code' => 3, 'verbose' => 'resolved'); - $this->defaultResolvedStatus[] = array('code' => 5, 'verbose' => 'closed'); + function __construct($type,$config,$name) { + $this->name = $name; + $this->interfaceViaDB = false; + $this->methodOpt['buildViewBugLink'] = array('addSummary' => true, 'colorByStatus' => false); + + $this->defaultResolvedStatus = array(); + $this->defaultResolvedStatus[] = array('code' => 3, 'verbose' => 'resolved'); + $this->defaultResolvedStatus[] = array('code' => 5, 'verbose' => 'closed'); - if( !$this->setCfg($config) ) - { - return false; - } + $this->canSetReporter = true; + if( !$this->setCfg($config) ) { + return false; + } - // http://www.redmine.org/issues/6843 - // "Target version" is the new display name for this property, - // but it's still named fixed_version internally and thus in the API. - // $issueXmlObj->addChild('fixed_version_id', (string)2); - $this->translate['targetversion'] = 'fixed_version_id'; + // http://www.redmine.org/issues/6843 + // "Target version" is the new display name for this property, + // but it's still named fixed_version internally and thus in the API. + // $issueXmlObj->addChild('fixed_version_id', (string)2); + $this->translate['targetversion'] = 'fixed_version_id'; - $this->completeCfg(); - $this->setResolvedStatusCfg(); + $this->completeCfg(); + $this->setResolvedStatusCfg(); $this->connect(); } @@ -315,8 +314,8 @@ function checkBugIDExistence($issueID) * - custom_fields - See Custom fields * - watcher_user_ids - Array of user ids to add as watchers (since 2.3.0) */ - public function addIssue($summary,$description,$opt=null) - { + public function addIssue($summary,$description,$opt=null) { + $reporter = null; if(!is_null($opt) && property_exists($opt, 'reporter')) { $reporter = $opt->reporter; @@ -327,7 +326,8 @@ public function addIssue($summary,$description,$opt=null) if( !property_exists($this->cfg,'projectidentifier') ) { throw new exception(__METHOD__ . " project identifier is MANDATORY"); } - + + try { // needs json or xml $issueXmlObj = new SimpleXMLElement(''); @@ -345,13 +345,7 @@ public function addIssue($summary,$description,$opt=null) // Got from XML Configuration // improvement $pid = (string)$this->cfg->projectidentifier; - if(is_string($pid)) { - $pinfo = $this->APIClient->getProjectByIdentity($pid); - if(!is_null($pinfo)) { - $pid = (int)$pinfo->id; - } - } - $issueXmlObj->addChild('project_id', (string)$pid); + $issueXmlObj->addChild('project_id',$pid); if( property_exists($this->cfg,'trackerid') ) { $issueXmlObj->addChild('tracker_id', (string)$this->cfg->trackerid); @@ -362,7 +356,6 @@ public function addIssue($summary,$description,$opt=null) $issueXmlObj->addChild('parent_issue_id', (string)$this->cfg->parent_issue_id); } - // Why issuesAttr is issue ? // Idea was // on XML config on TestLink provide direct access to a minimun set of MANDATORY @@ -409,7 +402,7 @@ public function addIssue($summary,$description,$opt=null) } // $op = $this->APIClient->addIssueFromSimpleXML($issueXmlObj); - file_put_contents('/var/testlink/' . __CLASS__ . '.log', $xml); + //file_put_contents('/var/testlink/' . __CLASS__ . '.log', $xml); $op = $this->APIClient->addIssueFromXMLString($xml,$reporter);