initial
This commit is contained in:
bovenliggende
5beb8d8782
commit
7219eead2d
@ -15,12 +15,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\Linkmobility4Ordermanager\Application\Model;
|
||||
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\Ordermanager\Application\Model\Actions\d3ordermanager_action_abstract;
|
||||
use D3\Ordermanager\Application\Model\d3ordermanager_conf;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use OxidEsales\Eshop\Application\Model\Content;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||
{
|
||||
@ -99,18 +103,14 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||
|
||||
$aMailDesc = [];
|
||||
$aEditedValues ?
|
||||
($aEditedValues['blSendMailToCustomer'] ? $aMailDesc[] = 'Customer' : '') :
|
||||
($this->getManager()->getValue('blSendMailToCustomer') ? $aMailDesc[] = 'Customer' : '');
|
||||
($aEditedValues['blLinkMobilityMessageToCustomer'] ? $aMailDesc[] = 'Customer' : '') :
|
||||
($this->getManager()->getValue('blLinkMobilityMessageToCustomer') ? $aMailDesc[] = 'Customer' : '');
|
||||
$aEditedValues ?
|
||||
($aEditedValues['blSendMailToOwner'] ? $aMailDesc[] = 'Owner' : '') :
|
||||
($this->getManager()->getValue('blSendMailToOwner') ? $aMailDesc[] = 'Owner' : '');
|
||||
$aEditedValues ?
|
||||
($aEditedValues['blSendMailToCustom'] ? $aMailDesc[] = 'Custom: ' . $aEditedValues['sSendMailToCustomAddress'] : '') :
|
||||
($this->getManager()->getValue('blSendMailToCustom') ?
|
||||
$aMailDesc[] = 'Custom: ' . $this->getManager()->getValue('sSendMailToCustomAddress') :
|
||||
($aEditedValues['blLinkMobilityMessageToCustom'] ? $aMailDesc[] = 'Custom: ' . $aEditedValues['sLinkMobilityMessageToCustomAddress'] : '') :
|
||||
($this->getManager()->getValue('blLinkMobilityMessageToCustom') ?
|
||||
$aMailDesc[] = 'Custom: ' . $this->getManager()->getValue('sLinkMobilityMessageToCustomAddress') :
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
return implode(', ', $aMailDesc);
|
||||
}
|
||||
@ -177,6 +177,33 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||
return $this->getManager()->getExecMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws DatabaseException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function startExecution()
|
||||
{
|
||||
if ($this->canExecuteMethod() && $this->hasRequiredValues()) {
|
||||
$this->getSendClass()->sendOrderManagerSms($this->getManager(), $this->getItem());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3linkmobility_ordermanager_sender
|
||||
*/
|
||||
public function getSendClass()
|
||||
{
|
||||
/** @var d3linkmobility_ordermanager_sender $mailer */
|
||||
$sender = oxNew(d3linkmobility_ordermanager_sender::class);
|
||||
|
||||
return $sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
100
src/Application/Model/d3linkmobility_ordermanager_sender.php
Normal file
100
src/Application/Model/d3linkmobility_ordermanager_sender.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?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;
|
||||
|
||||
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
|
||||
use D3\Linkmobility4OXID\Application\Model\OrderRecipients;
|
||||
use D3\LinkmobilityClient\ValueObject\Recipient;
|
||||
use D3\Ordermanager\Application\Model\d3ordermanager;
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
|
||||
class d3linkmobility_ordermanager_sender
|
||||
{
|
||||
/** @var d3ordermanager */
|
||||
protected $manager;
|
||||
|
||||
/** @var Order */
|
||||
protected $item;
|
||||
|
||||
public function sendOrderManagerSms(d3ordermanager $manager, Order $item)
|
||||
{
|
||||
$this->setManager($manager);
|
||||
$this->setItem($item);
|
||||
|
||||
$sms = oxNew(Sms::class, $this->getMessageBody());
|
||||
$sms->sendCustomRecipientMessage($this->getRecipients());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getMessageBody(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException
|
||||
* @throws \D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException
|
||||
*/
|
||||
protected function getRecipients(): array
|
||||
{
|
||||
$aEditedValues = $this->getManager()->getEditedValues();
|
||||
|
||||
$recipients = [];
|
||||
if ($aEditedValues && $aEditedValues['blLinkMobilityMessageToCustomer']) {
|
||||
$recipients[] = oxNew(OrderRecipients::class, $this->getItem())->getSmsRecipient();
|
||||
}
|
||||
if ($aEditedValues && $aEditedValues['blLinkMobilityMessageToCustom']) {
|
||||
$recipients[] = oxNew(Recipient::class, 'number', 'DE');
|
||||
}
|
||||
|
||||
return $recipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Order
|
||||
*/
|
||||
public function getItem(): Order
|
||||
{
|
||||
return $this->item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $item
|
||||
*/
|
||||
public function setItem(Order $item): void
|
||||
{
|
||||
$this->item = $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3ordermanager $manager
|
||||
*/
|
||||
public function setManager(d3ordermanager $manager): void
|
||||
{
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3ordermanager
|
||||
*/
|
||||
public function getManager(): d3ordermanager
|
||||
{
|
||||
return $this->manager;
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
<input style="margin-left: 20px;" id="FromThemeFrontend" type="radio" name="value[sLinkMobilityMessageFromTheme]" value="frontend" [{if $edit->getValue('sLinkMobilityMessageFromTheme') == 'frontend'}]checked[{/if}] [{$blActionRestriction}] [{$readonly}]> <label for="FromThemeFrontend">[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMTPL_FRONTEND"}] ([{$oView->getManagerTemplateDirs(0)}])</label><br>
|
||||
<input style="margin-left: 20px;" id="FromModule" type="radio" name="value[sLinkMobilityMessageFromTheme]" value="module" [{if $edit->getValue('sLinkMobilityMessageFromTheme') == 'module'}]checked[{/if}] [{$blActionRestriction}] [{$readonly}]>
|
||||
<label for="FromModule">[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMTPL_MODULE"}]</label>
|
||||
<label for="FromModuleId" style="position: absolute; left: -2000px">[{oxmultilang ident="D3_ORDERMANAGER_ACTION_MAILSEND"}]</label>
|
||||
<label for="FromModuleId" style="position: absolute; left: -2000px">[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE"}]</label>
|
||||
<select id="FromModuleId" class="editinput" name="value[sLinkMobilityMessageFromModulePath]" size="1" [{$blActionRestriction}] [{$readonly}]>
|
||||
[{foreach from=$oView->getModulePathList() key="sId" item="sModulePath"}]
|
||||
<option value="[{$sId}]" [{if $edit->getValue('sLinkMobilityMessageFromModulePath') == $sId}]selected[{/if}]>[{$sModulePath}]</option>
|
||||
@ -30,10 +30,24 @@
|
||||
</SELECT> <br>
|
||||
|
||||
<hr>
|
||||
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROM2"}]<br>
|
||||
|
||||
<input type="hidden" name="value[blLinkMobilityMessageToCustomer]" value="0">
|
||||
<input id="ToCustomer" class="edittext ext_edittext" type="checkbox" name="value[blLinkMobilityMessageToCustomer]" value='1' [{if $edit->getValue('blLinkMobilityMessageToCustomer') == 1}]checked[{/if}] [{$blActionRestriction}] [{$readonly}]>
|
||||
<label for="ToCustomer">[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOCUSTOMER"}]</label>
|
||||
[{oxinputhelp ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOCUSTOMER_DESC"}]<br>
|
||||
<input type="hidden" name="value[blLinkMobilityMessageToCustom]" value="0">
|
||||
<input id="ToMail" class="edittext ext_edittext" type="checkbox" name="value[blLinkMobilityMessageToCustom]" value='1' [{if $edit->getValue('blLinkMobilityMessageToCustom') == 1}]checked[{/if}] [{$blActionRestriction}] [{$readonly}]>
|
||||
<label for="ToMail">[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOMAIL"}]</label>
|
||||
<label for="ToMailInput" style="position: absolute; left: -2000px">[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE"}]</label>
|
||||
<input id="ToMailInput" type="text" name="value[sLinkMobilityMessageToCustomAddress]" size="30" maxlength="60" value="[{$edit->getValue('sLinkMobilityMessageToCustomAddress')}]" [{$blActionRestriction}] [{$readonly}]>
|
||||
[{oxinputhelp ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOMAIL_DESC"}]
|
||||
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings"}] [{oxinputhelp ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings_DESC"}]<br>
|
||||
[{/block}]
|
||||
[{else}]
|
||||
[{block name="ordermanager_admin_action_sendmail_viewer"}]
|
||||
[{block name="ordermanager_admin_action_LinkMobilityMessage_viewer"}]
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROM1"}]<br>
|
||||
[{if $edit->getValue('sLinkMobilityMessageFromSource') == 'template'}]
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROMTEMPLATE"}]
|
||||
@ -57,6 +71,19 @@
|
||||
[{/foreach}]
|
||||
[{/if}]
|
||||
<hr>
|
||||
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_FROM2"}]<br>
|
||||
|
||||
[{if $edit->getValue('blLinkMobilityMessageToCustomer') == 1}]
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOCUSTOMER"}]
|
||||
[{oxinputhelp ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOCUSTOMER_DESC"}],
|
||||
[{/if}]
|
||||
[{if $edit->getValue('blLinkMobilityMessageToCustom') == 1}]
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOMAIL"}]
|
||||
"[{$edit->getValue('sLinkMobilityMessageToCustomAddress')}]"
|
||||
[{oxinputhelp ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_TOMAIL_DESC"}]
|
||||
[{/if}]
|
||||
|
||||
[{oxmultilang ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings"}] [{oxinputhelp ident="D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ToUseLMSettings_DESC"}]<br>
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user