Skip to content

Commit

Permalink
Merge pull request sugarcrm#27 from arazumenko-sugarcrm/moduleFor7conn
Browse files Browse the repository at this point in the history
COGNOS-131 - When todo making completed unassigned user
  • Loading branch information
afedyk-sugarcrm committed May 22, 2014
2 parents 7dffbbe + 5fce18c commit 909fa19
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions SugarModules/custom/include/IBMConnections/Api/ActivitiesAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,22 @@ public function markToDoCompleted($id, $completed = true)
$this->httpClient = $this->getHttpClient();
$newEntry = IBMEditableAtomEntry::createEmptyEditableEntry();
$newEntry->addCategory('todo', 'http://www.ibm.com/xmlns/prod/sn/type', 'To Do');

$todoEntry = $this->getActivityNode($id);
$nodeList = $todoEntry->getAtom()->xquery("./snx:assignedto");
if($nodeList->length > 0) {
$node = $nodeList->item(0);
$assignedTo = array(
"name" => $node->attributes->getNamedItem("name")->textContent,
"id" => $node->attributes->getNamedItem("userid")->textContent,
"email" => $node->textContent
);
$assignedElt = $newEntry->getDom()->createElement('snx:assignedto');
$assignedElt->setAttribute('name', $assignedTo['name']);
$assignedElt->setAttribute('userid', $assignedTo['id']);
$newEntry->getEntryNode()->appendChild($assignedElt);
}

if ($completed) {
$newEntry->addCategory('completed', 'http://www.ibm.com/xmlns/prod/sn/flags', 'Completed');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,9 @@ public static function createActivityNodeFromEntry(IBMAtomEntry $atomEntry, IBMA
$GLOBALS['log']->fatal("Unrecognized Activity node type: " . $type['term']);
}
}

public function getAtom()
{
return $this->atom;
}
}

0 comments on commit 909fa19

Please sign in to comment.