From b03bdfa09e73a8635b4e8e9c0c8bf3972d336630 Mon Sep 17 00:00:00 2001 From: mayue Date: Tue, 30 Aug 2022 16:11:54 +0800 Subject: [PATCH 1/4] * Finish task #66993. --- module/execution/view/batchedit.html.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/execution/view/batchedit.html.php b/module/execution/view/batchedit.html.php index b132bc9fbe..2a606d1224 100755 --- a/module/execution/view/batchedit.html.php +++ b/module/execution/view/batchedit.html.php @@ -106,8 +106,8 @@ ?> '>execution->statusList, $executions[$executionID]->status, 'class=form-control');?> - begin, "id='begins{$executionID}' class='form-control form-date' onchange='computeWorkDays(this.id)'");?> - end, "id='ends{$executionID}' class='form-control form-date' onchange='computeWorkDays(this.id)'");?> + begin, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?> + end, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?> '> desc, "rows='1' class='form-control autosize'");?> '>team, "class='form-control'");?> '> @@ -154,7 +154,7 @@ $('#executionForm').submit(function() /* Clear all error messages. */ $('input[name^=begins]').each(function() { - var beginDateID = $(this).attr('id'); + var beginDateID = $(this).attr('id').replace(/\[|]/g, ''); var endDateID = beginDateID.replace('begins', 'ends'); $('#help' + beginDateID).remove(); $('#help' + endDateID).remove(); @@ -164,7 +164,7 @@ $('#executionForm').submit(function() $('input[name^=begins]').each(function() { var beginDate = $(this).val(); - var beginDateID = $(this).attr('id'); + var beginDateID = $(this).attr('id').replace(/\[|]/g, ''); var nameID = beginDateID.replace('begins', 'names'); var endDateID = beginDateID.replace('begins', 'ends'); From 451bccf572198d40c2ac48dc2b9d458afa7e0fae Mon Sep 17 00:00:00 2001 From: mayue Date: Tue, 30 Aug 2022 17:09:15 +0800 Subject: [PATCH 2/4] * Optimize regex. --- module/execution/js/common.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/module/execution/js/common.js b/module/execution/js/common.js index 70b25619db..1ede120620 100644 --- a/module/execution/js/common.js +++ b/module/execution/js/common.js @@ -63,9 +63,7 @@ function computeWorkDays(currentID) isBactchEdit = false; if(currentID) { - index = currentID.replace('begins[', ''); - index = index.replace('ends[', ''); - index = index.replace(']', ''); + index = currentID.replace(/\w*\[|\]/g, ''); if(!isNaN(index)) isBactchEdit = true; } From 197e3d6ec4d364739df16f3c9961540fa720ca1f Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 31 Aug 2022 13:16:22 +0800 Subject: [PATCH 3/4] * Fix error tips. --- module/execution/view/batchedit.html.php | 40 +++++++++++------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/module/execution/view/batchedit.html.php b/module/execution/view/batchedit.html.php index 2a606d1224..015b79fc73 100755 --- a/module/execution/view/batchedit.html.php +++ b/module/execution/view/batchedit.html.php @@ -85,7 +85,7 @@ systemMode == 'new' and isset($project) and $project->model == 'scrum'):?> project, "class='form-control picker-select' data-lastselected='{$executions[$executionID]->project}' onchange='changeProject(this, $executionID, {$executions[$executionID]->project})'");?> - name, "id='names{$executionID}' class='form-control'");?> + name, "class='form-control'");?> setCode) or $config->setCode == 1):?> code, "class='form-control'");?> @@ -154,26 +154,22 @@ $('#executionForm').submit(function() /* Clear all error messages. */ $('input[name^=begins]').each(function() { - var beginDateID = $(this).attr('id').replace(/\[|]/g, ''); - var endDateID = beginDateID.replace('begins', 'ends'); - $('#help' + beginDateID).remove(); - $('#help' + endDateID).remove(); + var executionID = $(this).attr('id').replace(/\w*\[|\]/g, ''); + $('#helpbegins' + executionID).remove(); + $('#helpends' + executionID).remove(); }); var submitForm = true; $('input[name^=begins]').each(function() { var beginDate = $(this).val(); - var beginDateID = $(this).attr('id').replace(/\[|]/g, ''); + var executionID = $(this).attr('id').replace(/\w*\[|\]/g, ''); - var nameID = beginDateID.replace('begins', 'names'); - var endDateID = beginDateID.replace('begins', 'ends'); - var executionID = beginDateID.replace('begins', ''); - $('#help' + beginDateID).remove(); - $('#help' + endDateID).remove(); + $('#helpbegins' + executionID).remove(); + $('#helpends' + executionID).remove(); /* Invalid data is skipped. */ - var nameVal = $('#' + nameID).val() + var nameVal = $("[name='names[" + executionID + "]']").val() if(!nameVal) return; var projectBeginDate = '0000-00-00'; @@ -199,18 +195,18 @@ $('#executionForm').submit(function() if(!beginDate) { submitForm = false; - var emptyBeginHtml = '
' + emptyBegin + '
'; + var emptyBeginHtml = '
' + emptyBegin + '
'; $(this).after(emptyBeginHtml); alert(emptyBegin); return false; } - var endDate = $('#' + endDateID).val(); + var endDate = $("[name='ends[" + executionID + "]']").val(); if(!endDate) { submitForm = false; - var emptyEndHtml = '
' + emptyEnd + '
'; - $('#' + endDateID).after(emptyEndHtml); + var emptyEndHtml = '
' + emptyEnd + '
'; + $("[name='ends[" + executionID + "]']").after(emptyEndHtml); alert(emptyEnd); return false; } @@ -218,8 +214,8 @@ $('#executionForm').submit(function() if(endDate < beginDate) { submitForm = false; - var emptyEndHtml = '
' + planFinishSmall + '
'; - $('#' + endDateID).after(emptyEndHtml); + var emptyEndHtml = '
' + planFinishSmall + '
'; + $("[name='ends[" + executionID + "]']").after(emptyEndHtml); alert(planFinishSmall); return false; } @@ -228,8 +224,8 @@ $('#executionForm').submit(function() { submitForm = false; var errorBeginTip = errorBegin.replace('%s', projectBeginDate); - var errorBeginHtml = '
' + errorBeginTip + '
'; - $('#' + beginDateID).after(errorBeginHtml); + var errorBeginHtml = '
' + errorBeginTip + '
'; + $("[name='begins[" + executionID + "]']").after(errorBeginHtml); alert(errorBeginTip); return false; } @@ -238,8 +234,8 @@ $('#executionForm').submit(function() { submitForm = false; var errorEndTip = errorEnd.replace('%s', projectEndDate); - var errorEndHtml = '
' + errorEndTip + '
'; - $('#' + endDateID).after(errorEndHtml); + var errorEndHtml = '
' + errorEndTip + '
'; + $("[name='begins[" + executionID + "]']").after(errorEndHtml); alert(errorEndTip); return false; } From b9efaee05761ff541171c1c4eedb5ed34d132b00 Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 31 Aug 2022 13:39:59 +0800 Subject: [PATCH 4/4] * Optimize code. --- module/execution/lang/de.php | 4 ++-- module/execution/lang/en.php | 4 ++-- module/execution/lang/fr.php | 4 ++-- module/execution/lang/zh-cn.php | 4 ++-- module/execution/view/batchedit.html.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php index d7c4b8a112..853272afe3 100644 --- a/module/execution/lang/de.php +++ b/module/execution/lang/de.php @@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon} Kann n $lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice"; $lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; $lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; -$lang->execution->errorLetterProject = "The start time of stage cannot be less than the start time of the project %s."; -$lang->execution->errorGreaterProject = "The end time of stage cannot be greater than the end time %s of the project."; +$lang->execution->errorLetterProject = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; +$lang->execution->errorGreaterProject = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; $lang->execution->errorCommonBegin = 'The start date of ' . $lang->executionCommon . ' should be ≥ the start date of project : %s.'; $lang->execution->errorCommonEnd = 'The deadline of ' . $lang->executionCommon . ' should be ≤ the deadline of project : %s.'; $lang->execution->accessDenied = "Zugriff zu {$lang->executionCommon} verweigert!"; diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index f9adc1fed0..1a5bb94f77 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon} cannot $lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice"; $lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; $lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; -$lang->execution->errorLetterProject = "The start time of stage cannot be less than the start time of the project %s."; -$lang->execution->errorGreaterProject = "The end time of stage cannot be greater than the end time %s of the project."; +$lang->execution->errorLetterProject = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; +$lang->execution->errorGreaterProject = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; $lang->execution->errorCommonBegin = 'The start date of ' . $lang->executionCommon . ' should be ≥ the start date of project : %s.'; $lang->execution->errorCommonEnd = 'The deadline of ' . $lang->executionCommon . ' should be ≤ the deadline of project : %s.'; $lang->execution->accessDenied = "Your access to {$lang->executionCommon} is denied!"; diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php index bae0166bcd..068d55bd72 100644 --- a/module/execution/lang/fr.php +++ b/module/execution/lang/fr.php @@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "Ce {$lang->executionCommon} ne $lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice"; $lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; $lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; -$lang->execution->errorLetterProject = "The start time of stage cannot be less than the start time of the project %s."; -$lang->execution->errorGreaterProject = "The end time of stage cannot be greater than the end time %s of the project."; +$lang->execution->errorLetterProject = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; +$lang->execution->errorGreaterProject = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; $lang->execution->errorCommonBegin = 'The start date of ' . $lang->executionCommon . ' should be ≥ the start date of project : %s.'; $lang->execution->errorCommonEnd = 'The deadline of ' . $lang->executionCommon . ' should be ≤ the deadline of project : %s.'; $lang->execution->accessDenied = "Votre accès au {$lang->executionCommon} est refusé ! Désolé."; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 9b308c85be..87c8b9fac9 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon}不能 $lang->execution->errorSameBranches = "{$lang->executionCommon}不能关联多个相同的分支。"; $lang->execution->errorBegin = "{$lang->executionCommon}的开始时间不能小于所属项目的开始时间%s。"; $lang->execution->errorEnd = "{$lang->executionCommon}的截止时间不能大于所属项目的结束时间%s。"; -$lang->execution->errorLetterProject = "阶段的计划开始时间不能小于所属项目的计划开始时间%s。"; -$lang->execution->errorGreaterProject = "阶段的计划完成时间不能大于所属项目的计划完成时间%s。"; +$lang->execution->errorLetterProject = "{$lang->executionCommon}的计划开始时间不能小于所属项目的计划开始时间%s。"; +$lang->execution->errorGreaterProject = "{$lang->executionCommon}的计划完成时间不能大于所属项目的计划完成时间%s。"; $lang->execution->errorCommonBegin = $lang->executionCommon . '开始日期应大于等于项目的开始日期:%s。'; $lang->execution->errorCommonEnd = $lang->executionCommon . '截止日期应小于等于项目的截止日期:%s。'; $lang->execution->accessDenied = "您无权访问该{$lang->executionCommon}!"; diff --git a/module/execution/view/batchedit.html.php b/module/execution/view/batchedit.html.php index 015b79fc73..00dd365a63 100755 --- a/module/execution/view/batchedit.html.php +++ b/module/execution/view/batchedit.html.php @@ -235,7 +235,7 @@ $('#executionForm').submit(function() submitForm = false; var errorEndTip = errorEnd.replace('%s', projectEndDate); var errorEndHtml = '
' + errorEndTip + '
'; - $("[name='begins[" + executionID + "]']").after(errorEndHtml); + $("[name='ends[" + executionID + "]']").after(errorEndHtml); alert(errorEndTip); return false; }