From a03c5b953e02ae187921b0fef6e33d841c596780 Mon Sep 17 00:00:00 2001 From: daitingting Date: Mon, 9 Jul 2018 16:01:07 +0800 Subject: [PATCH 1/2] * Finish task #4621. --- module/task/lang/en.php | 1 + module/task/lang/zh-cn.php | 1 + module/task/model.php | 6 ++++++ module/task/view/assignto.html.php | 10 ++++------ module/task/view/pause.html.php | 9 +++++++++ module/task/view/recordestimate.html.php | 10 ++++------ 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/module/task/lang/en.php b/module/task/lang/en.php index 3f9c88db00..38add30f65 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -183,6 +183,7 @@ $lang->task->error->left = 'Please enter "Left Hour"'; $lang->task->error->work = '"Remark" must be less than %d characteres.'; $lang->task->error->skipClose = 'Task: %s is not “Done” or “Cancelled”. Do you want to close it?'; $lang->task->error->consumed = 'Task: %s Hour must be more than 0. Ignore changes to this Task.'; +$lang->task->error->assignedTo = 'Multiple task in the current state cannot be assigned to member who outside the task team.'; /* Report. */ $lang->task->report = new stdclass(); diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index c77d1c29f3..dee4bdf397 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -183,6 +183,7 @@ $lang->task->error->left = '请填写"剩余"'; $lang->task->error->work = '"备注"必须小于%d个字符'; $lang->task->error->skipClose = '任务:%s 不是“已完成”或“已取消”状态,确定要关闭吗?'; $lang->task->error->consumed = '任务:%s工时不能小于0,忽略该任务工时的改动'; +$lang->task->error->assignedTo = '当前状态的多人任务不能指派给任务团队外的成员。'; /* Report. */ $lang->task->report = new stdclass(); diff --git a/module/task/model.php b/module/task/model.php index 7f0efdf5ac..65a7fec37b 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -581,6 +581,12 @@ class taskModel extends model $teams = array(); if($this->post->multiple) { + if(strpos(',done,closed,cancel,', ",{$task->status},") === false && !in_array($this->post->assignedTo, $this->post->team)) + { + dao::$errors[] = $this->lang->task->error->assignedTo; + return false; + } + foreach($this->post->team as $row => $account) { if(empty($account) or isset($team[$account])) continue; diff --git a/module/task/view/assignto.html.php b/module/task/view/assignto.html.php index befb86256e..b11a77de99 100644 --- a/module/task/view/assignto.html.php +++ b/module/task/view/assignto.html.php @@ -15,12 +15,10 @@
team) && $task->assignedTo != $this->app->user->account):?> -
-
- -
-

task->deniedNotice, '' . $task->assignedToRealName . '', $lang->task->transfer);?>

-
+
+ +
+

task->deniedNotice, '' . $task->assignedToRealName . '', $lang->task->transfer);?>

diff --git a/module/task/view/pause.html.php b/module/task/view/pause.html.php index 23ebab98e1..49e7b97ade 100644 --- a/module/task/view/pause.html.php +++ b/module/task/view/pause.html.php @@ -14,6 +14,14 @@
+ team) && $task->assignedTo != $this->app->user->account):?> +
+ +
+

task->deniedNotice, '' . $task->assignedToRealName . '', $lang->task->pause);?>

+
+
+

id;?> @@ -40,6 +48,7 @@
+

diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index 73d4b578f2..4f0ae677a1 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -18,12 +18,10 @@
team) && $task->assignedTo != $this->app->user->account):?> -
-
- -
-

task->deniedNotice, '' . $task->assignedToRealName . '', $lang->task->logEfforts);?>

-
+
+ +
+

task->deniedNotice, '' . $task->assignedToRealName . '', $lang->task->logEfforts);?>

From abc7375b2e4cddd2decfea61fabaf69ddd84bc42 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 9 Jul 2018 16:22:09 +0800 Subject: [PATCH 2/2] * finish task #4596. --- module/project/control.php | 4 +++- module/story/model.php | 20 +++++++++++++++++++- module/story/view/edit.html.php | 16 +++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index b95b6d502e..2f9cd23c93 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -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; diff --git a/module/story/model.php b/module/story/model.php index 5d6c5cb632..70ac555163 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -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) diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php index 7521b86081..97b8c8da69 100644 --- a/module/story/view/edit.html.php +++ b/module/story/view/edit.html.php @@ -126,7 +126,21 @@ status != 'draft'):?> story->stage;?> - story->stageList, $story->stage, "class='form-control chosen'");?> + + stages and $branches) + { + foreach($story->stages as $branch => $stage) + { + if(isset($branches[$branch])) echo '

' . $branches[$branch] . html::select("stages[$branch]", $lang->story->stageList, $stage, "class='form-control chosen'") . '

'; + } + } + else + { + echo html::select('stage', $lang->story->stageList, $story->stage, "class='form-control chosen'"); + } + ?> +