* code for task #44306.
This commit is contained in:
@@ -21,6 +21,7 @@ class executionsEntry extends entry
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
$appendFields = $this->param('fields', '');
|
||||
$withProject = $this->param('withProject', '');
|
||||
|
||||
$control = $this->loadController('execution', 'all');
|
||||
$control->all($this->param('status', 'all'), $this->param('project', $projectID), $this->param('order', 'id_desc'), 0, 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
@@ -28,14 +29,24 @@ class executionsEntry extends entry
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$pager = $data->data->pager;
|
||||
$result = array();
|
||||
$pager = $data->data->pager;
|
||||
$projects = $data->data->projects;
|
||||
$result = array();
|
||||
foreach($data->data->executionStats as $execution)
|
||||
{
|
||||
$execution = $this->filterFields($execution, 'id,name,project,code,type,parent,begin,end,status,openedBy,openedDate,' . $appendFields);
|
||||
foreach($execution->hours as $field => $value) $execution->$field = $value;
|
||||
|
||||
$execution = $this->filterFields($execution, 'id,name,project,code,type,parent,begin,end,status,openedBy,openedDate,delay,progress,' . $appendFields);
|
||||
$result[] = $this->format($execution, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool');
|
||||
}
|
||||
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'executions' => $result));
|
||||
|
||||
$data = array();
|
||||
$data['page'] = $pager->pageID;
|
||||
$data['total'] = $pager->recTotal;
|
||||
$data['limit'] = $pager->recPerPage;
|
||||
$data['executions'] = $result;
|
||||
if(!empty($withProject)) $data['projects'] = $projects;
|
||||
return $this->send(200, $data);
|
||||
}
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class productEntry extends Entry
|
||||
|
||||
$product = $this->format($data->data->product, 'createdDate:time');
|
||||
|
||||
$users = $this->loadModel('user')->getPairs('noletter|nodeleted');
|
||||
$users = $data->data->users;
|
||||
$product->PO = $this->formatUser($product->PO, $users);
|
||||
$product->QD = $this->formatUser($product->QD, $users);
|
||||
$product->RD = $this->formatUser($product->RD, $users);
|
||||
@@ -60,31 +60,8 @@ class productEntry extends Entry
|
||||
case 'actions':
|
||||
$product->addComment = common::hasPriv('action', 'comment') ? true : false;
|
||||
|
||||
$actions = $this->loadModel('action')->getList('product', $productID);
|
||||
$product->actions = array();
|
||||
foreach($actions as $action)
|
||||
{
|
||||
$action->actor = zget($users, $action->actor);
|
||||
if($action->action == 'assigned') $action->extra = zget($users, $action->extra);
|
||||
if(strpos($action->actor, ':') !== false) $action->actor = substr($action->actor, strpos($action->actor, ':') + 1);
|
||||
|
||||
ob_start();
|
||||
$this->action->printAction($action);
|
||||
$action->desc = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$action = $this->filterFields($action, 'id,objectType,objectID,actor,action,date,comment,extra,desc,history');
|
||||
if($action->history)
|
||||
{
|
||||
foreach($action->history as $i => $history)
|
||||
{
|
||||
$history = $this->filterFields($history, 'id,field,old,new,diff');
|
||||
$history->fieldName = zget($this->lang->product, $history->field);
|
||||
$action->history[$i] = $history;
|
||||
}
|
||||
}
|
||||
$product->actions[] = $action;
|
||||
}
|
||||
$actions = $data->data->actions;
|
||||
$product->actions = $this->loadModel('action')->processActionForAPI($actions, $users, $this->lang->product);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user