Files
ltsecurityinc/app/code/JR/NetSuite/Plugin/EmailNotification.php
T

39 lines
934 B
PHP
Executable File

<?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;
}
}