ltsecurityinc安防产品在线商城代码
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace JR\NetSuite\Plugin;
|
||||
|
||||
use Magento\Framework\App\Config\ScopeConfigInterface;
|
||||
use Magento\Store\Model\ScopeInterface;
|
||||
|
||||
class EmailNotification
|
||||
{
|
||||
/**
|
||||
* @var ScopeConfigInterface
|
||||
*/
|
||||
protected $_scopeConfig;
|
||||
|
||||
public function __construct(
|
||||
ScopeConfigInterface $scopeConfig
|
||||
) {
|
||||
$this->_scopeConfig = $scopeConfig;
|
||||
}
|
||||
|
||||
public function aroundNewAccount(
|
||||
\Magento\Customer\Model\EmailNotification $subject,
|
||||
\Closure $proceed,
|
||||
$customer,
|
||||
$type = \Magento\Customer\Model\EmailNotification::NEW_ACCOUNT_EMAIL_REGISTERED,
|
||||
$backUrl = '',
|
||||
$storeId = null,
|
||||
$sendemailStoreId = null
|
||||
) {
|
||||
$disabled = $customer->getCustomAttribute('netsuite_id');
|
||||
|
||||
if ($disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = $proceed($customer, $type, $backUrl, $storeId, $sendemailStoreId);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace JR\NetSuite\Plugin;
|
||||
|
||||
class SendEmailWhenRmaChanged
|
||||
{
|
||||
/**
|
||||
* @var \JR\NetSuite\Model\ResourceModel\RmaQueue\CollectionFactory
|
||||
*/
|
||||
private $rmaQueueCollectionFactory;
|
||||
|
||||
/**
|
||||
* @var \Mirasvit\Rma\Api\Service\Rma\RmaManagementInterface
|
||||
*/
|
||||
private $rmaManagement;
|
||||
|
||||
public function __construct(
|
||||
\JR\NetSuite\Model\ResourceModel\RmaQueue\CollectionFactory $rmaQueueCollectionFactory,
|
||||
\Mirasvit\Rma\Api\Service\Rma\RmaManagementInterface $rmaManagement
|
||||
)
|
||||
{
|
||||
$this->rmaQueueCollectionFactory = $rmaQueueCollectionFactory;
|
||||
$this->rmaManagement = $rmaManagement;
|
||||
}
|
||||
|
||||
public function aroundOnRmaStatusChange(
|
||||
\Mirasvit\Rma\Helper\Rma\Event $subject,
|
||||
callable $proceed,
|
||||
$rma
|
||||
) {
|
||||
// if RMA just created, do nothing
|
||||
$rmaQueueCollection = $this->rmaQueueCollectionFactory->create();
|
||||
$rmaQueueCollection->addFieldToFilter('status', 'processing');
|
||||
|
||||
$order = $this->rmaManagement->getOrder($rma);
|
||||
|
||||
foreach ($rmaQueueCollection as $rmaQueue) {
|
||||
if ($rmaQueue->getOrderIncrementId() == $order->getRealorderId()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $proceed($rma);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user