/** * @return \Application\Model\Bean\ProformaInvoiceLog */ private function newLog(ProformaInvoice $proformaInvoice, $eventType) { $now = \Zend_Date::now(); $log = ProformaInvoiceLogFactory::createFromArray(array('id_proforma_invoice' => $proformaInvoice->getIdProformaInvoice(), 'id_user' => $this->getUser()->getBean()->getIdUser(), 'date' => $now->get('yyyy-MM-dd HH:mm:ss'), 'event_type' => $eventType, 'note' => '')); $this->getCatalog('ProformaInvoiceLogCatalog')->create($log); return $log; }
public function purchaseOrder(PurchaseOrder $purchaseOrder, PurchaseOrderEntryCollection $purchaseOrderEntries) { $proformaInvoicePk = $purchaseOrderEntries->getOne()->getBaseEntry() ? $purchaseOrderEntries->getOne()->getBaseEntry() : 0; if (ProformaInvoiceQuery::create()->whereAdd(ProformaInvoice::ID_PROFORMA_INVOICE, $purchaseOrderEntries->getOne()->getBaseEntry())->count()) { $proformaInvoice = ProformaInvoiceQuery::create()->findByPK($purchaseOrderEntries->getOne()->getBaseEntry()); } else { $proformaInvoice = new ProformaInvoice(); } $purchaseOrder->setIdDestinationCountry($proformaInvoice->getIdDestinationCountry()); $parameters["purchaseOrderSachi"] = $purchaseOrder->toSAPArray(); $parameters["purchaseOrderSachi"]["Lines"] = $purchaseOrderEntries->toSAPArray(); // echo '<pre>'; // print_r($parameters); // die; $this->createLogrequest($parameters); return $this->soapClient->purchaseOrder($parameters); }