* Code for task#81187.

This commit is contained in:
xieqiyu
2022-12-28 14:20:57 +08:00
parent 260e043338
commit bb0c7167c9
3 changed files with 12 additions and 37 deletions
+2 -31
View File
@@ -941,7 +941,7 @@ class storyModel extends model
->join('linkStories', ',')
->join('linkRequirements', ',')
->join('childStories', ',')
->remove('files,labels,comment,contactListMenu,stages,reviewer,needNotReview')
->remove('files,labels,comment,contactListMenu,reviewer,needNotReview')
->get();
/* Relieve twins when change product. */
@@ -958,35 +958,6 @@ class storyModel extends model
if(isset($story->plan) and is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ',');
if(isset($_POST['branch']) and $_POST['branch'] == 0) $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));
$minStagePos = strlen($stageList);
$minStage = '';
foreach($this->post->stages as $branch => $stage)
{
$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 : '';
}
if($story->branch == 0) $this->dao->insert(TABLE_STORYSTAGE)->data($newStage)->exec();
if(strpos($stageList, $stage) !== false and strpos($stageList, $stage) < $minStagePos)
{
$minStage = $stage;
$minStagePos = strpos($stageList, $stage);
}
}
$story->stage = $minStage;
}
if(isset($story->stage) and $oldStory->stage != $story->stage) $story->stagedBy = (strpos('tested|verified|released|closed', $story->stage) !== false) ? $this->app->user->account : '';
$story = $this->loadModel('file')->processImgURL($story, $this->config->story->editor->edit['id'], $this->post->uid);
@@ -5111,8 +5082,8 @@ class storyModel extends model
$style .= 'overflow: visible;';
$maxStage = $story->stage;
$maxStagePos = 0;
$stageList = join(',', array_keys($this->lang->story->stageList));
$maxStagePos = strpos($stageList, $maxStage);
if(isset($storyStages[$story->id]))
{
foreach($storyStages[$story->id] as $storyBranch => $storyStage)
+9 -5
View File
@@ -227,17 +227,21 @@
<th><?php echo $lang->story->stage;?></th>
<td>
<?php
$maxStage = $story->stage;
$stageList = join(',', array_keys($this->lang->story->stageList));
$maxStagePos = strpos($stageList, $maxStage);
if($story->stages and $branchTagOption)
{
foreach($story->stages as $branch => $stage)
{
if(isset($branchTagOption[$branch])) echo '<p>' . $branchTagOption[$branch] . html::select("stages[$branch]", $lang->story->stageList, $stage, "class='form-control chosen'") . '</p>';
if(strpos($stageList, $stage) !== false and strpos($stageList, $stage) > $maxStagePos)
{
$maxStage = $stage;
$maxStagePos = strpos($stageList, $stage);
}
}
}
else
{
echo html::select('stage', $lang->story->stageList, $story->stage, "class='form-control chosen'");
}
echo html::select('stage', $lang->story->stageList, $maxStage, "class='form-control chosen'");
?>
</td>
</tr>
+1 -1
View File
@@ -303,8 +303,8 @@
<td>
<?php
$maxStage = $story->stage;
$maxStagePos = 0;
$stageList = join(',', array_keys($this->lang->story->stageList));
$maxStagePos = strpos($stageList, $maxStage);
if($story->stages and $branches)
{
foreach($story->stages as $branch => $stage)