From 461235a04834a76bd1acf90cc3856ed3e9d11654 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Wed, 29 Jun 2022 09:00:33 +0000 Subject: [PATCH 1/3] * Fix bug #24417. --- module/product/js/all.js | 21 ++++++++++++++++++--- module/program/lang/de.php | 5 +++-- module/program/lang/en.php | 5 +++-- module/program/lang/fr.php | 5 +++-- module/program/lang/zh-cn.php | 5 +++-- module/program/model.php | 11 +++++++---- module/project/lang/de.php | 2 +- module/project/lang/fr.php | 2 +- module/project/lang/zh-cn.php | 26 ++++++++++++++------------ module/project/model.php | 13 +++++++++++++ 10 files changed, 66 insertions(+), 29 deletions(-) diff --git a/module/product/js/all.js b/module/product/js/all.js index e3e8a72217..d468307e32 100644 --- a/module/product/js/all.js +++ b/module/product/js/all.js @@ -77,6 +77,21 @@ $(function() } } + function debounce(fn,delay) + { + var timer = null; + return function() + { + if(timer) clearTimeout(timer); + timer = setTimeout(fn,delay) + } + } + + function updateStatistic() + { + debounce(addStatistic(), 200) + } + $('#productTableList').on('click', '.row-program,.row-line', function(e) { if($(e.target).closest('.table-nest-toggle,a').length) return; @@ -96,7 +111,7 @@ $(function() { updatePrarentCheckbox($('#productTableList>tr[data-id="' + parentID + '"]')); } - addStatistic() + updateStatistic() }); $('#productListForm').on('checkChange', updateCheckboxes); @@ -104,7 +119,7 @@ $(function() $(":checkbox[name^='productIDList']").on('click', function() { - addStatistic() + updateStatistic() }); $(".check-all").on('click', function() @@ -117,6 +132,6 @@ $(function() { $(":checkbox[name^='productIDList']").prop('checked', true); } - addStatistic() + updateStatistic() }); }); diff --git a/module/program/lang/de.php b/module/program/lang/de.php index 86fcbcd233..fa898bb47a 100644 --- a/module/program/lang/de.php +++ b/module/program/lang/de.php @@ -47,6 +47,7 @@ $lang->program->realDuration = 'RealDuration'; $lang->program->openedVersion = 'OpenedVersion'; $lang->program->lastEditedBy = 'LastEditedBy'; $lang->program->lastEditedDate = 'LastEditedDate'; +$lang->program->childProgram = 'Child Program'; /* Actions. */ $lang->program->common = 'Program'; @@ -101,8 +102,8 @@ $lang->program->tips = 'If a parent program is selected, the produ $lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?"; $lang->program->beginLetterParent = 'The start date of the program "%s" should be ≥ the start date of the parent program "%s": %s.'; $lang->program->endGreaterParent = 'The finish date of the program "%s" should be ≤ the finish date of the parent program "%s": %s.'; -$lang->program->beginGreateChild = 'The start date of the parent program "%s" should be ≤the minimum start time of the subprogram "%s": %s.'; -$lang->program->endLetterChild = 'The finish time of the parent program "%s" should be ≥ the maximum finish time of the subprogram "%s": %s.'; +$lang->program->beginGreateChild = 'The start date of the parent program "%s" should be ≤the minimum start time of the %s "%s": %s.'; +$lang->program->endLetterChild = 'The finish time of the parent program "%s" should be ≥ the maximum finish time of the %s "%s": %s.'; $lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed'; $lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.'; $lang->program->hasProduct = 'It has products. You cannot delete it.'; diff --git a/module/program/lang/en.php b/module/program/lang/en.php index 44a8f7ac5d..ea3984b164 100644 --- a/module/program/lang/en.php +++ b/module/program/lang/en.php @@ -47,6 +47,7 @@ $lang->program->realDuration = 'RealDuration'; $lang->program->openedVersion = 'OpenedVersion'; $lang->program->lastEditedBy = 'LastEditedBy'; $lang->program->lastEditedDate = 'LastEditedDate'; +$lang->program->childProgram = 'Child Program'; /* Actions. */ $lang->program->common = 'Program'; @@ -101,8 +102,8 @@ $lang->program->tips = 'If a parent program is selected, the produ $lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?"; $lang->program->beginLetterParent = 'The start date of the program "%s" should be ≥ the start date of the parent program "%s": %s.'; $lang->program->endGreaterParent = 'The finish date of the program "%s" should be ≤ the finish date of the parent program "%s": %s.'; -$lang->program->beginGreateChild = 'The start date of the parent program "%s" should be ≤the minimum start time of the subprogram "%s": %s.'; -$lang->program->endLetterChild = 'The finish time of the parent program "%s" should be ≥ the maximum finish time of the subprogram "%s": %s.'; +$lang->program->beginGreateChild = 'The start date of the parent program "%s" should be ≤the minimum start time of the %s "%s": %s.'; +$lang->program->endLetterChild = 'The finish time of the parent program "%s" should be ≥ the maximum finish time of the %s "%s": %s.'; $lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed'; $lang->program->hasChildren = 'The program has a child program or the project exists and can not be deleted.'; $lang->program->hasProduct = 'The program has products exist and can not be deleted.'; diff --git a/module/program/lang/fr.php b/module/program/lang/fr.php index aac9e38cc5..8c0f082390 100644 --- a/module/program/lang/fr.php +++ b/module/program/lang/fr.php @@ -47,6 +47,7 @@ $lang->program->realDuration = 'RealDuration'; $lang->program->openedVersion = 'OpenedVersion'; $lang->program->lastEditedBy = 'LastEditedBy'; $lang->program->lastEditedDate = 'LastEditedDate'; +$lang->program->childProgram = 'sous-programme'; /* Actions. */ $lang->program->common = 'Program'; @@ -101,8 +102,8 @@ $lang->program->tips = 'If a parent program is selected, the produ $lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?"; $lang->program->beginLetterParent = 'La date de début du programme "%s" doit être ≥ à la date de début du programme parent "%s" : %s.'; $lang->program->endGreaterParent = 'La date de fin du programme "%s" doit être ≤ à la date de fin du programme parent "%s" : %s.'; -$lang->program->beginGreateChild = 'La date de début du programme parent "%s" doit être ≤ à la date de début minimum du sous-programme "%s" : %s.'; -$lang->program->endLetterChild = 'Le temps de fin du programme parent "%s" doit être ≥ au temps de fin maximum du sous-programme "%s" : %s.'; +$lang->program->beginGreateChild = 'La date de début du programme parent "%s" doit être ≤ à la date de début minimum du %s "%s" : %s.'; +$lang->program->endLetterChild = 'Le temps de fin du programme parent "%s" doit être ≥ au temps de fin maximum du %s "%s" : %s.'; $lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed'; $lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.'; $lang->program->hasProduct = 'It has products. You cannot delete it.'; diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index 91c20bc491..94152e486a 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -47,6 +47,7 @@ $lang->program->realDuration = '实际周期天数'; $lang->program->openedVersion = '创建版本'; $lang->program->lastEditedBy = '最后编辑人'; $lang->program->lastEditedDate = '最后编辑日期'; +$lang->program->childProgram = '子项目集'; /* Actions. */ $lang->program->common = '项目集'; @@ -101,8 +102,8 @@ $lang->program->tips = '选择了父项目集,则可关联该父 $lang->program->confirmBatchUnlink = "您确定要批量移除这些干系人吗?"; $lang->program->beginLetterParent = '项目集“%s”开始日期应大于等于父项目集“%s”的开始日期:%s。'; $lang->program->endGreaterParent = '项目集“%s”完成日期应小于等于父项目集“%s”的完成日期:%s。'; -$lang->program->beginGreateChild = '父项目集“%s”的开始日期应小于等于子项目集“%s”的最小开始时间:%s。'; -$lang->program->endLetterChild = '父项目集“%s”的完成时间应大于等于子项目集“%s”的最大完成时间:%s。'; +$lang->program->beginGreateChild = '父项目集“%s”的开始日期应小于等于%s“%s”的最小开始时间:%s。'; +$lang->program->endLetterChild = '父项目集“%s”的完成时间应大于等于%s“%s”的最大完成时间:%s。'; $lang->program->closeErrorMessage = '存在子项目集或项目为未关闭状态'; $lang->program->hasChildren = '该项目集有子项目集或项目存在,不能删除。'; $lang->program->hasProduct = '该项目集有产品存在,不能删除。'; diff --git a/module/program/model.php b/module/program/model.php index cb62e0f692..e4188b1f8d 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -772,6 +772,7 @@ class programModel extends model */ public function update($programID) { + $this->app->loadLang('project'); $programID = (int)$programID; $oldProgram = $this->dao->findById($programID)->from(TABLE_PROGRAM)->fetch(); @@ -799,11 +800,13 @@ class programModel extends model if($children > 0) { - $minChildBegin = $this->dao->select('name, min(begin) as minBegin')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->fetch(); - $maxChildEnd = $this->dao->select('name, max(end) as maxEnd')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->andWhere('end')->ne('0000-00-00')->fetch(); + $minChildBegin = $this->dao->select('name, type, begin as minBegin')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->orderBy('begin_asc')->fetch(); + $maxChildEnd = $this->dao->select('name, type, end as maxEnd')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->andWhere('end')->ne('0000-00-00')->orderBy('end_desc')->fetch(); - if($minChildBegin and $program->begin > $minChildBegin) dao::$errors['begin'] = sprintf($this->lang->program->beginGreateChild, $program->name, $minChildBegin->name, $minChildBegin->minBegin); - if($maxChildEnd and $program->end < $maxChildEnd and $this->post->delta != 999) dao::$errors['end'] = sprintf($this->lang->program->endLetterChild, $program->name, $maxChildEnd->name, $maxChildEnd->maxEnd); + $minChildType = ($minChildBegin->type == 'project') ? $this->lang->project->common : $this->lang->program->childProgram; + $maxChildType = ($maxChildEnd->type == 'project') ? $this->lang->project->common : $this->lang->program->childProgram; + if($minChildBegin and $program->begin > $minChildBegin->minBegin) dao::$errors['begin'] = sprintf($this->lang->program->beginGreateChild, $program->name, $minChildType, $minChildBegin->name, $minChildBegin->minBegin); + if($maxChildEnd and $program->end < $maxChildEnd->maxEnd and $this->post->delta != 999) dao::$errors['end'] = sprintf($this->lang->program->endLetterChild, $program->name, $maxChildType, $maxChildEnd->name, $maxChildEnd->maxEnd); if(dao::isError()) return false; } diff --git a/module/project/lang/de.php b/module/project/lang/de.php index f9a6cf60a2..f699a0c1d0 100644 --- a/module/project/lang/de.php +++ b/module/project/lang/de.php @@ -65,7 +65,7 @@ $lang->project->budgetGe0 = '『Budget』must be greater than or equal $lang->project->allProjects = 'All Projects'; /* Fields. */ -$lang->project->common = 'Program'; +$lang->project->common = 'Project'; $lang->project->id = 'ID'; $lang->project->project = 'Project'; $lang->project->stage = 'Stage'; diff --git a/module/project/lang/fr.php b/module/project/lang/fr.php index f3969c0654..7da0606307 100644 --- a/module/project/lang/fr.php +++ b/module/project/lang/fr.php @@ -65,7 +65,7 @@ $lang->project->budgetGe0 = '『Budget』must be greater than or equal $lang->project->allProjects = 'All Projects'; /* Fields. */ -$lang->project->common = 'Project'; +$lang->project->common = 'Projets'; $lang->project->id = 'ID'; $lang->project->project = 'Project'; $lang->project->stage = 'Stage'; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index 04edb713da..e16391f3e3 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -310,18 +310,20 @@ $lang->project->programTitle['end'] = '只显示最后一级项目集'; $lang->project->accessDenied = '您无权访问该项目!'; $lang->project->chooseProgramType = '选择项目管理方式'; $lang->project->cannotCreateChild = '该项目已经有实际的内容,无法直接添加子项目。您可以为当前项目创建一个父项目,然后在新的父项目下面添加子项目。'; -$lang->project->hasChildren = '该项目有子项目存在,不能删除。'; -$lang->project->confirmDelete = '您确定删除项目“%s”吗?'; -$lang->project->cannotChangeToCat = "该项目已经有实际的内容,无法修改为父项目"; -$lang->project->cannotCancelCat = "该项目下已经有子项目,无法取消父项目标记"; -$lang->project->parentBeginEnd = "父项目起止时间:%s ~ %s"; -$lang->project->parentBudget = "父项目预算:"; -$lang->project->beginLetterParent = "父项目的开始日期:%s,开始日期不能小于父项目的开始日期"; -$lang->project->endGreaterParent = "父项目的完成日期:%s,完成日期不能大于父项目的完成日期"; -$lang->project->beginGreateChild = '项目“%s”的开始日期应大于等于项目集“%s”的最小开始日期:%s'; -$lang->project->endLetterChild = '项目“%s”的完成日期应小于等于项目集“%s”的最大完成日期:%s'; -$lang->project->childLongTime = "子项目中有长期项目,父项目也应该是长期项目"; -$lang->project->confirmUnlinkMember = "您确定从该项目中移除该用户吗?"; +$lang->project->hasChildren = '该项目有子项目存在,不能删除。'; +$lang->project->confirmDelete = '您确定删除项目“%s”吗?'; +$lang->project->cannotChangeToCat = "该项目已经有实际的内容,无法修改为父项目"; +$lang->project->cannotCancelCat = "该项目下已经有子项目,无法取消父项目标记"; +$lang->project->parentBeginEnd = "父项目起止时间:%s ~ %s"; +$lang->project->parentBudget = "父项目预算:"; +$lang->project->beginLetterParent = "父项目的开始日期:%s,开始日期不能小于父项目的开始日期"; +$lang->project->endGreaterParent = "父项目的完成日期:%s,完成日期不能大于父项目的完成日期"; +$lang->project->beginGreateChild = '项目“%s”的开始日期应大于等于项目集“%s”的最小开始日期:%s'; +$lang->project->endLetterChild = '项目“%s”的完成日期应小于等于项目集“%s”的最大完成日期:%s'; +$lang->project->begigLetterExecution = '项目“%s”的开始日期应小于等于执行“%s”的最小开始日期:%s'; +$lang->project->endGreateExecution = '项目“%s”的完成日期应大于等于执行“%s”的最大完成日期:%s'; +$lang->project->childLongTime = "子项目中有长期项目,父项目也应该是长期项目"; +$lang->project->confirmUnlinkMember = "您确定从该项目中移除该用户吗?"; $lang->project->action = new stdclass(); $lang->project->action->managed = '$date, 由 $actor 维护。$extra' . "\n"; diff --git a/module/project/model.php b/module/project/model.php index 12e7b85acc..a4b8633608 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1375,6 +1375,19 @@ class projectModel extends model } } + $executions = $this->dao->select('*')->from(TABLE_PROJECT) + ->where('project')->eq($project->id) + ->andWhere('deleted')->eq('0') + ->fetch(); + if(!empty($executions)) + { + $minExecutionBegin = $this->dao->select('name, begin as minBegin')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('begin_asc')->fetch(); + $maxExecutionEnd = $this->dao->select('name, end as maxEnd')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('end_desc')->fetch(); + if($minExecutionBegin and $project->begin > $minExecutionBegin->minBegin) dao::$errors['begin'] = sprintf($this->lang->project->begigLetterExecution, $project->name, $minExecutionBegin->name, $minExecutionBegin->minBegin); + if($maxExecutionEnd and $project->end < $maxExecutionEnd->maxEnd) dao::$errors['end'] = sprintf($this->lang->project->endGreateExecution, $project->name, $maxExecutionEnd->name, $maxExecutionEnd->maxEnd); + if(dao::isError()) return false; + } + /* Judge products not empty. */ $linkedProductsCount = 0; foreach($_POST['products'] as $product) From 298493d3a103cfb898592b7a5af6a18904c41f4d Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Thu, 30 Jun 2022 00:57:18 +0000 Subject: [PATCH 2/3] * Fix bug #24417. --- module/program/lang/de.php | 8 ++++---- module/program/lang/en.php | 8 ++++---- module/program/lang/fr.php | 8 ++++---- module/program/lang/zh-cn.php | 8 ++++---- module/program/model.php | 20 ++++++++++---------- module/project/lang/de.php | 32 +++++++++++++++++--------------- module/project/lang/en.php | 6 ++++-- module/project/lang/fr.php | 32 +++++++++++++++++--------------- module/project/lang/zh-cn.php | 8 ++++---- module/project/model.php | 20 ++++++++++---------- 10 files changed, 78 insertions(+), 72 deletions(-) diff --git a/module/program/lang/de.php b/module/program/lang/de.php index fa898bb47a..ddc8622604 100644 --- a/module/program/lang/de.php +++ b/module/program/lang/de.php @@ -100,10 +100,10 @@ $lang->program->noProgram = 'No program.'; $lang->program->showClosed = 'Closed programs.'; $lang->program->tips = 'If a parent program is selected, the products under the parent program can be associated. If no program is selected for the project, a product with the same name as the project is created and associated with the project by default.'; $lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?"; -$lang->program->beginLetterParent = 'The start date of the program "%s" should be ≥ the start date of the parent program "%s": %s.'; -$lang->program->endGreaterParent = 'The finish date of the program "%s" should be ≤ the finish date of the parent program "%s": %s.'; -$lang->program->beginGreateChild = 'The start date of the parent program "%s" should be ≤the minimum start time of the %s "%s": %s.'; -$lang->program->endLetterChild = 'The finish time of the parent program "%s" should be ≥ the maximum finish time of the %s "%s": %s.'; +$lang->program->beginLetterParent = 'The start date of the program should be ≥ the start date of the parent program: %s.'; +$lang->program->endGreaterParent = 'The finish date of the program should be ≤ the finish date of the parent program: %s.'; +$lang->program->beginGreateChild = 'The start date of the parent program should be ≤the minimum start time of the %s: %s.'; +$lang->program->endLetterChild = 'The finish time of the parent program should be ≥ the maximum finish time of the %s: %s.'; $lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed'; $lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.'; $lang->program->hasProduct = 'It has products. You cannot delete it.'; diff --git a/module/program/lang/en.php b/module/program/lang/en.php index ea3984b164..c1bff24805 100644 --- a/module/program/lang/en.php +++ b/module/program/lang/en.php @@ -100,10 +100,10 @@ $lang->program->noProgram = 'No program.'; $lang->program->showClosed = 'Closed'; $lang->program->tips = 'If a parent program is selected, the products under the parent program can be associated. If no program is selected for the project, a product with the same name as the project is created and associated with the project by default.'; $lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?"; -$lang->program->beginLetterParent = 'The start date of the program "%s" should be ≥ the start date of the parent program "%s": %s.'; -$lang->program->endGreaterParent = 'The finish date of the program "%s" should be ≤ the finish date of the parent program "%s": %s.'; -$lang->program->beginGreateChild = 'The start date of the parent program "%s" should be ≤the minimum start time of the %s "%s": %s.'; -$lang->program->endLetterChild = 'The finish time of the parent program "%s" should be ≥ the maximum finish time of the %s "%s": %s.'; +$lang->program->beginLetterParent = 'The start date of the program should be ≥ the start date of the parent program: %s.'; +$lang->program->endGreaterParent = 'The finish date of the program should be ≤ the finish date of the parent program: %s.'; +$lang->program->beginGreateChild = 'The start date of the parent program should be ≤the minimum start time of the %s: %s.'; +$lang->program->endLetterChild = 'The finish time of the parent program should be ≥ the maximum finish time of the %s: %s.'; $lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed'; $lang->program->hasChildren = 'The program has a child program or the project exists and can not be deleted.'; $lang->program->hasProduct = 'The program has products exist and can not be deleted.'; diff --git a/module/program/lang/fr.php b/module/program/lang/fr.php index 8c0f082390..35a7c36065 100644 --- a/module/program/lang/fr.php +++ b/module/program/lang/fr.php @@ -100,10 +100,10 @@ $lang->program->noProgram = 'No program.'; $lang->program->showClosed = 'Closed programs.'; $lang->program->tips = 'If a parent program is selected, the products under the parent program can be associated. If no program is selected for the project, a product with the same name as the project is created and associated with the project by default.'; $lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?"; -$lang->program->beginLetterParent = 'La date de début du programme "%s" doit être ≥ à la date de début du programme parent "%s" : %s.'; -$lang->program->endGreaterParent = 'La date de fin du programme "%s" doit être ≤ à la date de fin du programme parent "%s" : %s.'; -$lang->program->beginGreateChild = 'La date de début du programme parent "%s" doit être ≤ à la date de début minimum du %s "%s" : %s.'; -$lang->program->endLetterChild = 'Le temps de fin du programme parent "%s" doit être ≥ au temps de fin maximum du %s "%s" : %s.'; +$lang->program->beginLetterParent = 'La date de début du programme doit être ≥ à la date de début du programme parent: %s.'; +$lang->program->endGreaterParent = 'La date de fin du programme doit être ≤ à la date de fin du programme parent: %s.'; +$lang->program->beginGreateChild = 'La date de début du programme parent doit être ≤ à la date de début minimum du %s: %s.'; +$lang->program->endLetterChild = 'Le temps de fin du programme parent doit être ≥ au temps de fin maximum du %s: %s.'; $lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed'; $lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.'; $lang->program->hasProduct = 'It has products. You cannot delete it.'; diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index 94152e486a..0ec1b2a72a 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -100,10 +100,10 @@ $lang->program->noProgram = '暂时没有项目集'; $lang->program->showClosed = '显示已关闭'; $lang->program->tips = '选择了父项目集,则可关联该父项目集下的产品。如果项目未选择任何项目集,则系统会默认创建一个和该项目同名的产品并关联该项目。'; $lang->program->confirmBatchUnlink = "您确定要批量移除这些干系人吗?"; -$lang->program->beginLetterParent = '项目集“%s”开始日期应大于等于父项目集“%s”的开始日期:%s。'; -$lang->program->endGreaterParent = '项目集“%s”完成日期应小于等于父项目集“%s”的完成日期:%s。'; -$lang->program->beginGreateChild = '父项目集“%s”的开始日期应小于等于%s“%s”的最小开始时间:%s。'; -$lang->program->endLetterChild = '父项目集“%s”的完成时间应大于等于%s“%s”的最大完成时间:%s。'; +$lang->program->beginLetterParent = '项目集开始日期应大于等于父项目集的开始日期:%s。'; +$lang->program->endGreaterParent = '项目集完成日期应小于等于父项目集的完成日期:%s。'; +$lang->program->beginGreateChild = '父项目集的开始日期应小于等于%s的最小开始时间:%s。'; +$lang->program->endLetterChild = '父项目集的完成时间应大于等于%s的最大完成时间:%s。'; $lang->program->closeErrorMessage = '存在子项目集或项目为未关闭状态'; $lang->program->hasChildren = '该项目集有子项目集或项目存在,不能删除。'; $lang->program->hasProduct = '该项目集有产品存在,不能删除。'; diff --git a/module/program/model.php b/module/program/model.php index e4188b1f8d..08a0f9fd69 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -709,13 +709,13 @@ class programModel extends model if($parentProgram) { /* Child program begin cannot less than parent. */ - if(!empty($program->name) and $program->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->beginLetterParent, $program->name, $parentProgram->name, $parentProgram->begin); + if(!empty($program->name) and $program->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->beginLetterParent, $parentProgram->begin); /* When parent set end then child program end cannot greater than parent. */ - if(!empty($program->name) and$parentProgram->end != '0000-00-00' and $program->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $program->name, $parentProgram->name, $parentProgram->end); + if(!empty($program->name) and$parentProgram->end != '0000-00-00' and $program->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end); /* When parent set end then child program cannot set longTime. */ - if(!empty($program->name) and empty($program->end) and $this->post->delta == 999 and $parentProgram->end != '0000-00-00') dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $program->name, $parentProgram->name, $parentProgram->end); + if(!empty($program->name) and empty($program->end) and $this->post->delta == 999 and $parentProgram->end != '0000-00-00') dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end); /* The budget of a child program cannot beyond the remaining budget of the parent program. */ $program->budgetUnit = $parentProgram->budgetUnit; @@ -800,13 +800,13 @@ class programModel extends model if($children > 0) { - $minChildBegin = $this->dao->select('name, type, begin as minBegin')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->orderBy('begin_asc')->fetch(); - $maxChildEnd = $this->dao->select('name, type, end as maxEnd')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->andWhere('end')->ne('0000-00-00')->orderBy('end_desc')->fetch(); + $minChildBegin = $this->dao->select('type, begin as minBegin')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->orderBy('begin_asc')->fetch(); + $maxChildEnd = $this->dao->select('type, end as maxEnd')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->andWhere('end')->ne('0000-00-00')->orderBy('end_desc')->fetch(); $minChildType = ($minChildBegin->type == 'project') ? $this->lang->project->common : $this->lang->program->childProgram; $maxChildType = ($maxChildEnd->type == 'project') ? $this->lang->project->common : $this->lang->program->childProgram; - if($minChildBegin and $program->begin > $minChildBegin->minBegin) dao::$errors['begin'] = sprintf($this->lang->program->beginGreateChild, $program->name, $minChildType, $minChildBegin->name, $minChildBegin->minBegin); - if($maxChildEnd and $program->end < $maxChildEnd->maxEnd and $this->post->delta != 999) dao::$errors['end'] = sprintf($this->lang->program->endLetterChild, $program->name, $maxChildType, $maxChildEnd->name, $maxChildEnd->maxEnd); + if($minChildBegin and $program->begin > $minChildBegin->minBegin) dao::$errors['begin'] = sprintf($this->lang->program->beginGreateChild, $minChildType, $minChildBegin->minBegin); + if($maxChildEnd and $program->end < $maxChildEnd->maxEnd and $this->post->delta != 999) dao::$errors['end'] = sprintf($this->lang->program->endLetterChild, $maxChildType, $maxChildEnd->maxEnd); if(dao::isError()) return false; } @@ -821,9 +821,9 @@ class programModel extends model $parentProgram = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($program->parent)->fetch(); if($parentProgram) { - if(!empty($program->name) and $program->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->beginLetterParent, $program->name, $parentProgram->name, $parentProgram->begin); - if(!empty($program->name) and $parentProgram->end != '0000-00-00' and $program->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $program->name, $parentProgram->name, $parentProgram->end); - if(!empty($program->name) and empty($program->end) and $this->post->delta == 999 and $parentProgram->end != '0000-00-00') dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $program->name, $parentProgram->name, $parentProgram->end); + if(!empty($program->name) and $program->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->beginLetterParent, $parentProgram->begin); + if(!empty($program->name) and $parentProgram->end != '0000-00-00' and $program->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end); + if(!empty($program->name) and empty($program->end) and $this->post->delta == 999 and $parentProgram->end != '0000-00-00') dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end); } /* The budget of a child program cannot beyond the remaining budget of the parent program. */ diff --git a/module/project/lang/de.php b/module/project/lang/de.php index f699a0c1d0..0297e0c2a6 100644 --- a/module/project/lang/de.php +++ b/module/project/lang/de.php @@ -307,21 +307,23 @@ $lang->project->programTitle['0'] = 'Hide'; $lang->project->programTitle['base'] = 'Base-level project only'; $lang->project->programTitle['end'] = 'End-level project only'; -$lang->project->accessDenied = 'Access denied!'; -$lang->project->chooseProgramType = 'Select the project management model'; -$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.'; -$lang->project->hasChildren = 'This project has a child project, so it cannot be deleted.'; -$lang->project->confirmDelete = "Do you want to delete [%s]?"; -$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent."; -$lang->project->cannotCancelCat = "It has child projects, so you cannot unmark the parent."; -$lang->project->parentBeginEnd = "Parent begin&end date: %s ~ %s"; -$lang->project->parentBudget = "The budget of the parent project: "; -$lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project."; -$lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project."; -$lang->project->beginGreateChild = 'The start date of the project "%s" should be ≥ the start date of program "%s": %s.'; -$lang->project->endLetterChild = 'The finish date of the project "%s" should be ≤ the finish date of program "%s": %s.'; -$lang->project->childLongTime = "If a child as long-term projects, the parent should be long-term too."; -$lang->project->confirmUnlinkMember = "Do you want to remove this user from project?"; +$lang->project->accessDenied = 'Access denied!'; +$lang->project->chooseProgramType = 'Select the project management model'; +$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.'; +$lang->project->hasChildren = 'This project has a child project, so it cannot be deleted.'; +$lang->project->confirmDelete = "Do you want to delete [%s]?"; +$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent."; +$lang->project->cannotCancelCat = "It has child projects, so you cannot unmark the parent."; +$lang->project->parentBeginEnd = "Parent begin&end date: %s ~ %s"; +$lang->project->parentBudget = "The budget of the parent project: "; +$lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project."; +$lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project."; +$lang->project->beginGreateChild = 'The start date of the project should be ≥ the start date of program: %s.'; +$lang->project->endLetterChild = 'The finish date of the project should be ≤ the finish date of program: %s.'; +$lang->project->begigLetterExecution = 'The start date of project should be ≤ the minimum start date of the execution: %s.'; +$lang->project->endGreateExecution = 'The finish date of the project should be ≥ the maximum finish date of the execution: %s.'; +$lang->project->childLongTime = "If a child as long-term projects, the parent should be long-term too."; +$lang->project->confirmUnlinkMember = "Do you want to remove this user from project?"; $lang->project->action = new stdclass(); $lang->project->action->managed = '$date, managed by $actor. $extra' . "\n"; diff --git a/module/project/lang/en.php b/module/project/lang/en.php index 3e07049109..87a656b975 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -318,8 +318,10 @@ $lang->project->parentBeginEnd = "The begin and end date of the parent proj $lang->project->parentBudget = "The budget of the parent project: "; $lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project."; $lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project."; -$lang->project->beginGreateChild = 'The start date of the project "%s" should be ≥ the start date of program "%s": %s.'; -$lang->project->endLetterChild = 'The finish date of the project "%s" should be ≤ the finish date of program "%s": %s.'; +$lang->project->beginGreateChild = 'The start date of the project should be ≥ the start date of program: %s.'; +$lang->project->endLetterChild = 'The finish date of the project should be ≤ the finish date of program: %s.'; +$lang->project->begigLetterExecution = 'The start date of project should be ≤ the minimum start date of the execution: %s.'; +$lang->project->endGreateExecution = 'The finish date of the project should be ≥ the maximum finish date of the execution: %s.'; $lang->project->childLongTime = "There are long-term projects in the child project, and the parent project should also be a long-term project."; $lang->project->confirmUnlinkMember = "Do you want to remove this user from project?"; diff --git a/module/project/lang/fr.php b/module/project/lang/fr.php index 7da0606307..b08f7cae8c 100644 --- a/module/project/lang/fr.php +++ b/module/project/lang/fr.php @@ -307,21 +307,23 @@ $lang->project->programTitle['0'] = 'Hide'; $lang->project->programTitle['base'] = 'Base-level project only'; $lang->project->programTitle['end'] = 'End-level project only'; -$lang->project->accessDenied = 'Access denied!'; -$lang->project->chooseProgramType = 'Select the project management model'; -$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.'; -$lang->project->hasChildren = 'This project has a child project, so it cannot be deleted.'; -$lang->project->confirmDelete = "Do you want to delete [%s]?"; -$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent."; -$lang->project->cannotCancelCat = "It has child projects, so you cannot unmark the parent."; -$lang->project->parentBeginEnd = "Parent begin&end date: %s ~ %s"; -$lang->project->parentBudget = "The budget of the parent project: "; -$lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project."; -$lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project."; -$lang->project->beginGreateChild = 'La date de début du projets "%s" doit être ≥ à la date de début du programme "%s" : %s.'; -$lang->project->endLetterChild = 'La date de fin du projets "%s" doit être ≤ à la date de fin du programme "%s" : %s.'; -$lang->project->childLongTime = "If a child as long-term projects, the parent should be long-term too."; -$lang->project->confirmUnlinkMember = "Do you want to remove this user from project?"; +$lang->project->accessDenied = 'Access denied!'; +$lang->project->chooseProgramType = 'Select the project management model'; +$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.'; +$lang->project->hasChildren = 'This project has a child project, so it cannot be deleted.'; +$lang->project->confirmDelete = "Do you want to delete [%s]?"; +$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent."; +$lang->project->cannotCancelCat = "It has child projects, so you cannot unmark the parent."; +$lang->project->parentBeginEnd = "Parent begin&end date: %s ~ %s"; +$lang->project->parentBudget = "The budget of the parent project: "; +$lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project."; +$lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project."; +$lang->project->beginGreateChild = 'La date de début du projets "%s" doit être ≥ à la date de début du programme "%s" : %s.'; +$lang->project->endLetterChild = 'La date de fin du projets doit être ≤ à la date de fin du programme: %s.'; +$lang->project->begigLetterExecution = 'La date de début du projet "%s" doit être ≤ à la date de début minimum d\'excution: %s'; +$lang->project->endGreateExecution = 'La date de fin du projet "%s" doit être ≥ à la date de fin maximale d\'exécution: %s.'; +$lang->project->childLongTime = "If a child as long-term projects, the parent should be long-term too."; +$lang->project->confirmUnlinkMember = "Do you want to remove this user from project?"; $lang->project->action = new stdclass(); $lang->project->action->managed = '$date, managed by $actor. $extra' . "\n"; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index e16391f3e3..eacc6c49c0 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -318,10 +318,10 @@ $lang->project->parentBeginEnd = "父项目起止时间:%s ~ %s"; $lang->project->parentBudget = "父项目预算:"; $lang->project->beginLetterParent = "父项目的开始日期:%s,开始日期不能小于父项目的开始日期"; $lang->project->endGreaterParent = "父项目的完成日期:%s,完成日期不能大于父项目的完成日期"; -$lang->project->beginGreateChild = '项目“%s”的开始日期应大于等于项目集“%s”的最小开始日期:%s'; -$lang->project->endLetterChild = '项目“%s”的完成日期应小于等于项目集“%s”的最大完成日期:%s'; -$lang->project->begigLetterExecution = '项目“%s”的开始日期应小于等于执行“%s”的最小开始日期:%s'; -$lang->project->endGreateExecution = '项目“%s”的完成日期应大于等于执行“%s”的最大完成日期:%s'; +$lang->project->beginGreateChild = '项目的开始日期应大于等于项目集的最小开始日期:%s'; +$lang->project->endLetterChild = '项目的完成日期应小于等于项目集的最大完成日期:%s'; +$lang->project->begigLetterExecution = '项目的开始日期应小于等于执行的最小开始日期:%s'; +$lang->project->endGreateExecution = '项目的完成日期应大于等于执行的最大完成日期:%s'; $lang->project->childLongTime = "子项目中有长期项目,父项目也应该是长期项目"; $lang->project->confirmUnlinkMember = "您确定从该项目中移除该用户吗?"; diff --git a/module/project/model.php b/module/project/model.php index a4b8633608..d76f2cf1b1 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1094,10 +1094,10 @@ class projectModel extends model if($program) { /* Child project begin cannot less than parent. */ - if(!empty($project->name) and $project->begin < $program->begin) dao::$errors['begin'] = sprintf($this->lang->project->beginGreateChild, $project->name, $program->name, $program->begin); + if(!empty($project->name) and $project->begin < $program->begin) dao::$errors['begin'] = sprintf($this->lang->project->beginGreateChild, $program->begin); /* When parent set end then child project end cannot greater than parent. */ - if(!empty($project->name) and $$program->end != '0000-00-00' and $project->end > $program->end) dao::$errors['end'] = sprintf($this->lang->project->endLetterChild, $project->name, $program->name, $program->end); + if(!empty($project->name) and $$program->end != '0000-00-00' and $project->end > $program->end) dao::$errors['end'] = sprintf($this->lang->project->endLetterChild, $program->end); if(dao::isError()) return false; } @@ -1358,10 +1358,10 @@ class projectModel extends model if($program) { /* Child project begin cannot less than parent. */ - if(!empty($project->name) and $project->begin < $program->begin) dao::$errors['begin'] = sprintf($this->lang->project->beginGreateChild, $project->name, $program->name, $program->begin); + if(!empty($project->name) and $project->begin < $program->begin) dao::$errors['begin'] = sprintf($this->lang->project->beginGreateChild, $program->begin); /* When parent set end then child project end cannot greater than parent. */ - if(!empty($project->name) and $program->end != '0000-00-00' and $project->end > $program->end) dao::$errors['end'] = sprintf($this->lang->project->endLetterChild, $project->name, $program->name, $program->end); + if(!empty($project->name) and $program->end != '0000-00-00' and $project->end > $program->end) dao::$errors['end'] = sprintf($this->lang->project->endLetterChild, $program->end); if(dao::isError()) return false; } @@ -1381,10 +1381,10 @@ class projectModel extends model ->fetch(); if(!empty($executions)) { - $minExecutionBegin = $this->dao->select('name, begin as minBegin')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('begin_asc')->fetch(); - $maxExecutionEnd = $this->dao->select('name, end as maxEnd')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('end_desc')->fetch(); - if($minExecutionBegin and $project->begin > $minExecutionBegin->minBegin) dao::$errors['begin'] = sprintf($this->lang->project->begigLetterExecution, $project->name, $minExecutionBegin->name, $minExecutionBegin->minBegin); - if($maxExecutionEnd and $project->end < $maxExecutionEnd->maxEnd) dao::$errors['end'] = sprintf($this->lang->project->endGreateExecution, $project->name, $maxExecutionEnd->name, $maxExecutionEnd->maxEnd); + $minExecutionBegin = $this->dao->select('begin as minBegin')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('begin_asc')->fetch(); + $maxExecutionEnd = $this->dao->select('end as maxEnd')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('end_desc')->fetch(); + if($minExecutionBegin and $project->begin > $minExecutionBegin->minBegin) dao::$errors['begin'] = sprintf($this->lang->project->begigLetterExecution, $minExecutionBegin->minBegin); + if($maxExecutionEnd and $project->end < $maxExecutionEnd->maxEnd) dao::$errors['end'] = sprintf($this->lang->project->endGreateExecution, $maxExecutionEnd->maxEnd); if(dao::isError()) return false; } @@ -1542,14 +1542,14 @@ class projectModel extends model /* Child project begin cannot less than parent. */ if(!empty($projects[$projectID]->name) and $projects[$projectID]->begin < $parentProject->begin) { - dao::$errors['begin'] = sprintf($this->lang->project->beginGreateChild, $projects[$projectID]->name, $parentProject->name, $parentProject->begin); + dao::$errors['begin'] = sprintf($this->lang->project->beginGreateChild, $parentProject->begin); return false; } /* When parent set end then child project end cannot greater than parent. */ if(!empty($projects[$projectID]->name) and $parentProject->end != '0000-00-00' and $projects[$projectID]->end > $parentProject->end) { - dao::$errors['end'] = sprintf($this->lang->project->endLetterChild, $projects[$projectID]->name, $parentProject->name, $parentProject->end); + dao::$errors['end'] = sprintf($this->lang->project->endLetterChild, $parentProject->end); return false; } } From 577ba8638081d584949d11c40320c6ccf909285c Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Thu, 30 Jun 2022 01:21:54 +0000 Subject: [PATCH 3/3] * Fix bug #24417. --- module/product/js/all.js | 25 ++++++++++++++++++++++--- module/project/model.php | 6 +++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/module/product/js/all.js b/module/product/js/all.js index d468307e32..59c2438291 100644 --- a/module/product/js/all.js +++ b/module/product/js/all.js @@ -60,7 +60,12 @@ $(function() }); } - /* Add a statistics prompt statement after the Edit button */ + /** + * Add a statistics prompt statement after the Edit button. + * + * @access public + * @return void + */ function addStatistic() { var checkedLength = $(":checkbox[name^='productIDList']:checked").length; @@ -77,16 +82,30 @@ $(function() } } - function debounce(fn,delay) + /** + * Anti shake operation for jquery. + * + * @param fn $fn + * @param delay $delay + * @access public + * @return void + */ + function debounce(fn, delay) { var timer = null; return function() { if(timer) clearTimeout(timer); - timer = setTimeout(fn,delay) + timer = setTimeout(fn, delay) } } + /** + * Update statistics. + * + * @access public + * @return void + */ function updateStatistic() { debounce(addStatistic(), 200) diff --git a/module/project/model.php b/module/project/model.php index d76f2cf1b1..5c48d70d93 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1375,11 +1375,11 @@ class projectModel extends model } } - $executions = $this->dao->select('*')->from(TABLE_PROJECT) + $executionsCount = $this->dao->select('COUNT(*) as count')->from(TABLE_PROJECT) ->where('project')->eq($project->id) ->andWhere('deleted')->eq('0') - ->fetch(); - if(!empty($executions)) + ->fetchAll(); + if(!empty($executionsCount)) { $minExecutionBegin = $this->dao->select('begin as minBegin')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('begin_asc')->fetch(); $maxExecutionEnd = $this->dao->select('end as maxEnd')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('end_desc')->fetch();