diff --git a/module/execution/control.php b/module/execution/control.php index ef26f905ad..0050be1d43 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1594,9 +1594,16 @@ class execution extends control $newPlans = array(); if(isset($_POST['plans'])) { + foreach($_POST['plans'] as $plans) { - foreach($plans as $planID) $newPlans[$planID] = $planID; + foreach($plans as $planList) + { + foreach($planList as $planID) + { + $newPlans[$planID] = $planID; + } + } } } diff --git a/module/execution/js/common.js b/module/execution/js/common.js index 250b57fc8b..9a831597b7 100644 --- a/module/execution/js/common.js +++ b/module/execution/js/common.js @@ -184,12 +184,12 @@ function loadPlans(product, branchID) var branchID = typeof(branchID) == 'undefined' ? 0 : branchID; var index = $(product).attr('id').replace('products', ''); - $.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=noclosed,' + (config.currentMethod == 'create' ? 'unexpired' : '') + '¶m=skipParent'), function(data) + $.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=noclosed,unexpired¶m=skipParent,multiple'), function(data) { if(data) { if($("div#plan" + index).size() == 0) $("#plansBox .row").append('
'); - $("div#plan" + index).html(data).find('select').attr('name', 'plans[' + productID + '][' + branchID + ']').attr('id', 'plans' + productID).chosen(); + $("div#plan" + index).html(data).find('select').attr('name', 'plans[' + productID + '][' + branchID + '][]').attr('id', 'plans' + productID).chosen(); adjustPlanBoxMargin(); } diff --git a/module/execution/model.php b/module/execution/model.php index bb760866c5..fbd5818e4e 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2023,7 +2023,7 @@ class executionModel extends model $data->project = $executionID; $data->product = $productID; $data->branch = $branch; - $data->plan = isset($plans[$productID][$branch]) ? $plans[$productID][$branch] : $oldPlan; + $data->plan = isset($plans[$productID][$branch]) ? implode(',', $plans[$productID][$branch]) : $oldPlan; $this->dao->insert(TABLE_PROJECTPRODUCT)->data($data)->exec(); $existedProducts[$productID][$branch] = true; } diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index ad142d687e..a38a8e0500 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -159,19 +159,19 @@
begin)):?> -
product}][{$plan->branch}]", $productPlan, $plan->id, "class='form-control chosen'");?>
+
product}][{$plan->branch}]", $productPlan, $plan->id, "class='form-control chosen' multiple");?>
id)?> id] as $branchID => $branch):?> id][$branchID]) ? $productPlans[$product->id][$branchID] : array();?> -
id}][$branchID]", $plans, $branches[$product->id][$branchID]->plan, "class='form-control chosen'");?>
+
id}][$branchID]", $plans, $branches[$product->id][$branchID]->plan, "class='form-control chosen' multiple");?>
-
+
diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index b8d706294c..6106f73c6d 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -179,7 +179,7 @@ id] as $branchID => $branch):?> id][$branchID]) ? $productPlans[$product->id][$branchID] : array();?> -
id}][{$branchID}]", $plans, $branches[$product->id][$branchID]->plan, "class='form-control chosen'");?>
+
id}][{$branchID}][]", $plans, $branches[$product->id][$branchID]->plan, "class='form-control chosen' multiple");?>
diff --git a/module/execution/view/view.html.php b/module/execution/view/view.html.php index 70661107d5..10aaac97db 100644 --- a/module/execution/view/view.html.php +++ b/module/execution/view/view.html.php @@ -198,13 +198,19 @@
execution->linkPlan;?>
- $product):?> - plans as $planID):?> - -
createLink('productplan', 'view', "planID={$planID}"), $product->name . '/' . $planGroups[$productID][$planID]);?>
- - - + $product) + { + foreach($product->plans as $planIDList) + { + $planIDList = explode(',', $planIDList); + foreach($planIDList as $planID) + { + if(isset($planGroups[$productID][$planID])) echo '
' . html::a($this->createLink('productplan', 'view', "planID={$planID}"), $product->name . '/' . $planGroups[$productID][$planID]) . '
'; + } + } + } + ?>