From f7284ad5de091c8ec909ba7f10ba68834196c10c Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 20 Jul 2021 10:04:09 +0800 Subject: [PATCH 1/8] * Fix comment. --- module/upgrade/js/mergeprogram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js index 03cc7a00be..28f4ec2a94 100644 --- a/module/upgrade/js/mergeprogram.js +++ b/module/upgrade/js/mergeprogram.js @@ -1106,7 +1106,7 @@ function getProgramStatus(objectType, objectID) * @param int lineID * @param string type * @access public - * @return void + * @return bool */ function isSelectAll(lineID = 0, type = 'product') { From ea798466aa3bf03e4eb318ba651d1a4ab641a516 Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Tue, 20 Jul 2021 10:11:56 +0800 Subject: [PATCH 2/8] * Delete a blank line. --- db/update15.0.3.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/db/update15.0.3.sql b/db/update15.0.3.sql index 5f9314cd79..dcdd21813f 100644 --- a/db/update15.0.3.sql +++ b/db/update15.0.3.sql @@ -11,4 +11,3 @@ RENAME TABLE `zt_jenkins` TO `zt_pipeline`; ALTER TABLE `zt_relation` DROP INDEX `relation`; ALTER TABLE `zt_relation` ADD UNIQUE INDEX `relation`(`product`, `relation`, `AType`, `BType`, `AID`, `BID`); - From 23858061c9c201e61a85d7f5b5558642f6400f51 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 20 Jul 2021 10:16:45 +0800 Subject: [PATCH 3/8] * Fix bug#13686. --- module/build/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/build/model.php b/module/build/model.php index 294f92c285..d21081da46 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -238,7 +238,7 @@ class buildModel extends model $selectedBuilds = array(); if(strpos($params, 'noempty') === false) $sysBuilds = array('' => ''); if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk); - if($buildID != 0) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchPairs(); + if($buildID != 0) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildID)->andWhere('execution')->eq($executionID)->fetchPairs(); $executionBuilds = $this->dao->select('t1.id, t1.name, t1.execution, t2.status as executionStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName')->from(TABLE_BUILD)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id') From 566a2091c12ad1dda0ac26131783265d4ee6f397 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 20 Jul 2021 10:25:40 +0800 Subject: [PATCH 4/8] * Fix the select all issue. --- module/upgrade/js/mergeprogram.js | 36 ++++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js index 28f4ec2a94..3b4d6ebc74 100644 --- a/module/upgrade/js/mergeprogram.js +++ b/module/upgrade/js/mergeprogram.js @@ -105,11 +105,7 @@ $(function() $('#checkAllLines').prop('checked', checkedLines); } - var checkAllLines = true; - var lineNum = $("[id^='productLines'").length; - var checkedLineNum = $("[id^='productLines']:checked").length; - - if(lineNum > checkedLineNum) checkAllLines = false; + var checkAllLines = isSelectAll(0, 'line'); $("[id='checkAllLines']").prop('checked', checkAllLines); setProgramBegin(programBegin); @@ -194,6 +190,10 @@ $(function() } $('#programName').val(''); } + + var checkAllLines = isSelectAll(0, 'line'); + $("[id='checkAllLines']").prop('checked', checkAllLines); + setProgramBegin(programBegin); setProgramEnd(programEnd); @@ -234,6 +234,9 @@ $(function() $('[name^=sprints]').prop('checked', false); } } + var checkAllLines = isSelectAll(0, 'line'); + $("[id='checkAllLines']").prop('checked', checkAllLines); + setProgramBegin(programBegin); setProgramEnd(programEnd); @@ -272,11 +275,7 @@ $(function() } /* Determine whether all product line buttons are selected. */ - var checked = true; - var lineNum = $("[id^='productLines'").length; - var checkedLineNum = $("[id^='productLines']:checked").length; - - if(lineNum > checkedLineNum) checked = false; + var checked = isSelectAll(0, 'line'); $('#checkAllLines').prop('checked', checked); setProgramBegin(programBegin); @@ -418,11 +417,7 @@ $(function() } $("[id^='productLines\[" + lineID + "\]']").prop('checked', checkedLine); - var checkAllLines = true; - var lineNum = $("[id^='productLines'").length; - var checkedLineNum = $("[id^='productLines']:checked").length; - - if(lineNum > checkedLineNum) checkAllLines = false; + var checkAllLines = isSelectAll(0, 'line'); $("[id='checkAllLines']").prop('checked', checkAllLines); } else if($('[id^=products]').length > 0) @@ -505,11 +500,7 @@ $(function() } $("[id^='productLines\["+ lineID +"\]").prop('checked', checkedLine); - var checkAllLines = true; - var lineNum = $("[id^='productLines'").length; - var checkedLineNum = $("[id^='productLines']:checked").length; - - if(lineNum > checkedLineNum) checkAllLines = false; + var checkAllLines = isSelectAll(0, 'line'); $("[id='checkAllLines']").prop('checked', checkAllLines); } else if($('[id^=products]').length > 0) @@ -1136,6 +1127,11 @@ function isSelectAll(lineID = 0, type = 'product') var objectNum = $("[id^='products']").length; var checkedObjectNum = $("[id^='products']:checked").length; } + else if(type = 'line') + { + var objectNum = $("[id^='productLines'").length; + var checkedObjectNum = $("[id^='productLines']:checked").length; + } } if(objectNum > checkedObjectNum) checked = false; return checked; From 2a80e33c1ffeb169f3f3e05cce2298ba33c609f9 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 20 Jul 2021 10:43:47 +0800 Subject: [PATCH 5/8] * Fix the issue of select all projects. --- module/upgrade/js/mergeprogram.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js index 3b4d6ebc74..28ce5485fe 100644 --- a/module/upgrade/js/mergeprogram.js +++ b/module/upgrade/js/mergeprogram.js @@ -162,18 +162,22 @@ $(function() var lineID = $('li.currentPage').attr('lineid'); if($(this).is(':checked')) { - $('#checkAllProjects').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); + + 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 { @@ -1133,6 +1137,6 @@ function isSelectAll(lineID = 0, type = 'product') var checkedObjectNum = $("[id^='productLines']:checked").length; } } - if(objectNum > checkedObjectNum) checked = false; + if(objectNum > checkedObjectNum || objectNum == 0) checked = false; return checked; } From d8a7c921babdc2d37190d44bc43adf330ad67de9 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 20 Jul 2021 10:44:25 +0800 Subject: [PATCH 6/8] * Fix a bug of unlink project`s product when edit the product has not change program. --- module/product/js/edit.js | 2 ++ module/product/model.php | 2 ++ module/product/view/edit.html.php | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/module/product/js/edit.js b/module/product/js/edit.js index 8cc74a545b..f1bf6175b2 100644 --- a/module/product/js/edit.js +++ b/module/product/js/edit.js @@ -19,6 +19,8 @@ $(function() $('#line').replaceWith(data); $('#line').chosen(); }) + + $("button[type='submit']").before(changeProjectsHtml); }) }); diff --git a/module/product/model.php b/module/product/model.php index 5ad5f73600..fdd6aa483b 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1744,6 +1744,8 @@ class productModel extends model */ public function updateProjects($productID, $singleLinkProjects = array(), $multipleLinkProjects = array()) { + if(!isset($_POST['changeProjects'])) return; + $programID = $_POST['program']; foreach($singleLinkProjects as $projectID => $projectName) { diff --git a/module/product/view/edit.html.php b/module/product/view/edit.html.php index a619913fb7..3c2a4ae898 100644 --- a/module/product/view/edit.html.php +++ b/module/product/view/edit.html.php @@ -17,6 +17,7 @@ + @@ -84,7 +85,6 @@ - From 566c87f9405c33816800671121a9e86a0afae822 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 20 Jul 2021 11:09:34 +0800 Subject: [PATCH 7/8] * Fix the issue of select all product lines. --- module/upgrade/js/mergeprogram.js | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js index 28ce5485fe..c3873c6a41 100644 --- a/module/upgrade/js/mergeprogram.js +++ b/module/upgrade/js/mergeprogram.js @@ -370,25 +370,13 @@ $(function() setProjectPM(); /* Determine whether products and projects are selected. */ - if($('#checkAllLines').is(':checked')) + if($(this).closest("li").find('[id^=productLines]').prop('checked')) { - $('#checkAllProducts').prop('checked', true); - $('#checkAllProjects').prop('checked', true); - $('[name^=productLines]').prop('checked', true); - $('[name^=products]').prop('checked', true); - $('[name^=sprints]').prop('checked', true); - } - else if($(this).closest("li").find('[id^=productLines]').prop('checked')) - { - var productLine = $('.nav li.active').attr('lineid'); - var objectNum = $('[data-line='+ productLine +']').length; - var checkedObjectNum = $('[data-line='+ productLine +']:checked').length; - if(objectNum == checkedObjectNum) - { - $('#checkAllProducts').prop('checked', true); - $('#checkAllProjects').prop('checked', true); - $('[data-line=' + productLine + ']').prop('checked', true); - } + var productLine = $('.nav li.currentPage').attr('lineid'); + var checkedProduct = isSelectAll(productLine, 'product'); + var checkedProject = isSelectAll(productLine, 'project'); + $('#checkAllProducts').prop('checked', checkedProduct); + $('#checkAllProjects').prop('checked', checkedProject); } else { @@ -426,10 +414,7 @@ $(function() } else if($('[id^=products]').length > 0) { - var productNum = $("[id^='products'").length; - var checkedProductNum = $("[id^='products']:checked").length; - - if(productNum > checkedProductNum) checked = false; + checked = isSelectAll(0, 'product'); } $('#checkAllProducts').prop('checked', checked); From 19b3b75b2e3b512049dd81ccb503e75324c6990f Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 20 Jul 2021 11:24:50 +0800 Subject: [PATCH 8/8] * Restore code and fix a bug of unlink project`s product when edit the product has not change program. --- module/product/control.php | 2 +- module/product/js/edit.js | 2 -- module/product/model.php | 2 -- module/product/view/edit.html.php | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index 14e70481b6..922fc4f324 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -451,7 +451,7 @@ class product extends control if($this->config->systemMode == 'new') { /* Change the projects set of the program. */ - if(($_POST['program'] != $product->program) and $singleLinkProjects or $multipleLinkProjects) + if(($_POST['program'] != $product->program) and ($singleLinkProjects or $multipleLinkProjects)) { $this->product->updateProjects($productID, $singleLinkProjects, $multipleLinkProjects); } diff --git a/module/product/js/edit.js b/module/product/js/edit.js index f1bf6175b2..8cc74a545b 100644 --- a/module/product/js/edit.js +++ b/module/product/js/edit.js @@ -19,8 +19,6 @@ $(function() $('#line').replaceWith(data); $('#line').chosen(); }) - - $("button[type='submit']").before(changeProjectsHtml); }) }); diff --git a/module/product/model.php b/module/product/model.php index fdd6aa483b..5ad5f73600 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1744,8 +1744,6 @@ class productModel extends model */ public function updateProjects($productID, $singleLinkProjects = array(), $multipleLinkProjects = array()) { - if(!isset($_POST['changeProjects'])) return; - $programID = $_POST['program']; foreach($singleLinkProjects as $projectID => $projectName) { diff --git a/module/product/view/edit.html.php b/module/product/view/edit.html.php index 3c2a4ae898..a619913fb7 100644 --- a/module/product/view/edit.html.php +++ b/module/product/view/edit.html.php @@ -17,7 +17,6 @@ - @@ -85,6 +84,7 @@ +