public function renderDetail($no) { $item = $this->ics->Read($no); if ($item) { $this->template->item = $item; } else { $this->redirect('Homepage:default'); } }
public function actionRating($no) { $item = $this->ics->Read($no); if ($item && $this->ics->isRatingOpen($this->user->id, $no)) { $this->item_no = $no; $this->template->item = $item; } else { $this->redirect('Account:ratings'); } }
public function getAll($full = false) { if ($full) { $keys = $this->getKeys(); if ($keys) { $filer = new NFilter(self::KEY_FIELD, $keys); $items = $this->itemCardService->ReadMultiple(0, $filer); return array_map(function ($item) { $item->{self::ORDER_QUANTITY_FIELD} = $this->getQuantity($item->{self::KEY_FIELD}); return $item; }, $items); } return []; } else { return $this->session; } }
public function formSucceeded(Form $form, $values) { unset($values->agree); $values[CF::GEN_BUS_POSTING_GROUP] = 'NATIONAL'; $values[CF::VAT_BUS_POSTING_GROUP] = 'NATIONAL'; $values[CF::CUSTOMER_POSTING_GROUP] = 'DOMESTIC'; $values[CF::KEY] = $this->cus->Read($this->user->id)->{CF::KEY}; $values[CF::NO] = $this->user->id; $this->cus->Update($values); $order = new SalesOrder(); // $order->Bill_to_Customer_No = $this->user->id; $order->Sell_to_Customer_No = $this->user->id; // $order->VAT_Bus_Posting_Group = 'NATIONAL'; // $order->Currency_Code = 'EUR'; $lines = []; foreach ($this->shoppingCart->getAll() as $item) { $line = new SalesOrderLine(); $line->Type = 'Item'; $line->No = $item[ShoppingCart::KEY_FIELD]; $line->Quantity = $item[ShoppingCart::ORDER_QUANTITY_FIELD]; // $line->Line_Discount_Percent = '0.0'; // $line->Line_Discount_Amount = 0; // $line->Inv_Discount_Amount = 0; $lines[] = $line; } $order->SalesLines = $lines; $result = $this->sos->Create($order); if ($result) { foreach ($this->shoppingCart->getAll() as $item) { if (!$this->ics->ratingExists($this->user->id, $item[ShoppingCart::KEY_FIELD])) { $this->ics->addEmptyRating($this->user->id, $item[ShoppingCart::KEY_FIELD]); } } $this->shoppingCart->clear(); $this->onSuccess($values); } else { } }
public function formSucceeded(Form $form, $values) { $this->ics->updateRating($this->user->id, $this->item_no, $values); $this->onSuccess($values); }