add order sent message and order canceled message
This commit is contained in:
@ -16,6 +16,7 @@
|
|||||||
namespace D3\Linkmobility4OXID\Application\Controller\Admin;
|
namespace D3\Linkmobility4OXID\Application\Controller\Admin;
|
||||||
|
|
||||||
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
|
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
|
||||||
|
use D3\Linkmobility4OXID\Application\Model\Exceptions\successfullySentException;
|
||||||
use D3\Linkmobility4OXID\Application\Model\OrderRecipients;
|
use D3\Linkmobility4OXID\Application\Model\OrderRecipients;
|
||||||
use D3\Linkmobility4OXID\Application\Model\Sms;
|
use D3\Linkmobility4OXID\Application\Model\Sms;
|
||||||
use D3\Linkmobility4OXID\Application\Model\UserRecipients;
|
use D3\Linkmobility4OXID\Application\Model\UserRecipients;
|
||||||
@ -89,7 +90,9 @@ class AdminOrder extends AdminController
|
|||||||
$sms = oxNew( Sms::class );
|
$sms = oxNew( Sms::class );
|
||||||
if ( $sms->sendOrderMessage( $order, $messageBody ) ) {
|
if ( $sms->sendOrderMessage( $order, $messageBody ) ) {
|
||||||
$this->setRemark( $messageBody );
|
$this->setRemark( $messageBody );
|
||||||
Registry::getUtilsView()->addErrorToDisplay( sprintf( Registry::getLang()->translateString( 'D3LM_EXC_SMS_SUCC_SENT' ), $sms->getResponse()->getSmsCount() ) );
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
|
oxNew(successfullySentException::class, $sms->getResponse()->getSmsCount() )
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
Registry::getUtilsView()->addErrorToDisplay( Registry::getLang()->translateString( 'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' ) );
|
Registry::getUtilsView()->addErrorToDisplay( Registry::getLang()->translateString( 'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' ) );
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?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 (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
|
* @link http://www.oxidmodule.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace D3\Linkmobility4OXID\Application\Model\Exceptions;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class successfullySentException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param int $messageCount
|
||||||
|
* @param int $code
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct( $messageCount = 1, $code = 0, Throwable $previous = null )
|
||||||
|
{
|
||||||
|
$message = sprintf( Registry::getLang()->translateString( 'D3LM_EXC_SMS_SUCC_SENT' ), $messageCount);
|
||||||
|
|
||||||
|
parent::__construct( $message, $code, $previous );
|
||||||
|
}
|
||||||
|
}
|
@ -39,13 +39,13 @@ class OrderRecipients
|
|||||||
*/
|
*/
|
||||||
public function getSmsRecipient(): Recipient
|
public function getSmsRecipient(): Recipient
|
||||||
{
|
{
|
||||||
foreach ($this->getSmsRecipientFields() as $fieldName)
|
foreach ($this->getSmsRecipientFields() as $phoneFieldName => $countryIdFieldName)
|
||||||
{
|
{
|
||||||
$content = trim($this->order->getFieldData($fieldName));
|
$content = trim($this->order->getFieldData($phoneFieldName));
|
||||||
if (strlen($content)) {
|
|
||||||
|
|
||||||
|
if (strlen($content)) {
|
||||||
$country = oxNew(Country::class);
|
$country = oxNew(Country::class);
|
||||||
$country->load($this->order->getUser()->getFieldData('oxcountryid'));
|
$country->load($this->order->getFieldData($countryIdFieldName));
|
||||||
|
|
||||||
return oxNew(Recipient::class, $content, $country->getFieldData('oxisoalpha2'));
|
return oxNew(Recipient::class, $content, $country->getFieldData('oxisoalpha2'));
|
||||||
}
|
}
|
||||||
@ -60,8 +60,8 @@ class OrderRecipients
|
|||||||
public function getSmsRecipientFields(): array
|
public function getSmsRecipientFields(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'oxdelfon',
|
'oxdelfon' => 'oxdelcountryid',
|
||||||
'oxbillfon'
|
'oxbillfon' => 'oxbillcountryid'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -62,10 +62,19 @@ class Sms
|
|||||||
public function sendOrderMessage(Order $order, $message): bool
|
public function sendOrderMessage(Order $order, $message): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->sendCustomRecipientMessage(
|
oxNew( OrderRecipients::class, $order )->getSmsRecipient();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
dumpvar($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Registry::getLogger()->debug('startRequest', ['orderId' => $order->getId()]);
|
||||||
|
$return = $this->sendCustomRecipientMessage(
|
||||||
[ oxNew( OrderRecipients::class, $order )->getSmsRecipient() ],
|
[ oxNew( OrderRecipients::class, $order )->getSmsRecipient() ],
|
||||||
$message
|
$message
|
||||||
);
|
);
|
||||||
|
Registry::getLogger()->debug('finishRequest', ['orderId' => $order->getId()]);
|
||||||
|
return $return;
|
||||||
} catch (noRecipientFoundException $e) {
|
} catch (noRecipientFoundException $e) {
|
||||||
Registry::getLogger()->warning($e->getMessage());
|
Registry::getLogger()->warning($e->getMessage());
|
||||||
throw $e;
|
throw $e;
|
||||||
@ -91,6 +100,7 @@ class Sms
|
|||||||
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;
|
||||||
|
@ -35,5 +35,6 @@ $aLang = [
|
|||||||
'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' => 'Beim Versenden der Nachricht(en) ist ein unerwarteter Fehler aufgetreten.',
|
'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' => 'Beim Versenden der Nachricht(en) ist ein unerwarteter Fehler aufgetreten.',
|
||||||
'D3LM_EXC_NO_RECIPIENT_SET' => 'Kein (verwendbarer) Empfänger gesetzt.',
|
'D3LM_EXC_NO_RECIPIENT_SET' => 'Kein (verwendbarer) Empfänger gesetzt.',
|
||||||
|
|
||||||
'tbcluser_linkmobility' => 'SMS-Versand'
|
'tbcluser_linkmobility' => 'SMS-Versand',
|
||||||
|
'tbclorder_linkmobility' => 'SMS-Versand'
|
||||||
];
|
];
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
Vielen Dank für Ihre Bestellung!
|
||||||
|
|
||||||
|
[{*
|
||||||
[{assign var="shop" value=$oEmailView->getShop()}]
|
[{assign var="shop" value=$oEmailView->getShop()}]
|
||||||
[{assign var="oViewConf" value=$oEmailView->getViewConfig()}]
|
[{assign var="oViewConf" value=$oEmailView->getViewConfig()}]
|
||||||
[{assign var="currency" value=$oEmailView->getCurrency()}]
|
[{assign var="currency" value=$oEmailView->getCurrency()}]
|
||||||
@ -55,30 +58,24 @@
|
|||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
[{if !$basket->getDiscounts()}]
|
[{if !$basket->getDiscounts()}]
|
||||||
[{block name="email_plain_order_cust_nodiscounttotalnet"}]
|
[{block name="email_plain_order_cust_nodiscounttotalnet"}]
|
||||||
[{* netto price *}]
|
|
||||||
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
[{block name="email_plain_order_cust_nodiscountproductvats"}]
|
[{block name="email_plain_order_cust_nodiscountproductvats"}]
|
||||||
[{* VATs *}]
|
|
||||||
[{foreach from=$basket->getProductVats() item=VATitem key=key}]
|
[{foreach from=$basket->getProductVats() item=VATitem key=key}]
|
||||||
[{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$key}] [{$VATitem}] [{$currency->name}]
|
[{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$key}] [{$VATitem}] [{$currency->name}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
[{block name="email_plain_order_cust_nodiscounttotalgross"}]
|
[{block name="email_plain_order_cust_nodiscounttotalgross"}]
|
||||||
[{* brutto price *}]
|
|
||||||
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
[{* applied discounts *}]
|
|
||||||
[{if $basket->getDiscounts()}]
|
[{if $basket->getDiscounts()}]
|
||||||
[{if $order->isNettoMode()}]
|
[{if $order->isNettoMode()}]
|
||||||
[{block name="email_plain_order_ownerdiscounttotalnet"}]
|
[{block name="email_plain_order_ownerdiscounttotalnet"}]
|
||||||
[{* netto price *}]
|
|
||||||
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
[{else}]
|
[{else}]
|
||||||
[{block name="email_plain_order_discountownertotalgross"}]
|
[{block name="email_plain_order_discountownertotalgross"}]
|
||||||
[{* brutto price *}]
|
|
||||||
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
@ -89,12 +86,10 @@
|
|||||||
[{/block}]
|
[{/block}]
|
||||||
[{if !$order->isNettoMode()}]
|
[{if !$order->isNettoMode()}]
|
||||||
[{block name="email_plain_order_cust_totalnet"}]
|
[{block name="email_plain_order_cust_totalnet"}]
|
||||||
[{* netto price *}]
|
|
||||||
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
[{block name="email_plain_order_cust_productvats"}]
|
[{block name="email_plain_order_cust_productvats"}]
|
||||||
[{* VATs *}]
|
|
||||||
[{foreach from=$basket->getProductVats() item=VATitem key=key}]
|
[{foreach from=$basket->getProductVats() item=VATitem key=key}]
|
||||||
[{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$key}] [{$VATitem}] [{$currency->name}]
|
[{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$key}] [{$VATitem}] [{$currency->name}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
@ -102,19 +97,16 @@
|
|||||||
[{/if}]
|
[{/if}]
|
||||||
[{if $order->isNettoMode()}]
|
[{if $order->isNettoMode()}]
|
||||||
[{block name="email_plain_order_ownertotalgross"}]
|
[{block name="email_plain_order_ownertotalgross"}]
|
||||||
[{* brutto price *}]
|
|
||||||
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
[{block name="email_plain_order_cust_voucherdiscount"}]
|
[{block name="email_plain_order_cust_voucherdiscount"}]
|
||||||
[{* voucher discounts *}]
|
|
||||||
[{if $oViewConf->getShowVouchers() && $basket->getVoucherDiscValue()}]
|
[{if $oViewConf->getShowVouchers() && $basket->getVoucherDiscValue()}]
|
||||||
[{oxmultilang ident="COUPON"}] [{if $basket->getFVoucherDiscountValue() > 0}]-[{/if}][{$basket->getFVoucherDiscountValue()|replace:"-":""}] [{$currency->name}]
|
[{oxmultilang ident="COUPON"}] [{if $basket->getFVoucherDiscountValue() > 0}]-[{/if}][{$basket->getFVoucherDiscountValue()|replace:"-":""}] [{$currency->name}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
|
|
||||||
[{block name="email_plain_order_cust_delcosts"}]
|
[{block name="email_plain_order_cust_delcosts"}]
|
||||||
[{* delivery costs *}]
|
|
||||||
[{if $basket->getDelCostNet()}]
|
[{if $basket->getDelCostNet()}]
|
||||||
[{oxmultilang ident="SHIPPING_NET" suffix="COLON"}] [{$basket->getDelCostNet()}] [{$currency->sign}]
|
[{oxmultilang ident="SHIPPING_NET" suffix="COLON"}] [{$basket->getDelCostNet()}] [{$currency->sign}]
|
||||||
[{if $basket->getDelCostVat()}] [{oxmultilang ident="BASKET_TOTAL_PLUS_PROPORTIONAL_VAT"}] [{else}] [{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$basket->getDelCostVatPercent()}][{/if}] [{$basket->getDelCostVat()}] [{$currency->sign}]
|
[{if $basket->getDelCostVat()}] [{oxmultilang ident="BASKET_TOTAL_PLUS_PROPORTIONAL_VAT"}] [{else}] [{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$basket->getDelCostVatPercent()}][{/if}] [{$basket->getDelCostVat()}] [{$currency->sign}]
|
||||||
@ -124,7 +116,6 @@
|
|||||||
[{/block}]
|
[{/block}]
|
||||||
|
|
||||||
[{block name="email_plain_order_cust_paymentcosts"}]
|
[{block name="email_plain_order_cust_paymentcosts"}]
|
||||||
[{* payment sum *}]
|
|
||||||
[{if $basket->getPayCostNet()}]
|
[{if $basket->getPayCostNet()}]
|
||||||
[{if $basket->getPaymentCosts() >= 0}][{oxmultilang ident="SURCHARGE"}][{else}][{oxmultilang ident="DEDUCTION"}][{/if}] [{oxmultilang ident="PAYMENT_METHOD"}] [{$basket->getPayCostNet()}] [{$currency->sign}]
|
[{if $basket->getPaymentCosts() >= 0}][{oxmultilang ident="SURCHARGE"}][{else}][{oxmultilang ident="DEDUCTION"}][{/if}] [{oxmultilang ident="PAYMENT_METHOD"}] [{$basket->getPayCostNet()}] [{$currency->sign}]
|
||||||
[{if $basket->getPayCostVat()}]
|
[{if $basket->getPayCostVat()}]
|
||||||
@ -136,7 +127,6 @@
|
|||||||
[{/block}]
|
[{/block}]
|
||||||
|
|
||||||
[{block name="email_plain_order_cust_wrappingcosts"}]
|
[{block name="email_plain_order_cust_wrappingcosts"}]
|
||||||
[{* Gift wrapping *}]
|
|
||||||
[{if $oViewConf->getShowGiftWrapping()}]
|
[{if $oViewConf->getShowGiftWrapping()}]
|
||||||
[{if $basket->getWrappCostNet()}]
|
[{if $basket->getWrappCostNet()}]
|
||||||
[{oxmultilang ident="BASKET_TOTAL_WRAPPING_COSTS_NET"}] [{$basket->getWrappCostNet()}] [{$currency->sign}]
|
[{oxmultilang ident="BASKET_TOTAL_WRAPPING_COSTS_NET"}] [{$basket->getWrappCostNet()}] [{$currency->sign}]
|
||||||
@ -150,7 +140,6 @@
|
|||||||
[{/block}]
|
[{/block}]
|
||||||
|
|
||||||
[{block name="email_plain_order_cust_giftwrapping"}]
|
[{block name="email_plain_order_cust_giftwrapping"}]
|
||||||
[{* Greeting card *}]
|
|
||||||
[{if $oViewConf->getShowGiftWrapping()}]
|
[{if $oViewConf->getShowGiftWrapping()}]
|
||||||
[{if $basket->getGiftCardCostNet()}]
|
[{if $basket->getGiftCardCostNet()}]
|
||||||
[{oxmultilang ident="BASKET_TOTAL_GIFTCARD_COSTS_NET"}] [{$basket->getGiftCardCostNet()}] [{$currency->sign}]
|
[{oxmultilang ident="BASKET_TOTAL_GIFTCARD_COSTS_NET"}] [{$basket->getGiftCardCostNet()}] [{$currency->sign}]
|
||||||
@ -164,7 +153,6 @@
|
|||||||
[{/block}]
|
[{/block}]
|
||||||
|
|
||||||
[{block name="email_plain_order_cust_grandtotal"}]
|
[{block name="email_plain_order_cust_grandtotal"}]
|
||||||
[{* grand total price *}]
|
|
||||||
[{oxmultilang ident="GRAND_TOTAL"}] [{$basket->getFPrice()}] [{$currency->name}]
|
[{oxmultilang ident="GRAND_TOTAL"}] [{$basket->getFPrice()}] [{$currency->name}]
|
||||||
|
|
||||||
[{if $basket->getCard()}]
|
[{if $basket->getCard()}]
|
||||||
@ -245,3 +233,4 @@
|
|||||||
[{/block}]
|
[{/block}]
|
||||||
|
|
||||||
[{oxcontent ident="oxemailfooterplain"}]
|
[{oxcontent ident="oxemailfooterplain"}]
|
||||||
|
*}]
|
1
src/Application/views/tpl/SMS/ordercanceled.tpl
Normal file
1
src/Application/views/tpl/SMS/ordercanceled.tpl
Normal file
@ -0,0 +1 @@
|
|||||||
|
Ihre Bestellung wurde storniert.
|
1
src/Application/views/tpl/SMS/sendednow.tpl
Normal file
1
src/Application/views/tpl/SMS/sendednow.tpl
Normal file
@ -0,0 +1 @@
|
|||||||
|
Ihre Bestellung wurde eben versendet.
|
@ -20,6 +20,13 @@ namespace D3\Linkmobility4OXID\Modules\Application\Controller
|
|||||||
class StartController_parent extends StartController {}
|
class StartController_parent extends StartController {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace D3\Linkmobility4OXID\Modules\Aplication\Model {
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Application\Model\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;
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
<?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 (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
||||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
|
||||||
* @link http://www.oxidmodule.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace D3\Linkmobility4OXID\Modules\Application\Controller;
|
|
||||||
|
|
||||||
use D3\LinkmobilityClient\Client;
|
|
||||||
use D3\LinkmobilityClient\SMS\Request;
|
|
||||||
use D3\LinkmobilityClient\ValueObject\Sender;
|
|
||||||
use D3\LinkmobilityClient\ValueObject\SmsMessage;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
use OxidEsales\EshopCommunity\Internal\Domain\Contact\Form\ContactFormBridgeInterface;
|
|
||||||
|
|
||||||
class ContactController extends ContactController_parent
|
|
||||||
{
|
|
||||||
public function send()
|
|
||||||
{
|
|
||||||
$contactFormBridge = $this->getContainer()->get(ContactFormBridgeInterface::class);
|
|
||||||
|
|
||||||
$form = $contactFormBridge->getContactForm();
|
|
||||||
$form->handleRequest($this->getMappedContactFormRequest());
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$contactMessageSender = oxNew(MessageSender::class);
|
|
||||||
$contactMessageSender->send(
|
|
||||||
$form->email->getValue(),
|
|
||||||
$form->subject->getValue(),
|
|
||||||
$contactFormBridge->getContactFormMessage($form)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
foreach ($form->getErrors() as $error) {
|
|
||||||
Registry::getUtilsView()->addErrorToDisplay($error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,16 +29,13 @@ class StartController extends StartController_parent
|
|||||||
//$message = "test\tMessage\ttest\tMessage";
|
//$message = "test\tMessage\ttest\tMessage";
|
||||||
|
|
||||||
$order = oxNew(Order::class);
|
$order = oxNew(Order::class);
|
||||||
$order->load('03444d89ad35b138c150003e69fdff34');
|
$order->load('eda00356201d7ec2bcf31166fa6c37dd');
|
||||||
dumpvar(__METHOD__.__LINE__.PHP_EOL);
|
|
||||||
|
|
||||||
/** @var EmailCore $mail */
|
/** @var EmailCore $mail */
|
||||||
$mail = oxNew(Email::class);
|
$mail = oxNew(Email::class);
|
||||||
$mail->d3SendOrderMessage($order);
|
$mail->d3SendOrderMessage($order);
|
||||||
die();
|
|
||||||
$user = oxNew(User::class);
|
|
||||||
$user->load('oxdefaultadmin');
|
|
||||||
$success = oxNew(Sms::class)->sendUserAccountMessage($user, $message);
|
|
||||||
dumpvar($success);
|
|
||||||
return parent::render();
|
return parent::render();
|
||||||
}
|
}
|
||||||
}
|
}
|
32
src/Modules/Application/Model/OrderModel.php
Normal file
32
src/Modules/Application/Model/OrderModel.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?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 (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||||
|
* @link http://www.oxidmodule.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace D3\Linkmobility4OXID\Modules\Application\Model;
|
||||||
|
|
||||||
|
use D3\Linkmobility4OXID\Application\Model\MessageSender;
|
||||||
|
use OxidEsales\Eshop\Core\Email;
|
||||||
|
|
||||||
|
class OrderModel extends OrderModel_parent
|
||||||
|
{
|
||||||
|
public function cancelOrder()
|
||||||
|
{
|
||||||
|
parent::cancelOrder();
|
||||||
|
|
||||||
|
if ($this->getFieldData('oxstorno') === 1) {
|
||||||
|
$Email = oxNew( Email::class );
|
||||||
|
$Email->d3SendCancelMessage($this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,8 @@ use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInte
|
|||||||
class EmailCore extends EmailCore_parent
|
class EmailCore extends EmailCore_parent
|
||||||
{
|
{
|
||||||
protected $orderCustSmsTemplate = 'd3sms_ordercust.tpl';
|
protected $orderCustSmsTemplate = 'd3sms_ordercust.tpl';
|
||||||
|
protected $orderSendedNowSmsTemplate = 'd3sms_sendednow.tpl';
|
||||||
|
protected $orderCanceledSmsTemplate = 'd3sms_ordercanceled.tpl';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Order $order
|
* @param Order $order
|
||||||
@ -40,6 +42,21 @@ class EmailCore extends EmailCore_parent
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Order $order
|
||||||
|
* @param null $subject
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function sendSendedNowMail($order, $subject = null)
|
||||||
|
{
|
||||||
|
$ret = parent::sendSendedNowMail($order, $subject);
|
||||||
|
|
||||||
|
$this->d3SendedNowMessage($order);
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Order $order
|
* @param Order $order
|
||||||
*
|
*
|
||||||
@ -47,8 +64,6 @@ class EmailCore extends EmailCore_parent
|
|||||||
*/
|
*/
|
||||||
public function d3SendOrderMessage(Order $order)
|
public function d3SendOrderMessage(Order $order)
|
||||||
{
|
{
|
||||||
dumpvar($this->d3GetOrderSmsMessageBody($order));
|
|
||||||
die();
|
|
||||||
$messageSender = oxNew(MessageSender::class);
|
$messageSender = oxNew(MessageSender::class);
|
||||||
$messageSender->sendOrderMessage($order, $this->d3GetOrderSmsMessageBody($order));
|
$messageSender->sendOrderMessage($order, $this->d3GetOrderSmsMessageBody($order));
|
||||||
}
|
}
|
||||||
@ -63,11 +78,52 @@ class EmailCore extends EmailCore_parent
|
|||||||
$renderer = $this->d3GetTplRenderer();
|
$renderer = $this->d3GetTplRenderer();
|
||||||
$this->setViewData("order", $order);
|
$this->setViewData("order", $order);
|
||||||
|
|
||||||
dumpvar($this->orderCustSmsTemplate);
|
|
||||||
|
|
||||||
return $renderer->renderTemplate($this->orderCustSmsTemplate, $this->getViewData());
|
return $renderer->renderTemplate($this->orderCustSmsTemplate, $this->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Order $order
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function d3SendedNowMessage(Order $order)
|
||||||
|
{
|
||||||
|
$messageSender = oxNew(MessageSender::class);
|
||||||
|
$messageSender->sendOrderMessage($order, $this->d3GetSendedNowSmsMessageBody($order));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Order $order
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function d3GetSendedNowSmsMessageBody(Order $order): string
|
||||||
|
{
|
||||||
|
$renderer = $this->d3GetTplRenderer();
|
||||||
|
$this->setViewData("order", $order);
|
||||||
|
|
||||||
|
return $renderer->renderTemplate($this->orderSendedNowSmsTemplate, $this->getViewData());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function d3SendCancelMessage($order)
|
||||||
|
{
|
||||||
|
$messageSender = oxNew(MessageSender::class);
|
||||||
|
$messageSender->sendCancelOrderMessage($order, $this->d3GetCancelOrderSmsMessageBody($order));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Order $order
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function d3GetCancelOrderSmsMessageBody(Order $order): string
|
||||||
|
{
|
||||||
|
$renderer = $this->d3GetTplRenderer();
|
||||||
|
$this->setViewData("order", $order);
|
||||||
|
|
||||||
|
return $renderer->renderTemplate($this->orderCanceledSmsTemplate, $this->getViewData());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Templating instance getter
|
* Templating instance getter
|
||||||
*
|
*
|
||||||
@ -75,7 +131,8 @@ class EmailCore extends EmailCore_parent
|
|||||||
*/
|
*/
|
||||||
protected function d3GetTplRenderer()
|
protected function d3GetTplRenderer()
|
||||||
{
|
{
|
||||||
$bridge = \OxidEsales\EshopCommunity\Internal\Container\ContainerFactory::getInstance()->getContainer()->get(TemplateRendererBridgeInterface::class);
|
$bridge = \OxidEsales\EshopCommunity\Internal\Container\ContainerFactory::getInstance()->getContainer()
|
||||||
|
->get(TemplateRendererBridgeInterface::class);
|
||||||
$bridge->setEngine($this->_getSmarty());
|
$bridge->setEngine($this->_getSmarty());
|
||||||
|
|
||||||
return $bridge->getTemplateRenderer();
|
return $bridge->getTemplateRenderer();
|
||||||
|
@ -19,7 +19,7 @@ $aModule = [
|
|||||||
'id' => $sModuleId,
|
'id' => $sModuleId,
|
||||||
'title' => $sD3Logo . ' Linkmobility',
|
'title' => $sD3Logo . ' Linkmobility',
|
||||||
'description' => [
|
'description' => [
|
||||||
'de' => 'Anbiundung an die Linkmobility API <ul><li>Nachrichtenversand per SMS</li></ul>',
|
'de' => 'Anbindung an die Linkmobility API <ul><li>Nachrichtenversand per SMS</li></ul>',
|
||||||
'en' => '',
|
'en' => '',
|
||||||
],
|
],
|
||||||
'thumbnail' => 'picture.png',
|
'thumbnail' => 'picture.png',
|
||||||
@ -29,17 +29,19 @@ $aModule = [
|
|||||||
'url' => 'https://www.oxidmodule.com/',
|
'url' => 'https://www.oxidmodule.com/',
|
||||||
'extend' => [
|
'extend' => [
|
||||||
\OxidEsales\Eshop\Application\Controller\StartController::class => \D3\Linkmobility4OXID\Modules\Application\Controller\StartController::class,
|
\OxidEsales\Eshop\Application\Controller\StartController::class => \D3\Linkmobility4OXID\Modules\Application\Controller\StartController::class,
|
||||||
\OxidEsales\Eshop\Application\Controller\ContactController::class => \D3\Linkmobility4OXID\Modules\Application\Controller\ContactController::class,
|
Email::class => EmailCore::class,
|
||||||
Email::class => EmailCore::class
|
\OxidEsales\Eshop\Application\Model\Order::class => \D3\Linkmobility4OXID\Modules\Application\Model\OrderModel::class
|
||||||
],
|
],
|
||||||
'controllers' => [
|
'controllers' => [
|
||||||
'd3linkmobility_user' => AdminUser::class,
|
'd3linkmobility_user' => AdminUser::class,
|
||||||
'd3linkmobility_order' => AdminOrder::class
|
'd3linkmobility_order' => AdminOrder::class
|
||||||
],
|
],
|
||||||
'templates' => [
|
'templates' => [
|
||||||
'd3adminuser.tpl' => 'd3/linkmobility/Application/views/admin/tpl/adminuser.tpl',
|
'd3adminuser.tpl' => 'd3/linkmobility/Application/views/admin/tpl/adminuser.tpl',
|
||||||
'd3adminorder.tpl' => 'd3/linkmobility/Application/views/admin/tpl/adminuser.tpl',
|
'd3adminorder.tpl' => 'd3/linkmobility/Application/views/admin/tpl/adminuser.tpl',
|
||||||
'd3sms_ordercust.tpl' => 'd3/linkmobility/Application/views/tpl/SMS/order_cust.tpl',
|
'd3sms_ordercust.tpl' => 'd3/linkmobility/Application/views/tpl/SMS/order_cust.tpl',
|
||||||
|
'd3sms_sendednow.tpl' => 'd3/linkmobility/Application/views/tpl/SMS/sendednow.tpl',
|
||||||
|
'd3sms_ordercanceled.tpl' => 'd3/linkmobility/Application/views/tpl/SMS/ordercanceled.tpl',
|
||||||
],
|
],
|
||||||
'events' => [],
|
'events' => [],
|
||||||
'settings' => [
|
'settings' => [
|
||||||
|
Reference in New Issue
Block a user