diff --git a/module/workestimation/control.php b/module/workestimation/control.php index f5151fd211..32d6f61478 100644 --- a/module/workestimation/control.php +++ b/module/workestimation/control.php @@ -11,6 +11,13 @@ */ class workestimation extends control { + /** + * Index + * + * @param int $program + * @access public + * @return void + */ public function index($program = 0) { $program = $program ? $program : $this->session->program; @@ -27,7 +34,7 @@ class workestimation extends control $budget = $this->workestimation->getBudget($program); if(!isset($this->config->project)) $this->config->project = new stdclass(); - if(empty($budget)) + if(empty($budget)) { $this->app->loadConfig('estimate'); $budget = new stdclass(); diff --git a/module/workestimation/model.php b/module/workestimation/model.php index d749bbe3b4..b1f13a38ce 100644 --- a/module/workestimation/model.php +++ b/module/workestimation/model.php @@ -11,11 +11,25 @@ */ class workestimationModel extends model { + /** + * Get a budget + * + * @param int $program + * @access public + * @return array + */ public function getBudget($program) { return $this->dao->select('*')->from(TABLE_WORKESTIMATION)->where('program')->eq($program)->fetch(); } + /** + * Get program scale + * + * @param int $program + * @access public + * @return int + */ public function getProgramScale($program) { $products = $this->loadModel('product')->getPairs($program); @@ -23,13 +37,20 @@ class workestimationModel extends model return $this->dao->select('cast(sum(estimate) as decimal(10,2)) as scale')->from(TABLE_STORY)->where('product')->in($productIdList)->andWhere('type')->eq('requirement')->fetch('scale'); } + /** + * Save a budget + * + * @param int $program + * @access public + * @return bool + */ public function save($program) { $budget = $this->getBudget($program); $postBudget = fixer::input('post')->get(); $postBudget->program = $program; - if(empty($budget)) + if(empty($budget)) { $this->dao->insert(TABLE_WORKESTIMATION) ->batchcheck($this->config->workestimation->index->requiredFields, 'notempty') diff --git a/module/workestimation/view/index.html.php b/module/workestimation/view/index.html.php index d3455d2bba..bbd2fe84dd 100644 --- a/module/workestimation/view/index.html.php +++ b/module/workestimation/view/index.html.php @@ -1,3 +1,15 @@ + + * @package workestimation + * @version $Id: index.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $ + * @link http://www.zentao.net + */ +?>