From ceec1e02f7da90892872a8944018c395064e0a7e Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 14 Jan 2015 23:48:10 +0300 Subject: [PATCH] Fix comment worktime reminder --- js/bug.js | 2 +- js/enter_bug.js | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/js/bug.js b/js/bug.js index b71f83b94..557f4d256 100644 --- a/js/bug.js +++ b/js/bug.js @@ -260,7 +260,7 @@ function changeform_onsubmit() return false; var wtInput = document.changeform.work_time; - if (wtInput) + if (!wtInput) { window.checkCommentOnUnload = false; return true; diff --git a/js/enter_bug.js b/js/enter_bug.js index d8376ced4..58e4018da 100644 --- a/js/enter_bug.js +++ b/js/enter_bug.js @@ -155,23 +155,27 @@ function validateEntryForm(theform) } // Validate worktime - var wt = bzParseTime(theform.work_time.value); - if (wt !== null && (wt === undefined || wt != wt)) - wt = null; - else if (wt < 0) - wt = 0; - if (wantsReminder && (wt === null || noTimeTracking == (wt != 0))) + if (theform.work_time) { - wt = prompt("Please, verify working time:", "0"); - if (wt == null || wt == undefined || (""+wt).length <= 0) + var wt = bzParseTime(theform.work_time.value); + if (wt !== null && (wt === undefined || wt != wt)) + wt = null; + else if (wt < 0) + wt = 0; + if (wantsReminder && (wt === null || noTimeTracking == (wt != 0))) { - theform.work_time.focus(); - return false; + wt = prompt("Please, verify working time:", "0"); + if (wt == null || wt == undefined || (""+wt).length <= 0) + { + theform.work_time.focus(); + return false; + } } + if (wt === null) + wt = 0; + theform.work_time.value = wt; } - if (wt === null) - wt = 0; - theform.work_time.value = wt; + window.checkCommentOnUnload = false; return true; }