|
|
|
@@ -515,6 +515,7 @@ class storyModel extends model
|
|
|
|
|
if(empty($_POST['branch'])) $story->branch = 0;
|
|
|
|
|
if(!empty($_POST['stages']))
|
|
|
|
|
{
|
|
|
|
|
$oldStages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->eq($storyID)->fetchAll('branch');
|
|
|
|
|
$this->dao->delete()->from(TABLE_STORYSTAGE)->where('story')->eq($storyID)->exec();
|
|
|
|
|
|
|
|
|
|
$stageList = join(',', array_keys($this->lang->story->stageList));
|
|
|
|
@@ -522,7 +523,17 @@ class storyModel extends model
|
|
|
|
|
$minStage = '';
|
|
|
|
|
foreach($this->post->stages as $branch => $stage)
|
|
|
|
|
{
|
|
|
|
|
$this->dao->insert(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq($stage)->exec();
|
|
|
|
|
$newStage = new stdclass();
|
|
|
|
|
$newStage->story = $storyID;
|
|
|
|
|
$newStage->branch = $branch;
|
|
|
|
|
$newStage->stage = $stage;
|
|
|
|
|
if(isset($oldStages[$branch]))
|
|
|
|
|
{
|
|
|
|
|
$oldStage = $oldStages[$branch];
|
|
|
|
|
$newStage->stagedBy = $oldStage->stagedBy;
|
|
|
|
|
if($stage != $oldStage->stage) $newStage->stagedBy = (strpos('tested|verified|released|closed', $stage) !== false) ? $this->app->user->account : '';
|
|
|
|
|
}
|
|
|
|
|
$this->dao->insert(TABLE_STORYSTAGE)->data($newStage)->exec();
|
|
|
|
|
if(strpos($stageList, $stage) !== false and strpos($stageList, $stage) < $minStagePos)
|
|
|
|
|
{
|
|
|
|
|
$minStage = $stage;
|
|
|
|
@@ -531,6 +542,7 @@ class storyModel extends model
|
|
|
|
|
}
|
|
|
|
|
$story->stage = $minStage;
|
|
|
|
|
}
|
|
|
|
|
if($oldStory->stage != $story->stage) $story->stagedBy = (strpos('tested|verified|released|closed', $story->stage) !== false) ? $this->app->user->account : '';
|
|
|
|
|
|
|
|
|
|
$this->dao->update(TABLE_STORY)
|
|
|
|
|
->data($story)
|
|
|
|
@@ -628,6 +640,7 @@ class storyModel extends model
|
|
|
|
|
$story->duplicateStory = isset($data->duplicateStories[$storyID]) ? $data->duplicateStories[$storyID] : $oldStory->duplicateStory;
|
|
|
|
|
$story->childStories = isset($data->childStoriesIDList[$storyID]) ? $data->childStoriesIDList[$storyID] : $oldStory->childStories;
|
|
|
|
|
$story->version = $story->title == $oldStory->title ? $oldStory->version : $oldStory->version + 1;
|
|
|
|
|
if($story->stage != $oldStory->stage) $story->stagedBy = (strpos('tested|verified|released|closed', $story->stage) !== false) ? $this->app->user->account : '';
|
|
|
|
|
|
|
|
|
|
if($story->title != $oldStory->title) $story->status = 'changed';
|
|
|
|
|
if($story->plan !== false and $story->plan == '') $story->plan = 0;
|
|
|
|
@@ -1043,6 +1056,7 @@ class storyModel extends model
|
|
|
|
|
{
|
|
|
|
|
$now = helper::now();
|
|
|
|
|
$allChanges = array();
|
|
|
|
|
$account = $this->app->user->account;
|
|
|
|
|
$oldStories = $this->getByList($storyIDList);
|
|
|
|
|
$ignoreStories = '';
|
|
|
|
|
foreach($storyIDList as $storyID)
|
|
|
|
@@ -1055,13 +1069,13 @@ class storyModel extends model
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$story = new stdclass();
|
|
|
|
|
$story->lastEditedBy = $this->app->user->account;
|
|
|
|
|
$story->lastEditedBy = $account;
|
|
|
|
|
$story->lastEditedDate = $now;
|
|
|
|
|
$story->stage = $stage;
|
|
|
|
|
$story->stagedBy = $account;
|
|
|
|
|
|
|
|
|
|
$this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec();
|
|
|
|
|
$this->dao->update(TABLE_STORYSTAGE)->set('stage')->eq($stage)->where('story')->eq((int)$storyID)->exec();
|
|
|
|
|
$this->setStage($storyID);
|
|
|
|
|
$this->dao->update(TABLE_STORYSTAGE)->set('stage')->eq($stage)->set('stagedBy')->eq($account)->where('story')->eq((int)$storyID)->exec();
|
|
|
|
|
if(!dao::isError()) $allChanges[$storyID] = common::createChanges($oldStory, $story);
|
|
|
|
|
}
|
|
|
|
|
if($ignoreStories) echo js::alert(sprintf($this->lang->story->ignoreChangeStage, $ignoreStories));
|
|
|
|
@@ -1164,8 +1178,12 @@ class storyModel extends model
|
|
|
|
|
$storyID = (int)$storyID;
|
|
|
|
|
|
|
|
|
|
/* Get projects which status is doing. */
|
|
|
|
|
$oldStages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->eq($storyID)->fetchAll('branch');
|
|
|
|
|
$this->dao->delete()->from(TABLE_STORYSTAGE)->where('story')->eq($storyID)->exec();
|
|
|
|
|
$story = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
|
|
|
|
|
|
|
|
|
|
$story = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
|
|
|
|
|
if(!empty($story->stagedBy)) return false;
|
|
|
|
|
|
|
|
|
|
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fetch();
|
|
|
|
|
$projects = $this->dao->select('t1.project,t3.branch')->from(TABLE_PROJECTSTORY)->alias('t1')
|
|
|
|
|
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
|
|
|
@@ -1187,7 +1205,19 @@ class storyModel extends model
|
|
|
|
|
{
|
|
|
|
|
$this->dao->update(TABLE_STORY)->set('stage')->eq('wait')->where('id')->eq($storyID)->andWhere('plan')->eq('')->exec();
|
|
|
|
|
|
|
|
|
|
foreach($stages as $branch => $stage) $this->dao->insert(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq($stage)->exec();
|
|
|
|
|
foreach($stages as $branch => $stage)
|
|
|
|
|
{
|
|
|
|
|
if(isset($oldStages[$branch]))
|
|
|
|
|
{
|
|
|
|
|
$oldStage = $oldStages[$branch];
|
|
|
|
|
if(!empty($oldStage->stagedBy))
|
|
|
|
|
{
|
|
|
|
|
$this->dao->replace(TABLE_STORYSTAGE)->data($oldStage)->exec();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq($stage)->exec();
|
|
|
|
|
}
|
|
|
|
|
$this->dao->update(TABLE_STORY)->set('stage')->eq('planned')->where('id')->eq($storyID)->andWhere("(plan != '' AND plan != '0')")->exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1209,7 +1239,19 @@ class storyModel extends model
|
|
|
|
|
/* No tasks, then the stage is projected. */
|
|
|
|
|
if(!$tasks and $projects)
|
|
|
|
|
{
|
|
|
|
|
foreach($stages as $branch => $stage) $this->dao->insert(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('projected')->exec();
|
|
|
|
|
foreach($stages as $branch => $stage)
|
|
|
|
|
{
|
|
|
|
|
if(isset($oldStages[$branch]))
|
|
|
|
|
{
|
|
|
|
|
$oldStage = $oldStages[$branch];
|
|
|
|
|
if(!empty($oldStage->stagedBy))
|
|
|
|
|
{
|
|
|
|
|
$this->dao->replace(TABLE_STORYSTAGE)->data($oldStage)->exec();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('projected')->exec();
|
|
|
|
|
}
|
|
|
|
|
$this->dao->update(TABLE_STORY)->set('stage')->eq('projected')->where('id')->eq($storyID)->exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1284,7 +1326,16 @@ class storyModel extends model
|
|
|
|
|
$minStage = '';
|
|
|
|
|
foreach($stages as $branch => $stage)
|
|
|
|
|
{
|
|
|
|
|
$this->dao->insert(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq($stage)->exec();
|
|
|
|
|
$this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq($stage)->exec();
|
|
|
|
|
if(isset($oldStages[$branch]))
|
|
|
|
|
{
|
|
|
|
|
$oldStage = $oldStages[$branch];
|
|
|
|
|
if(!empty($oldStage->stagedBy))
|
|
|
|
|
{
|
|
|
|
|
$this->dao->replace(TABLE_STORYSTAGE)->data($oldStage)->exec();
|
|
|
|
|
$stage = $oldStage->$stage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(strpos($stageList, $stage) !== false and strpos($stageList, $stage) < $minStagePos)
|
|
|
|
|
{
|
|
|
|
|
$minStage = $stage;
|
|
|
|
@@ -2424,7 +2475,7 @@ class storyModel extends model
|
|
|
|
|
echo "<ul class='dropdown-menu pull-right'>";
|
|
|
|
|
foreach($storyStages[$story->id] as $storyBranch => $storyStage)
|
|
|
|
|
{
|
|
|
|
|
echo '<li class="text-ellipsis">' . $branches[$storyBranch] . ": " . $this->lang->story->stageList[$storyStage->stage] . '</li>';
|
|
|
|
|
if(isset($branches[$storyBranch])) echo '<li class="text-ellipsis">' . $branches[$storyBranch] . ": " . $this->lang->story->stageList[$storyStage->stage] . '</li>';
|
|
|
|
|
}
|
|
|
|
|
echo "</ul>";
|
|
|
|
|
echo '</div>';
|
|
|
|
|