From ae9da000b1cdbecd71599cd47a1c1ed2c20c7681 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Wed, 9 Jan 2013 06:35:02 +0000 Subject: [PATCH] * code for task#1030. --- module/task/control.php | 2 +- module/task/js/record.js | 16 ++++++++++++++++ module/task/lang/en.php | 1 + module/task/lang/zh-cn.php | 1 + module/task/model.php | 2 ++ module/task/view/record.html.php | 7 ++++++- 6 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 module/task/js/record.js diff --git a/module/task/control.php b/module/task/control.php index cd286138b6..68c7639eba 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -437,7 +437,7 @@ class task extends control if(!empty($_POST)) { $changes = $this->task->record($taskID); - $actionID = $this->action->create('task', $taskID, 'Record', ''); + $actionID = $this->action->create('task', $taskID, 'Recorded', $this->post->comment, (float)$this->post->consumed); $this->action->logHistory($actionID, $changes); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } diff --git a/module/task/js/record.js b/module/task/js/record.js new file mode 100644 index 0000000000..ca3c9cf3c9 --- /dev/null +++ b/module/task/js/record.js @@ -0,0 +1,16 @@ +/* If left = 0, warning. */ +function checkLeft() +{ + value = $("#left").val(); + if(isNaN(parseInt(value))) + { + if(confirm(confirmFinish)) + { + return true; + } + else + { + return false; + } + } +} diff --git a/module/task/lang/en.php b/module/task/lang/en.php index 980bc792f4..adc0ed36c6 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -136,6 +136,7 @@ $lang->task->successSaved = "Successfully saved"; $lang->task->delayWarning = " Postponed %s days "; $lang->task->remindBug = "This task from Bug, update the Bug:%s or not?"; $lang->task->confirmChangeProject = 'Change project will change module, story and assignedTo also, are you sure?'; +$lang->task->confirmFinish = '"Left" is 0, this task will be done. Are you sure?'; $lang->task->error = new stdclass(); $lang->task->error->consumed = '"Consumed" must be number'; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index bc775cd67b..3880bd0b0c 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -136,6 +136,7 @@ $lang->task->successSaved = "成功添加,"; $lang->task->delayWarning = " 延期%s天 "; $lang->task->remindBug = "该任务为Bug转化得到,是否更新Bug:%s ?"; $lang->task->confirmChangeProject = '修改项目会导致相应的所属模块、相关需求和指派人发生变化,确定吗?'; +$lang->task->confirmFinish = '"预计剩余"为0,确认将任务状态改为"已完成"吗?'; $lang->task->error = new stdclass(); $lang->task->error->consumed = '"已经消耗"必须为数字'; diff --git a/module/task/model.php b/module/task/model.php index 8cf16f6e2a..e115dfd91b 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -417,6 +417,8 @@ class taskModel extends model ->setDefault('account', $this->app->user->account) ->setDefault('task', $taskID) ->setDefault('date', helper::now()) + ->cleanFloat('consumed, left') + ->remove('comment') ->get(); $this->dao->insert(TABLE_TASKESTIMATE)->data($estimate) ->autoCheck() diff --git a/module/task/view/record.html.php b/module/task/view/record.html.php index 3a771e3c16..cba928d728 100644 --- a/module/task/view/record.html.php +++ b/module/task/view/record.html.php @@ -11,7 +11,8 @@ */ ?> -
+task->confirmFinish);?> + @@ -26,6 +27,10 @@ + + + +
name;?>
task->left;?> task->hour;?>
comment;?>
goback, $this->session->taskList); ?>