apply PSR-12 rules
This commit is contained in:
parent
f7f3ab0af4
commit
328a98f90a
13
.php-cs-fixer.php
Normal file
13
.php-cs-fixer.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->in(__DIR__)
|
||||||
|
;
|
||||||
|
|
||||||
|
$config = new PhpCsFixer\Config();
|
||||||
|
return $config->setRules([
|
||||||
|
'@PHP70Migration' => true,
|
||||||
|
'@PSR12' => true
|
||||||
|
])
|
||||||
|
->setFinder($finder)
|
||||||
|
;
|
@ -56,7 +56,7 @@ class AdminOrder extends AdminController
|
|||||||
public function getRecipientFromCurrentOrder()
|
public function getRecipientFromCurrentOrder()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return oxNew( OrderRecipients::class, $this->order )->getSmsRecipient();
|
return oxNew(OrderRecipients::class, $this->order)->getSmsRecipient();
|
||||||
} catch (noRecipientFoundException $e) {
|
} catch (noRecipientFoundException $e) {
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
Registry::getLang()->translateString($e->getMessage())
|
Registry::getLang()->translateString($e->getMessage())
|
||||||
@ -70,7 +70,7 @@ class AdminOrder extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function send()
|
public function send()
|
||||||
{
|
{
|
||||||
$messageBody = Registry::getRequest()->getRequestEscapedParameter( 'messagebody' );
|
$messageBody = Registry::getRequest()->getRequestEscapedParameter('messagebody');
|
||||||
|
|
||||||
if (strlen($messageBody) <= 1) {
|
if (strlen($messageBody) <= 1) {
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
@ -83,16 +83,16 @@ class AdminOrder extends AdminController
|
|||||||
$order->load($this->getEditObjectId());
|
$order->load($this->getEditObjectId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$sms = oxNew( Sms::class, $messageBody );
|
$sms = oxNew(Sms::class, $messageBody);
|
||||||
if ( $sms->sendOrderMessage( $order ) ) {
|
if ($sms->sendOrderMessage($order)) {
|
||||||
$this->setRemark( $sms->getRecipientsList(), $sms->getMessage() );
|
$this->setRemark($sms->getRecipientsList(), $sms->getMessage());
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
oxNew(successfullySentException::class, $sms->getResponse()->getSmsCount() )
|
oxNew(successfullySentException::class, $sms->getResponse()->getSmsCount())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
sprintf(
|
sprintf(
|
||||||
Registry::getLang()->translateString( 'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' ),
|
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
|
||||||
$sms->getResponse()->getErrorMessage()
|
$sms->getResponse()->getErrorMessage()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -107,14 +107,14 @@ class AdminOrder extends AdminController
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function setRemark( $recipients, $messageBody )
|
protected function setRemark($recipients, $messageBody)
|
||||||
{
|
{
|
||||||
$remark = oxNew( Remark::class );
|
$remark = oxNew(Remark::class);
|
||||||
$remark->assign( [
|
$remark->assign([
|
||||||
'oxtype' => AdminUser::REMARK_IDENT,
|
'oxtype' => AdminUser::REMARK_IDENT,
|
||||||
'oxparentid' => $this->order->getUser()->getId(),
|
'oxparentid' => $this->order->getUser()->getId(),
|
||||||
'oxtext' => $recipients.PHP_EOL.$messageBody
|
'oxtext' => $recipients.PHP_EOL.$messageBody
|
||||||
] );
|
]);
|
||||||
$remark->save();
|
$remark->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,7 +27,7 @@ use OxidEsales\Eshop\Core\Registry;
|
|||||||
|
|
||||||
class AdminUser extends AdminController
|
class AdminUser extends AdminController
|
||||||
{
|
{
|
||||||
const REMARK_IDENT = 'LMSMS';
|
public const REMARK_IDENT = 'LMSMS';
|
||||||
|
|
||||||
protected $_sThisTemplate = 'd3adminuser.tpl';
|
protected $_sThisTemplate = 'd3adminuser.tpl';
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class AdminUser extends AdminController
|
|||||||
public function getRecipientFromCurrentUser()
|
public function getRecipientFromCurrentUser()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return oxNew( UserRecipients::class, $this->user )->getSmsRecipient();
|
return oxNew(UserRecipients::class, $this->user)->getSmsRecipient();
|
||||||
} catch (noRecipientFoundException $e) {
|
} catch (noRecipientFoundException $e) {
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
Registry::getLang()->translateString($e->getMessage())
|
Registry::getLang()->translateString($e->getMessage())
|
||||||
@ -71,7 +71,7 @@ class AdminUser extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function send()
|
public function send()
|
||||||
{
|
{
|
||||||
$messageBody = Registry::getRequest()->getRequestEscapedParameter( 'messagebody' );
|
$messageBody = Registry::getRequest()->getRequestEscapedParameter('messagebody');
|
||||||
|
|
||||||
if (strlen($messageBody) <= 1) {
|
if (strlen($messageBody) <= 1) {
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
@ -85,7 +85,7 @@ class AdminUser extends AdminController
|
|||||||
|
|
||||||
$sms = oxNew(Sms::class, $messageBody);
|
$sms = oxNew(Sms::class, $messageBody);
|
||||||
if ($sms->sendUserAccountMessage($user)) {
|
if ($sms->sendUserAccountMessage($user)) {
|
||||||
$this->setRemark( $sms->getRecipientsList(), $sms->getMessage() );
|
$this->setRemark($sms->getRecipientsList(), $sms->getMessage());
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
sprintf(
|
sprintf(
|
||||||
Registry::getLang()->translateString('D3LM_EXC_SMS_SUCC_SENT'),
|
Registry::getLang()->translateString('D3LM_EXC_SMS_SUCC_SENT'),
|
||||||
@ -95,7 +95,7 @@ class AdminUser extends AdminController
|
|||||||
} else {
|
} else {
|
||||||
Registry::getUtilsView()->addErrorToDisplay(
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
sprintf(
|
sprintf(
|
||||||
Registry::getLang()->translateString( 'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' ),
|
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
|
||||||
$sms->getResponse()->getErrorMessage()
|
$sms->getResponse()->getErrorMessage()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -107,14 +107,14 @@ class AdminUser extends AdminController
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function setRemark( $recipients, $messageBody )
|
protected function setRemark($recipients, $messageBody)
|
||||||
{
|
{
|
||||||
$remark = oxNew( Remark::class );
|
$remark = oxNew(Remark::class);
|
||||||
$remark->assign( [
|
$remark->assign([
|
||||||
'oxtype' => AdminUser::REMARK_IDENT,
|
'oxtype' => AdminUser::REMARK_IDENT,
|
||||||
'oxparentid' => $this->getEditObjectId(),
|
'oxparentid' => $this->getEditObjectId(),
|
||||||
'oxtext' => $recipients.PHP_EOL.$messageBody
|
'oxtext' => $recipients.PHP_EOL.$messageBody
|
||||||
] );
|
]);
|
||||||
$remark->save();
|
$remark->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -37,7 +37,7 @@ class Configuration
|
|||||||
*/
|
*/
|
||||||
public function getTestMode(): bool
|
public function getTestMode(): bool
|
||||||
{
|
{
|
||||||
return (bool) Registry::getConfig()->getConfigParam( 'd3linkmobility_debug');
|
return (bool) Registry::getConfig()->getConfigParam('d3linkmobility_debug');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,4 +16,5 @@ declare(strict_types=1);
|
|||||||
namespace D3\Linkmobility4OXID\Application\Model\Exceptions;
|
namespace D3\Linkmobility4OXID\Application\Model\Exceptions;
|
||||||
|
|
||||||
interface abortSendingExceptionInterface
|
interface abortSendingExceptionInterface
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
@ -20,8 +20,8 @@ use OxidEsales\Eshop\Core\Exception\StandardException;
|
|||||||
|
|
||||||
class noRecipientFoundException extends StandardException implements abortSendingExceptionInterface
|
class noRecipientFoundException extends StandardException implements abortSendingExceptionInterface
|
||||||
{
|
{
|
||||||
public function __construct( $sMessage = "D3LM_EXC_NO_RECIPIENT_SET", $iCode = 0, Exception $previous = null )
|
public function __construct($sMessage = "D3LM_EXC_NO_RECIPIENT_SET", $iCode = 0, Exception $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct( $sMessage, $iCode, $previous );
|
parent::__construct($sMessage, $iCode, $previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,10 +26,10 @@ class successfullySentException extends Exception
|
|||||||
* @param int $code
|
* @param int $code
|
||||||
* @param Throwable|null $previous
|
* @param Throwable|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct( $messageCount = 1, $code = 0, Throwable $previous = null )
|
public function __construct($messageCount = 1, $code = 0, Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$message = sprintf( Registry::getLang()->translateString( 'D3LM_EXC_SMS_SUCC_SENT' ), $messageCount);
|
$message = sprintf(Registry::getLang()->translateString('D3LM_EXC_SMS_SUCC_SENT'), $messageCount);
|
||||||
|
|
||||||
parent::__construct( $message, $code, $previous );
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -64,11 +64,12 @@ class MessageSender
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$sms = oxNew( Sms::class, $messageBody );
|
$sms = oxNew(Sms::class, $messageBody);
|
||||||
if ( $sms->sendOrderMessage( $order ) ) {
|
if ($sms->sendOrderMessage($order)) {
|
||||||
$this->setRemark( $order->getId(), $sms->getRecipientsList(), $sms->getMessage() );
|
$this->setRemark($order->getId(), $sms->getRecipientsList(), $sms->getMessage());
|
||||||
}
|
}
|
||||||
} catch (noRecipientFoundException $e) {}
|
} catch (noRecipientFoundException $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,12 +78,12 @@ class MessageSender
|
|||||||
*/
|
*/
|
||||||
protected function setRemark($orderId, $recipients, $message)
|
protected function setRemark($orderId, $recipients, $message)
|
||||||
{
|
{
|
||||||
$remark = oxNew( Remark::class );
|
$remark = oxNew(Remark::class);
|
||||||
$remark->assign( [
|
$remark->assign([
|
||||||
'oxtype' => AdminUser::REMARK_IDENT,
|
'oxtype' => AdminUser::REMARK_IDENT,
|
||||||
'oxparentid' => $orderId,
|
'oxparentid' => $orderId,
|
||||||
'oxtext' => $recipients.PHP_EOL.$message
|
'oxtext' => $recipients.PHP_EOL.$message
|
||||||
] );
|
]);
|
||||||
$remark->save();
|
$remark->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,8 +39,7 @@ class OrderRecipients
|
|||||||
*/
|
*/
|
||||||
public function getSmsRecipient(): Recipient
|
public function getSmsRecipient(): Recipient
|
||||||
{
|
{
|
||||||
foreach ($this->getSmsRecipientFields() as $phoneFieldName => $countryIdFieldName)
|
foreach ($this->getSmsRecipientFields() as $phoneFieldName => $countryIdFieldName) {
|
||||||
{
|
|
||||||
$content = trim($this->order->getFieldData($phoneFieldName));
|
$content = trim($this->order->getFieldData($phoneFieldName));
|
||||||
|
|
||||||
if (strlen($content)) {
|
if (strlen($content)) {
|
||||||
@ -72,7 +71,7 @@ class OrderRecipients
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getSanitizedCustomFields() : array
|
public function getSanitizedCustomFields(): array
|
||||||
{
|
{
|
||||||
$customFields = (array) Registry::getConfig()->getConfigParam('d3linkmobility_smsOrderRecipientsFields');
|
$customFields = (array) Registry::getConfig()->getConfigParam('d3linkmobility_smsOrderRecipientsFields');
|
||||||
array_walk($customFields, [$this, 'checkFieldExists']);
|
array_walk($customFields, [$this, 'checkFieldExists']);
|
||||||
@ -85,7 +84,9 @@ class OrderRecipients
|
|||||||
$checkPhoneFieldName = trim($checkPhoneFieldName);
|
$checkPhoneFieldName = trim($checkPhoneFieldName);
|
||||||
$allFieldNames = oxNew(Order::class)->getFieldNames();
|
$allFieldNames = oxNew(Order::class)->getFieldNames();
|
||||||
|
|
||||||
array_walk($allFieldNames, function(&$value) {$value = strtolower($value);});
|
array_walk($allFieldNames, function (&$value) {
|
||||||
|
$value = strtolower($value);
|
||||||
|
});
|
||||||
|
|
||||||
$checkPhoneFieldName = in_array(strtolower($checkPhoneFieldName), $allFieldNames) &&
|
$checkPhoneFieldName = in_array(strtolower($checkPhoneFieldName), $allFieldNames) &&
|
||||||
in_array(strtolower($checkCountryFieldName), $allFieldNames) ? $checkPhoneFieldName : null;
|
in_array(strtolower($checkCountryFieldName), $allFieldNames) ? $checkPhoneFieldName : null;
|
||||||
|
@ -23,14 +23,14 @@ class RequestFactory extends \D3\LinkmobilityClient\SMS\RequestFactory
|
|||||||
{
|
{
|
||||||
public function getSmsRequest(): SmsRequestInterface
|
public function getSmsRequest(): SmsRequestInterface
|
||||||
{
|
{
|
||||||
$configuration = oxNew( Configuration::class );
|
$configuration = oxNew(Configuration::class);
|
||||||
|
|
||||||
$request = parent::getSmsRequest();
|
$request = parent::getSmsRequest();
|
||||||
$request->setTestMode($configuration->getTestMode())
|
$request->setTestMode($configuration->getTestMode())
|
||||||
->setSenderAddress(
|
->setSenderAddress(
|
||||||
oxNew( Sender::class, $configuration->getSmsSenderNumber(), $configuration->getSmsSenderCountry() )
|
oxNew(Sender::class, $configuration->getSmsSenderNumber(), $configuration->getSmsSenderCountry())
|
||||||
)
|
)
|
||||||
->setSenderAddressType( RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL );
|
->setSenderAddressType(RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL);
|
||||||
|
|
||||||
return $request;
|
return $request;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class Sms
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->sendCustomRecipientMessage(
|
return $this->sendCustomRecipientMessage(
|
||||||
[ oxNew( UserRecipients::class, $user )->getSmsRecipient() ]
|
[ oxNew(UserRecipients::class, $user)->getSmsRecipient() ]
|
||||||
);
|
);
|
||||||
} catch (noRecipientFoundException $e) {
|
} catch (noRecipientFoundException $e) {
|
||||||
Registry::getLogger()->warning($e->getMessage());
|
Registry::getLogger()->warning($e->getMessage());
|
||||||
@ -72,7 +72,7 @@ class Sms
|
|||||||
try {
|
try {
|
||||||
Registry::getLogger()->debug('startRequest', ['orderId' => $order->getId()]);
|
Registry::getLogger()->debug('startRequest', ['orderId' => $order->getId()]);
|
||||||
$return = $this->sendCustomRecipientMessage(
|
$return = $this->sendCustomRecipientMessage(
|
||||||
[ oxNew( OrderRecipients::class, $order )->getSmsRecipient() ]
|
[ oxNew(OrderRecipients::class, $order)->getSmsRecipient() ]
|
||||||
);
|
);
|
||||||
Registry::getLogger()->debug('finishRequest', ['orderId' => $order->getId()]);
|
Registry::getLogger()->debug('finishRequest', ['orderId' => $order->getId()]);
|
||||||
return $return;
|
return $return;
|
||||||
@ -91,12 +91,12 @@ class Sms
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->setRecipients($recipientsArray);
|
$this->setRecipients($recipientsArray);
|
||||||
$configuration = oxNew( Configuration::class );
|
$configuration = oxNew(Configuration::class);
|
||||||
$client = oxNew( MessageClient::class )->getClient();
|
$client = oxNew(MessageClient::class)->getClient();
|
||||||
|
|
||||||
/** @var SmsRequestInterface $request */
|
/** @var SmsRequestInterface $request */
|
||||||
$request = oxNew( RequestFactory::class, $this->getMessage(), $client )->getSmsRequest();
|
$request = oxNew(RequestFactory::class, $this->getMessage(), $client)->getSmsRequest();
|
||||||
$request->setTestMode( $configuration->getTestMode() )->setMethod( RequestInterface::METHOD_POST )
|
$request->setTestMode($configuration->getTestMode())->setMethod(RequestInterface::METHOD_POST)
|
||||||
->setSenderAddress(
|
->setSenderAddress(
|
||||||
oxNew(
|
oxNew(
|
||||||
Sender::class,
|
Sender::class,
|
||||||
@ -104,19 +104,19 @@ class Sms
|
|||||||
$configuration->getSmsSenderCountry()
|
$configuration->getSmsSenderCountry()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setSenderAddressType( RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL );
|
->setSenderAddressType(RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL);
|
||||||
|
|
||||||
$recipientsList = $request->getRecipientsList();
|
$recipientsList = $request->getRecipientsList();
|
||||||
foreach ($recipientsArray as $recipient) {
|
foreach ($recipientsArray as $recipient) {
|
||||||
$recipientsList->add( $recipient );
|
$recipientsList->add($recipient);
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $client->request( $request );
|
$response = $client->request($request);
|
||||||
|
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
|
|
||||||
if (false === $response->isSuccessful()) {
|
if (false === $response->isSuccessful()) {
|
||||||
Registry::getLogger()->warning( $response->getErrorMessage(), [$request->getBody()] );
|
Registry::getLogger()->warning($response->getErrorMessage(), [$request->getBody()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response->isSuccessful();
|
return $response->isSuccessful();
|
||||||
@ -129,7 +129,7 @@ class Sms
|
|||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
Registry::getLogger()->warning($e->getMessage());
|
Registry::getLogger()->warning($e->getMessage());
|
||||||
Registry::getUtilsView()->addErrorToDisplay($e);
|
Registry::getUtilsView()->addErrorToDisplay($e);
|
||||||
} catch ( InvalidArgumentException $e) {
|
} catch (InvalidArgumentException $e) {
|
||||||
Registry::getLogger()->warning($e->getMessage());
|
Registry::getLogger()->warning($e->getMessage());
|
||||||
Registry::getUtilsView()->addErrorToDisplay($e);
|
Registry::getUtilsView()->addErrorToDisplay($e);
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ class Sms
|
|||||||
$this->recipients = $recipients;
|
$this->recipients = $recipients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRecipientsList() : string
|
public function getRecipientsList(): string
|
||||||
{
|
{
|
||||||
$list = [];
|
$list = [];
|
||||||
/** @var Recipient $recipient */
|
/** @var Recipient $recipient */
|
||||||
@ -166,7 +166,7 @@ class Sms
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function sanitizeMessage($message) : string
|
protected function sanitizeMessage($message): string
|
||||||
{
|
{
|
||||||
$message = trim(strip_tags($message));
|
$message = trim(strip_tags($message));
|
||||||
$message = $this->removeLineBreaks ? str_replace(["\r", "\n"], ' ', $message) : $message;
|
$message = $this->removeLineBreaks ? str_replace(["\r", "\n"], ' ', $message) : $message;
|
||||||
@ -174,7 +174,7 @@ class Sms
|
|||||||
return $this->removeMultipleSpaces ? preg_replace($regexp, ' ', $message) : $message;
|
return $this->removeMultipleSpaces ? preg_replace($regexp, ' ', $message) : $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMessage() : string
|
public function getMessage(): string
|
||||||
{
|
{
|
||||||
return $this->message;
|
return $this->message;
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,9 @@ class UserRecipients
|
|||||||
*/
|
*/
|
||||||
public function getSmsRecipient(): Recipient
|
public function getSmsRecipient(): Recipient
|
||||||
{
|
{
|
||||||
foreach ($this->getSmsRecipientFields() as $fieldName)
|
foreach ($this->getSmsRecipientFields() as $fieldName) {
|
||||||
{
|
|
||||||
$content = trim($this->user->getFieldData($fieldName));
|
$content = trim($this->user->getFieldData($fieldName));
|
||||||
if (strlen($content)) {
|
if (strlen($content)) {
|
||||||
|
|
||||||
$country = oxNew(Country::class);
|
$country = oxNew(Country::class);
|
||||||
$country->load($this->user->getFieldData('oxcountryid'));
|
$country->load($this->user->getFieldData('oxcountryid'));
|
||||||
|
|
||||||
@ -73,7 +71,7 @@ class UserRecipients
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getSanitizedCustomFields() : array
|
public function getSanitizedCustomFields(): array
|
||||||
{
|
{
|
||||||
$customFields = (array) Registry::getConfig()->getConfigParam('d3linkmobility_smsUserRecipientsFields');
|
$customFields = (array) Registry::getConfig()->getConfigParam('d3linkmobility_smsUserRecipientsFields');
|
||||||
array_walk($customFields, [$this, 'checkFieldExists']);
|
array_walk($customFields, [$this, 'checkFieldExists']);
|
||||||
@ -88,7 +86,9 @@ class UserRecipients
|
|||||||
$checkFieldName = trim($checkFieldName);
|
$checkFieldName = trim($checkFieldName);
|
||||||
$allFieldNames = oxNew(User::class)->getFieldNames();
|
$allFieldNames = oxNew(User::class)->getFieldNames();
|
||||||
|
|
||||||
array_walk($allFieldNames, function(&$value) {$value = strtolower($value);});
|
array_walk($allFieldNames, function (&$value) {
|
||||||
|
$value = strtolower($value);
|
||||||
|
});
|
||||||
|
|
||||||
$checkFieldName = in_array(strtolower($checkFieldName), $allFieldNames) ? $checkFieldName : null;
|
$checkFieldName = in_array(strtolower($checkFieldName), $allFieldNames) ? $checkFieldName : null;
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,16 @@ namespace D3\Linkmobility4OXID\Modules\Aplication\Model {
|
|||||||
|
|
||||||
use OxidEsales\Eshop\Application\Model\Order;
|
use OxidEsales\Eshop\Application\Model\Order;
|
||||||
|
|
||||||
class OrderModel_parent extends Order{}
|
class OrderModel_parent extends Order
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace D3\Linkmobility4OXID\Modules\Core {
|
namespace D3\Linkmobility4OXID\Modules\Core {
|
||||||
|
|
||||||
use OxidEsales\Eshop\Core\Email;
|
use OxidEsales\Eshop\Core\Email;
|
||||||
|
|
||||||
class EmailCore_parent extends Email{}
|
class EmailCore_parent extends Email
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
@ -24,7 +24,7 @@ class OrderModel extends OrderModel_parent
|
|||||||
parent::cancelOrder();
|
parent::cancelOrder();
|
||||||
|
|
||||||
if ($this->getFieldData('oxstorno') === 1) {
|
if ($this->getFieldData('oxstorno') === 1) {
|
||||||
$Email = oxNew( Email::class );
|
$Email = oxNew(Email::class);
|
||||||
$Email->d3SendCancelMessage($this);
|
$Email->d3SendCancelMessage($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ class EmailCore extends EmailCore_parent
|
|||||||
*
|
*
|
||||||
* @return TemplateRendererInterface
|
* @return TemplateRendererInterface
|
||||||
*/
|
*/
|
||||||
protected function d3GetTplRenderer() : TemplateRendererInterface
|
protected function d3GetTplRenderer(): TemplateRendererInterface
|
||||||
{
|
{
|
||||||
$bridge = ContainerFactory::getInstance()->getContainer()
|
$bridge = ContainerFactory::getInstance()->getContainer()
|
||||||
->get(TemplateRendererBridgeInterface::class);
|
->get(TemplateRendererBridgeInterface::class);
|
||||||
|
Loading…
Reference in New Issue
Block a user