From 6b63ed43f2693d0457c2eca1cc0b201d44866da7 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Wed, 17 Nov 2021 10:44:19 +0800 Subject: [PATCH 1/2] Fix bug. --- module/product/control.php | 54 +++++++++++++++++++++++++----------- module/story/js/batchedit.js | 2 +- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index bc1a794a16..b52c2dd6c7 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -971,10 +971,11 @@ class product extends control * @param bool $needCreate * @param string $expired * @param string $from + * @param string $param * @access public * @return void */ - public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $from = '') + public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $from = '', $param = '') { $this->loadModel('productplan'); if($from == 'story' and $branch == BRANCH_MAIN) @@ -992,24 +993,45 @@ class product extends control } $field = $fieldID ? "plans[$fieldID]" : 'plan'; - $output = "
"; - $output .= "
"; - $output .= html::select($field, $plans, $planID, "class='form-control chosen'"); - $output .= "
"; - if(count($plans) == 1 and $needCreate) + + $output = ''; + $isBatchEdit = false; + if(strpos($param, 'batchEdit') !== false) $isBatchEdit = true; + if($isBatchEdit) { + $output = "
"; $output .= "
"; - $output .= "
"; - $output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'"); - $output .= '
'; - $output .= '
'; - $output .= "
"; - $output .= "
"; - $output .= html::a("javascript:void(0)", "", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'"); - $output .= '
'; - $output .= '
'; + $output .= html::select($field, $plans, $planID, "class='form-control chosen'"); + $output .= "
"; + if(count($plans) == 1 and $needCreate) + { + $output .= "
"; + $output .= "
"; + $output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'"); + $output .= '
'; + $output .= '
'; + $output .= "
"; + $output .= "
"; + $output .= html::a("javascript:void(0)", "", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'"); + $output .= '
'; + $output .= '
'; + } + $output .= "
"; + } + else + { + $output .= html::select($field, $plans, $planID, "class='form-control chosen'"); + if(count($plans) == 1 and $needCreate) + { + $output .= "
"; + $output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'"); + $output .= '
'; + $output .= "
"; + $output .= html::a("javascript:void(0)", "", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'"); + $output .= '
'; + } + } - $output .= ""; die($output); } diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index e26b145ec8..835f2de2da 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -34,7 +34,7 @@ function loadBranches(product, branch, storyID) $('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen();}); planID = $('#plans' + storyID).val(); - planLink = createLink('product', 'ajaxGetPlans', 'productID=' + product + '&branch=' + branch + '&planID=' + planID + '&fieldID=' + storyID + '&needCreate=false&expired=&from=story'); + planLink = createLink('product', 'ajaxGetPlans', 'productID=' + product + '&branch=' + branch + '&planID=' + planID + '&fieldID=' + storyID + '&needCreate=false&expired=&from=story¶m=batchEdit'); $('#plans' + storyID).parent('td').load(planLink, function(){$('#plans' + storyID).chosen();}); } From fc3411190c91b27c2ba1a24ae8616e084968908e Mon Sep 17 00:00:00 2001 From: zhouxin Date: Wed, 17 Nov 2021 13:31:54 +0800 Subject: [PATCH 2/2] Fix bug 16209. --- module/product/control.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index b52c2dd6c7..c9d3de96eb 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -995,9 +995,7 @@ class product extends control $field = $fieldID ? "plans[$fieldID]" : 'plan'; $output = ''; - $isBatchEdit = false; - if(strpos($param, 'batchEdit') !== false) $isBatchEdit = true; - if($isBatchEdit) + if(strpos($param, 'batchEdit') !== false) { $output = "
"; $output .= "
";