* code for task #44947,44948,44949,44950,44956.
This commit is contained in:
@@ -25,6 +25,77 @@ class storyEntry extends Entry
|
||||
|
||||
$data = $this->getData();
|
||||
$story = $data->data->story;
|
||||
|
||||
if(!empty($story->children)) $story->children = array_values((array)$story->children);
|
||||
if(isset($story->planTitle)) $story->planTitle = array_values((array)$story->planTitle);
|
||||
if($story->parent > 0) $story->parentPri = $this->dao->select('pri')->from(TABLE_STORY)->where('id')->eq($story->parent)->fetch('pri');
|
||||
|
||||
/* Set product name */
|
||||
$story->productName = $data->data->product->name;
|
||||
|
||||
/* Set module title */
|
||||
$moduleTitle = '';
|
||||
if($story->module)
|
||||
{
|
||||
$modulePath = $data->data->modulePath;
|
||||
foreach($modulePath as $key => $module)
|
||||
{
|
||||
$moduleTitle .= $module->name;
|
||||
if(isset($modulePath[$key + 1])) $moduleTitle .= '/';
|
||||
}
|
||||
}
|
||||
$story->moduleTitle = $moduleTitle;
|
||||
|
||||
/* Format user for api. */
|
||||
if($story->openedBy) $story->openedBy = $this->formatUser($story->openedBy, $data->data->users);
|
||||
if($story->assignedTo) $story->assignedTo = $this->formatUser($story->assignedTo, $data->data->users);
|
||||
if($story->closedBy) $story->closedBy = $this->formatUser($story->closedBy, $data->data->users);
|
||||
if($story->lastEditedBy) $story->lastEditedBy = $this->formatUser($story->lastEditedBy, $data->data->users);
|
||||
|
||||
$mailto = array();
|
||||
if($story->mailto)
|
||||
{
|
||||
foreach(explode(',', $story->mailto) as $account)
|
||||
{
|
||||
if(empty($account)) continue;
|
||||
$mailto[] = $this->formatUser($account, $data->data->users);
|
||||
}
|
||||
}
|
||||
$story->mailto = $mailto;
|
||||
|
||||
$reviewedBy = array();
|
||||
if($story->reviewedBy)
|
||||
{
|
||||
foreach(explode(',', $story->reviewedBy) as $account)
|
||||
{
|
||||
if(empty($account)) continue;
|
||||
$reviewedBy[] = $this->formatUser($account, $data->data->users);
|
||||
}
|
||||
}
|
||||
$story->reviewedBy = $reviewedBy;
|
||||
|
||||
$storyTasks = array();
|
||||
foreach($story->tasks as $executionTasks)
|
||||
{
|
||||
foreach($executionTasks as $task)
|
||||
{
|
||||
if(!isset($data->data->executions->{$task->execution})) continue;
|
||||
$storyTasks[] = $this->filterFields($task, 'id,name');
|
||||
}
|
||||
}
|
||||
$story->tasks = $storyTasks;
|
||||
|
||||
$story->bugs = array();
|
||||
foreach($data->data->bugs as $bug) $story->bugs[] = $this->filterFields($bug, 'id,title');
|
||||
|
||||
$story->cases = array();
|
||||
foreach($data->data->cases as $case) $story->cases[] = $this->filterFields($case, 'id,title');
|
||||
|
||||
$story->requirements = array();
|
||||
foreach($data->data->relations as $relation) $story->requirements[] = $this->filterFields($relation, 'id,title');
|
||||
|
||||
$story->actions = $this->loadModel('action')->processActionForAPI($data->data->actions, $data->data->users, $this->lang->story);
|
||||
|
||||
$this->send(200, $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user