public function saveWithParams(Article $article = null, User $user, array $data) { if (!$article) { $article = new Article(); $article->setUser($user); } if (isset($data['name'])) { $article->setName($data['name']); } if (isset($data['code'])) { $article->setCode($data['code']); } if (isset($data['salesPrice'])) { $article->setSalesPrice($data['salesPrice']); } if (isset($data['qty'])) { $article->setQuantity($data['qty']); } if (isset($data['description'])) { $article->setDescription($data['description']); } if (isset($data['uom'])) { if ($data['uom'] > 0) { $uom = $this->settingsService->getUomById($data['uom']); $article->setUom($uom); } } return $this->saveArticle($article); }
private function getUomValues() { $results = array(); foreach ($this->settingsService->getAllUoms($this->user) as $value) { $results[$value->getId()] = $value->getCode(); } return $results; }
public function sendInvoiceEmail(Invoice $invoice, Parameters $data, array $fileData) { $params = new Parameters(); if (!isset($data->default) && isset($data->smtp) && $data->smtp > 0) { $smtp = $this->settingsService->getSmtpById($data->smtp); $params->transport = $smtp->getTransport(); } $params->from = $data->from; $params->to = $data->to; $params->header = $data->header; $params->content = $data->content; $params->file = $fileData['file']; $params->fileName = $fileData['fileName']; $this->mailService->sendInvoiceWithParams($invoice, $params); }
public function smtpAction() { $auth = $this->getServiceLocator()->get('zfcuser_auth_service'); $user = $auth->getIdentity(); $view = new ViewModel(); $smtp = $this->settingsService->setDefaultSmtp($user); if ($this->request->isPost()) { $this->settingsService->saveSmtpWithParams($smtp, (array) $this->request->getPost()); $translator = $this->serviceLocator->get('MvcTranslator'); $this->flashMessenger()->addMessage($translator->translate('Controller.Settings.smtp.Saved')); $this->redirect()->toRoute('application/default', array('controller' => 'settings', 'action' => 'smtp')); } $view = new ViewModel(); $view->smtp = $smtp; $view->tab = 'smtp'; $view->messages = $this->flashMessenger()->getMessages(); return $view; }
private function addInvoiceRowToView(ViewModel $view, Row $row = null) { $auth = $this->getServiceLocator()->get('zfcuser_auth_service'); $user = $auth->getIdentity(); $view->setTemplate('application/document/partial/row'); $view->uoms = $this->settingsService->getAllUoms($user); $view->vats = $this->settingsService->getAllVats($user); if ($row != null) { $view->price = $row->getPrice(); $view->code = $row->getCode(); $view->name = $row->getName(); $view->description = $row->getDescription(); $view->quantity = $row->getQuantity(); $view->rowId = $row->getId(); $view->selectedUom = $row->getUom(); $view->selectedVat = $row->getVat(); $view->selectedArticle = $row->getArticle(); $view->selectedWarehouse = $row->getWarehouse(); $view->amount = $row->getAmount(); $view->vatAmount = $row->getVatAmount(); $view->vatValue = $row->getVatValue(); } return $view; }