* finish task #4596.

This commit is contained in:
wangyidong
2018-07-09 16:22:09 +08:00
parent 8e33b05bb5
commit abc7375b2e
3 changed files with 37 additions and 3 deletions

View File

@@ -1014,7 +1014,9 @@ class project extends control
}
}
$this->project->setMenu($this->projects, key($this->projects));
$projectID = key($this->projects);
if($this->session->project) $projectID = $this->session->project;
$this->project->setMenu($this->projects, $projectID);
$this->view->title = $this->lang->project->create;
$this->view->position[] = $this->view->title;

View File

@@ -495,11 +495,29 @@ class storyModel extends model
->join('mailto', ',')
->join('linkStories', ',')
->join('childStories', ',')
->remove('files,labels,comment,contactListMenu')
->remove('files,labels,comment,contactListMenu,stages')
->get();
if(isset($story->plan) and is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ',');
if(empty($_POST['product'])) $story->branch = $oldStory->branch;
if(empty($_POST['branch'])) $story->branch = 0;
if(!empty($_POST['stages']))
{
$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)
{
$this->dao->insert(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq($stage)->exec();
if(strpos($stageList, $stage) !== false and strpos($stageList, $stage) < $minStagePos)
{
$minStage = $stage;
$minStagePos = strpos($stageList, $stage);
}
}
$story->stage = $minStage;
}
$this->dao->update(TABLE_STORY)
->data($story)

View File

@@ -126,7 +126,21 @@
<?php if($story->status != 'draft'):?>
<tr>
<th><?php echo $lang->story->stage;?></th>
<td><?php echo html::select('stage', $lang->story->stageList, $story->stage, "class='form-control chosen'");?></td>
<td>
<?php
if($story->stages and $branches)
{
foreach($story->stages as $branch => $stage)
{
if(isset($branches[$branch])) echo '<p>' . $branches[$branch] . html::select("stages[$branch]", $lang->story->stageList, $stage, "class='form-control chosen'") . '</p>';
}
}
else
{
echo html::select('stage', $lang->story->stageList, $story->stage, "class='form-control chosen'");
}
?>
</td>
</tr>
<?php endif;?>
<tr>