From 836b70cd8606f9b75d1d91211720dff1b1960f9f Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Mon, 20 Jun 2016 15:14:18 +0800 Subject: [PATCH] * Remind users to save the estimate record if it has not been saved before they edit or delete an estimate record. --- module/task/control.php | 5 +++++ module/task/js/recordestimate.js | 22 +++++++++++++++++++++- module/task/lang/en.php | 1 + module/task/lang/zh-cn.php | 1 + module/task/view/recordestimate.html.php | 3 ++- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 64eb1c5159..03e9237dda 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -628,6 +628,11 @@ class task extends control } } } + if($this->cookie->reload2Parent) + { + setcookie('reload2Parent', false, 0, $this->config->webRoot); + die(js::reload('parent')); + } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); diff --git a/module/task/js/recordestimate.js b/module/task/js/recordestimate.js index fd7d720cfb..bce3f5786f 100644 --- a/module/task/js/recordestimate.js +++ b/module/task/js/recordestimate.js @@ -8,5 +8,25 @@ $(function() }); if(left === '0') return confirm(confirmRecord); }); -}) + $('#recordForm .showinonlybody').each(function() + { + $(this).click(function() + { + var saveRecord = false; + $('#recordForm .form-date').each(function() + { + if($(this).val() !== '') + { + saveRecord = confirm(confirmSaveRecord); + return false; + } + }); + if(saveRecord) + { + $.cookie('reload2Parent', true, {path:config.webRoot}); + return false; + } + }); + }); +}) diff --git a/module/task/lang/en.php b/module/task/lang/en.php index 738fb28ead..c1b0d8ebf7 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -144,6 +144,7 @@ $lang->task->remindBug = "This task from Bug, update the Bug:%s or n $lang->task->confirmChangeProject = "Change {$lang->projectCommon} will change module, story and assignedTo also, are you sure?"; $lang->task->confirmFinish = '"Left" is zero, this task will be done. Are you sure?'; $lang->task->confirmRecord = '"Left" is zero, this task will be done. Are you sure?'; +$lang->task->confirmSaveRecord = 'Please save the estimate record which has not been saved.'; $lang->task->commentActions = '%s. %s, commented by%s.'; $lang->task->error = new stdclass(); diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index b056c34e5c..abdb765e79 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -144,6 +144,7 @@ $lang->task->remindBug = "该任务为Bug转化得到,是否更新 $lang->task->confirmChangeProject = "修改{$lang->projectCommon}会导致相应的所属模块、相关需求和指派人发生变化,确定吗?"; $lang->task->confirmFinish = '"预计剩余"为0,确认将任务状态改为"已完成"吗?'; $lang->task->confirmRecord = '"剩余"为0,任务将标记为"已完成",您确定吗?'; +$lang->task->confirmSaveRecord = '您有尚未保存的工时记录,请先将其保存。'; $lang->task->commentActions = '%s. %s, 由 %s 添加备注。'; $lang->task->error = new stdclass(); diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index be3cf41b8a..fa8c8a2fed 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -12,7 +12,8 @@ ?> -task->confirmRecord);?> +task->confirmRecord);?> +task->confirmSaveRecord);?>
icons['task']);?> id;?>