initial
This commit is contained in:
parent
7219eead2d
commit
8ecd117132
@ -13,8 +13,11 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\Linkmobility4Ordermanager\Application\Model;
|
namespace D3\Linkmobility4Ordermanager\Application\Model\Actions;
|
||||||
|
|
||||||
|
use D3\Linkmobility4Ordermanager\Application\Model\d3linkmobility_ordermanager_sender;
|
||||||
|
use D3\Linkmobility4Ordermanager\Application\Model\Exceptions\emptyMesageException;
|
||||||
|
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
|
||||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||||
use D3\Ordermanager\Application\Model\Actions\d3ordermanager_action_abstract;
|
use D3\Ordermanager\Application\Model\Actions\d3ordermanager_action_abstract;
|
||||||
@ -25,6 +28,8 @@ use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
|||||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||||
use OxidEsales\Eshop\Core\Exception\DatabaseException;
|
use OxidEsales\Eshop\Core\Exception\DatabaseException;
|
||||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||||
|
use OxidEsales\Eshop\Core\Language;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||||
{
|
{
|
||||||
@ -56,8 +61,11 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
|||||||
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDSOURCE';
|
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDSOURCE';
|
||||||
} elseif ($this->hasRequiredValuesTplSource(false)) {
|
} elseif ($this->hasRequiredValuesTplSource(false)) {
|
||||||
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDTPL';
|
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDTPL';
|
||||||
} else {
|
} elseif ($this->hasRequiredValuesCmsSource(false)) {
|
||||||
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDCMS';
|
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDCMS';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return 'foo';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,21 +82,18 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
|||||||
if (false == $this->isExecutable()) {
|
if (false == $this->isExecutable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->throwUnvalidConfigurationException();
|
$this->throwUnvalidConfigurationException();
|
||||||
|
|
||||||
startProfile(__METHOD__);
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
/** @var Language $oLang */
|
/** @var Language $oLang */
|
||||||
$oLang = d3GetModCfgDIC()->get('d3ox.ordermanager.'.Language::class);
|
$oLang = oxNew(Language::class);
|
||||||
|
|
||||||
$this->getManager()->getRemarkHandler()->addNote(
|
$this->getManager()->getRemarkHandler()->addNote(
|
||||||
sprintf(
|
sprintf(
|
||||||
$oLang->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE', null, true),
|
$oLang->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE', null, true),
|
||||||
$this->getRecipientDescription()
|
$this->getRecipientDescription()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->startExecution();
|
$this->startExecution();
|
||||||
|
|
||||||
stopProfile(__METHOD__);
|
stopProfile(__METHOD__);
|
||||||
@ -115,6 +120,33 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
|||||||
return implode(', ', $aMailDesc);
|
return implode(', ', $aMailDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasRequiredValues(): bool
|
||||||
|
{
|
||||||
|
return $this->hasRequiredValuesNoSource(true) &&
|
||||||
|
(
|
||||||
|
$this->hasRequiredValuesTplSource(true) ||
|
||||||
|
$this->hasRequiredValuesCmsSource(true)
|
||||||
|
) && $this->hasRequiredValuesRecipient();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $blExpected
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function hasRequiredValuesNoSource(bool $blExpected): bool
|
||||||
|
{
|
||||||
|
$source = (string) $this->getManager()->getValue( 'sLinkMobilityMessageFromSource' );
|
||||||
|
|
||||||
|
$return = strlen(trim($source)) &&
|
||||||
|
in_array(trim($source), [self::SOURCE_CMS, self::SOURCE_TEMPLATE]);
|
||||||
|
|
||||||
|
return $blExpected ? $return : false === $return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $blExpected
|
* @param bool $blExpected
|
||||||
*
|
*
|
||||||
@ -166,6 +198,21 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function hasRequiredValuesRecipient(): bool
|
||||||
|
{
|
||||||
|
$toCust = (bool) $this->getManager()->getValue( 'blLinkMobilityMessageToCustomer' );
|
||||||
|
$toCustom = (bool) $this->getManager()->getValue( 'blLinkMobilityMessageToCustom' );
|
||||||
|
$toCustomAddress = (string) $this->getManager()->getValue( 'sLinkMobilityMessageToCustomAddress' );
|
||||||
|
|
||||||
|
return $toCust || (
|
||||||
|
$toCustom &&
|
||||||
|
(bool) strlen( trim( $toCustomAddress ) )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws DBALException
|
* @throws DBALException
|
||||||
@ -188,15 +235,26 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
|||||||
*/
|
*/
|
||||||
public function startExecution()
|
public function startExecution()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
if ($this->canExecuteMethod() && $this->hasRequiredValues()) {
|
if ($this->canExecuteMethod() && $this->hasRequiredValues()) {
|
||||||
|
dumpvar(__METHOD__ . __LINE__ . PHP_EOL);
|
||||||
$this->getSendClass()->sendOrderManagerSms($this->getManager(), $this->getItem());
|
$this->getSendClass()->sendOrderManagerSms($this->getManager(), $this->getItem());
|
||||||
}
|
}
|
||||||
|
} catch (emptyMesageException $e) {
|
||||||
|
Registry::getLogger()->error($e->getMessage());
|
||||||
|
} catch (noRecipientFoundException $e) {
|
||||||
|
Registry::getLogger()->info(
|
||||||
|
$this->getManager()->getFieldData('oxtitle')." => ".
|
||||||
|
$this->getItem()->getFieldData('oxordernr').": ".
|
||||||
|
$e->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return d3linkmobility_ordermanager_sender
|
* @return d3linkmobility_ordermanager_sender
|
||||||
*/
|
*/
|
||||||
public function getSendClass()
|
public function getSendClass(): d3linkmobility_ordermanager_sender
|
||||||
{
|
{
|
||||||
/** @var d3linkmobility_ordermanager_sender $mailer */
|
/** @var d3linkmobility_ordermanager_sender $mailer */
|
||||||
$sender = oxNew(d3linkmobility_ordermanager_sender::class);
|
$sender = oxNew(d3linkmobility_ordermanager_sender::class);
|
27
src/Application/Model/Exceptions/emptyMesageException.php
Normal file
27
src/Application/Model/Exceptions/emptyMesageException.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* https://www.d3data.de
|
||||||
|
*
|
||||||
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
|
* @link https://www.oxidmodule.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace D3\Linkmobility4Ordermanager\Application\Model\Exceptions;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||||
|
|
||||||
|
class emptyMesageException extends StandardException
|
||||||
|
{
|
||||||
|
public function __construct($sMessage = "not set", $iCode = 0, \Exception $previous = null)
|
||||||
|
{
|
||||||
|
$sMessage = 'empty message content in task '.$sMessage;
|
||||||
|
parent::__construct($sMessage, $iCode, $previous);
|
||||||
|
}
|
||||||
|
}
|
@ -15,11 +15,30 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\Linkmobility4Ordermanager\Application\Model;
|
namespace D3\Linkmobility4Ordermanager\Application\Model;
|
||||||
|
|
||||||
|
use D3\Linkmobility4Ordermanager\Application\Model\Exceptions\emptyMesageException;
|
||||||
|
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
|
||||||
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
|
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
|
||||||
use D3\Linkmobility4OXID\Application\Model\OrderRecipients;
|
use D3\Linkmobility4OXID\Application\Model\OrderRecipients;
|
||||||
use D3\LinkmobilityClient\ValueObject\Recipient;
|
use D3\LinkmobilityClient\ValueObject\Recipient;
|
||||||
|
use D3\ModCfg\Application\Model\d3str;
|
||||||
|
use D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException;
|
||||||
use D3\Ordermanager\Application\Model\d3ordermanager;
|
use D3\Ordermanager\Application\Model\d3ordermanager;
|
||||||
|
use D3\Ordermanager\Application\Model\d3ordermanager as Manager;
|
||||||
|
use D3\Ordermanager\Application\Model\d3ordermanager_renderererrorhandler;
|
||||||
|
use D3\OxidServiceBridges\Internal\Framework\Module\Path\ModulePathResolverBridgeInterface;
|
||||||
|
use OxidEsales\Eshop\Application\Model\Basket;
|
||||||
|
use OxidEsales\Eshop\Application\Model\Content;
|
||||||
use OxidEsales\Eshop\Application\Model\Order;
|
use OxidEsales\Eshop\Application\Model\Order;
|
||||||
|
use OxidEsales\Eshop\Application\Model\Payment;
|
||||||
|
use OxidEsales\Eshop\Core\Email;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\ArticleException;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\ArticleInputException;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use OxidEsales\EshopCommunity\Core\Controller\BaseController;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateEngineInterface;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInterface;
|
||||||
|
|
||||||
class d3linkmobility_ordermanager_sender
|
class d3linkmobility_ordermanager_sender
|
||||||
{
|
{
|
||||||
@ -29,43 +48,206 @@ class d3linkmobility_ordermanager_sender
|
|||||||
/** @var Order */
|
/** @var Order */
|
||||||
protected $item;
|
protected $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Manager $manager
|
||||||
|
* @param Order $item
|
||||||
|
* @return void
|
||||||
|
* @throws ArticleException
|
||||||
|
* @throws ArticleInputException
|
||||||
|
* @throws noRecipientFoundException
|
||||||
|
* @throws d3ParameterNotFoundException
|
||||||
|
* @throws emptyMesageException
|
||||||
|
*/
|
||||||
public function sendOrderManagerSms(d3ordermanager $manager, Order $item)
|
public function sendOrderManagerSms(d3ordermanager $manager, Order $item)
|
||||||
{
|
{
|
||||||
$this->setManager($manager);
|
$this->setManager($manager);
|
||||||
$this->setItem($item);
|
$this->setItem($item);
|
||||||
|
dumpvar(__METHOD__.__LINE__.PHP_EOL);
|
||||||
|
dumpvar($this->getMessageBody());
|
||||||
|
dumpvar($this->getRecipients());
|
||||||
|
die();
|
||||||
$sms = oxNew(Sms::class, $this->getMessageBody());
|
$sms = oxNew(Sms::class, $this->getMessageBody());
|
||||||
$sms->sendCustomRecipientMessage($this->getRecipients());
|
$sms->sendCustomRecipientMessage($this->getRecipients());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws ArticleException
|
||||||
|
* @throws ArticleInputException
|
||||||
|
* @throws d3ParameterNotFoundException
|
||||||
|
* @throws emptyMesageException
|
||||||
*/
|
*/
|
||||||
protected function getMessageBody(): string
|
protected function getMessageBody(): string
|
||||||
{
|
{
|
||||||
return '';
|
$oManager = $this->getManager();
|
||||||
|
|
||||||
|
$viewData = [];
|
||||||
|
|
||||||
|
$blTplFromAdmin = $oManager->getValue('sLinkMobilityMessageFromTheme') == 'admin';
|
||||||
|
|
||||||
|
$oConfig = Registry::getConfig();
|
||||||
|
$oConfig->setAdminMode($blTplFromAdmin);
|
||||||
|
|
||||||
|
/** @var TemplateRendererInterface $renderer */
|
||||||
|
$renderer = ContainerFactory::getInstance()->getContainer()
|
||||||
|
->get(TemplateRendererBridgeInterface::class)
|
||||||
|
->getTemplateRenderer();
|
||||||
|
$templateEngine = $renderer->getTemplateEngine();
|
||||||
|
|
||||||
|
/** @var $oBasket Basket */
|
||||||
|
$oBasket = $oManager->getCurrentItem()->d3getOrderBasket4OrderManager($oManager);
|
||||||
|
|
||||||
|
$oPayment = oxNew(Payment::class);
|
||||||
|
$oPayment->loadInLang($oManager->getCurrentItem()->getFieldData('oxlang'), $oBasket->getPaymentId());
|
||||||
|
|
||||||
|
$oManager->getCurrentItem()->d3setBasket4OrderManager($oBasket);
|
||||||
|
$oManager->getCurrentItem()->d3setPayment4OrderManager($oPayment);
|
||||||
|
|
||||||
|
$oShop = Registry::getConfig()->getActiveShop();
|
||||||
|
|
||||||
|
$viewData["oShop"] = $oShop;
|
||||||
|
$viewData["oViewConf"] = (oxNew(BaseController::class))->getViewConfig();
|
||||||
|
$viewData["oOrder"] = $oManager->getCurrentItem();
|
||||||
|
$viewData["oUser"] = $oManager->getCurrentItem()->getOrderUser();
|
||||||
|
$viewData["shopTemplateDir"] = $oConfig->getTemplateDir(false);
|
||||||
|
$viewData["charset"] = Registry::getLang()->translateString("charset");
|
||||||
|
|
||||||
|
$viewData["shop"] = $oShop;
|
||||||
|
$viewData["order"] = $oManager->getCurrentItem();
|
||||||
|
$viewData["user"] = $oManager->getCurrentItem()->getOrderUser();
|
||||||
|
$viewData["payment"] = $oPayment;
|
||||||
|
$viewData["oDelSet"] = $oManager->getCurrentItem()->getDelSet();
|
||||||
|
$viewData["currency"] = $oManager->getCurrentItem()->getOrderCurrency();
|
||||||
|
$viewData["basket"] = $oBasket;
|
||||||
|
$viewData["oEmailView"] = oxNew(Email::class);
|
||||||
|
|
||||||
|
// ToDo: check in TWIG and change to a generic solution (e.g. path names in template name)
|
||||||
|
// Smarty only
|
||||||
|
if (method_exists($templateEngine, '__set')) {
|
||||||
|
$templateEngine->__set( 'template_dir', $this->getTemplateDir4OrderManager( $oManager ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($viewData as $id => $value) {
|
||||||
|
$templateEngine->addGlobal($id, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = $this->_d3GenerateOrderManagerMessageContent($templateEngine);
|
||||||
|
$oConfig->setAdminMode(true);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TemplateEngineInterface $templateEngine
|
||||||
|
* @return string
|
||||||
|
* @throws d3ParameterNotFoundException
|
||||||
|
* @throws emptyMesageException
|
||||||
|
*/
|
||||||
|
protected function _d3GenerateOrderManagerMessageContent(TemplateEngineInterface $templateEngine)
|
||||||
|
{
|
||||||
|
$iOrderLangId = $this->getManager()->getCurrentItem()->getFieldData('oxlang');
|
||||||
|
$oLang = Registry::getLang();
|
||||||
|
$iCurrentTplLang = $oLang->getTplLanguage();
|
||||||
|
$iCurrentBaseLang = $oLang->getBaseLanguage();
|
||||||
|
$oLang->setTplLanguage($iOrderLangId);
|
||||||
|
$oLang->setBaseLanguage($iOrderLangId);
|
||||||
|
|
||||||
|
$iCurrentCurrency = Registry::getConfig()->getShopCurrency();
|
||||||
|
$iOrderCurr = $this->getManager()->getCurrentItem()->getOrderCurrency()->id;
|
||||||
|
Registry::getConfig()->setActShopCurrency($iOrderCurr);
|
||||||
|
|
||||||
|
set_error_handler(
|
||||||
|
[d3GetModCfgDIC()->get(d3ordermanager_renderererrorhandler::class), 'd3HandleTemplateEngineErrors']
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($this->getManager()->getValue('sLinkMobilityMessageFromSource') == 'cms') {
|
||||||
|
$oUtilsView = Registry::getUtilsView();
|
||||||
|
$oContent = oxNew(Content::class);
|
||||||
|
$oContent->loadInLang($iOrderLangId, $this->getManager()->getValue('sLinkMobilityMessageFromContentname'));
|
||||||
|
|
||||||
|
$content = $oUtilsView->getRenderedContent(
|
||||||
|
$oContent->getFieldData('oxcontent'),
|
||||||
|
$templateEngine->getGlobals(),
|
||||||
|
$oContent->getId() . 'oxcontent'
|
||||||
|
);
|
||||||
|
} elseif ($this->getManager()->getValue('sLinkMobilityMessageFromSource') == 'template') {
|
||||||
|
$content = $templateEngine->render($this->getManager()->getValue('sLinkMobilityMessageFromTemplatename'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false === is_string($content) || false === (bool) strlen($content)) {
|
||||||
|
throw oxNew(emptyMesageException::class, 'message content is empty', $this->getManager()->getFieldData('oxtitle'));
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_error_handler();
|
||||||
|
|
||||||
|
$oLang->setTplLanguage($iCurrentTplLang);
|
||||||
|
$oLang->setBaseLanguage($iCurrentBaseLang);
|
||||||
|
Registry::getConfig()->setActShopCurrency($iCurrentCurrency);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Manager $oManager
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTemplateDir4OrderManager( Manager $oManager ): string
|
||||||
|
{
|
||||||
|
if ($oManager->getValue('sLinkMobilityMessageFromTheme') == 'module') {
|
||||||
|
$sModuleId = $oManager->getValue('sLinkMobilityMessageFromModulePath');
|
||||||
|
/** @var ModulePathResolverBridgeInterface $pathResolverBridge */
|
||||||
|
$pathResolverBridge = ContainerFactory::getInstance()->getContainer()->get(ModulePathResolverBridgeInterface::class);
|
||||||
|
$sModulePath = $pathResolverBridge->getFullModulePathFromConfiguration(
|
||||||
|
$sModuleId,
|
||||||
|
Registry::getConfig()->getShopId()
|
||||||
|
);
|
||||||
|
$sPath = (oxNew(d3str::class))->untrailingslashit($sModulePath);
|
||||||
|
} else {
|
||||||
|
$blAdmin = $oManager->getValue('sLinkMobilityMessageFromTheme') == 'admin';
|
||||||
|
$sPath = Registry::getConfig()->getTemplateDir($blAdmin);
|
||||||
|
}
|
||||||
|
return $sPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException
|
* @throws noRecipientFoundException
|
||||||
* @throws \D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException
|
|
||||||
*/
|
*/
|
||||||
protected function getRecipients(): array
|
protected function getRecipients(): array
|
||||||
{
|
{
|
||||||
$aEditedValues = $this->getManager()->getEditedValues();
|
|
||||||
|
|
||||||
$recipients = [];
|
$recipients = [];
|
||||||
if ($aEditedValues && $aEditedValues['blLinkMobilityMessageToCustomer']) {
|
if ((bool) $this->getManager()->getValue('blLinkMobilityMessageToCustomer')) {
|
||||||
$recipients[] = oxNew(OrderRecipients::class, $this->getItem())->getSmsRecipient();
|
$recipients[] = (oxNew(OrderRecipients::class, $this->getItem()))->getSmsRecipient();
|
||||||
|
}
|
||||||
|
if ((bool) $this->getManager()->getValue('blLinkMobilityMessageToCustom') &&
|
||||||
|
strlen(trim($this->getManager()->getValue('sLinkMobilityMessageToCustomAddress')))
|
||||||
|
) {
|
||||||
|
foreach ($this->extractCustomAddresses() as $phoneNumber => $countryId) {
|
||||||
|
$recipients[] = oxNew(Recipient::class, $phoneNumber, $countryId);
|
||||||
}
|
}
|
||||||
if ($aEditedValues && $aEditedValues['blLinkMobilityMessageToCustom']) {
|
|
||||||
$recipients[] = oxNew(Recipient::class, 'number', 'DE');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $recipients;
|
return $recipients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function extractCustomAddresses(): array
|
||||||
|
{
|
||||||
|
$addresses = [];
|
||||||
|
$customAddresses = trim($this->getManager()->getValue('sLinkMobilityMessageToCustomAddress'));
|
||||||
|
|
||||||
|
if (strlen($customAddresses)) {
|
||||||
|
foreach (explode(';', $customAddresses) as $addressGroups) {
|
||||||
|
list($phoneNumber, $countryId) = explode('@', trim($addressGroups));
|
||||||
|
$addresses[trim($phoneNumber)] = trim($countryId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $addresses;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
|
@ -20,12 +20,11 @@ $sLangName = 'Deutsch';
|
|||||||
$aLang = array(
|
$aLang = array(
|
||||||
'charset' => 'UTF-8',
|
'charset' => 'UTF-8',
|
||||||
|
|
||||||
'D3_LINKMOBILITY_ORDERMANAGER_ACTION' => 'Mobile Messages (über LINK Mobility) senden',
|
'D3_LINKMOBILITY_ORDERMANAGER_ACTION' => 'SMS senden (via LINK Mobility)',
|
||||||
|
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings' => 'Der Nachrichtenempfänger wird aus den Kundendaten an den Bestellungen ermittelt.',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings' => '',
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings_DESC' => 'Welche Daten der Bestellung hierfür verwendet werden, setzen Sie in den Einstellungen des LINK Mobility Moduls unter "Erweiterungen -> Module -> Einstell.".',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings_DESC' => '',
|
||||||
|
|
||||||
'D3_ORDERMANAGER_ACTION_MAILSEND' => 'E-Mail senden',
|
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROM1' => '',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROM1' => '',
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMSUBJECT' => 'Betreff-Template',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMSUBJECT' => 'Betreff-Template',
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMCMS_SUBJECT' => 'Der CMS-Titel ist gleichzeitig der Mail-Betreff.',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMCMS_SUBJECT' => 'Der CMS-Titel ist gleichzeitig der Mail-Betreff.',
|
||||||
@ -38,6 +37,12 @@ $aLang = array(
|
|||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMTEMPLATE_DESC' => 'Geben Sie den vollständigen Templatenamen (inkl. Ordner ab tpl-Ordner und Dateiendung) an',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMTEMPLATE_DESC' => 'Geben Sie den vollständigen Templatenamen (inkl. Ordner ab tpl-Ordner und Dateiendung) an',
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMCMS' => 'aus Kundeninformation',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMCMS' => 'aus Kundeninformation',
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMCMS_SOURCE' => 'CMS-Eintrag',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMCMS_SOURCE' => 'CMS-Eintrag',
|
||||||
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROM2' => 'an',
|
||||||
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOCUSTOMER' => 'Kunde',
|
||||||
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOCUSTOMER_DESC' => 'Der Nachrichtenempfänger wird aus den Kundendaten an den Bestellungen ermittelt. Welche Daten der Bestellung hierfür verwendet werden, setzen Sie in den Einstellungen des LINK Mobility Moduls unter "Erweiterungen -> Module -> Einstell.".',
|
||||||
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOOWNER' => 'Shopbetreiber',
|
||||||
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOMAIL' => 'folgende Mobilfunknummer(n)',
|
||||||
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOMAIL_DESC' => '<p>Geben Sie in dem Eingabefeld eine oder mehrere gültige Mobilfunknummern und deren Herkunftsland in folgendem Format an und aktivieren Sie die Option mit dem Häkchenfeld:</p><code>017112345678@DE; 015212345678@AT</code>',
|
||||||
|
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDSOURCE' => 'keine gültige Inhaltsquelle gesetzt',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDSOURCE' => 'keine gültige Inhaltsquelle gesetzt',
|
||||||
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDTPL' => 'keine gültigen Templatedaten gesetzt',
|
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDTPL' => 'keine gültigen Templatedaten gesetzt',
|
||||||
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\Linkmobility4Ordermanager\Modules\Ordermanager\Application\Model;
|
namespace D3\Linkmobility4Ordermanager\Modules\Ordermanager\Application\Model;
|
||||||
|
|
||||||
use D3\Linkmobility4Ordermanager\Application\Model\d3linkmobility_ordermanager_action;
|
use D3\Linkmobility4Ordermanager\Application\Model\Actions\d3linkmobility_ordermanager_action;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\State\ModuleStateServiceInterface;
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\State\ModuleStateServiceInterface;
|
||||||
|
Loading…
Reference in New Issue
Block a user