コード例 #1
0
 public function cancelOrder()
 {
     $this->autoRender = FALSE;
     $orderId = parent::readCookie('cancel_order_id');
     $orderStatus = $this->getTableObj()->getOrderStatus($orderId);
     if (!$orderStatus) {
         $this->response->body(json_encode(DTO\ErrorDto::prepareError(143)));
     } elseif ($orderStatus == 3) {
         $this->response->body(json_encode(DTO\ErrorDto::prepareError(144)));
     } else {
         if ($this->getTableObj()->deleteOrder($orderId)) {
             $menuRecipeController = new MenuRecipeController();
             $menuRecipeController->restoreMenuRecipeItemQty($orderId);
             $this->response->body(json_encode(DTO\ErrorDto::prepareSuccessMessage("Order has been canceled.")));
         } else {
             Log::debug('Current cancel orderid :-' . $orderId);
             $this->response->body(json_encode(DTO\ErrorDto::prepareError(142)));
         }
     }
 }
コード例 #2
0
ファイル: MenuController.php プロジェクト: Vibeosys/RorderWeb
 public function editRecipe()
 {
     $menuId = parent::readCookie('current-mid');
     $menuRecipeController = new MenuRecipeController();
     $data = $this->request->data;
     $result = TRUE;
     if ($this->request->is('post') and isset($data['save'])) {
         //$this->autoRender = FALSE;
         $menurecipeDto = new UploadDTO\MenuRecipeInsertDto($menuId, $data['recipeItem'], $data['qty'], $data['itemUnit']);
         $result = $menuRecipeController->addNewRecipeItem($menurecipeDto);
     }
     $recipe = $menuRecipeController->getMenuRecipe($menuId);
     $menuInfo = $this->getMenuItemList(null, array($menuId));
     $menu = null;
     foreach ($menuInfo as $menui) {
         if (is_null($menu)) {
             $menu = $menui;
         }
     }
     Log::debug($recipe);
     $this->set(['menurecipe' => $recipe, 'menu' => $menu]);
 }