$refill_qty = $class_pm->calcRefillQuantity($oi['products_id'], $oi['products_articles_id'], $products_stock[$stock_id], $open_orders, $refill_qty_request); if($refill_qty>0) { for($r=1;$r<=$refill_qty;$r++) { $class_do->newOrder(SEGMENT_ID_HAMBURG, $oi['products_id'], $oi['products_articles_id'], $oi['products_ean'], 1, null, 'AR', $refill_type); } } } } */ } //FLAG ORDER MODE if (count($items_mto) > 0 || count($items_mmo) > 0) { //If there is at least 1 MTO or MMO, the DSO items will be saved as WMO if ($order_type == 'SP') { if (count($items_dso) > 0) { $class_jo->updateOrderItemMode($items_dso, 'WMO'); } $class_jo->updateOrderItemMode($items_mmo, 'MMO'); } else { if (count($items_dso) > 0) { $class_o->updateOrderItemMode($items_dso, 'WMO'); } $class_o->updateOrderItemMode($items_mmo, 'MMO'); } } else { //If there is no MMO and MTO then all items should be flagged as DSO (Full DSO) if ($orders_total[$order_key] == count($items_dso)) { //IF ALL ITEMS IS ALREADY INCLUDED if ($order_type == 'SP') { $class_jo->updateOrderItemMode($items_dso, 'DSO'); } else {