diff --git a/vendor/magento/module-purchase-order/Model/Plugin/DisableCommunicationsForPurchaseOrders.php b/vendor/magento/module-purchase-order/Model/Plugin/DisableCommunicationsForPurchaseOrders.php new file mode 100644 index 0000000000..6f4317a9a8 --- /dev/null +++ b/vendor/magento/module-purchase-order/Model/Plugin/DisableCommunicationsForPurchaseOrders.php @@ -0,0 +1,44 @@ +scopeConfig = $scopeConfig; + } + + /** + * Disable sending email based on the global system configuration setting + * + * @param Config $subject + * @param bool $result + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterIsEnabledForStoreView(Config $subject, bool $result): bool + { + if ($this->scopeConfig->isSetFlag('system/smtp/disable', ScopeInterface::SCOPE_STORE)) { + $result = false; + } + return $result; + } +} diff --git a/vendor/magento/module-purchase-order/etc/di.xml b/vendor/magento/module-purchase-order/etc/di.xml index 369ae3458e..7d1bca3555 100644 --- a/vendor/magento/module-purchase-order/etc/di.xml +++ b/vendor/magento/module-purchase-order/etc/di.xml @@ -262,4 +262,7 @@ + + +