* code for task #43761.
This commit is contained in:
@@ -33,6 +33,13 @@ class productEntry extends Entry
|
||||
}
|
||||
|
||||
$product = $this->format($data->data->product, 'createdDate:time');
|
||||
|
||||
$users = $this->loadModel('user')->getPairs('noletter|nodeleted');
|
||||
$product->PO = $this->formatUser($product->PO, $users);
|
||||
$product->QD = $this->formatUser($product->QD, $users);
|
||||
$product->RD = $this->formatUser($product->RD, $users);
|
||||
$product->createdBy = $this->formatUser($product->createdBy, $users);
|
||||
if(isset($product->feedback)) $product->feedback = $this->formatUser($product->feedback, $users);
|
||||
if(!$fields) return $this->send(200, $product);
|
||||
|
||||
/* Set other fields. */
|
||||
@@ -50,6 +57,27 @@ class productEntry extends Entry
|
||||
$product->modules = $data->data->tree;
|
||||
}
|
||||
break;
|
||||
case 'actions':
|
||||
$actions = $this->loadModel('action')->getList('product', $productID);
|
||||
$actions = $this->action->transformActions($actions);
|
||||
|
||||
$product->actions = array();
|
||||
foreach($actions as $action)
|
||||
{
|
||||
$action = $this->filterFields($action, 'id,objectType,objectID,actor,action,date,comment,extra,objectName,originalDate,actionLabel,objectLabel,history');
|
||||
$action->actor = $this->formatUser($action->actor, $users);
|
||||
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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -546,6 +546,23 @@ class baseEntry
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format user.
|
||||
*
|
||||
* @param string $account
|
||||
* @param array $users
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function formatUser($account, $users)
|
||||
{
|
||||
$user = array();
|
||||
$user['account'] = $account;
|
||||
$user['realname'] = zget($users, $account);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型转换.
|
||||
* Typecasting.
|
||||
|
||||
Reference in New Issue
Block a user