From 31edf998a399db011a0a774c92bceae05c4fccfd Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 3 Aug 2021 16:29:23 +0800 Subject: [PATCH] * Finish task #40854. --- module/doc/control.php | 6 +-- module/product/model.php | 2 + module/upgrade/js/mergeprogram.js | 88 +++++++++++++------------------ 3 files changed, 43 insertions(+), 53 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index e68555c6c5..c6def4f134 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -163,9 +163,9 @@ class doc extends control } $libTypeList = $this->lang->doc->libTypeList; - if(empty($products)) unset($libTypeList['product']); - if(empty($projects)) unset($libTypeList['project']); - if(empty($executions) or ($type == 'custom' and $this->config->systemMode == 'new')) unset($libTypeList['execution']); + if(empty($products)) unset($libTypeList['product']); + if(empty($projects)) unset($libTypeList['project']); + if(empty($executions) or ($this->config->systemMode == 'new' and $this->app->openApp == 'doc')) unset($libTypeList['execution']); $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode'); diff --git a/module/product/model.php b/module/product/model.php index e31f0157be..fee25cb4c4 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1638,6 +1638,8 @@ class productModel extends model */ public function statisticData($type = 'program', $productStructure = array(), $product = null) { + if(empty($productStructure)) return $productStructure; + /* Init vars. */ $data = $type == 'program' ? $productStructure[$product->program] : $productStructure[$product->program][$product->line]; foreach($this->config->product->statisticFields as $key => $fields) diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js index 350f6d44e7..7ec141c5d3 100644 --- a/module/upgrade/js/mergeprogram.js +++ b/module/upgrade/js/mergeprogram.js @@ -129,27 +129,25 @@ $(function() /* Select all product line events. */ $('#checkAllLines').click(function() { + var checked = true; if($(this).is(':checked')) { - $('#checkAllProducts').prop('checked', true); - $('#checkAllProjects').prop('checked', true); - $('[name^=productLines]').prop('checked', true); - $('[name^=products]').prop('checked', true); - $('[name^=sprints]').prop('checked', true); $('.main-row .side-col .nav li').addClass('active'); $('#programName').val($('.main-row .side-col .nav li.currentPage div a').text()); } else { - $('#checkAllProducts').prop('checked', false); - $('#checkAllProjects').prop('checked', false); - $('[name^=productLines]').prop('checked', false); - $('[name^=products]').prop('checked', false); - $('[name^=sprints]').prop('checked', false); + checked = false; $('.main-row .side-col .nav li').removeClass('active'); $('#programName').val(''); } + $('#checkAllProducts').prop('checked', checked); + $('#checkAllProjects').prop('checked', checked); + $('[name^=productLines]').prop('checked', checked); + $('[name^=products]').prop('checked', checked); + $('[name^=sprints]').prop('checked', checked); + setProgramBegin(programBegin); setProgramEnd(programEnd); @@ -160,42 +158,39 @@ $(function() /* Select all product events. */ $('#checkAllProducts').click(function() { - var lineID = $('li.currentPage').attr('lineid'); + var lineID = $('li.currentPage').attr('lineid'); + var checked = true; if($(this).is(':checked')) { $('#programName').val($('.main-row .side-col .nav li.currentPage div a').text()); if($('[id^=productLines]').length > 0) { - $('[data-line=' + lineID + ']').prop('checked', true); - $("[id^='productLines\[" + lineID + "\]']").prop('checked', true); - var projectNum = $("[id^='sprints\[" + lineID + "\]']").length; } else { - $('[name^=products]').prop('checked', true); - $('[name^=sprints]').prop('checked', true); - var projectNum = $("[id^='sprints']").length; } if(projectNum !== 0) $('#checkAllProjects').prop('checked', true); } else { + checked = false; $('#checkAllProjects').prop('checked', false); - if($('[id^=productLines]').length > 0) - { - $('[data-line=' + lineID + ']').prop('checked', false); - $("[id^='productLines\[" + lineID + "\]']").prop('checked', false); - } - else - { - $('[name^=products]').prop('checked', false); - $('[name^=sprints]').prop('checked', false); - } $('#programName').val(''); } + if($('[id^=productLines]').length > 0) + { + $('[data-line=' + lineID + ']').prop('checked', checked); + $("[id^='productLines\[" + lineID + "\]']").prop('checked', checked); + } + else + { + $('[name^=products]').prop('checked', checked); + $('[name^=sprints]').prop('checked', checked); + } + var checkAllLines = isSelectAll(0, 'line'); $("[id='checkAllLines']").prop('checked', checkAllLines); @@ -208,37 +203,30 @@ $(function() /* Select all project events. */ $('#checkAllProjects').click(function() { - var lineID = $('li.currentPage').attr('lineid'); + var lineID = $('li.currentPage').attr('lineid'); + var checked = true; if($(this).is(':checked')) { - $('#checkAllProducts').prop('checked', true); $('#programName').val($('.main-row .side-col .nav li.currentPage div a').text()); - if($('[id^=productLines]').length > 0) - { - $('[data-line=' + lineID + ']').prop('checked', true); - $("[id^='productLines\[" + lineID + "\]']").prop('checked', true); - } - else - { - $('[name^=products]').prop('checked', true); - $('[name^=sprints]').prop('checked', true); - } } else { - $('#checkAllProducts').prop('checked', false); + checked = false; $('#programName').val(''); - if($('[id^=productLines]').length > 0) - { - $('[data-line=' + lineID + ']').prop('checked', false); - $("[id^='productLines\[" + lineID + "\]']").prop('checked', false); - } - else - { - $('[name^=products]').prop('checked', false); - $('[name^=sprints]').prop('checked', false); - } } + + $('#checkAllProducts').prop('checked', checked); + if($('[id^=productLines]').length > 0) + { + $('[data-line=' + lineID + ']').prop('checked', checked); + $("[id^='productLines\[" + lineID + "\]']").prop('checked', checked); + } + else + { + $('[name^=products]').prop('checked', checked); + $('[name^=sprints]').prop('checked', checked); + } + var checkAllLines = isSelectAll(0, 'line'); $("[id='checkAllLines']").prop('checked', checkAllLines);