showing disabled products in existing orders if needed
This commit is contained in:
@@ -364,9 +364,11 @@ class OrderController extends mfBaseController {
|
||||
|
||||
// TODO: filter by network permissions
|
||||
$this->layout()->setTemplate("Order/Form");
|
||||
$products = [];
|
||||
if($this->me->is("Admin")) {
|
||||
//$this->layout()->set("addresses", AddressModel::search(['parents_only' => 1]));
|
||||
$this->layout()->set("products", ProductModel::getActive());
|
||||
//$this->layout()->set("products", ProductModel::getActive());
|
||||
$products = ProductModel::getActive();
|
||||
$this->layout()->set("terminations", TerminationModel::getAll());
|
||||
} else {
|
||||
// get all salespartner addresses of my networks
|
||||
@@ -397,13 +399,24 @@ class OrderController extends mfBaseController {
|
||||
$products = [];
|
||||
foreach(ProductNetworkModel::search(["network_id" => $network_ids]) as $pn) {
|
||||
if(!$pn->product->active) continue;
|
||||
if(!array_key_exists($pn->product_id, $products))
|
||||
if(!array_key_exists($pn->product_id, $products)) {
|
||||
$products[$pn->product_id] = $pn->product;
|
||||
}
|
||||
}
|
||||
$this->layout()->set("products", $products);
|
||||
|
||||
}
|
||||
|
||||
$order = $this->layout()->get("order");
|
||||
if($order) {
|
||||
foreach($order->products as $op) {
|
||||
if(!$op->product->active) {
|
||||
$products[$op->product_id] = $op->product;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout()->set("products", $products);
|
||||
|
||||
if($this->request->filter) {
|
||||
$this->layout()->set("filter", $this->request->filter);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@ class mfLayout {
|
||||
public function set($name, $value) {
|
||||
$this->tvars[$name] = $value;
|
||||
}
|
||||
|
||||
public function get($name) {
|
||||
if(array_key_exists($name, $this->tvars)) {
|
||||
return $this->tvars[$name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setPackage($package) {
|
||||
$this->package = $package;
|
||||
|
||||
Reference in New Issue
Block a user