private function forceDoneOrder($orderId) { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $order = new MasterOrderModel(); $order->getByID($orderId); $order->status_progress = 9; $order->save(); $o = new OrderDetailModel(); $orderDetails = $o->getWhere("id_order='{$orderId}'"); foreach ($orderDetails as $orderDetail) { $orderDetail->load = 1; $orderDetail->status_progress = 9; $orderDetail->save(); } $resto = new MasterRestaurantModel(); $resto->getByID($order->id_restaurant); if ($order->id_table != 0) { Mastertable::clearTable($order->id_table); } if ($order->id_user != 0) { $guestId = $order->id_user; if ($order->user_guest_id != "" || $order->user_guest_id != ",") { $guestId .= $order->user_guest_id; } $j["id_order"] = $orderId; $j['datetime'] = date('Y-m-d H:i:s'); $msg = "Your order at restaurant {$resto->name} with order ID {$orderId} has been voided"; $this->pushToUser($guestId, $msg, $j, Push::$typeUpdateWaiting); die; } }
public static function forceDoneOrder($orderId) { $order = new MasterOrderModel(); $order->getByID($orderId); $order->status_progress = Keys::$STATUS_PROGRESS_VOID; $order->save(); $o = new OrderDetailModel(); $orderDetails = $o->getWhere("id_order='{$orderId}'"); foreach ($orderDetails as $orderDetail) { $orderDetail->load = 1; $orderDetail->status_progress = Keys::$STATUS_PROGRESS_VOID; $orderDetail->save(); } $resto = new MasterRestaurantModel(); $resto->getByID($order->id_restaurant); if ($order->id_table != 0) { Mastertable::clearTable($order->id_table); } if ($order->id_user != 0) { Util::pushNotifyOrderVoided($orderId); die; } }
public function cancelOrder() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $id_order = isset($_GET['id_order']) ? addslashes($_GET['id_order']) : ""; if (!$id_order) { Generic::errorMsg("No id order found!"); } $objOrder = new MasterOrderModel(); $objOrder->getByID($id_order); Mastertable::clearTable($objOrder->id_table); $objOrder->status = "0"; $objOrder->load = 1; $idUpdate = $objOrder->save(); if (!$idUpdate) { $json['status_code'] = 0; $json['messages'] = Lang::t('save failed'); } else { $json['status_code'] = 1; $json['results']['messages'] = "Success"; } echo json_encode($json); die; }