diff --git a/module/report/config.php b/module/report/config.php index d9d227cdaa..9c1ea60972 100644 --- a/module/report/config.php +++ b/module/report/config.php @@ -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')); diff --git a/module/report/control.php b/module/report/control.php index 062cabcd7c..6058ad8635 100644 --- a/module/report/control.php +++ b/module/report/control.php @@ -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;