From c33000b578ea3661a369151933fc7e33bebb42ca Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Fri, 10 Dec 2021 13:11:37 +0800 Subject: [PATCH] * Code for task#45536. --- module/product/js/project.js | 2 +- module/productplan/js/browse.js | 6 +++--- module/productplan/lang/en.php | 2 ++ module/productplan/view/browse.html.php | 4 ++++ module/project/control.php | 8 ++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/module/product/js/project.js b/module/product/js/project.js index 0e8cc68513..ba0df1535d 100644 --- a/module/product/js/project.js +++ b/module/product/js/project.js @@ -13,7 +13,7 @@ $(function() var currentProductID = $('#product').val(); var currentBranchID = $('#branch').val(); - $.get(createLink('project', 'ajaxGetLinkedProductsWithBranch', 'projectID=' + selectProjectID), function(product) + $.get(createLink('project', 'ajaxGetLinkedProducts', 'projectID=' + selectProjectID), function(product) { var products = []; var branches = []; diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index 631c75e74c..15ac917812 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -72,11 +72,11 @@ function getPlanID(obj, branch) { $("#project").attr('disabled', true); $("#project").trigger('chosen:updated'); - $("#project").closest('td').append("" + noLinkedProject + ""); + $(".tips").removeClass('hidden'); var locateLink = createLink('product', 'project', 'status=all&productID=' + productID); var locateButton = "" + enterProjectList + ""; - $(".btn-primary").replaceWith(locateButton); - }; + $("#projects .btn-primary").replaceWith(locateButton); + } }); } diff --git a/module/productplan/lang/en.php b/module/productplan/lang/en.php index 0f61f73e15..189cf9350b 100644 --- a/module/productplan/lang/en.php +++ b/module/productplan/lang/en.php @@ -85,6 +85,8 @@ $lang->productplan->errorNoEnd = 'ID %s end time should not be empty.'; $lang->productplan->beginGeEnd = 'ID %s begin time should not be >= end time.'; $lang->productplan->beginLetterParent = "The start date of the parent plan: %s, the start date cannot be less than the start date of the parent plan."; $lang->productplan->endGreaterParent = "The completion date of the parent plan: %s, the completion date cannot be greater than the completion date of the parent plan."; +$lang->productplan->noLinkedProject = "The current product has not been linked with a project. Please enter the list of the product to link or create a project."; +$lang->productplan->enterProjectList = "Enter the list of the product"; $lang->productplan->featureBar['browse']['all'] = 'All'; $lang->productplan->featureBar['browse']['unexpired'] = 'Unexpired'; diff --git a/module/productplan/view/browse.html.php b/module/productplan/view/browse.html.php index aee516592b..ef026c79b2 100644 --- a/module/productplan/view/browse.html.php +++ b/module/productplan/view/browse.html.php @@ -193,6 +193,10 @@ productplan->project?> + + + productplan->noLinkedProject;?> + diff --git a/module/project/control.php b/module/project/control.php index 1efd21a2e9..b89b13a6f3 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -215,13 +215,13 @@ class project extends control } /** - * Ajax get linked products with branch. + * AJAX: Get linked products with branch. * - * @param int $projectID + * @param int $projectID * @access public * @return void */ - public function ajaxGetLinkedProductsWithBranch($projectID) + public function ajaxGetLinkedProducts($projectID) { $productsWithBranch = array(); $linkedProducts = $this->project->getBranchesByProject($projectID); @@ -230,7 +230,7 @@ class project extends control foreach($branches as $branchID => $branchInfo) $productsWithBranch[$productID][$branchID] = $branchID; } - die(json_encode($productsWithBranch)); + echo json_encode($productsWithBranch); } /**