* set default year.

This commit is contained in:
wangyidong
2019-12-31 15:03:22 +08:00
parent 59b479d21d
commit 384b1b2f24
2 changed files with 20 additions and 9 deletions
+2
View File
@@ -7,6 +7,8 @@ $config->report->dailyreminder->task = true;
$config->report->dailyreminder->todo = true;
$config->report->dailyreminder->testTask = true;
$config->report->annualData['minMonth'] = 2;
$config->report->annualData['po']['block1'] = array('title' => 'baseInfo', 'data' => array('logins', 'involvedProducts', 'createdPlans', 'createdStories'));
$config->report->annualData['po']['block2'] = array('title' => 'productOverview', 'data' => array());
$config->report->annualData['po']['block3'] = array('title' => '', 'data' => array('products'));
+18 -9
View File
@@ -246,8 +246,24 @@ class report extends control
*/
public function annualData($year = '')
{
if(empty($year)) $year = date('Y');
$account = $this->app->user->account;
$account = $this->app->user->account;
$firstAction = $this->dao->select('*')->from(TABLE_ACTION)->orderBy('id')->limit(1)->fetch();
$firstYear = substr($firstAction->date, 0, 4);
$currentYear = date('Y');
$years = array();
for($thisYear = $firstYear; $thisYear <= $currentYear; $thisYear ++) $years[$thisYear] = $thisYear;
if(empty($year))
{
$year = date('Y');
$month = date('n');
if($month <= $this->config->report->annualData['minMonth'])
{
$year -= 1;
if(!isset($years[$year])) $year += 1;
}
}
$role = 'po';
if($this->app->user->role == 'dev' or $this->app->user->role == 'td' or $this->app->user->role == 'pm') $role = 'dev';
@@ -335,13 +351,6 @@ class report extends control
$data['productStat'] = $productStat;
}
$firstAction = $this->dao->select('*')->from(TABLE_ACTION)->orderBy('id')->limit(1)->fetch();
$firstYear = substr($firstAction->date, 0, 4);
$currentYear = date('Y');
$years = array();
for($thisYear = $firstYear; $thisYear <= $currentYear; $thisYear ++) $years[$thisYear] = $thisYear;
$this->view->title = sprintf($this->lang->report->annualData->title, $year, $this->app->user->realname);
$this->view->data = $data;
$this->view->role = $role;