From 2839e05c8cfdfc045ae6beeda0de2c7ce25e0777 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Thu, 25 Mar 2010 03:14:21 +0000 Subject: [PATCH] + add the required fields of story. --- module/story/config.php | 6 ++++++ module/story/model.php | 10 +++++----- module/story/view/create.html.php | 6 +++--- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 module/story/config.php diff --git a/module/story/config.php b/module/story/config.php new file mode 100644 index 0000000000..8dd2c1025d --- /dev/null +++ b/module/story/config.php @@ -0,0 +1,6 @@ +story->create->requiredFields = 'estimate,title'; +$config->story->edit->requiredFields = 'estimate,title'; +$config->story->change->requiredFields = 'title'; +$config->story->close->requiredFields = 'closedReason'; +$config->story->review->requiredFields = 'assignedTo,reviewedBy,result'; diff --git a/module/story/model.php b/module/story/model.php index 580173b4c3..e0d2f29568 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -74,7 +74,7 @@ class storyModel extends model ->setIF($this->post->needNotReview, 'status', 'active') ->remove('files,labels,spec,needNotReview') ->get(); - $this->dao->insert(TABLE_STORY)->data($story)->autoCheck()->batchCheck('title,estimate', 'notempty')->exec(); + $this->dao->insert(TABLE_STORY)->data($story)->autoCheck()->batchCheck($this->config->story->create->requiredFields, 'notempty')->exec(); if(!dao::isError()) { $storyID = $this->dao->lastInsertID(); @@ -116,7 +116,7 @@ class storyModel extends model $this->dao->update(TABLE_STORY) ->data($story) ->autoCheck() - ->check('title', 'notempty') + ->batchCheck($this->config->story->change->requiredFields, 'notempty') ->where('id')->eq((int)$storyID)->exec(); if(!dao::isError()) { @@ -165,7 +165,7 @@ class storyModel extends model $this->dao->update(TABLE_STORY) ->data($story) ->autoCheck() - ->batchCheck('title,estimate', 'notempty') + ->batchCheck($this->config->story->edit->requiredFields, 'notempty') ->checkIF($story->closedBy, 'closedReason', 'notempty') ->checkIF($story->closedReason == 'done', 'stage', 'notempty') ->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty') @@ -209,7 +209,7 @@ class storyModel extends model ->get(); $this->dao->update(TABLE_STORY)->data($story) ->autoCheck() - ->batchCheck('assignedTo, reviewedBy', 'notempty') + ->batchCheck($this->config->story->review->requiredFields, 'notempty') ->checkIF($this->post->result == 'reject', 'closedReason', 'notempty') ->checkIF($this->post->result == 'reject' and $this->post->closedReason == 'duplicate', 'duplicateStory', 'notempty') ->checkIF($this->post->result == 'reject' and $this->post->closedReason == 'subdivided', 'childStories', 'notempty') @@ -246,7 +246,7 @@ class storyModel extends model ->get(); $this->dao->update(TABLE_STORY)->data($story) ->autoCheck() - ->check('closedReason', 'notempty') + ->batchCheck($this->config->story->close->requiredFields, 'notempty') ->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty') ->checkIF($story->closedReason == 'subdivided', 'childStories', 'notempty') ->where('id')->eq($storyID)->exec(); diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index ff6d9b86b4..92bd3598ef 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -45,7 +45,7 @@ story->estimate;?> - + story->reviewedBy;?> @@ -53,11 +53,11 @@ story->title;?> - + story->spec;?> -
story->specTemplate;?> +
story->specTemplate;?> story->mailto;?>