Fixed showing orders with not required termination

This commit is contained in:
Frank Schubert
2021-10-12 20:09:32 +02:00
parent 6d41583735
commit 77f5931995
2 changed files with 42 additions and 6 deletions

View File

@@ -101,8 +101,8 @@ class OrderController extends mfBaseController {
$lonelyOrders = [];
unset($order_search["network_id"]);
//$order_search['product_id'] = null;
// all orders without a product or with products without terminations
$order_search['product_id'] = null;
// orders without a product
if($this->me->isAdmin()) {
$lonelies = OrderModel::search($order_search);
} else {
@@ -114,7 +114,31 @@ class OrderController extends mfBaseController {
$lonelyOrders[$order->id] = $order;
}
}
// orders with termination product not requiring termination_id
$order_search['product_id'] = ">0";
$order_search['termination_id'] = null;
if($this->me->isAdmin()) {
$lonelies = OrderModel::search($order_search);
} else {
$order_search['create_by'] = $this->me->id;
$lonelies = OrderModel::search($order_search);
}
foreach($lonelies as $order) {
if(!array_key_exists($order->id, $orders)) {
$o = new Order($order->id);
foreach($o->products as $p) {
//var_dump($p->product->attributes);exit;
if(array_key_exists(TT_ATTRIB_TERMINATION_REQUIRED_NAME, $p->product->attributes)) {
$this->log->debug("found additional order wher termination_required 0");
$lonelyOrders[$order->id] = $order;
break;
}
}
//$lonelyOrders[$order->id] = $order;
}
}
$this->layout()->set("orders", $orders);