Skip to content

Commit

Permalink
fix: remove useless call to redmine
Browse files Browse the repository at this point in the history
  • Loading branch information
fmancardi committed Apr 26, 2019
1 parent 21eb691 commit 498cc54
Showing 1 changed file with 25 additions and 32 deletions.
57 changes: 25 additions & 32 deletions lib/issuetrackerintegration/redminerestInterface.class.php
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
Expand All @@ -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('<?xml version="1.0"?><issue></issue>');
Expand All @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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);


Expand Down

0 comments on commit 498cc54

Please sign in to comment.