Merge remote-tracking branch 'remotes/origin/rel_2.x'
This commit is contained in:
commit
687e2bbee0
|
@ -40,7 +40,12 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
|
||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
Registry::getSession()->setVariable('sess_challenge', $sSessChallenge);
|
if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev")
|
||||||
|
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
|
||||||
|
&& Registry::getConfig()->getConfigParam('blD3DevAvoidDelBasket')
|
||||||
|
) {
|
||||||
|
Registry::getSession()->setVariable( 'sess_challenge', $sSessChallenge );
|
||||||
|
}
|
||||||
|
|
||||||
if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev")
|
if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev")
|
||||||
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
|
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
|
||||||
|
@ -96,6 +101,27 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool|d3_dev_oxorder|\oxOrder
|
||||||
|
* @throws DatabaseConnectionException
|
||||||
|
* @throws DatabaseErrorException
|
||||||
|
*/
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
$oOrder = parent::getOrder();
|
||||||
|
|
||||||
|
if ((false == $oOrder || !$oOrder->getFieldData('oxordernr'))
|
||||||
|
&& Registry::get(Request::class)->getRequestEscapedParameter("d3dev")
|
||||||
|
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
|
||||||
|
&& Registry::getConfig()->getConfigParam('blD3DevShowThankyou')
|
||||||
|
) {
|
||||||
|
$this->_oOrder = $this->d3GetLastOrder();
|
||||||
|
$oOrder = $this->_oOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $oOrder;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool|d3_dev_oxorder
|
* @return bool|d3_dev_oxorder
|
||||||
* @throws DatabaseConnectionException
|
* @throws DatabaseConnectionException
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace D3\Devhelper\Modules\Application\Model;
|
|
||||||
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Software is the property of Data Development and is protected
|
* This Software is the property of Data Development and is protected
|
||||||
* by copyright law - it is NOT Freeware.
|
* by copyright law - it is NOT Freeware.
|
||||||
|
@ -19,6 +15,12 @@ use OxidEsales\Eshop\Core\Registry;
|
||||||
* @link http://www.oxidmodule.com
|
* @link http://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace D3\Devhelper\Modules\Application\Model;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Application\Model\BasketItem;
|
||||||
|
use OxidEsales\Eshop\Application\Model\OrderArticle;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
class d3_dev_oxbasket extends d3_dev_oxbasket_parent
|
class d3_dev_oxbasket extends d3_dev_oxbasket_parent
|
||||||
{
|
{
|
||||||
public function deleteBasket()
|
public function deleteBasket()
|
||||||
|
@ -61,4 +63,37 @@ class d3_dev_oxbasket extends d3_dev_oxbasket_parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param OrderArticle $oOrderArticle
|
||||||
|
*
|
||||||
|
* @return |null
|
||||||
|
* @throws \oxArticleInputException
|
||||||
|
* @throws \oxNoArticleException
|
||||||
|
*/
|
||||||
|
public function d3addOrderArticleToBasket($oOrderArticle)
|
||||||
|
{
|
||||||
|
// adding only if amount > 0
|
||||||
|
if ($oOrderArticle->oxorderarticles__oxamount->value > 0) {
|
||||||
|
$this->_isForOrderRecalculation = true;
|
||||||
|
$sItemId = $oOrderArticle->getId();
|
||||||
|
|
||||||
|
//inserting new
|
||||||
|
/** @var d3_dev_oxbasketitem $oBasketItem */
|
||||||
|
$oBasketItem = oxNew( BasketItem::class);
|
||||||
|
$oBasketItem->initFromOrderArticle($oOrderArticle);
|
||||||
|
$oBasketItem->d3ConvertToArticleObject();
|
||||||
|
$oBasketItem->setWrapping($oOrderArticle->oxorderarticles__oxwrapid->value);
|
||||||
|
$oBasketItem->setBundle($oOrderArticle->isBundle());
|
||||||
|
|
||||||
|
$this->_aBasketContents[$sItemId] = $oBasketItem;
|
||||||
|
|
||||||
|
//calling update method
|
||||||
|
$this->onUpdate();
|
||||||
|
|
||||||
|
return $this->_aBasketContents[$sItemId];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,12 @@
|
||||||
|
|
||||||
namespace D3\Devhelper\Modules\Application\Model;
|
namespace D3\Devhelper\Modules\Application\Model;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Application\Model\Article;
|
||||||
|
use OxidEsales\Eshop\Application\Model\OrderArticle;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\ArticleException;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\ArticleInputException;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\NoArticleException;
|
||||||
|
|
||||||
class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
|
class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
|
||||||
{
|
{
|
||||||
public function d3ClearArticle()
|
public function d3ClearArticle()
|
||||||
|
@ -25,9 +31,9 @@ class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \OxidEsales\Eshop\Core\Exception\ArticleException
|
* @throws ArticleException
|
||||||
* @throws \OxidEsales\Eshop\Core\Exception\ArticleInputException
|
* @throws ArticleInputException
|
||||||
* @throws \OxidEsales\Eshop\Core\Exception\NoArticleException
|
* @throws NoArticleException
|
||||||
*/
|
*/
|
||||||
public function getTitle()
|
public function getTitle()
|
||||||
{
|
{
|
||||||
|
@ -40,4 +46,19 @@ class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
|
||||||
|
|
||||||
return $this->_sTitle;
|
return $this->_sTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \oxArticleInputException
|
||||||
|
* @throws \oxNoArticleException
|
||||||
|
*/
|
||||||
|
public function d3ConvertToArticleObject()
|
||||||
|
{
|
||||||
|
$oEmbeddedArticle = $this->getArticle();
|
||||||
|
|
||||||
|
if ($oEmbeddedArticle instanceof OrderArticle) {
|
||||||
|
$oArticle = oxNew(Article::class);
|
||||||
|
$oArticle->load($oEmbeddedArticle->getFieldData('oxartid'));
|
||||||
|
$this->_oArticle = $oArticle;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace D3\Devhelper\Modules\Application\Model;
|
|
||||||
|
|
||||||
use OxidEsales\Eshop\Application\Model\OrderArticle;
|
|
||||||
use OxidEsales\Eshop\Application\Model\Voucher;
|
|
||||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
|
||||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
|
||||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
|
||||||
use OxidEsales\Eshop\Core\Model\ListModel;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
use OxidEsales\Eshop\Core\Request;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Software is the property of Data Development and is protected
|
* This Software is the property of Data Development and is protected
|
||||||
* by copyright law - it is NOT Freeware.
|
* by copyright law - it is NOT Freeware.
|
||||||
|
@ -26,6 +15,16 @@ use OxidEsales\Eshop\Core\Request;
|
||||||
* @link http://www.oxidmodule.com
|
* @link http://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace D3\Devhelper\Modules\Application\Model;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Application\Model\Voucher;
|
||||||
|
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||||
|
use OxidEsales\Eshop\Core\Model\ListModel;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use OxidEsales\Eshop\Core\Request;
|
||||||
|
|
||||||
class d3_dev_oxorder extends d3_dev_oxorder_parent
|
class d3_dev_oxorder extends d3_dev_oxorder_parent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -36,18 +35,9 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
|
||||||
/** @var d3_dev_oxbasket $oBasket */
|
/** @var d3_dev_oxbasket $oBasket */
|
||||||
$oBasket = $this->_getOrderBasket();
|
$oBasket = $this->_getOrderBasket();
|
||||||
|
|
||||||
// unsetting bundles
|
|
||||||
/** @var ListModel $oOrderArticles */
|
|
||||||
$oOrderArticles = $this->getOrderArticles();
|
|
||||||
foreach ($oOrderArticles as $sItemId => $oItem) {
|
|
||||||
/** @var $oItem OrderArticle */
|
|
||||||
if ($oItem->isBundle()) {
|
|
||||||
$oOrderArticles->offsetUnset($sItemId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add this order articles to basket and recalculate basket
|
// add this order articles to basket and recalculate basket
|
||||||
$this->_addOrderArticlesToBasket($oBasket, $oOrderArticles);
|
$this->_d3AddOrderArticlesToBasket($oBasket, $this->getOrderArticles());
|
||||||
|
|
||||||
// recalculating basket
|
// recalculating basket
|
||||||
$oBasket->calculateBasket(true);
|
$oBasket->calculateBasket(true);
|
||||||
$oBasket->d3ClearBasketItemArticles();
|
$oBasket->d3ClearBasketItemArticles();
|
||||||
|
@ -66,7 +56,7 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
|
||||||
$orderNr = (int) Registry::get(Request::class)->getRequestEscapedParameter('d3ordernr');
|
$orderNr = (int) Registry::get(Request::class)->getRequestEscapedParameter('d3ordernr');
|
||||||
$sWhere = 1;
|
$sWhere = 1;
|
||||||
if ($orderNr) {
|
if ($orderNr) {
|
||||||
$sWhere = ' oxordernr = ' . $orderNr;
|
$sWhere = ' oxordernr = ' . DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($orderNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sSelect = "SELECT oxid FROM ".getViewName('oxorder')." WHERE ".$sWhere." ORDER BY oxorderdate DESC LIMIT 1";
|
$sSelect = "SELECT oxid FROM ".getViewName('oxorder')." WHERE ".$sWhere." ORDER BY oxorderdate DESC LIMIT 1";
|
||||||
|
@ -114,4 +104,21 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
|
||||||
$this->_aVoucherList[$oVoucher->getId()] = $oVoucher;
|
$this->_aVoucherList[$oVoucher->getId()] = $oVoucher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds order articles back to virtual basket. Needed for recalculating order.
|
||||||
|
*
|
||||||
|
* @param d3_dev_oxbasket $oBasket basket object
|
||||||
|
* @param ListModel $aOrderArticles order articles
|
||||||
|
*/
|
||||||
|
protected function _d3AddOrderArticlesToBasket($oBasket, $aOrderArticles)
|
||||||
|
{
|
||||||
|
// if no order articles, return empty basket
|
||||||
|
if (count($aOrderArticles) > 0) {
|
||||||
|
//adding order articles to basket
|
||||||
|
foreach ($aOrderArticles as $oOrderArticle) {
|
||||||
|
$oBasket->d3addOrderArticleToBasket($oOrderArticle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace D3\Devhelper\Modules\Core;
|
|
||||||
|
|
||||||
use D3\Devhelper\Modules\Application\Model as ModuleModel;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Software is the property of Data Development and is protected
|
* This Software is the property of Data Development and is protected
|
||||||
* by copyright law - it is NOT Freeware.
|
* by copyright law - it is NOT Freeware.
|
||||||
|
@ -20,6 +15,12 @@ use OxidEsales\Eshop\Core\Registry;
|
||||||
* @link http://www.oxidmodule.com
|
* @link http://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace D3\Devhelper\Modules\Core;
|
||||||
|
|
||||||
|
use D3\Devhelper\Modules\Application\Model as ModuleModel;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
class d3_dev_oxemail extends d3_dev_oxemail_parent
|
class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -94,7 +95,7 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
public function d3GetInquiryMailContent($oInquiry, $sType)
|
public function d3GetInquiryMailContent($oInquiry, $sType )
|
||||||
{
|
{
|
||||||
if (Registry::getConfig()->getActiveShop()->isProductiveMode()) {
|
if (Registry::getConfig()->getActiveShop()->isProductiveMode()) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -154,6 +155,10 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||||
return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false));
|
return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
* @throws StandardException
|
||||||
|
*/
|
||||||
protected function _sendMail()
|
protected function _sendMail()
|
||||||
{
|
{
|
||||||
if (Registry::getConfig()->getActiveShop()->isProductiveMode()) {
|
if (Registry::getConfig()->getActiveShop()->isProductiveMode()) {
|
||||||
|
@ -161,6 +166,8 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->d3clearRecipients();
|
$this->d3clearRecipients();
|
||||||
|
$this->d3clearReplies();
|
||||||
|
$this->d3clearReplyTo();
|
||||||
$this->d3clearCC();
|
$this->d3clearCC();
|
||||||
$this->d3clearBCC();
|
$this->d3clearBCC();
|
||||||
|
|
||||||
|
@ -190,6 +197,44 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||||
$this->_aRecipients = $aRecipients;
|
$this->_aRecipients = $aRecipients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function d3clearReplies()
|
||||||
|
{
|
||||||
|
$aRecipients = array();
|
||||||
|
if (is_array($this->_aReplies) && count($this->_aReplies)) {
|
||||||
|
foreach ($this->_aReplies 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->_aReplies = $aRecipients;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function d3clearReplyTo()
|
||||||
|
{
|
||||||
|
$aRecipients = array();
|
||||||
|
if (is_array($this->ReplyTo) && count($this->ReplyTo)) {
|
||||||
|
foreach ($this->ReplyTo 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->ReplyTo = $aRecipients;
|
||||||
|
}
|
||||||
|
|
||||||
public function d3clearCC()
|
public function d3clearCC()
|
||||||
{
|
{
|
||||||
$aCc = array();
|
$aCc = array();
|
||||||
|
@ -230,6 +275,11 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||||
$this->bcc = $aCc;
|
$this->bcc = $aCc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $sMailAddress
|
||||||
|
*
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
public function getNewRecipient($sMailAddress)
|
public function getNewRecipient($sMailAddress)
|
||||||
{
|
{
|
||||||
if (Registry::getConfig()->getConfigParam('blD3DevBlockMails')) {
|
if (Registry::getConfig()->getConfigParam('blD3DevBlockMails')) {
|
||||||
|
|
Loading…
Reference in New Issue