* adjust code using setDefault replace if() $stories=''

This commit is contained in:
shiyangyangwork@yahoo.cn
2012-01-05 02:36:26 +00:00
parent a329a84c1d
commit 2085af82d5
2 changed files with 14 additions and 4 deletions

View File

@@ -134,7 +134,13 @@ class buildModel extends model
public function update($buildID)
{
$oldBuild = $this->getByID($buildID);
$build = fixer::input('post')->stripTags('name')->join('stories', ',')->join('bugs', ',')->get();
$build = fixer::input('post')
->stripTags('name')
->setDefault('stories', '')
->setDefault('bugs', '')
->join('stories', ',')
->join('bugs', ',')
->get();
if(empty($build->stories)) $build->stories = '';
if(empty($build->bugs)) $build->bugs = '';
$this->dao->update(TABLE_BUILD)->data($build)

View File

@@ -83,9 +83,13 @@ class releaseModel extends model
public function update($releaseID)
{
$oldRelease = $this->getByID($releaseID);
$release = fixer::input('post')->stripTags('name')->join('stories', ',')->join('bugs', ',')->get();
if(empty($release->stories)) $release->stories = '';
if(empty($release->bugs)) $release->bugs = '';
$release = fixer::input('post')
->stripTags('name')
->setDefault('stories', '')
->setDefault('bugs', '')
->join('stories', ',')
->join('bugs', ',')
->get();
$this->dao->update(TABLE_RELEASE)->data($release)
->autoCheck()
->batchCheck($this->config->release->edit->requiredFields, 'notempty')