diff --git a/module/task/control.php b/module/task/control.php index bdef2e9af1..809657dc56 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -728,6 +728,7 @@ class task extends control if(!empty($_POST)) { $changes = $this->task->recordEstimate($taskID); + if(dao::isError()) die(js::error(dao::getError())); /* Remind whether to update status of the bug, if task which from that bug has been finished. */ $task = $this->task->getById($taskID); diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index 8cd7b47a51..5c28c04036 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -198,6 +198,7 @@ $lang->task->createDenied = '你不能在该项目添加任务'; $lang->task->cannotDeleteParent = '不能删除父任务。'; $lang->task->error = new stdclass(); +$lang->task->error->totalNumber = '"总计消耗"必须为数字'; $lang->task->error->consumedNumber = '"本次消耗"必须为数字'; $lang->task->error->estimateNumber = '"预计剩余"必须为数字'; $lang->task->error->recordMinus = '工时不能为负数'; diff --git a/module/task/model.php b/module/task/model.php index e194fb0026..0a655419fe 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1205,7 +1205,25 @@ class taskModel extends model */ public function recordEstimate($taskID) { - $record = fixer::input('post')->get(); + $record = fixer::input('post')->get(); + foreach($record->consumed as $item) + { + if(!is_numeric($item)) + { + dao::$errors[] = $this->lang->task->error->totalNumber; + return false; + } + } + + foreach($record->left as $item) + { + if(!is_numeric($item)) + { + dao::$errors[] = $this->lang->task->error->estimateNumber; + return false; + } + } + $estimates = array(); $task = $this->getById($taskID); $earliestTime = '';