Esempio n. 1
0
 /**
  * Convert order object to invoice
  *
  * @param   \Magento\Sales\Model\Order $order
  * @return  \Magento\Sales\Model\Order\Invoice
  */
 public function toInvoice(\Magento\Sales\Model\Order $order)
 {
     $invoice = $this->invoiceRepository->create();
     $invoice->setOrder($order)->setStoreId($order->getStoreId())->setCustomerId($order->getCustomerId())->setBillingAddressId($order->getBillingAddressId())->setShippingAddressId($order->getShippingAddressId());
     $this->_objectCopyService->copyFieldsetToTarget('sales_convert_order', 'to_invoice', $order, $invoice);
     return $invoice;
 }
Esempio n. 2
0
 /**
  * Get options
  *
  * @return array
  */
 public function toOptionArray()
 {
     if ($this->options === null) {
         $this->options = [];
         /** @var \Magento\Framework\Phrase $state */
         foreach ($this->invoiceRepository->create()->getStates() as $id => $state) {
             $this->options[] = ['value' => $id, 'label' => $state->render()];
         }
     }
     return $this->options;
 }
Esempio n. 3
0
 /**
  * Constructor
  *
  * @param ContextInterface $context
  * @param UiComponentFactory $uiComponentFactory
  * @param InvoiceRepositoryInterface $invoiceRepository
  * @param array $components
  * @param array $data
  */
 public function __construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, InvoiceRepositoryInterface $invoiceRepository, array $components = [], array $data = [])
 {
     $this->states = $invoiceRepository->create()->getStates();
     parent::__construct($context, $uiComponentFactory, $components, $data);
 }
Esempio n. 4
0
 /**
  * Return option array
  *
  * @return array
  */
 public function toOptionArray()
 {
     return $this->invoiceRepository->create()->getStates();
 }