* code task #43770,43771,43772,43773,43774,43775,43776.
This commit is contained in:
@@ -54,3 +54,11 @@ $config->report->annualData['month']['story'] = array('opened' => 'create', 'act
|
||||
$config->report->annualData['month']['task'] = array('opened' => 'create', 'started' => 'start', 'finished' => 'finish', 'paused' => 'pause', 'activated' => 'activate', 'canceled' => 'cancel', 'closed' => 'close');
|
||||
$config->report->annualData['month']['bug'] = array('opened' => 'create', 'bugconfirmed' => 'confirm', 'activated' => 'activate', 'resolved' => 'resolve', 'closed' => 'close');
|
||||
$config->report->annualData['month']['case'] = array('opened' => 'create', 'run' => 'run', 'createBug' => 'createBug');
|
||||
|
||||
$config->report->outputData['story'] = array('opened' => 'create', 'changed' => 'change', 'reviewed' => 'review', 'closed' => 'close');
|
||||
$config->report->outputData['productplan'] = array('opened' => 'create');
|
||||
$config->report->outputData['release'] = array('opened' => 'create', 'stoped' => 'stop', 'activated' => 'activate');
|
||||
$config->report->outputData['execution'] = array('opened' => 'create', 'started' => 'start', 'delayed' => 'putoff', 'suspended' => 'suspend', 'closed' => 'close');
|
||||
$config->report->outputData['task'] = array('opened' => 'create', 'assigned' => 'assign', 'finished' => 'finish', 'activated' => 'activate', 'closed' => 'close');
|
||||
$config->report->outputData['bug'] = array('opened' => 'create', 'resolved' => 'resolve', 'activated' => 'activate', 'closed' => 'close');
|
||||
$config->report->outputData['case'] = array('opened' => 'create', 'run' => 'run', 'createBug' => 'createBug');
|
||||
|
||||
@@ -193,6 +193,10 @@ $lang->report->annualData->actionList['assign'] = '指派';
|
||||
$lang->report->annualData->actionList['activate'] = '激活';
|
||||
$lang->report->annualData->actionList['resolve'] = '解决';
|
||||
$lang->report->annualData->actionList['run'] = '执行';
|
||||
$lang->report->annualData->actionList['stop'] = '停止维护';
|
||||
|
||||
$lang->report->annualData->actionList['putoff'] = '延期';
|
||||
$lang->report->annualData->actionList['suspend'] = '挂起';
|
||||
$lang->report->annualData->actionList['change'] = '变更';
|
||||
$lang->report->annualData->actionList['pause'] = '暂停';
|
||||
$lang->report->annualData->actionList['cancel'] = '取消';
|
||||
|
||||
@@ -1063,6 +1063,71 @@ class reportModel extends model
|
||||
|
||||
return $statusOverview;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get output data for API.
|
||||
*
|
||||
* @param array $accounts
|
||||
* @param string $year
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getOutput4API($accounts, $year)
|
||||
{
|
||||
$stmt = $this->dao->select('*')->from(TABLE_ACTION)
|
||||
->where('objectType')->in(array_keys($this->config->report->outputData))
|
||||
->andWhere('LEFT(date, 4)')->eq($year)
|
||||
->beginIF($accounts)->andWhere('actor')->in($accounts)->fi()
|
||||
->query();
|
||||
|
||||
$outputData = array();
|
||||
while($action = $stmt->fetch())
|
||||
{
|
||||
if($action->objectType == 'release' and $action->action == 'changestatus')
|
||||
{
|
||||
if($action->extra == 'terminate') $action->action = 'stoped';
|
||||
if($action->extra == 'normal') $action->action = 'activated';
|
||||
}
|
||||
|
||||
if(!isset($this->config->report->outputData[$action->objectType][$action->action])) continue;
|
||||
if(!isset($outputData[$action->objectType][$action->action])) $outputData[$action->objectType][$action->action] = 0;
|
||||
|
||||
$outputData[$action->objectType][$action->action] += 1;
|
||||
}
|
||||
|
||||
$stmt = $this->dao->select('t1.*')->from(TABLE_ACTION)->alias('t1')
|
||||
->leftJoin(TABLE_BUG)->alias('t2')->on('t1.objectID=t2.id')
|
||||
->where('t1.objectType')->eq('bug')
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->andWhere('LEFT(t1.date, 4)')->eq($year)
|
||||
->andWhere('t1.action')->eq('opened')
|
||||
->andWhere('t2.case')->ne('0')
|
||||
->beginIF($accounts)->andWhere('t1.actor')->in($accounts)->fi()
|
||||
->query();
|
||||
while($action = $stmt->fetch())
|
||||
{
|
||||
if(!isset($outputData['case']['createBug'])) $outputData['case']['createBug'] = 0;
|
||||
$outputData['case']['createBug'] += 1;
|
||||
}
|
||||
|
||||
$processedOutput = array();
|
||||
foreach($this->config->report->outputData as $objectType => $actions)
|
||||
{
|
||||
$objectActions = $outputData[$objectType];
|
||||
$processedOutput[$objectType]['total'] = array_sum($objectActions);
|
||||
|
||||
foreach($actions as $action => $langCode)
|
||||
{
|
||||
if(empty($objectActions[$action])) continue;
|
||||
|
||||
$processedOutput[$objectType]['actions'][$langCode]['code'] = $langCode;
|
||||
$processedOutput[$objectType]['actions'][$langCode]['name'] = $this->lang->report->annualData->actionList[$langCode];
|
||||
$processedOutput[$objectType]['actions'][$langCode]['total'] = $objectActions[$action];
|
||||
}
|
||||
}
|
||||
|
||||
return $processedOutput;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user