Example #1
0
 /**
  * Format OrderItem to CSV format
  *
  * @param \Extcode\Cart\Domain\Model\Order\Item $orderItem Order Item
  * @param string $delim Delimiter
  * @param string $quote Quote Style
  *
  * @return string
  */
 public function render(\Extcode\Cart\Domain\Model\Order\Item $orderItem, $delim = ',', $quote = '"')
 {
     $orderItemArr = [];
     $orderItemArr[] = $orderItem->getBillingAddress()->getSalutation();
     $orderItemArr[] = $orderItem->getBillingAddress()->getTitle();
     $orderItemArr[] = $orderItem->getBillingAddress()->getFirstName();
     $orderItemArr[] = $orderItem->getBillingAddress()->getLastName();
     $orderItemArr[] = $orderItem->getOrderNumber();
     $orderItemArr[] = $orderItem->getInvoiceNumber();
     return \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($orderItemArr, $delim, $quote);
 }
Example #2
0
 /**
  * Generate Invoice Document Action
  *
  * @param \Extcode\Cart\Domain\Model\Order\Item $orderItem
  * @param string $pdfType
  *
  * @return void
  */
 public function generatePdfDocumentAction(\Extcode\Cart\Domain\Model\Order\Item $orderItem, $pdfType)
 {
     if ($pdfType == 'invoice') {
         if (!$orderItem->getInvoiceNumber()) {
             $invoiceNumber = $this->generateInvoiceNumber($orderItem);
             $orderItem->setInvoiceNumber($invoiceNumber);
             $orderItem->setInvoiceDate(new \DateTime());
             $this->addFlashMessage('Invoice Number was generated.', $messageTitle = '', $severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::OK, $storeInSession = true);
             $this->itemRepository->update($orderItem);
             $this->persistenceManager->persistAll();
         }
     }
     $this->generatePdfDocument($orderItem, $pdfType);
     $this->itemRepository->update($orderItem);
     $this->persistenceManager->persistAll();
     $msg = ucfirst($pdfType) . '-PDF-Document was generated.';
     $this->addFlashMessage($msg);
     $this->redirect('show', null, null, ['orderItem' => $orderItem]);
 }