2020-05-26 16:32:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This Software is the property of Data Development and is protected
|
|
|
|
* by copyright law - it is NOT Freeware.
|
|
|
|
*
|
|
|
|
* Any unauthorized use of this software without a valid license
|
|
|
|
* is a violation of the license agreement and will be prosecuted by
|
|
|
|
* civil and criminal law.
|
|
|
|
*
|
|
|
|
* http://www.shopmodule.com
|
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
* @author D3 Data Development - Max Buhe <support@shopmodule.com>
|
|
|
|
* @link http://www.oxidmodule.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace D3\PdfDocuments\Application\Model\AbstractClasses;
|
|
|
|
|
2020-05-30 00:48:43 +02:00
|
|
|
use D3\PdfDocuments\Application\Model\Exceptions\noBaseObjectSetException;
|
2020-05-30 01:17:27 +02:00
|
|
|
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface as orderInterface;
|
2020-05-26 16:32:22 +02:00
|
|
|
use \OxidEsales\Eshop\Application\Model\Order;
|
2020-05-27 09:46:44 +02:00
|
|
|
use OxidEsales\Eshop\Application\Model\Payment;
|
|
|
|
use OxidEsales\Eshop\Application\Model\User;
|
2020-05-26 16:32:22 +02:00
|
|
|
|
2020-05-30 01:17:27 +02:00
|
|
|
abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInterface
|
2020-05-26 16:32:22 +02:00
|
|
|
{
|
2020-05-27 09:46:44 +02:00
|
|
|
/** @var Order */
|
|
|
|
public $oOrder;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Order $order
|
|
|
|
*/
|
|
|
|
public function setOrder(Order $order)
|
|
|
|
{
|
|
|
|
$this->oOrder = $order;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Order
|
|
|
|
*/
|
|
|
|
public function getOrder()
|
|
|
|
{
|
|
|
|
return $this->oOrder;
|
|
|
|
}
|
|
|
|
|
2020-05-28 12:21:11 +02:00
|
|
|
public function setSmartyVars()
|
2020-05-27 09:46:44 +02:00
|
|
|
{
|
2020-05-28 12:21:11 +02:00
|
|
|
parent::setSmartyVars();
|
2020-05-27 09:46:44 +02:00
|
|
|
|
2020-05-28 12:21:11 +02:00
|
|
|
$this->oSmarty->assign('order', $this->getOrder());
|
2020-05-27 09:46:44 +02:00
|
|
|
|
|
|
|
$oUser = oxNew(User::Class);
|
|
|
|
$oUser->load($this->getOrder()->getFieldData('oxuserid'));
|
2020-05-28 12:21:11 +02:00
|
|
|
$this->oSmarty->assign('user', $oUser);
|
2020-05-27 09:46:44 +02:00
|
|
|
|
|
|
|
$oPayment = oxNew(Payment::class);
|
|
|
|
$oPayment->load($this->getOrder()->getFieldData('oxpaymenttype'));
|
2020-05-28 12:21:11 +02:00
|
|
|
$this->oSmarty->assign('payment', $oPayment);
|
2020-05-27 09:46:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $sFilename
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2020-06-04 10:31:38 +02:00
|
|
|
public function getFilename()
|
2020-05-27 09:46:44 +02:00
|
|
|
{
|
2020-06-05 09:37:11 +02:00
|
|
|
// forced filename from setFilename()
|
|
|
|
if ($this->filename) {
|
2020-06-05 10:06:58 +02:00
|
|
|
return $this->addFilenameExtension($this->filename);
|
2020-06-05 09:37:11 +02:00
|
|
|
}
|
|
|
|
|
2020-06-04 10:31:38 +02:00
|
|
|
$sTrimmedBillName = trim($this->getOrder()->getFieldData('oxbilllname'));
|
2020-05-27 09:46:44 +02:00
|
|
|
|
2020-06-05 10:06:58 +02:00
|
|
|
return $this->addFilenameExtension(
|
|
|
|
implode(
|
|
|
|
'_',
|
|
|
|
[
|
|
|
|
$this->getTypeForFilename(),
|
|
|
|
$this->getOrder()->getFieldData('oxordernr'),
|
|
|
|
$sTrimmedBillName
|
|
|
|
]
|
|
|
|
)
|
2020-06-04 10:31:38 +02:00
|
|
|
);
|
2020-05-27 09:46:44 +02:00
|
|
|
}
|
2020-05-30 00:48:43 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $sFilename
|
|
|
|
* @param int $iSelLang
|
|
|
|
* @param string $target
|
|
|
|
* @throws noBaseObjectSetException
|
|
|
|
*/
|
|
|
|
public function genPdf($sFilename, $iSelLang = 0, $target = 'I')
|
|
|
|
{
|
|
|
|
if (false == $this->getOrder()) {
|
|
|
|
$e = oxNew(noBaseObjectSetException::class);
|
|
|
|
throw $e;
|
|
|
|
}
|
|
|
|
|
|
|
|
parent::genPdf($sFilename, $iSelLang, $target);
|
|
|
|
}
|
2020-05-26 16:32:22 +02:00
|
|
|
}
|