From 7d9c9a98372fc16e6c7755ab1dd04a91d3a27d39 Mon Sep 17 00:00:00 2001 From: kristianhempel Date: Thu, 25 Jan 2018 11:30:17 +0100 Subject: [PATCH] changed CRLF to LF changed case to UTF-8 --- .../modules/d3/d3dev/IntelliSenseHelper.php | 104 ++-- .../modules/d3/d3dev/controllers/d3dev.php | 244 ++++----- .../modules/controllers/d3_dev_thankyou.php | 262 +++++----- .../d3dev/modules/models/d3_dev_d3inquiry.php | 346 ++++++------- .../models/d3_dev_d3inquiryarticle.php | 76 +-- .../d3dev/modules/models/d3_dev_oxbasket.php | 124 ++--- .../modules/models/d3_dev_oxbasketitem.php | 82 +-- .../d3dev/modules/models/d3_dev_oxemail.php | 486 +++++++++--------- .../d3dev/modules/models/d3_dev_oxorder.php | 218 ++++---- .../modules/models/d3_dev_oxorderarticle.php | 56 +- 10 files changed, 999 insertions(+), 999 deletions(-) diff --git a/copy_this/modules/d3/d3dev/IntelliSenseHelper.php b/copy_this/modules/d3/d3dev/IntelliSenseHelper.php index 654d793..b7de085 100644 --- a/copy_this/modules/d3/d3dev/IntelliSenseHelper.php +++ b/copy_this/modules/d3/d3dev/IntelliSenseHelper.php @@ -1,52 +1,52 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_thankyou_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController {} - -/** - * Class d3_dev_oxorder_parent - */ -class d3_dev_oxorder_parent extends \OxidEsales\Eshop\Application\Model\Order {} - -/** - * Class d3_dev_d3inquiry_parent - */ -class d3_dev_d3inquiry_parent extends d3inquiry {} - -/** - * Class d3_dev_oxorderarticle - */ -class d3_dev_oxorderarticle_parent extends \OxidEsales\Eshop\Application\Model\OrderArticle {} - -/** - * Class d3_dev_oxemail_parent - */ -class d3_dev_oxemail_parent extends \OxidEsales\Eshop\Core\Email {} - -/** - * Class d3_dev_order_parent - */ -class d3_dev_order_parent extends \OxidEsales\Eshop\Application\Controller\OrderController {} - -/** - * Class d3_dev_oxbasket_parent - */ -class d3_dev_oxbasket_parent extends \OxidEsales\Eshop\Application\Model\Basket {} - -/** - * Class d3_dev_oxbasketitem_parent - */ -class d3_dev_oxbasketitem_parent extends \OxidEsales\Eshop\Application\Model\BasketItem {} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_thankyou_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController {} + +/** + * Class d3_dev_oxorder_parent + */ +class d3_dev_oxorder_parent extends \OxidEsales\Eshop\Application\Model\Order {} + +/** + * Class d3_dev_d3inquiry_parent + */ +class d3_dev_d3inquiry_parent extends d3inquiry {} + +/** + * Class d3_dev_oxorderarticle + */ +class d3_dev_oxorderarticle_parent extends \OxidEsales\Eshop\Application\Model\OrderArticle {} + +/** + * Class d3_dev_oxemail_parent + */ +class d3_dev_oxemail_parent extends \OxidEsales\Eshop\Core\Email {} + +/** + * Class d3_dev_order_parent + */ +class d3_dev_order_parent extends \OxidEsales\Eshop\Application\Controller\OrderController {} + +/** + * Class d3_dev_oxbasket_parent + */ +class d3_dev_oxbasket_parent extends \OxidEsales\Eshop\Application\Model\Basket {} + +/** + * Class d3_dev_oxbasketitem_parent + */ +class d3_dev_oxbasketitem_parent extends \OxidEsales\Eshop\Application\Model\BasketItem {} diff --git a/copy_this/modules/d3/d3dev/controllers/d3dev.php b/copy_this/modules/d3/d3dev/controllers/d3dev.php index 5e9ae60..573428a 100644 --- a/copy_this/modules/d3/d3dev/controllers/d3dev.php +++ b/copy_this/modules/d3/d3dev/controllers/d3dev.php @@ -1,122 +1,122 @@ - - * @link http://www.oxidmodule.com - */ - -class d3dev extends \OxidEsales\EshopProfessional\Application\Controller\FrontendController -{ - public function init() - { - $this->_authenticate(); - - parent::init(); - } - - protected function _authenticate () - { - $request = oxNew(Request::class); - try { - $sUser = $request->getRequestParameter( 'usr' ); - $sPassword = $request->getRequestParameter( 'pwd' ); - - if ( !$sUser || !$sPassword ) { - $sUser = $_SERVER[ 'PHP_AUTH_USER' ]; - $sPassword = $_SERVER[ 'PHP_AUTH_PW' ]; - } - - if ( !$sUser || !$sPassword ) { - $sHttpAuthorization = $_REQUEST[ 'HTTP_AUTHORIZATION' ]; - if ( $sHttpAuthorization ) { - $sUser = null; - $sPassword = null; - $aHttpAuthorization = explode( ' ', $sHttpAuthorization ); - if ( is_array( $aHttpAuthorization ) && count( $aHttpAuthorization ) >= 2 && strtolower( $aHttpAuthorization[ 0 ] ) == 'basic' ) { - $sBasicAuthorization = base64_decode( $aHttpAuthorization[ 1 ] ); - $aBasicAuthorization = explode( ':', $sBasicAuthorization ); - if ( is_array( $aBasicAuthorization ) && count( $aBasicAuthorization ) >= 2 ) { - $sUser = $aBasicAuthorization[ 0 ]; - $sPassword = $aBasicAuthorization[ 1 ]; - } - } - } - } - $oUser = oxNew( \OxidEsales\Eshop\Application\Model\User::class ); - if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) { - /** @var \OxidEsales\Eshop\Core\Exception\UserException $oEx */ - $oEx = oxNew( \OxidEsales\Eshop\Core\Exception\UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' ); - - throw $oEx; - } - } - catch ( Exception $oEx ) { - $oShop = Registry::getConfig()->getActiveShop(); - header( 'WWW-Authenticate: Basic realm="' . $oShop->oxshops__oxname->value . '"' ); - header( 'HTTP/1.0 401 Unauthorized' ); - exit( 1 ); - } - } - - /** - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - public function showOrderMailContent() - { - header('Content-type: text/html; charset='.Registry::getLang()->translateString('charset')); - - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value - || false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser') - ) { - Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start'); - } - - $sTpl = oxNew(Request::class)->getRequestParameter('type'); - - /** @var d3_dev_thankyou $oThankyou */ - $oThankyou = oxNew(\OxidEsales\Eshop\Application\Controller\ThankYouController::class); - $oOrder = $oThankyou->d3GetLastOrder(); - - /** @var d3_dev_oxemail $oEmail */ - $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class); - echo $oEmail->d3GetOrderMailContent($oOrder, $sTpl); - die(); - } - - /** - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - */ - public function showInquiryMailContent() - { - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value - || false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser') - ) { - Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start'); - } - - $sTpl = oxNew(Request::class)->getRequestParameter('type'); - - /** @var d3_dev_thankyou $oThankyou */ - $oThankyou = oxNew(\OxidEsales\Eshop\Application\Controller\ThankYouController::class); - $oOrder = $oThankyou->d3GetLastInquiry(); - - /** @var d3_dev_oxemail $oEmail */ - $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class); - echo $oEmail->d3GetInquiryMailContent($oOrder, $sTpl); - die(); - } -} + + * @link http://www.oxidmodule.com + */ + +class d3dev extends \OxidEsales\EshopProfessional\Application\Controller\FrontendController +{ + public function init() + { + $this->_authenticate(); + + parent::init(); + } + + protected function _authenticate () + { + $request = oxNew(Request::class); + try { + $sUser = $request->getRequestParameter( 'usr' ); + $sPassword = $request->getRequestParameter( 'pwd' ); + + if ( !$sUser || !$sPassword ) { + $sUser = $_SERVER[ 'PHP_AUTH_USER' ]; + $sPassword = $_SERVER[ 'PHP_AUTH_PW' ]; + } + + if ( !$sUser || !$sPassword ) { + $sHttpAuthorization = $_REQUEST[ 'HTTP_AUTHORIZATION' ]; + if ( $sHttpAuthorization ) { + $sUser = null; + $sPassword = null; + $aHttpAuthorization = explode( ' ', $sHttpAuthorization ); + if ( is_array( $aHttpAuthorization ) && count( $aHttpAuthorization ) >= 2 && strtolower( $aHttpAuthorization[ 0 ] ) == 'basic' ) { + $sBasicAuthorization = base64_decode( $aHttpAuthorization[ 1 ] ); + $aBasicAuthorization = explode( ':', $sBasicAuthorization ); + if ( is_array( $aBasicAuthorization ) && count( $aBasicAuthorization ) >= 2 ) { + $sUser = $aBasicAuthorization[ 0 ]; + $sPassword = $aBasicAuthorization[ 1 ]; + } + } + } + } + $oUser = oxNew( \OxidEsales\Eshop\Application\Model\User::class ); + if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) { + /** @var \OxidEsales\Eshop\Core\Exception\UserException $oEx */ + $oEx = oxNew( \OxidEsales\Eshop\Core\Exception\UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' ); + + throw $oEx; + } + } + catch ( Exception $oEx ) { + $oShop = Registry::getConfig()->getActiveShop(); + header( 'WWW-Authenticate: Basic realm="' . $oShop->oxshops__oxname->value . '"' ); + header( 'HTTP/1.0 401 Unauthorized' ); + exit( 1 ); + } + } + + /** + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + public function showOrderMailContent() + { + header('Content-type: text/html; charset='.Registry::getLang()->translateString('charset')); + + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value + || false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser') + ) { + Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start'); + } + + $sTpl = oxNew(Request::class)->getRequestParameter('type'); + + /** @var d3_dev_thankyou $oThankyou */ + $oThankyou = oxNew(\OxidEsales\Eshop\Application\Controller\ThankYouController::class); + $oOrder = $oThankyou->d3GetLastOrder(); + + /** @var d3_dev_oxemail $oEmail */ + $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class); + echo $oEmail->d3GetOrderMailContent($oOrder, $sTpl); + die(); + } + + /** + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + */ + public function showInquiryMailContent() + { + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value + || false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser') + ) { + Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start'); + } + + $sTpl = oxNew(Request::class)->getRequestParameter('type'); + + /** @var d3_dev_thankyou $oThankyou */ + $oThankyou = oxNew(\OxidEsales\Eshop\Application\Controller\ThankYouController::class); + $oOrder = $oThankyou->d3GetLastInquiry(); + + /** @var d3_dev_oxemail $oEmail */ + $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class); + echo $oEmail->d3GetInquiryMailContent($oOrder, $sTpl); + die(); + } +} diff --git a/copy_this/modules/d3/d3dev/modules/controllers/d3_dev_thankyou.php b/copy_this/modules/d3/d3dev/modules/controllers/d3_dev_thankyou.php index 60e6e5a..198155a 100644 --- a/copy_this/modules/d3/d3dev/modules/controllers/d3_dev_thankyou.php +++ b/copy_this/modules/d3/d3dev/modules/controllers/d3_dev_thankyou.php @@ -1,131 +1,131 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_thankyou extends d3_dev_thankyou_parent -{ - /** - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - * @throws object - * @throws oxUserException - */ - public function init() - { - $sSessChallenge = Registry::getSession()->getVariable('sess_challenge'); - - parent::init(); - - Registry::getSession()->setVariable('sess_challenge', $sSessChallenge); - - if (oxNew(\OxidEsales\Eshop\Core\Request::class)->getRequestParameter('d3dev') - && false == (bool) Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value - && Registry::getConfig()->getConfigParam('blD3DevShowThankyou') - ) { - $this->_d3authenticate(); - $oOrder = $this->d3GetLastOrder(); - $oBasket = $oOrder->d3DevGetOrderBasket(); - $this->_oBasket = $oBasket; - } - } - - /** - * @throws object - * @throws oxUserException - */ - protected function _d3authenticate () - { - $request = oxNew(\OxidEsales\Eshop\Core\Request::class); - - try { - $sUser = $request->getRequestParameter( 'usr' ); - $sPassword = $request->getRequestParameter( 'pwd' ); - - if ( !$sUser || !$sPassword ) { - $sUser = $_SERVER[ 'PHP_AUTH_USER' ]; - $sPassword = $_SERVER[ 'PHP_AUTH_PW' ]; - } - - if ( !$sUser || !$sPassword ) { - $sHttpAuthorization = $_REQUEST[ 'HTTP_AUTHORIZATION' ]; - if ( $sHttpAuthorization ) { - $sUser = null; - $sPassword = null; - $aHttpAuthorization = explode( ' ', $sHttpAuthorization ); - if ( is_array( $aHttpAuthorization ) && count( $aHttpAuthorization ) >= 2 && strtolower( $aHttpAuthorization[ 0 ] ) == 'basic' ) { - $sBasicAuthorization = base64_decode( $aHttpAuthorization[ 1 ] ); - $aBasicAuthorization = explode( ':', $sBasicAuthorization ); - if ( is_array( $aBasicAuthorization ) && count( $aBasicAuthorization ) >= 2 ) { - $sUser = $aBasicAuthorization[ 0 ]; - $sPassword = $aBasicAuthorization[ 1 ]; - } - } - } - } - /** @var \OxidEsales\Eshop\Application\Model\User $oUser */ - $oUser = oxNew( \OxidEsales\Eshop\Application\Model\User::class ); - if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) { - /** @var \OxidEsales\Eshop\Core\Exception\UserException $oEx */ - $oEx = oxNew( \OxidEsales\Eshop\Core\Exception\UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN'); - throw $oEx; - } - } - catch ( Exception $oEx ) { - $oShop = Registry::getConfig()->getActiveShop(); - header( 'WWW-Authenticate: Basic realm="' . $oShop->oxshops__oxname->value . '"' ); - header( 'HTTP/1.0 401 Unauthorized' ); - exit( 1 ); - } - } - - /** - * @return bool|d3_dev_oxorder - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - public function d3GetLastOrder() - { - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { - return false; - } - - /** @var d3_dev_oxorder $oOrder */ - $oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class); - $oOrder->d3getLastOrder(); - - return $oOrder; - } - - /** - * @return bool|d3_dev_d3inquiry - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - */ - public function d3GetLastInquiry() - { - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { - return false; - } - - /** @var d3_dev_d3inquiry $oInquiry */ - $oInquiry = oxNew('d3inquiry'); - $oInquiry->d3getLastInquiry(); - - return $oInquiry; - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_thankyou extends d3_dev_thankyou_parent +{ + /** + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + * @throws object + * @throws oxUserException + */ + public function init() + { + $sSessChallenge = Registry::getSession()->getVariable('sess_challenge'); + + parent::init(); + + Registry::getSession()->setVariable('sess_challenge', $sSessChallenge); + + if (oxNew(\OxidEsales\Eshop\Core\Request::class)->getRequestParameter('d3dev') + && false == (bool) Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value + && Registry::getConfig()->getConfigParam('blD3DevShowThankyou') + ) { + $this->_d3authenticate(); + $oOrder = $this->d3GetLastOrder(); + $oBasket = $oOrder->d3DevGetOrderBasket(); + $this->_oBasket = $oBasket; + } + } + + /** + * @throws object + * @throws oxUserException + */ + protected function _d3authenticate () + { + $request = oxNew(\OxidEsales\Eshop\Core\Request::class); + + try { + $sUser = $request->getRequestParameter( 'usr' ); + $sPassword = $request->getRequestParameter( 'pwd' ); + + if ( !$sUser || !$sPassword ) { + $sUser = $_SERVER[ 'PHP_AUTH_USER' ]; + $sPassword = $_SERVER[ 'PHP_AUTH_PW' ]; + } + + if ( !$sUser || !$sPassword ) { + $sHttpAuthorization = $_REQUEST[ 'HTTP_AUTHORIZATION' ]; + if ( $sHttpAuthorization ) { + $sUser = null; + $sPassword = null; + $aHttpAuthorization = explode( ' ', $sHttpAuthorization ); + if ( is_array( $aHttpAuthorization ) && count( $aHttpAuthorization ) >= 2 && strtolower( $aHttpAuthorization[ 0 ] ) == 'basic' ) { + $sBasicAuthorization = base64_decode( $aHttpAuthorization[ 1 ] ); + $aBasicAuthorization = explode( ':', $sBasicAuthorization ); + if ( is_array( $aBasicAuthorization ) && count( $aBasicAuthorization ) >= 2 ) { + $sUser = $aBasicAuthorization[ 0 ]; + $sPassword = $aBasicAuthorization[ 1 ]; + } + } + } + } + /** @var \OxidEsales\Eshop\Application\Model\User $oUser */ + $oUser = oxNew( \OxidEsales\Eshop\Application\Model\User::class ); + if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) { + /** @var \OxidEsales\Eshop\Core\Exception\UserException $oEx */ + $oEx = oxNew( \OxidEsales\Eshop\Core\Exception\UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN'); + throw $oEx; + } + } + catch ( Exception $oEx ) { + $oShop = Registry::getConfig()->getActiveShop(); + header( 'WWW-Authenticate: Basic realm="' . $oShop->oxshops__oxname->value . '"' ); + header( 'HTTP/1.0 401 Unauthorized' ); + exit( 1 ); + } + } + + /** + * @return bool|d3_dev_oxorder + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + public function d3GetLastOrder() + { + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { + return false; + } + + /** @var d3_dev_oxorder $oOrder */ + $oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class); + $oOrder->d3getLastOrder(); + + return $oOrder; + } + + /** + * @return bool|d3_dev_d3inquiry + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + */ + public function d3GetLastInquiry() + { + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { + return false; + } + + /** @var d3_dev_d3inquiry $oInquiry */ + $oInquiry = oxNew('d3inquiry'); + $oInquiry->d3getLastInquiry(); + + return $oInquiry; + } +} diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiry.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiry.php index 5cf0abe..5dd6d5b 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiry.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiry.php @@ -1,173 +1,173 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_d3inquiry extends d3_dev_d3inquiry_parent -{ - protected $_oOrderBasket = null; - - /** - * @return d3_dev_oxbasket - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - public function d3DevGetOrderBasket() - { - /** @var oxbasket $oBasket */ - $this->_getInquiryBasket(); - - // unsetting bundles - $oOrderArticles = $this->getInquiryArticles(); - foreach ($oOrderArticles as $sItemId => $oItem) { - if ($oItem->isBundle()) { - $oOrderArticles->offsetUnset($sItemId); - } - } - - // add this order articles to basket and recalculate basket - $oBasket = $this->_addInquiryArticlesToBasket($this->getInquiryUser(), $oOrderArticles); - // recalculating basket - $oBasket->calculateBasket(true); - $oBasket->d3ClearBasketItemArticles(); - - return $oBasket; - } - - /** - * @return string - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - */ - public function d3getLastInquiryId() - { - $inquiryNr = (int) oxNew(\OxidEsales\Eshop\Core\Request::class)->getRequestParameter('d3inquirynr'); - $sWhere = 1; - if ($inquiryNr) { - $sWhere = ' oxinquirynr = ' . $inquiryNr; - } - - $sSelect = "SELECT oxid FROM ".getViewName('d3inquiry')." WHERE ".$sWhere." ORDER BY oxinquirydate DESC LIMIT 1"; - - return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($sSelect); - } - - /** - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - */ - public function d3getLastInquiry() - { - $this->load($this->d3getLastInquiryId()); - //$this->_d3AddVouchers(); - } - - /** - * @return oxBasket - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - public function getBasket() - { - $oBasket = parent::getBasket(); - - if (false == $oBasket && Registry::getConfig()->getActiveView()->getClassKey() == 'd3dev') { - $oBasket = $this->d3DevGetOrderBasket(); - } - - return $oBasket; - } - - /** - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - protected function _d3AddVouchers() - { - $sSelect = "SELECT oxid FROM oxvouchers WHERE oxorderid = ". DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($this->getId()).";"; - - $aResult = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getAll($sSelect); - - foreach ($aResult as $aFields) { - $oVoucher = oxNew('oxvoucher'); - $oVoucher->load($aFields['oxid']); - $this->_aVoucherList[$oVoucher->getId()] = $oVoucher; - } - } - - /** - * Returns basket object filled up with discount, delivery, wrapping and all other info - * - * @param bool $blStockCheck perform stock check or not (default true) - * - * @return \OxidEsales\Eshop\Application\Model\Basket - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - protected function _getInquiryBasket($blStockCheck = true) - { - /** @var \OxidEsales\Eshop\Application\Model\Basket _oOrderBasket */ - $this->_oOrderBasket = oxNew(\OxidEsales\Eshop\Application\Model\Basket::class); - $this->_oOrderBasket->enableSaveToDataBase(false); - - //setting recalculation mode - $this->_oOrderBasket->setCalculationModeNetto($this->isNettoMode()); - - // setting stock check mode - $this->_oOrderBasket->setStockCheckMode($blStockCheck); - - // setting virtual basket user - $this->_oOrderBasket->setBasketUser($this->getInquiryUser()); - - // transferring order id - $this->_oOrderBasket->setInquiryId($this->getId()); - - // setting basket currency order uses - $aCurrencies = Registry::getConfig()->getCurrencyArray(); - foreach ($aCurrencies as $oCur) { - if ($oCur->name == $this->oxorder__oxcurrency->value) { - $oBasketCur = $oCur; - break; - } - } - - // setting currency - $this->_oOrderBasket->setBasketCurrency($oBasketCur); - - // set basket card id and message - $this->_oOrderBasket->setCardId($this->oxorder__oxcardid->value); - $this->_oOrderBasket->setCardMessage($this->oxorder__oxcardtext->value); - - if ($this->_blReloadDiscount) { - $oDb = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC); - // disabling availability check - $this->_oOrderBasket->setSkipVouchersChecking(true); - - // add previously used vouchers - $sQ = 'select oxid from oxvouchers where oxorderid = ' . $oDb->quote($this->getId()); - $aVouchers = $oDb->getAll($sQ); - foreach ($aVouchers as $aVoucher) { - $this->_oOrderBasket->addVoucher($aVoucher['oxid']); - } - } else { - $this->_oOrderBasket->setDiscountCalcMode(false); - $this->_oOrderBasket->setVoucherDiscount($this->oxorder__oxvoucherdiscount->value); - $this->_oOrderBasket->setTotalDiscount($this->oxorder__oxdiscount->value); - } - - return $this->_oOrderBasket; - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_d3inquiry extends d3_dev_d3inquiry_parent +{ + protected $_oOrderBasket = null; + + /** + * @return d3_dev_oxbasket + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + public function d3DevGetOrderBasket() + { + /** @var oxbasket $oBasket */ + $this->_getInquiryBasket(); + + // unsetting bundles + $oOrderArticles = $this->getInquiryArticles(); + foreach ($oOrderArticles as $sItemId => $oItem) { + if ($oItem->isBundle()) { + $oOrderArticles->offsetUnset($sItemId); + } + } + + // add this order articles to basket and recalculate basket + $oBasket = $this->_addInquiryArticlesToBasket($this->getInquiryUser(), $oOrderArticles); + // recalculating basket + $oBasket->calculateBasket(true); + $oBasket->d3ClearBasketItemArticles(); + + return $oBasket; + } + + /** + * @return string + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + */ + public function d3getLastInquiryId() + { + $inquiryNr = (int) oxNew(\OxidEsales\Eshop\Core\Request::class)->getRequestParameter('d3inquirynr'); + $sWhere = 1; + if ($inquiryNr) { + $sWhere = ' oxinquirynr = ' . $inquiryNr; + } + + $sSelect = "SELECT oxid FROM ".getViewName('d3inquiry')." WHERE ".$sWhere." ORDER BY oxinquirydate DESC LIMIT 1"; + + return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($sSelect); + } + + /** + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + */ + public function d3getLastInquiry() + { + $this->load($this->d3getLastInquiryId()); + //$this->_d3AddVouchers(); + } + + /** + * @return oxBasket + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + public function getBasket() + { + $oBasket = parent::getBasket(); + + if (false == $oBasket && Registry::getConfig()->getActiveView()->getClassKey() == 'd3dev') { + $oBasket = $this->d3DevGetOrderBasket(); + } + + return $oBasket; + } + + /** + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + protected function _d3AddVouchers() + { + $sSelect = "SELECT oxid FROM oxvouchers WHERE oxorderid = ". DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($this->getId()).";"; + + $aResult = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getAll($sSelect); + + foreach ($aResult as $aFields) { + $oVoucher = oxNew('oxvoucher'); + $oVoucher->load($aFields['oxid']); + $this->_aVoucherList[$oVoucher->getId()] = $oVoucher; + } + } + + /** + * Returns basket object filled up with discount, delivery, wrapping and all other info + * + * @param bool $blStockCheck perform stock check or not (default true) + * + * @return \OxidEsales\Eshop\Application\Model\Basket + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + protected function _getInquiryBasket($blStockCheck = true) + { + /** @var \OxidEsales\Eshop\Application\Model\Basket _oOrderBasket */ + $this->_oOrderBasket = oxNew(\OxidEsales\Eshop\Application\Model\Basket::class); + $this->_oOrderBasket->enableSaveToDataBase(false); + + //setting recalculation mode + $this->_oOrderBasket->setCalculationModeNetto($this->isNettoMode()); + + // setting stock check mode + $this->_oOrderBasket->setStockCheckMode($blStockCheck); + + // setting virtual basket user + $this->_oOrderBasket->setBasketUser($this->getInquiryUser()); + + // transferring order id + $this->_oOrderBasket->setInquiryId($this->getId()); + + // setting basket currency order uses + $aCurrencies = Registry::getConfig()->getCurrencyArray(); + foreach ($aCurrencies as $oCur) { + if ($oCur->name == $this->oxorder__oxcurrency->value) { + $oBasketCur = $oCur; + break; + } + } + + // setting currency + $this->_oOrderBasket->setBasketCurrency($oBasketCur); + + // set basket card id and message + $this->_oOrderBasket->setCardId($this->oxorder__oxcardid->value); + $this->_oOrderBasket->setCardMessage($this->oxorder__oxcardtext->value); + + if ($this->_blReloadDiscount) { + $oDb = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC); + // disabling availability check + $this->_oOrderBasket->setSkipVouchersChecking(true); + + // add previously used vouchers + $sQ = 'select oxid from oxvouchers where oxorderid = ' . $oDb->quote($this->getId()); + $aVouchers = $oDb->getAll($sQ); + foreach ($aVouchers as $aVoucher) { + $this->_oOrderBasket->addVoucher($aVoucher['oxid']); + } + } else { + $this->_oOrderBasket->setDiscountCalcMode(false); + $this->_oOrderBasket->setVoucherDiscount($this->oxorder__oxvoucherdiscount->value); + $this->_oOrderBasket->setTotalDiscount($this->oxorder__oxdiscount->value); + } + + return $this->_oOrderBasket; + } +} diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiryarticle.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiryarticle.php index 4a224db..7254bcd 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiryarticle.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_d3inquiryarticle.php @@ -1,38 +1,38 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_d3inquiryarticle extends d3_dev_d3inquiryarticle_parent -{ - /** - * @return array - */ - public function getCustomerAlsoBoughtThisProducts() - { - $oArticle = $this->getArticle(); - - return $oArticle->getCustomerAlsoBoughtThisProducts(); - } - - /** - * Returns true if ordered product is bundle - * - * @return bool - */ - public function isBundle() - { - return ( bool ) $this->d3inquiryarticles__oxisbundle->value; - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_d3inquiryarticle extends d3_dev_d3inquiryarticle_parent +{ + /** + * @return array + */ + public function getCustomerAlsoBoughtThisProducts() + { + $oArticle = $this->getArticle(); + + return $oArticle->getCustomerAlsoBoughtThisProducts(); + } + + /** + * Returns true if ordered product is bundle + * + * @return bool + */ + public function isBundle() + { + return ( bool ) $this->d3inquiryarticles__oxisbundle->value; + } +} diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasket.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasket.php index c754f3e..c0adcb2 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasket.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasket.php @@ -1,62 +1,62 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_oxbasket extends d3_dev_oxbasket_parent -{ - public function deleteBasket() - { - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value - || false == Registry::getConfig()->getConfigParam('blD3DevAvoidDelBasket') - ) { - parent::deleteBasket(); - } - - // else do nothing; - } - - public function d3ClearBasketItemArticles() - { - /** @var d3_dev_oxbasketitem $oBasketItem */ - foreach ($this->_aBasketContents as $oBasketItem) { - $oBasketItem->d3ClearArticle(); - } - } - - /** - * Calculates total basket discount value. - */ - protected function _calcBasketTotalDiscount() - { - if ($this->_oTotalDiscount === null || (!$this->isAdmin())) { - $this->_oTotalDiscount = $this->_getPriceObject(); - - if (is_array($this->_aDiscounts)) { - foreach ($this->_aDiscounts as $oDiscount) { - // skipping bundle discounts - if ($oDiscount->sType == 'itm') { - continue; - } - - // add discount value to total basket discount - $this->_oTotalDiscount->add($oDiscount->dDiscount); - } - } - } - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_oxbasket extends d3_dev_oxbasket_parent +{ + public function deleteBasket() + { + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value + || false == Registry::getConfig()->getConfigParam('blD3DevAvoidDelBasket') + ) { + parent::deleteBasket(); + } + + // else do nothing; + } + + public function d3ClearBasketItemArticles() + { + /** @var d3_dev_oxbasketitem $oBasketItem */ + foreach ($this->_aBasketContents as $oBasketItem) { + $oBasketItem->d3ClearArticle(); + } + } + + /** + * Calculates total basket discount value. + */ + protected function _calcBasketTotalDiscount() + { + if ($this->_oTotalDiscount === null || (!$this->isAdmin())) { + $this->_oTotalDiscount = $this->_getPriceObject(); + + if (is_array($this->_aDiscounts)) { + foreach ($this->_aDiscounts as $oDiscount) { + // skipping bundle discounts + if ($oDiscount->sType == 'itm') { + continue; + } + + // add discount value to total basket discount + $this->_oTotalDiscount->add($oDiscount->dDiscount); + } + } + } + } +} diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasketitem.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasketitem.php index cec6afd..f81f1b5 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasketitem.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxbasketitem.php @@ -1,41 +1,41 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent -{ - public function d3ClearArticle() - { - $this->_oArticle = null; - } - - /** - * @return string - * @throws \OxidEsales\EshopCommunity\Application\Model\oxArticleException - * @throws \OxidEsales\Eshop\Core\Exception\StandardException - * @throws oxNoArticleException - */ - public function getTitle() - { - $oArticle = $this->getArticle(); - $this->_sTitle = $oArticle->oxarticles__oxtitle->value; - - if ($oArticle->oxarticles__oxvarselect->value) { - $this->_sTitle = $this->_sTitle . ', ' . $this->getVarSelect(); - } - - return $this->_sTitle; - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent +{ + public function d3ClearArticle() + { + $this->_oArticle = null; + } + + /** + * @return string + * @throws \OxidEsales\EshopCommunity\Application\Model\oxArticleException + * @throws \OxidEsales\Eshop\Core\Exception\StandardException + * @throws oxNoArticleException + */ + public function getTitle() + { + $oArticle = $this->getArticle(); + $this->_sTitle = $oArticle->oxarticles__oxtitle->value; + + if ($oArticle->oxarticles__oxvarselect->value) { + $this->_sTitle = $this->_sTitle . ', ' . $this->getVarSelect(); + } + + return $this->_sTitle; + } +} diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxemail.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxemail.php index 8622853..1b39138 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxemail.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxemail.php @@ -1,243 +1,243 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_oxemail extends d3_dev_oxemail_parent -{ - /** - * @param d3_dev_oxorder $oOrder - * - * @param $sType - * - * @return mixed|string - */ - public function d3GetOrderMailContent($oOrder, $sType) - { - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { - return ''; - } - - switch (strtolower($sType)) { - case 'owner_html': - $sTpl = $this->_sOrderOwnerTemplate; - break; - case 'owner_plain': - $sTpl = $this->_sOrderOwnerPlainTemplate; - break; - case 'user_plain': - $sTpl = $this->_sOrderUserPlainTemplate; - break; - case 'user_html': - default: - $sTpl = $this->_sOrderUserTemplate; - } - - $myConfig = $this->getConfig(); - - $oShop = $this->_getShop(); - - // cleanup - $this->_clearMailer(); - - // add user defined stuff if there is any - $oOrder = $this->_addUserInfoOrderEMail($oOrder); - - $oUser = $oOrder->getOrderUser(); - $this->setUser($oUser); - - // send confirmation to shop owner - // send not pretending from order user, as different email domain rise spam filters - $this->setFrom($oShop->oxshops__oxowneremail->value); - - $oLang = Registry::getLang(); - $iOrderLang = $oLang->getObjectTplLanguage(); - - // if running shop language is different from admin lang. set in config - // we have to load shop in config language - if ($oShop->getLanguage() != $iOrderLang) { - $oShop = $this->_getShop($iOrderLang); - } - - $this->setSmtp($oShop); - - // create messages - /** @var Smarty $oSmarty */ - $oSmarty = $this->_getSmarty(); - $this->setViewData("order", $oOrder); - - // Process view data array through oxoutput processor - $this->_processViewArray(); - - return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false)); - } - - /** - * @param d3_dev_d3inquiry $oInquiry - * - * @param $sType - * - * @return mixed|string - */ - public function d3GetInquiryMailContent($oInquiry, $sType) - { - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { - return ''; - } - - switch (strtolower($sType)) { - case 'owner_html': - $sTpl = $this->_sInquiryOwnerTemplate; - break; - case 'owner_plain': - $sTpl = $this->_sInquiryOwnerPlainTemplate; - break; - case 'user_plain': - $sTpl = $this->_sInquiryUserPlainTemplate; - break; - case 'user_html': - default: - $sTpl = $this->_sInquiryUserTemplate; - } - - $myConfig = $this->getConfig(); - - $oShop = $this->_getShop(); - - // cleanup - $this->_clearMailer(); - - // add user defined stuff if there is any - $oInquiry = $this->_addUserInfoOrderEMail($oInquiry); - - $oUser = $oInquiry->getInquiryUser(); - $this->setUser($oUser); - - // send confirmation to shop owner - // send not pretending from order user, as different email domain rise spam filters - $this->setFrom($oShop->oxshops__oxowneremail->value); - - $oLang = Registry::getLang(); - $iOrderLang = $oLang->getObjectTplLanguage(); - - // if running shop language is different from admin lang. set in config - // we have to load shop in config language - if ($oShop->getLanguage() != $iOrderLang) { - $oShop = $this->_getShop($iOrderLang); - } - - $this->setSmtp($oShop); - - // create messages - /** @var Smarty $oSmarty */ - $oSmarty = $this->_getSmarty(); - $this->setViewData("inquiry", $oInquiry); - - // Process view data array through oxoutput processor - $this->_processViewArray(); - - return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false)); - } - - protected function _sendMail() - { - if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { - return parent::_sendMail(); - } - - $this->d3clearRecipients(); - $this->d3clearCC(); - $this->d3clearBCC(); - - if (count($this->getRecipient())) { - return parent::_sendMail(); - } - - return true; - } - - public function d3clearRecipients() - { - $aRecipients = array(); - if (is_array($this->_aRecipients) && count($this->_aRecipients)) { - foreach ($this->_aRecipients as $aRecInfo) { - if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0])) - && $sNewRecipient != $aRecInfo[0] - ) { - $aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")"; - $aRecInfo[0] = $sNewRecipient; - $aRecipients[] = $aRecInfo; - } elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) { - $aRecipients[] = $aRecInfo; - } - } - } - - $this->_aRecipients = $aRecipients; - } - - public function d3clearCC() - { - $aCc = array(); - if (is_array($this->cc) && count($this->cc)) { - foreach ($this->cc as $aRecInfo) { - if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0])) - && $sNewRecipient != $aRecInfo[0] - ) { - $aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")"; - $aRecInfo[0] = $sNewRecipient; - $aCc[] = $aRecInfo; - } elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) { - $aCc[] = $aRecInfo; - } - } - } - - $this->cc = $aCc; - } - - public function d3clearBCC() - { - $aCc = array(); - if (is_array($this->bcc) && count($this->bcc)) { - foreach ($this->bcc as $aRecInfo) { - if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0])) - && $sNewRecipient != $aRecInfo[0] - ) { - $aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")"; - $aRecInfo[0] = $sNewRecipient; - $aCc[] = $aRecInfo; - } elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) { - $aCc[] = $aRecInfo; - } - } - } - - $this->bcc = $aCc; - } - - public function getNewRecipient($sMailAddress) - { - if (Registry::getConfig()->getConfigParam('blD3DevBlockMails')) { - return false; - } elseif (Registry::getConfig()->getConfigParam('sD3DevRedirectMail')) { - return trim(Registry::getConfig()->getConfigParam('sD3DevRedirectMail')); - } - - return $sMailAddress; - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_oxemail extends d3_dev_oxemail_parent +{ + /** + * @param d3_dev_oxorder $oOrder + * + * @param $sType + * + * @return mixed|string + */ + public function d3GetOrderMailContent($oOrder, $sType) + { + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { + return ''; + } + + switch (strtolower($sType)) { + case 'owner_html': + $sTpl = $this->_sOrderOwnerTemplate; + break; + case 'owner_plain': + $sTpl = $this->_sOrderOwnerPlainTemplate; + break; + case 'user_plain': + $sTpl = $this->_sOrderUserPlainTemplate; + break; + case 'user_html': + default: + $sTpl = $this->_sOrderUserTemplate; + } + + $myConfig = $this->getConfig(); + + $oShop = $this->_getShop(); + + // cleanup + $this->_clearMailer(); + + // add user defined stuff if there is any + $oOrder = $this->_addUserInfoOrderEMail($oOrder); + + $oUser = $oOrder->getOrderUser(); + $this->setUser($oUser); + + // send confirmation to shop owner + // send not pretending from order user, as different email domain rise spam filters + $this->setFrom($oShop->oxshops__oxowneremail->value); + + $oLang = Registry::getLang(); + $iOrderLang = $oLang->getObjectTplLanguage(); + + // if running shop language is different from admin lang. set in config + // we have to load shop in config language + if ($oShop->getLanguage() != $iOrderLang) { + $oShop = $this->_getShop($iOrderLang); + } + + $this->setSmtp($oShop); + + // create messages + /** @var Smarty $oSmarty */ + $oSmarty = $this->_getSmarty(); + $this->setViewData("order", $oOrder); + + // Process view data array through oxoutput processor + $this->_processViewArray(); + + return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false)); + } + + /** + * @param d3_dev_d3inquiry $oInquiry + * + * @param $sType + * + * @return mixed|string + */ + public function d3GetInquiryMailContent($oInquiry, $sType) + { + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { + return ''; + } + + switch (strtolower($sType)) { + case 'owner_html': + $sTpl = $this->_sInquiryOwnerTemplate; + break; + case 'owner_plain': + $sTpl = $this->_sInquiryOwnerPlainTemplate; + break; + case 'user_plain': + $sTpl = $this->_sInquiryUserPlainTemplate; + break; + case 'user_html': + default: + $sTpl = $this->_sInquiryUserTemplate; + } + + $myConfig = $this->getConfig(); + + $oShop = $this->_getShop(); + + // cleanup + $this->_clearMailer(); + + // add user defined stuff if there is any + $oInquiry = $this->_addUserInfoOrderEMail($oInquiry); + + $oUser = $oInquiry->getInquiryUser(); + $this->setUser($oUser); + + // send confirmation to shop owner + // send not pretending from order user, as different email domain rise spam filters + $this->setFrom($oShop->oxshops__oxowneremail->value); + + $oLang = Registry::getLang(); + $iOrderLang = $oLang->getObjectTplLanguage(); + + // if running shop language is different from admin lang. set in config + // we have to load shop in config language + if ($oShop->getLanguage() != $iOrderLang) { + $oShop = $this->_getShop($iOrderLang); + } + + $this->setSmtp($oShop); + + // create messages + /** @var Smarty $oSmarty */ + $oSmarty = $this->_getSmarty(); + $this->setViewData("inquiry", $oInquiry); + + // Process view data array through oxoutput processor + $this->_processViewArray(); + + return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false)); + } + + protected function _sendMail() + { + if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value) { + return parent::_sendMail(); + } + + $this->d3clearRecipients(); + $this->d3clearCC(); + $this->d3clearBCC(); + + if (count($this->getRecipient())) { + return parent::_sendMail(); + } + + return true; + } + + public function d3clearRecipients() + { + $aRecipients = array(); + if (is_array($this->_aRecipients) && count($this->_aRecipients)) { + foreach ($this->_aRecipients as $aRecInfo) { + if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0])) + && $sNewRecipient != $aRecInfo[0] + ) { + $aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")"; + $aRecInfo[0] = $sNewRecipient; + $aRecipients[] = $aRecInfo; + } elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) { + $aRecipients[] = $aRecInfo; + } + } + } + + $this->_aRecipients = $aRecipients; + } + + public function d3clearCC() + { + $aCc = array(); + if (is_array($this->cc) && count($this->cc)) { + foreach ($this->cc as $aRecInfo) { + if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0])) + && $sNewRecipient != $aRecInfo[0] + ) { + $aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")"; + $aRecInfo[0] = $sNewRecipient; + $aCc[] = $aRecInfo; + } elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) { + $aCc[] = $aRecInfo; + } + } + } + + $this->cc = $aCc; + } + + public function d3clearBCC() + { + $aCc = array(); + if (is_array($this->bcc) && count($this->bcc)) { + foreach ($this->bcc as $aRecInfo) { + if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0])) + && $sNewRecipient != $aRecInfo[0] + ) { + $aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")"; + $aRecInfo[0] = $sNewRecipient; + $aCc[] = $aRecInfo; + } elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) { + $aCc[] = $aRecInfo; + } + } + } + + $this->bcc = $aCc; + } + + public function getNewRecipient($sMailAddress) + { + if (Registry::getConfig()->getConfigParam('blD3DevBlockMails')) { + return false; + } elseif (Registry::getConfig()->getConfigParam('sD3DevRedirectMail')) { + return trim(Registry::getConfig()->getConfigParam('sD3DevRedirectMail')); + } + + return $sMailAddress; + } +} diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php index 5a17af7..e774614 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php @@ -1,109 +1,109 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_oxorder extends d3_dev_oxorder_parent -{ - /** - * @return d3_dev_oxbasket - */ - public function d3DevGetOrderBasket() - { - /** @var d3_dev_oxbasket $oBasket */ - $oBasket = $this->_getOrderBasket(); - - // unsetting bundles - /** @var \OxidEsales\Eshop\Core\Model\ListModel $oOrderArticles */ - $oOrderArticles = $this->getOrderArticles(); - foreach ($oOrderArticles as $sItemId => $oItem) { - /** @var $oItem \OxidEsales\Eshop\Application\Model\OrderArticle */ - if ($oItem->isBundle()) { - $oOrderArticles->offsetUnset($sItemId); - } - } - - // add this order articles to basket and recalculate basket - $this->_addOrderArticlesToBasket($oBasket, $oOrderArticles); - // recalculating basket - $oBasket->calculateBasket(true); - $oBasket->d3ClearBasketItemArticles(); - - $this->_oPayment = $this->_setPayment($oBasket->getPaymentId()); - - return $oBasket; - } - - /** - * @return string - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - */ - public function d3getLastOrderId() - { - $orderNr = (int) oxNew(\OxidEsales\Eshop\Core\Request::class)->getRequestParameter('d3ordernr'); - $sWhere = 1; - if ($orderNr) { - $sWhere = ' oxordernr = ' . $orderNr; - } - - $sSelect = "SELECT oxid FROM ".getViewName('oxorder')." WHERE ".$sWhere." ORDER BY oxorderdate DESC LIMIT 1"; - - return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($sSelect); - } - - /** - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - public function d3getLastOrder() - { - $this->load($this->d3getLastOrderId()); - $this->_d3AddVouchers(); - } - - /** - * @return d3_dev_oxbasket|\OxidEsales\Eshop\Application\Model\Basket - */ - public function getBasket() - { - $oBasket = parent::getBasket(); - - if (false == $oBasket && Registry::getConfig()->getActiveView()->getClassKey() == 'd3dev') { - $oBasket = $this->d3DevGetOrderBasket(); - } - - return $oBasket; - } - - /** - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException - * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException - */ - protected function _d3AddVouchers() - { - $sSelect = "SELECT oxid FROM oxvouchers WHERE oxorderid = ".DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($this->getId()).";"; - - $aResult = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getAll($sSelect); - - foreach ($aResult as $aFields) { - $oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class); - $oVoucher->load($aFields['oxid']); - $this->_aVoucherList[$oVoucher->getId()] = $oVoucher; - } - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_oxorder extends d3_dev_oxorder_parent +{ + /** + * @return d3_dev_oxbasket + */ + public function d3DevGetOrderBasket() + { + /** @var d3_dev_oxbasket $oBasket */ + $oBasket = $this->_getOrderBasket(); + + // unsetting bundles + /** @var \OxidEsales\Eshop\Core\Model\ListModel $oOrderArticles */ + $oOrderArticles = $this->getOrderArticles(); + foreach ($oOrderArticles as $sItemId => $oItem) { + /** @var $oItem \OxidEsales\Eshop\Application\Model\OrderArticle */ + if ($oItem->isBundle()) { + $oOrderArticles->offsetUnset($sItemId); + } + } + + // add this order articles to basket and recalculate basket + $this->_addOrderArticlesToBasket($oBasket, $oOrderArticles); + // recalculating basket + $oBasket->calculateBasket(true); + $oBasket->d3ClearBasketItemArticles(); + + $this->_oPayment = $this->_setPayment($oBasket->getPaymentId()); + + return $oBasket; + } + + /** + * @return string + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + */ + public function d3getLastOrderId() + { + $orderNr = (int) oxNew(\OxidEsales\Eshop\Core\Request::class)->getRequestParameter('d3ordernr'); + $sWhere = 1; + if ($orderNr) { + $sWhere = ' oxordernr = ' . $orderNr; + } + + $sSelect = "SELECT oxid FROM ".getViewName('oxorder')." WHERE ".$sWhere." ORDER BY oxorderdate DESC LIMIT 1"; + + return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($sSelect); + } + + /** + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + public function d3getLastOrder() + { + $this->load($this->d3getLastOrderId()); + $this->_d3AddVouchers(); + } + + /** + * @return d3_dev_oxbasket|\OxidEsales\Eshop\Application\Model\Basket + */ + public function getBasket() + { + $oBasket = parent::getBasket(); + + if (false == $oBasket && Registry::getConfig()->getActiveView()->getClassKey() == 'd3dev') { + $oBasket = $this->d3DevGetOrderBasket(); + } + + return $oBasket; + } + + /** + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException + * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException + */ + protected function _d3AddVouchers() + { + $sSelect = "SELECT oxid FROM oxvouchers WHERE oxorderid = ".DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($this->getId()).";"; + + $aResult = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getAll($sSelect); + + foreach ($aResult as $aFields) { + $oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class); + $oVoucher->load($aFields['oxid']); + $this->_aVoucherList[$oVoucher->getId()] = $oVoucher; + } + } +} diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorderarticle.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorderarticle.php index bfd0b49..81f2fdc 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorderarticle.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorderarticle.php @@ -1,28 +1,28 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_dev_oxorderarticle extends d3_dev_oxorderarticle_parent -{ - /** - * @return null|\OxidEsales\EshopCommunity\Application\Model\ArticleList - */ - public function getCustomerAlsoBoughtThisProducts() - { - $oArticle = $this->getArticle(); - - return $oArticle->getCustomerAlsoBoughtThisProducts(); - } -} + + * @link http://www.oxidmodule.com + */ + +class d3_dev_oxorderarticle extends d3_dev_oxorderarticle_parent +{ + /** + * @return null|\OxidEsales\EshopCommunity\Application\Model\ArticleList + */ + public function getCustomerAlsoBoughtThisProducts() + { + $oArticle = $this->getArticle(); + + return $oArticle->getCustomerAlsoBoughtThisProducts(); + } +}