*Optimize the code.

This commit is contained in:
孙华伟
2022-03-22 15:27:36 +08:00
parent 0816a49ce2
commit fb6de8f7e6
2 changed files with 9 additions and 9 deletions

View File

@@ -91,23 +91,23 @@ class productplan extends control
if($parent) $this->view->parentPlan = $this->productplan->getById($parent);
$branchesPair = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID, 'active');
/*get default branch*/
/*Get default branch.*/
$branchesList = $this->loadModel('branch')->getList($productID);
foreach($branchesList as $branchList)
{
if($branchList->default) $default = $branchList->id;
if($branchList->default) $defaultBranch = $branchList->id;
}
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->create;
$this->view->position[] = $this->lang->productplan->common;
$this->view->position[] = $this->lang->productplan->create;
$this->view->productID = $productID;
$this->view->lastPlan = $lastPlan;
$this->view->branch = $branchID;
$this->view->branches = $branchesPair;
$this->view->default = $default;
$this->view->parent = $parent;
$this->view->productID = $productID;
$this->view->lastPlan = $lastPlan;
$this->view->branch = $branchID;
$this->view->branches = $branchesPair;
$this->view->defaultBranch = $defaultBranch;
$this->view->parent = $parent;
$this->display();
}

View File

@@ -40,7 +40,7 @@
<?php if($product->type != 'normal'):?>
<tr>
<th><?php echo $lang->product->branch;?></th>
<td><?php echo html::select('branch', $branches, $default, "class='form-control chosen'");?></td><td></td><td></td>
<td><?php echo html::select('branch', $branches, $defaultBranch, "class='form-control chosen'");?></td><td></td><td></td>
</tr>
<?php endif;?>
<?php endif;?>