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 { } }