Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 private function getUomValues()
 {
     $results = array();
     foreach ($this->settingsService->getAllUoms($this->user) as $value) {
         $results[$value->getId()] = $value->getCode();
     }
     return $results;
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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;
 }