diff --git a/db/update9.5.1.sql b/db/update9.5.1.sql index 789f54ab2e..e8021f50e2 100644 --- a/db/update9.5.1.sql +++ b/db/update9.5.1.sql @@ -36,6 +36,23 @@ ALTER TABLE `zt_team` ADD `left` DECIMAL(12,2) UNSIGNED NOT NULL DEFAULT '0' ALTER TABLE `zt_team` ADD `order` TINYINT(3) NOT NULL DEFAULT '0' AFTER `left`; ALTER TABLE `zt_team` CHANGE `days` `days` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0'; - ALTER TABLE `zt_team` DROP PRIMARY KEY; -ALTER TABLE `zt_team` ADD PRIMARY KEY (`project`, `task`, `account`); \ No newline at end of file +ALTER TABLE `zt_team` ADD PRIMARY KEY (`project`, `task`, `account`); + +ALTER TABLE `zt_user` ADD `score` DECIMAL(12,1) NOT NULL DEFAULT '0' AFTER `deleted`; +ALTER TABLE `zt_user` ADD `score_level` DECIMAL(12,1) NOT NULL DEFAULT '0' AFTER `score`; + +CREATE TABLE `zt_score` ( + `id` bigint(12) unsigned NOT NULL AUTO_INCREMENT, + `userID` int(11) NOT NULL DEFAULT '0', + `account` varchar(30) NOT NULL, + `model` varchar(30) NOT NULL, + `method` varchar(30) NOT NULL, + `score` decimal(12,1) NOT NULL DEFAULT '0.0', + `type` enum('repeat','one') NOT NULL DEFAULT 'repeat', + `time` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `account` (`account`), + KEY `model` (`model`), + KEY `method` (`method`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/module/bug/model.php b/module/bug/model.php index 48a870551d..8aa51a3250 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2310,8 +2310,9 @@ class bugModel extends model * @access public * @return void */ - public function printCell($col, $bug, $users, $builds, $branches, $modulePairs, $projects = array(), $plans = array(), $stories = array(), $tasks = array()) + public function printCell($col, $bug, $users, $builds, $branches, $modulePairs, $projects = array(), $plans = array(), $stories = array(), $tasks = array(), $mode = 'datatable') { + $canView = common::hasPriv('bug', 'view'); $bugLink = inlink('view', "bugID=$bug->id"); $account = $this->app->user->account; $id = $col->id; @@ -2319,15 +2320,17 @@ class bugModel extends model { $class = ''; if($id == 'status') $class .= ' bug-' . $bug->status; - if($id == 'title') $class .= ' text-left'; + if($id == 'title') $class .= ' text-left'; + if($id == 'id') $class .= ' cell-id'; if($id == 'assignedTo' && $bug->assignedTo == $account) $class .= ' red'; if($id == 'deadline' && isset($bug->delay)) $class .= ' delayed'; echo "
| action->objectType);?> | -idAB);?> | -action->objectName;?> | -action->actor);?> | -action->date);?> | -actions;?> | +score->id;?> | +score->account;?> | +score->model;?> | +score->method;?> | +score->type;?> | +score->score;?> | +score->time;?> |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| action->objectTypes, $action->objectType, '');?> | -objectID;?> | -- objectType == 'user' ? "account={$action->objectName}" : "id={$action->objectID}"; - if($module == 'doclib') - { - echo $action->objectName; - } - else - { - echo html::a($this->createLink($module, $methodName, $params), $action->objectName); - } - ?> - | -actor];?> | -date;?> | -- id", $lang->action->undelete, 'hiddenwin'); - if($type == 'all') common::printLink('action', 'hideOne', "actionid=$action->id", $lang->action->hideOne, 'hiddenwin'); - ?> - | +|||||||
|
-
-
- action->hideAll, inlink('hideAll'), 'hiddenwin');?>
-
-
+ action->trashTips;?>
- | show();?> | "; - switch ($id) + switch($id) { case 'id': - echo html::a($storyLink, sprintf('%03d', $story->id)); + if($mode == 'table') echo " "; + echo $canView ? html::a($storyLink, sprintf('%03d', $story->id)) : sprintf('%03d', $story->id); break; case 'pri': echo ""; @@ -2277,7 +2280,7 @@ class storyModel extends model case 'title': if($story->branch) echo "{$branches[$story->branch]} "; if($modulePairs and $story->module) echo "{$modulePairs[$story->module]} "; - echo html::a($storyLink, $story->title, null, "style='color: $story->color'"); + echo $canView ? html::a($storyLink, $story->title, '', "style='color: $story->color'") : "{$story->title}"; break; case 'plan': echo $story->planTitle; diff --git a/module/task/control.php b/module/task/control.php index 002e5c1db6..c3865d194d 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -233,7 +233,8 @@ class task extends control */ public function commonAction($taskID) { - $this->view->task = $this->loadModel('task')->getByID($taskID); + $task=$this->loadModel('task')->getByID($taskID); + $this->view->task = $task; $this->view->project = $this->project->getById($this->view->task->project); $this->view->members = $this->project->getTeamMemberPairs($this->view->project->id ,'nodeleted'); $this->view->actions = $this->loadModel('action')->getList('task', $taskID); diff --git a/module/task/css/create.css b/module/task/css/create.css index 1e089a7841..21e7dcdaab 100644 --- a/module/task/css/create.css +++ b/module/task/css/create.css @@ -14,3 +14,4 @@ #taskPlanCol, #mailCol {width: 50%} #planAndMailCell.has-mail-col #taskPlanCol {padding-right: 5px;} #planAndMailCell.has-mail-col #taskPlanCol + #mailCol {padding-left: 5px;} +.input-group-addon input[type='checkBox']{} \ No newline at end of file diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js index 97e0603d71..13ca2c9e8f 100755 --- a/module/task/js/batchcreate.js +++ b/module/task/js/batchcreate.js @@ -153,3 +153,11 @@ $(function() if(storyID != 0) setStoryRelated(0); }) + +// if(projectType == 'ops') +// { +// $("#tableBody th").eq(2).addClass('hidden'); +// $("#tableBody tr").each(function() { +// $(this).find('td').eq(2).addClass('hidden'); +// }); +// } diff --git a/module/task/js/create.js b/module/task/js/create.js index b9b90827af..0129013f0b 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -20,11 +20,16 @@ function copyStoryTitle() /* Set the assignedTos field. */ function setOwners(result) { + $("#multipleBox").removeAttr("checked"); + $('.team-group').addClass('hidden'); + $('#assignedTo, #assignedTo_chosen').removeClass('hidden'); if(result == 'affair') { $('#assignedTo').attr('multiple', 'multiple'); $('#assignedTo').chosen('destroy'); $('#assignedTo').chosen(defaultChosenOptions); + $('.affair').hide(); + $('.team-group').addClass('hidden'); $('#selectAllUser').removeClass('hidden'); } else if($('#assignedTo').attr('multiple') == 'multiple') @@ -32,6 +37,7 @@ function setOwners(result) $('#assignedTo').removeAttr('multiple'); $('#assignedTo').chosen('destroy'); $('#assignedTo').chosen(defaultChosenOptions); + $('.affair').show(); $('#selectAllUser').addClass('hidden'); } } @@ -219,8 +225,8 @@ $('[name^=multiple]').change(function() $('#estimate').attr('readonly', false); } }); - -$(".btn[data-toggle='modalTeam']").click(function() +$(".team-group[data-toggle='modalTeam']").css('cursor', 'pointer'); +$(".team-group[data-toggle='modalTeam']").click(function() { $('#modalTeam').modal('show'); adjustSortBtn(); diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index 5d1087ef11..1c7ad02246 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -103,7 +103,6 @@ $lang->task->transmitTo = '转交给'; $lang->task->children = '子任务'; $lang->task->childrenAB = '子'; $lang->task->parent = '父任务'; -$lang->task->unfinished = '未完成'; $lang->task->lblPri = 'P'; $lang->task->lblHour = '(h)'; diff --git a/module/task/model.php b/module/task/model.php index 886fce034f..6232d3eb6c 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -74,10 +74,11 @@ class taskModel extends model if(!empty($teams)) { - $firstMember = reset($teams); - $task->assignedTo = $firstMember->account; - $task->estimate = $estimate; - $task->left = $left; + $firstMember = reset($teams); + $task->assignedTo = $firstMember->account; + $task->assignedDate = helper::today(); + $task->estimate = $estimate; + $task->left = $left; } } @@ -248,10 +249,10 @@ class taskModel extends model * * @param $taskID * - * @access public + * @access private * @return void */ - public function countTime($taskID) + private function countTime($taskID) { if(!$taskID) return true; @@ -277,6 +278,29 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->data($newTask)->autoCheck()->where('id')->eq($taskID)->exec(); } + /** + * Check that all child status + * + * @param $parentID + * @param $status + * + * @access private + * @return bool + */ + private function parentStatus($parentID, $status = 'done') + { + if(!$parentID) return true; + $data = new stdClass(); + $children = $this->dao->select('id,status')->from(TABLE_TASK)->where('parent')->eq($parentID)->fetchPairs('id', 'status'); + $values = array_values(array_unique($children)); + if((count($values) == 1 && $values[0] == $status) || (count($values) == 2 && in_array('closed', $values) && $status == 'done')) + { + $data->status = $status; + $this->dao->update(TABLE_TASK)->data($data)->autoCheck()->where('id')->eq($parentID)->exec(); + } + } + + /** * Update a task. * @@ -689,6 +713,23 @@ class taskModel extends model ->check('consumed,left', 'float') ->where('id')->eq((int)$taskID)->exec(); + if($oldTask->parent) + { + switch($task->status) + { + case 'doing': + $status = new stdClass(); + $status->status = 'doing'; + $this->dao->update(TABLE_TASK)->data($status)->autoCheck()->where('id')->eq((int)$oldTask->parent)->exec(); + break; + case 'done': + $this->parentStatus($oldTask->parent,'done'); + break; + } + } + + $this->countTime($oldTask->parent); + if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story); if(!dao::isError()) return common::createChanges($oldTask, $task); } @@ -801,6 +842,7 @@ class taskModel extends model if(!empty($actionID)) $this->action->logHistory($actionID, $changes); if($task->story) $this->loadModel('story')->setStage($task->story); + if($task->status == 'done') $this->parentStatus($task->parent, 'done'); $this->countTime($task->parent); return $changes; @@ -848,6 +890,9 @@ class taskModel extends model ->check('consumed', 'notempty') ->where('id')->eq((int)$taskID)->exec(); + if($task->status == 'done') $this->parentStatus($oldTask->parent, 'done'); + $this->countTime($oldTask->parent); + if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story); if(!dao::isError()) return common::createChanges($oldTask, $task); } @@ -897,6 +942,12 @@ class taskModel extends model ->remove('comment')->get(); $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec(); + $this->parentStatus($oldTask->parent,'closed'); + $this->countTime($oldTask->parent); + + $data = new stdClass(); + $data->status = 'closed'; + $this->dao->update(TABLE_TASK)->data($data)->autoCheck()->where('parent')->eq($taskID)->exec(); if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story); if(!dao::isError()) return common::createChanges($oldTask, $task); @@ -953,6 +1004,13 @@ class taskModel extends model ->check('left', 'notempty') ->where('id')->eq((int)$taskID)->exec(); + $this->countTime($oldTask->parent); + + $data = new stdClass(); + $data->status = 'doing'; + $this->dao->update(TABLE_TASK)->data($data)->autoCheck()->where('parent')->eq($taskID)->exec(); + if($oldTask->parent) $this->dao->update(TABLE_TASK)->data($data)->autoCheck()->where('id')->eq((int)$oldTask->parent)->exec(); + if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story); if(!dao::isError()) return common::createChanges($oldTask, $task); @@ -1755,6 +1813,9 @@ class taskModel extends model if($action == 'start' and !empty($task->children)) return false; if($action == 'recordestimate' and !empty($task->children)) return false; + if($action == 'finish' and !empty($task->children)) return false; + if($action == 'cancel' and !empty($task->children)) return false; + if($action == 'pause' and !empty($task->children)) return false; if($action == 'batchcreate' and !empty($task->team)) return false; if($action == 'batchcreate' and $task->parent) return false; @@ -1803,15 +1864,21 @@ class taskModel extends model /** * Print cell data. * - * @param object $col - * @param object $task - * @param array $users - * @param string $browseType + * @param $col + * @param $task + * @param $users + * @param $browseType + * @param $branchGroups + * @param array $modulePairs + * @param string $mode + * @param bool $child + * * @access public * @return void */ - public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array()) + public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array(), $mode = 'datatable', $child = false) { + $canView = common::hasPriv('task', 'view'); $taskLink = helper::createLink('task', 'view', "taskID=$task->id"); $account = $this->app->user->account; $id = $col->id; @@ -1819,15 +1886,18 @@ class taskModel extends model { $class = ''; if($id == 'status') $class .= ' task-' . $task->status; + if($id == 'id') $class .= ' cell-id'; if($id == 'name' or $id == 'story') $class .= ' text-left'; if($id == 'deadline' and isset($task->delay)) $class .= ' delayed'; if($id == 'assignedTo' && $task->assignedTo == $account) $class .= ' red'; echo " | "; - switch ($id) + switch($id) { case 'id': - echo html::a($taskLink, sprintf('%03d', $task->id)); + if($mode == 'table' && $child == false) echo " "; + if($child) echo ' '; + echo $canView ? html::a($taskLink, sprintf('%03d', $task->id)) : sprintf('%03d', $task->id); break; case 'pri': echo ""; @@ -1837,7 +1907,9 @@ class taskModel extends model case 'name': if(!empty($task->product) && isset($branchGroups[$task->product][$task->branch])) echo "" . $branchGroups[$task->product][$task->branch] . ' '; if($modulePairs and $task->module) echo "" . $modulePairs[$task->module] . ' '; - echo html::a($taskLink, $task->name, null, "style='color: $task->color'"); + if($child) echo ''.$this->lang->task->childrenAB.' '; + if(!empty($task->team)) echo ''.$this->lang->task->multipleAB.' '; + echo $canView ? html::a($taskLink, $task->name, null, "style='color: $task->color'") : "$task->name"; if($task->fromBug) echo html::a(helper::createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'"); if(!empty($task->children)) echo ' '; break; diff --git a/module/task/view/batchcreate.html.php b/module/task/view/batchcreate.html.php index af9b4e682c..ab74f65672 100644 --- a/module/task/view/batchcreate.html.php +++ b/module/task/view/batchcreate.html.php @@ -34,12 +34,12 @@ $hiddenStory = ((isonlybody() and $storyID) || $this->config->global->flow == 'o if($hiddenStory and isset($visibleFields['story'])) $colspan -= 1; ?> | |||||||||