* fix bugs.

This commit is contained in:
wangyidong
2015-12-23 09:29:38 +08:00
parent 957111c6f0
commit e45a196b7b
4 changed files with 7 additions and 7 deletions

View File

@@ -217,6 +217,7 @@ class buildModel extends model
->where('id')->eq((int)$buildID)
->check('name', 'unique', "id != $buildID AND product = {$build->product} AND deleted = '0'")
->exec();
if(isset($build->branch) and $oldBuild->branch != $build->branch) $this->dao->update(TABLE_RELEASE)->set('branch')->eq($build->branch)->where('build')->eq($buildID)->exec();
if(!dao::isError()) return common::createChanges($oldBuild, $build);
}

View File

@@ -58,7 +58,7 @@ class release extends control
{
if(!empty($_POST))
{
$releaseID = $this->release->create($productID);
$releaseID = $this->release->create($productID, $branch);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('release', $releaseID, 'opened');
die(js::locate(inlink('view', "releaseID=$releaseID"), 'parent'));

View File

@@ -100,7 +100,7 @@ class releaseModel extends model
* @access public
* @return int
*/
public function create($productID)
public function create($productID, $branch = 0)
{
$buildID = 0;
if($this->post->build == false)
@@ -108,6 +108,7 @@ class releaseModel extends model
$build = fixer::input('post')
->add('product', (int)$productID)
->add('builder', $this->app->user->account)
->add('branch', $branch)
->stripTags($this->config->release->editor->create['id'], $this->config->allowedTags)
->remove('build,files,labels')
->get();
@@ -116,7 +117,6 @@ class releaseModel extends model
$buildID = $this->dao->lastInsertID();
}
$branch = 0;
if($this->post->build) $branch = $this->dao->select('branch')->from(TABLE_BUILD)->where('id')->eq($this->post->build)->fetch('branch');
$release = fixer::input('post')
->add('product', (int)$productID)
@@ -152,8 +152,7 @@ class releaseModel extends model
public function update($releaseID)
{
$oldRelease = $this->getByID($releaseID);
$branch = $this->dao->select('branch')->from(TABLE_BUILD)->where('id')->eq($this->post->build)->fetch('branch');
$branch = $this->dao->select('branch')->from(TABLE_BUILD)->where('id')->eq($this->post->build)->fetch('branch');
$release = fixer::input('post')->stripTags($this->config->release->editor->edit['id'], $this->config->allowedTags)
->add('branch', (int)$branch)

View File

@@ -326,7 +326,7 @@ class testtaskModel extends model
* */
$postData = fixer::input('post')->get();
$caseResult = isset($postData->result) ? $postData->result : 'pass';
if($postData->steps)
if(isset($postData->steps) and $postData->steps)
{
foreach($postData->steps as $stepID => $stepResult)
{
@@ -339,7 +339,7 @@ class testtaskModel extends model
}
/* Create result of every step. */
if($postData->steps)
if(isset($postData->steps) and $postData->steps)
{
foreach($postData->steps as $stepID =>$stepResult)
{