changed CRLF to LF

changed case to UTF-8
This commit is contained in:
kristianhempel 2018-01-25 11:30:17 +01:00
parent 1187854c86
commit 7d9c9a9837
10 changed files with 999 additions and 999 deletions

View File

@ -1,52 +1,52 @@
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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 {}
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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 {}

View File

@ -1,122 +1,122 @@
<?php
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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();
}
}
<?php
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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();
}
}

View File

@ -1,131 +1,131 @@
<?php
// .../?cl=thankyou[&d3orderid=23]
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}
<?php
// .../?cl=thankyou[&d3orderid=23]
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}

View File

@ -1,173 +1,173 @@
<?php
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}
<?php
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}

View File

@ -1,38 +1,38 @@
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}

View File

@ -1,62 +1,62 @@
<?php
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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);
}
}
}
}
}
<?php
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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);
}
}
}
}
}

View File

@ -1,41 +1,41 @@
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}

View File

@ -1,243 +1,243 @@
<?php
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}
<?php
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}

View File

@ -1,109 +1,109 @@
<?php
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}
}
<?php
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
/**
* 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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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;
}
}
}

View File

@ -1,28 +1,28 @@
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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();
}
}
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @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();
}
}