diff --git a/db/update12.3.3.sql b/db/update12.3.3.sql index 5978ebe38a..197a64dfee 100644 --- a/db/update12.3.3.sql +++ b/db/update12.3.3.sql @@ -1,3 +1,6 @@ ALTER TABLE `zt_doccontent` CHANGE `content` `content` longtext NOT NULL AFTER `digest`; +update zt_storystage as a, zt_story as b set a.stage = 'closed', b.stage = 'closed' where a.story = b.id and b.status = 'closed'; + update zt_story set stage = 'closed' where status = 'closed'; + diff --git a/module/story/model.php b/module/story/model.php index 1c35eb8054..b5ebeefb40 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1114,7 +1114,7 @@ class storyModel extends model /* Update parent story status. */ if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent); - + $this->setStage($storyID); if(!dao::isError()) $this->loadModel('score')->create('story', 'close', $storyID); return common::createChanges($oldStory, $story); } @@ -1183,7 +1183,7 @@ class storyModel extends model { /* Update parent story status. */ if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent); - + $this->setStage($storyID); $allChanges[$storyID] = common::createChanges($oldStory, $story); } else @@ -1437,9 +1437,7 @@ class storyModel extends model $this->dao->delete()->from(TABLE_STORYSTAGE)->where('story')->eq($storyID)->exec(); $story = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); - if(!empty($story->stagedBy)) return false; - if($story->status == 'closed') $this->dao->update(TABLE_STORY)->set('stage')->eq('closed')->where('id')->eq($storyID)->exec(); $product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fetch(); $projects = $this->dao->select('t1.project,t3.branch')->from(TABLE_PROJECTSTORY)->alias('t1') @@ -1457,6 +1455,15 @@ class storyModel extends model foreach($plans as $branch) $stages[$branch] = 'planned'; } + /* When the status is closed, phase = is also changed to closed. */ + if($story->status == 'closed') + { + $this->dao->update(TABLE_STORY)->set('stage')->eq('closed')->where('id')->eq($storyID)->exec(); + foreach($stages as $branch => $stage) $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec(); + foreach($projects as $project => $branch) $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec(); + return false; + } + /* If no projects, in plan, stage is planned. No plan, wait. */ if(!$projects) { diff --git a/module/todo/control.php b/module/todo/control.php index 25d3c38b28..831fb5621f 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -149,6 +149,7 @@ class todo extends control $todo = $this->todo->getById($todoID); if($todo->private and $this->app->user->account != $todo->account) die('private'); + unset($this->lang->todo->typeList['cycle']); $todo->date = date("Y-m-d", strtotime($todo->date)); $this->view->title = $this->lang->todo->common . $this->lang->colon . $this->lang->todo->edit; $this->view->position[] = $this->lang->todo->common; @@ -206,6 +207,8 @@ class todo extends control $countInputVars = count($editedTodos) * $columns; $showSuhosinInfo = common::judgeSuhosinSetting($countInputVars); + + unset($this->lang->todo->typeList['cycle']); /* Set Custom*/ foreach(explode(',', $this->config->todo->list->customBatchEditFields) as $field) $customFields[$field] = $this->lang->todo->$field; $this->view->customFields = $customFields; diff --git a/module/todo/js/edit.js b/module/todo/js/edit.js new file mode 100644 index 0000000000..8e373182f1 --- /dev/null +++ b/module/todo/js/edit.js @@ -0,0 +1,4 @@ +$(function() +{ + loadList($('#type').val()); +}); diff --git a/module/todo/model.php b/module/todo/model.php index 06d0e39032..69fe808be7 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -171,13 +171,17 @@ class todoModel extends model $todo = fixer::input('post') ->cleanInt('pri, begin, end, private') ->add('account', $oldTodo->account) - ->setIF(in_array($oldTodo->type, array('bug', 'task', 'story')), 'name', '') + ->setIF(in_array($this->post->type, array('bug', 'task', 'story')), 'name', '') + ->setIF($this->post->type == 'bug' and $this->post->bug, 'idvalue', $this->post->bug) + ->setIF($this->post->type == 'task' and $this->post->task, 'idvalue', $this->post->task) + ->setIF($this->post->type == 'story' and $this->post->story, 'idvalue', $this->post->story) + ->setIF($this->post->type == 'feedback' and $this->post->feedback, 'idvalue', $this->post->feedback) ->setIF($this->post->date == false, 'date', '2030-01-01') ->setIF($this->post->begin == false, 'begin', '2400') ->setIF($this->post->end == false, 'end', '2400') ->setDefault('private', 0) ->stripTags($this->config->todo->editor->edit['id'], $this->config->allowedTags) - ->remove('uid') + ->remove('bug, task, story, feedback, uid') ->get(); if($todo->end < $todo->begin) @@ -214,6 +218,10 @@ class todoModel extends model $this->dao->update(TABLE_TODO)->data($todo) ->autoCheck() ->checkIF($todo->type == 'custom', $this->config->todo->edit->requiredFields, 'notempty') + ->checkIF($todo->type == 'bug' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'task' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'story' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'feedback' and $todo->idvalue == 0, 'idvalue', 'notempty') ->where('id')->eq($todoID) ->exec(); if(!dao::isError()) @@ -263,12 +271,14 @@ class todoModel extends model foreach($todos as $todoID => $todo) { $oldTodo = $oldTodos[$todoID]; - if($oldTodo->type == 'bug' or $oldTodo->type == 'task') $oldTodo->name = ''; + if($oldTodo->type == 'bug' or $oldTodo->type == 'task' or $oldTodo->type == 'story' or $oldTodo->type == 'feedback') $oldTodo->name = ''; $this->dao->update(TABLE_TODO)->data($todo) ->autoCheck() ->checkIF($todo->type == 'custom', $this->config->todo->edit->requiredFields, 'notempty') - ->checkIF($todo->type == 'bug', 'idvalue', 'notempty') - ->checkIF($todo->type == 'task', 'idvalue', 'notempty') + ->checkIF($todo->type == 'bug' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'task' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'story' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'feedback' and $todo->idvalue == 0, 'idvalue', 'notempty') ->where('id')->eq($todoID) ->exec(); diff --git a/module/todo/view/batchedit.html.php b/module/todo/view/batchedit.html.php index 15b061009c..6dcdde697e 100644 --- a/module/todo/view/batchedit.html.php +++ b/module/todo/view/batchedit.html.php @@ -36,7 +36,7 @@ idAB;?> todo->date;?> - todo->type;?> + todo->type;?> '> todo->pri;?> todo->name;?> >todo->desc;?> @@ -50,12 +50,11 @@ id . html::hidden("todoIDList[$todo->id]", $todo->id);?> id]", $todo->date, "class='form-control form-date'");?> - todo->typeList, $todo->type);?> - id]", $todo->type);?> + id]", $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, " . $todo->id . ")' class='form-control'");?> >id]", $lang->todo->priList, $todo->pri, "class='form-control chosen'");?> - +
type == 'custom' or $todo->type == 'cycle') diff --git a/module/todo/view/edit.html.php b/module/todo/view/edit.html.php index 65ffe267f2..3ce31314f4 100644 --- a/module/todo/view/edit.html.php +++ b/module/todo/view/edit.html.php @@ -85,9 +85,8 @@
-
- - todo->typeList[$todo->type];?> +
+ todo->typeList, $todo->type, 'onchange="loadList(this.value);" class="form-control"');?>
@@ -99,12 +98,8 @@
-
- type == 'bug' or $todo->type == 'task') ? 'readonly' : ''; - echo html::input('name', $todo->name, "$readType class='form-control'"); - ?> -
+ +
name, "class='form-control'");?>