* finish task #1202.
This commit is contained in:
1
db/update6.1.sql
Normal file
1
db/update6.1.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE `zt_task` CHANGE `status` `status` enum('wait','doing','done','pause','cancel','closed') COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'wait' AFTER `deadline`;
|
||||
@@ -91,6 +91,7 @@ $lang->action->desc->canceled = '$date, canceled by <strong>$actor</strong
|
||||
$lang->action->desc->svncommited = '$date, <strong>$actor</strong> commited to svn,revision is <strong>#$extra</strong>.' . "\n";
|
||||
$lang->action->desc->gitcommited = '$date, <strong>$actor</strong> commited to git,revision is <strong>#$extra</strong>.' . "\n";
|
||||
$lang->action->desc->finished = '$date, finished by <strong>$actor</strong>.';
|
||||
$lang->action->desc->paused = '$date, paused by <strong>$actor</strong>.';
|
||||
$lang->action->desc->diff1 = 'changed <strong><i>%s</i></strong>, old is "%s", new is "%s".<br />';
|
||||
$lang->action->desc->diff2 = 'changed <strong><i>%s</i></strong>, the diff is:' . "\n" . "<blockquote>%s</blockquote>" . "\n<div class='hidden'>%s</div>";
|
||||
$lang->action->desc->diff3 = "changed file's name %s to %s.";
|
||||
@@ -131,6 +132,7 @@ $lang->action->label->recordestimate = 'Hours';
|
||||
$lang->action->label->editestimate = 'edit hour';
|
||||
$lang->action->label->canceled = 'canceled';
|
||||
$lang->action->label->finished = 'finished';
|
||||
$lang->action->label->paused = 'paused';
|
||||
$lang->action->label->login = 'login';
|
||||
$lang->action->label->logout = "logout";
|
||||
|
||||
@@ -204,5 +206,6 @@ $lang->action->search->label['recordestimate'] = $lang->action->label->reco
|
||||
$lang->action->search->label['editestimate'] = $lang->action->label->editestimate;
|
||||
$lang->action->search->label['canceled'] = $lang->action->label->canceled;
|
||||
$lang->action->search->label['finished'] = $lang->action->label->finished;
|
||||
$lang->action->search->label['paused'] = $lang->action->label->paused;
|
||||
$lang->action->search->label['login'] = $lang->action->label->login;
|
||||
$lang->action->search->label['logout'] = $lang->action->label->logout;
|
||||
|
||||
@@ -91,6 +91,7 @@ $lang->action->desc->canceled = '$date, 由 <strong>$actor</strong> 取消
|
||||
$lang->action->desc->svncommited = '$date, 由 <strong>$actor</strong> 提交代码,版本为<strong>#$extra</strong>。' . "\n";
|
||||
$lang->action->desc->gitcommited = '$date, 由 <strong>$actor</strong> 提交代码,版本为<strong>#$extra</strong>。' . "\n";
|
||||
$lang->action->desc->finished = '$date, 由 <strong>$actor</strong> 完成。' . "\n";
|
||||
$lang->action->desc->paused = '$date, 由 <strong>$actor</strong> 暂停。' . "\n";
|
||||
$lang->action->desc->diff1 = '修改了 <strong><i>%s</i></strong>,旧值为 "%s",新值为 "%s"。<br />' . "\n";
|
||||
$lang->action->desc->diff2 = '修改了 <strong><i>%s</i></strong>,区别为:' . "\n" . "<blockquote>%s</blockquote>" . "\n<div class='hidden'>%s</div>";
|
||||
$lang->action->desc->diff3 = '将文件名 %s 改为 %s 。' . "\n";
|
||||
@@ -131,6 +132,7 @@ $lang->action->label->recordestimate = '记录了工时';
|
||||
$lang->action->label->editestimate = '编辑了工时';
|
||||
$lang->action->label->canceled = '取消了';
|
||||
$lang->action->label->finished = '完成';
|
||||
$lang->action->label->paused = '暂停';
|
||||
$lang->action->label->login = '登录系统';
|
||||
$lang->action->label->logout = "退出登录";
|
||||
|
||||
@@ -204,5 +206,6 @@ $lang->action->search->label['recordestimate'] = $lang->action->label->reco
|
||||
$lang->action->search->label['editestimate'] = $lang->action->label->editestimate;
|
||||
$lang->action->search->label['canceled'] = $lang->action->label->canceled;
|
||||
$lang->action->search->label['finished'] = $lang->action->label->finished;
|
||||
$lang->action->search->label['paused'] = $lang->action->label->paused;
|
||||
$lang->action->search->label['login'] = $lang->action->label->login;
|
||||
$lang->action->search->label['logout'] = $lang->action->label->logout;
|
||||
|
||||
@@ -460,6 +460,7 @@ $lang->icons['review'] = 'search';
|
||||
$lang->icons['confirm'] = 'search';
|
||||
$lang->icons['putoff'] = 'calendar';
|
||||
$lang->icons['suspend'] = 'pause';
|
||||
$lang->icons['pause'] = 'pause';
|
||||
$lang->icons['cancel'] = 'ban-circle';
|
||||
$lang->icons['recordEstimate'] = 'time';
|
||||
$lang->icons['customFields'] = 'cogs';
|
||||
|
||||
@@ -460,6 +460,7 @@ $lang->icons['review'] = 'search';
|
||||
$lang->icons['confirm'] = 'search';
|
||||
$lang->icons['putoff'] = 'calendar';
|
||||
$lang->icons['suspend'] = 'pause';
|
||||
$lang->icons['pause'] = 'pause';
|
||||
$lang->icons['cancel'] = 'ban-circle';
|
||||
$lang->icons['recordEstimate'] = 'time';
|
||||
$lang->icons['customFields'] = 'cogs';
|
||||
|
||||
@@ -1414,7 +1414,7 @@ class projectModel extends model
|
||||
*/
|
||||
public function summary($tasks)
|
||||
{
|
||||
$taskSum = $statusWait = $statusDone = $statusDoing = $statusClosed = $statusCancel = 0;
|
||||
$taskSum = $statusWait = $statusDone = $statusDoing = $statusClosed = $statusCancel = $statusPause = 0;
|
||||
$totalEstimate = $totalConsumed = $totalLeft = 0.0;
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
@@ -1425,7 +1425,7 @@ class projectModel extends model
|
||||
$$statusVar ++;
|
||||
}
|
||||
|
||||
return sprintf($this->lang->project->taskSummary, count($tasks), $statusWait, $statusDoing, $totalEstimate, $totalConsumed, $totalLeft);
|
||||
return sprintf($this->lang->project->taskSummary, count($tasks), $statusWait, $statusDoing, $totalEstimate, round($totalConsumed, 1), $totalLeft);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ $config->task->editor->finish = array('id' => 'comment', 'tools' => 'simpleToo
|
||||
$config->task->editor->close = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
$config->task->editor->activate = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
$config->task->editor->cancel = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
$config->task->editor->pause = array('id' => 'comment', 'tools' => 'simpleTools');
|
||||
|
||||
$config->task->exportFields = '
|
||||
id, project, module, story,
|
||||
|
||||
@@ -595,6 +595,38 @@ class task extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function pause($taskID)
|
||||
{
|
||||
$this->commonAction($taskID);
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$changes = $this->task->pause($taskID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
if($this->post->comment != '' or !empty($changes))
|
||||
{
|
||||
$actionID = $this->action->create('task', $taskID, 'Paused', $this->post->comment);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
|
||||
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
}
|
||||
|
||||
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->pause;
|
||||
$this->view->position[] = $this->lang->task->pause;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a task.
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@ $lang->task->logEfforts = "Log working hours";
|
||||
$lang->task->record = "Estimate";
|
||||
$lang->task->start = "Start";
|
||||
$lang->task->finish = "Finish";
|
||||
$lang->task->pause = "Pause";
|
||||
$lang->task->close = "Close";
|
||||
$lang->task->batchClose = "Batch close";
|
||||
$lang->task->cancel = "Cancel";
|
||||
@@ -89,6 +90,7 @@ $lang->task->statusList[''] = '';
|
||||
$lang->task->statusList['wait'] = 'Pending';
|
||||
$lang->task->statusList['doing'] = 'Doing';
|
||||
$lang->task->statusList['done'] = 'Done';
|
||||
$lang->task->statusList['pause'] = 'Paused';
|
||||
$lang->task->statusList['cancel'] = 'Canceled';
|
||||
$lang->task->statusList['closed'] = 'Closed';
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ $lang->task->logEfforts = "记录工时";
|
||||
$lang->task->record = "工时";
|
||||
$lang->task->start = "开始";
|
||||
$lang->task->finish = "完成";
|
||||
$lang->task->pause = "暂停";
|
||||
$lang->task->close = "关闭";
|
||||
$lang->task->batchClose = "批量关闭";
|
||||
$lang->task->cancel = "取消";
|
||||
@@ -89,6 +90,7 @@ $lang->task->statusList[''] = '';
|
||||
$lang->task->statusList['wait'] = '未开始';
|
||||
$lang->task->statusList['doing'] = '进行中';
|
||||
$lang->task->statusList['done'] = '已完成';
|
||||
$lang->task->statusList['pause'] = '已暂停';
|
||||
$lang->task->statusList['cancel'] = '已取消';
|
||||
$lang->task->statusList['closed'] = '已关闭';
|
||||
|
||||
|
||||
@@ -499,6 +499,13 @@ class taskModel extends model
|
||||
$data->assignedDate = $now;
|
||||
$data->realStarted = date('Y-m-d');
|
||||
}
|
||||
else if($task->status == 'pause')
|
||||
{
|
||||
$task->status = 'doing';
|
||||
$data->status = $task->status;
|
||||
$data->assignedTo = $this->app->user->account;
|
||||
$data->assignedDate = $now;
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_TASK)->data($data)->where('id')->eq($taskID)->exec();
|
||||
|
||||
@@ -558,6 +565,28 @@ class taskModel extends model
|
||||
if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story);
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause task
|
||||
*
|
||||
* @param int $taskID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function pause($taskID)
|
||||
{
|
||||
$oldTask = $this->getById($taskID);
|
||||
$now = helper::now();
|
||||
$task = fixer::input('post')
|
||||
->setDefault('status', 'pause')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->remove('comment')->get();
|
||||
|
||||
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec();
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a task.
|
||||
@@ -1334,7 +1363,8 @@ class taskModel extends model
|
||||
if($action == 'finish') return $task->status != 'done' and $task->status != 'closed' and $task->status != 'cancel';
|
||||
if($action == 'close') return $task->status == 'done' or $task->status == 'cancel';
|
||||
if($action == 'activate') return $task->status == 'done' or $task->status == 'closed' or $task->status == 'cancel' ;
|
||||
if($action == 'cancel') return $task->status != 'done ' and $task->status != 'closed' and $task->status != 'cancel';
|
||||
if($action == 'cancel') return $task->status != 'done' and $task->status != 'closed' and $task->status != 'cancel';
|
||||
if($action == 'pause') return $task->status != 'done' and $task->status != 'closed' and $task->status != 'cancel' and $task->status != 'wait' and $task->status != 'pause';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
37
module/task/view/pause.html.php
Normal file
37
module/task/view/pause.html.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* The pause file of task module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package task
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix'><?php echo html::icon($lang->icons['task']);?> <strong><?php echo $task->id;?></strong></span>
|
||||
<strong><?php echo html::a($this->createLink('task', 'view', 'task=' . $task->id), $task->name, '_blank');?></strong>
|
||||
<small class='text-danger'> <?php echo $lang->task->pause;?> <?php echo html::icon($lang->icons['pause']);?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class='form-condensed' method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-60px'><?php echo $lang->comment;?></th>
|
||||
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='text-center'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<div class='main'>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -34,6 +34,7 @@
|
||||
common::printIcon('task', 'assignTo', "projectID=$task->project&taskID=$task->id", $task, 'button', '', '', 'iframe', true);
|
||||
common::printIcon('task', 'start', "taskID=$task->id", $task, 'button', '', '', 'iframe', true);
|
||||
common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'button', '', '', 'iframe', true);
|
||||
common::printIcon('task', 'pause', "taskID=$task->id", $task, 'button', '', '', 'iframe', true);
|
||||
common::printIcon('task', 'finish', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody text-success', true);
|
||||
common::printIcon('task', 'close', "taskID=$task->id", $task, 'button', '', '', 'iframe', true);
|
||||
common::printIcon('task', 'activate', "taskID=$task->id", $task, 'button', '', '', 'iframe text-success', true);
|
||||
|
||||
Reference in New Issue
Block a user