public function jsonGetArticleAction() { if ($this->request->isPost() && $this->request->isXmlHttpRequest()) { $article = $this->articleService->getArticleById($this->request->getPost()->articleId); if ($article) { /* @var $article \Application\Entity\Article */ $result = array('name' => $article->getName(), 'code' => $article->getCode(), 'uom' => $article->getUom() ? $article->getUom()->getId() : '', 'price' => $article->getSalesPrice(), 'quantity' => $article->getQuantity(), 'description' => $article->getDescription()); return new JsonModel($result); } } return $this->response; }
public function assembleInvoiceRowsArrayFromPost(array $data) { $invoiceRows = array(); foreach ($data['names'] as $key => $value) { $vat = $this->settingsService->getVatById($data['vatIds'][$key]); $uom = $this->settingsService->getUomById($data['uomIds'][$key]); $article = $this->articleService->getArticleById($data['articleIds'][$key]); $rowArray = array('rowId' => $data['rowIds'][$key], 'description' => $data['rowIds'][$key], 'name' => $value, 'price' => $data['prices'][$key], 'quantity' => $data['quantities'][$key], 'selectedVat' => $vat, 'selectedArticle' => $article, 'selectedUom' => $uom, 'total' => $data['totals'][$key], 'vatAmount' => $data['vatAmounts'][$key], 'vatValue' => $data['vatValues'][$key]); $invoiceRows[] = $rowArray; } return $invoiceRows; }