From 559ce03369b526c879f6204b3356252da32c57ae Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 14 Dec 2021 08:57:10 +0800 Subject: [PATCH] * Fix bug#17472. --- module/product/control.php | 1 + module/product/view/project.html.php | 2 +- module/productplan/js/browse.js | 2 +- module/productplan/view/browse.html.php | 6 ++++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index 7fc9180a64..08fe5853b6 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -111,6 +111,7 @@ class product extends control $this->view->status = $status; $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->branchID = $branch; + $this->view->branchStatus = $this->loadModel('branch')->getByID($branch, 0, 'status'); $this->display(); } diff --git a/module/product/view/project.html.php b/module/product/view/project.html.php index 202bfb497b..3abaf6ad66 100644 --- a/module/product/view/project.html.php +++ b/module/product/view/project.html.php @@ -18,7 +18,7 @@ $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?>
product->projectInfo;?>>
- systemMode == 'new'):?> + systemMode == 'new' and $branchStatus != 'closed'):?>
' . $lang->product->link2Project, '', "data-toggle='modal' class='btn btn-secondary'");?> program&from=project&productID=$productID&branchID=$branchID", ' ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?> diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index 3428244485..48fcb457d9 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -84,7 +84,7 @@ function getPlanID(obj, branch) $("#project").trigger('chosen:updated'); $(".tips").removeClass('hidden'); - var locateLink = createLink('product', 'project', 'status=all&productID=' + productID); + var locateLink = createLink('product', 'project', 'status=all&productID=' + productID + '&branch=' + branch); var locateButton = "" + enterProjectList + ""; $("#projects .btn-primary").replaceWith(locateButton); } diff --git a/module/productplan/view/browse.html.php b/module/productplan/view/browse.html.php index b8fc94032c..9ae112d310 100644 --- a/module/productplan/view/browse.html.php +++ b/module/productplan/view/browse.html.php @@ -133,14 +133,16 @@ $attr = $plan->expired ? "disabled='disabled'" : ''; if(common::hasPriv('execution', 'create', $plan) and $plan->parent >= 0) { + $branchStatus = $this->branch->getByID($plan->branch, 0, 'status'); + $disabled = $branchStatus == 'closed' ? 'disabled' : ''; $executionLink = $config->systemMode == 'new' ? '#projects' : $this->createLink('execution', 'create', "projectID=0&executionID=0©ExecutionID=0&plan=$plan->id&confirm=no&productID=$productID"); if($config->systemMode == 'new') { - echo html::a($executionLink, '', '', "data-toggle='modal' data-id='$plan->id' onclick='getPlanID(this, $plan->branch)' class='btn' title='{$lang->productplan->createExecution}' $attr"); + echo html::a($executionLink, '', '', "data-toggle='modal' data-id='$plan->id' onclick='getPlanID(this, $plan->branch)' class='btn {$disabled}' title='{$lang->productplan->createExecution}' $attr"); } else { - echo html::a($executionLink, '', '', "class='btn' title='{$lang->productplan->createExecution}' $attr"); + echo html::a($executionLink, '', '', "class='btn {$disabled}' title='{$lang->productplan->createExecution}' $attr"); } } if(common::hasPriv('productplan', 'linkStory', $plan) and $plan->parent >= 0) echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), '', '', "class='btn' title='{$lang->productplan->linkStory}'");