diff --git a/Layout/default/Order/Index.php b/Layout/default/Order/Index.php index b34aa1c7c..c3f1f248b 100644 --- a/Layout/default/Order/Index.php +++ b/Layout/default/Order/Index.php @@ -148,10 +148,10 @@ - + + + +
@@ -180,6 +202,9 @@ + + + " id="order-id?>"> diff --git a/application/Order/OrderController.php b/application/Order/OrderController.php index 093d0b59c..0b25eaee9 100644 --- a/application/Order/OrderController.php +++ b/application/Order/OrderController.php @@ -135,9 +135,17 @@ class OrderController extends mfBaseController { $showLoneliesCount = true; } + if($this->request->voiceProductsOnly) { + $showLoneliesCount = true; + $this->layout()->set("showVoice", true); + } + if($this->request->specialProductsOnly) { + $showLoneliesCount = true; + $this->layout()->set("showSpecial", true); + } + if($showLonelies || $showLoneliesCount) { $userIds = $this->me->getAddressOrParent()->getUserIds(); - //var_dump($userIds);exit; if(!array_key_exists("network_linked_status", $order_search)) { $lonelyOrders = []; unset($order_search["network_id"]); @@ -146,6 +154,7 @@ class OrderController extends mfBaseController { if($this->me->isAdmin()) { if(!$this->request->filter['network_id']) { $lonelies = OrderModel::search($order_search); + } } else { $order_search['create_by'] = $userIds; @@ -157,9 +166,10 @@ class OrderController extends mfBaseController { $lonelyOrders[$order->id] = $order; } } + //var_dump($lonelyOrders);exit; } - - + + // orders with termination product not requiring termination_id $order_search['product_id'] = ">0"; $order_search['termination_id'] = null; @@ -171,7 +181,38 @@ class OrderController extends mfBaseController { $order_search['create_by'] = $userIds; $lonelies = OrderModel::search($order_search); } + + $special_orders = []; + $voice_orders = []; + foreach($lonelies as $order) { + // check for voice or special products only + $this->log->debug("Order id ".$order->id); + /*if($order->id == 38) { + var_dump($order); + exit; + }*/ + + $has_bras = false; + $has_voice = false; + foreach($order->products as $lop) { + if(array_key_exists("bras_type", $lop->product->attributes) && $lop->product->attributes['bras_type']) { + $has_bras = true; + } + if(array_key_exists("voip_chan", $lop->product->attributes) && $lop->product->attributes['voip_chan']) { + $has_voice = true; + } + } + if(!$has_bras && !$has_voice) { + $special_orders[] = $order; + continue; + } + if($has_voice && !$has_bras) { + $voice_orders[] = $order; + continue; + } + + // check for termination if(!array_key_exists($order->id, $orders)) { $o = new Order($order->id); $add = true; @@ -198,6 +239,8 @@ class OrderController extends mfBaseController { } $this->layout()->set("lonelyOrders", $lonelyOrders); + $this->layout()->set("special_orders", $special_orders); + $this->layout()->set("voice_orders", $voice_orders); }