Data.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Helper;
  7. use Magento\Store\Model\Store;
  8. /**
  9. * Sales module base helper
  10. *
  11. * @author Magento Core Team <core@magentocommerce.com>
  12. */
  13. class Data extends \Magento\Framework\App\Helper\AbstractHelper
  14. {
  15. /**
  16. * Check allow to send new order confirmation email
  17. *
  18. * @param null|string|bool|int|Store $store
  19. * @return bool
  20. */
  21. public function canSendNewOrderConfirmationEmail($store = null)
  22. {
  23. return $this->scopeConfig->isSetFlag(
  24. \Magento\Sales\Model\Order\Email\Container\OrderIdentity::XML_PATH_EMAIL_ENABLED,
  25. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  26. $store
  27. );
  28. }
  29. /**
  30. * Check allow to send new order email
  31. *
  32. * @param null|string|bool|int|Store $store
  33. * @return bool
  34. */
  35. public function canSendNewOrderEmail($store = null)
  36. {
  37. return $this->canSendNewOrderConfirmationEmail($store);
  38. }
  39. /**
  40. * Check allow to send order comment email
  41. *
  42. * @param null|string|bool|int|Store $store
  43. * @return bool
  44. */
  45. public function canSendOrderCommentEmail($store = null)
  46. {
  47. return $this->scopeConfig->isSetFlag(
  48. \Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity::XML_PATH_EMAIL_ENABLED,
  49. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  50. $store
  51. );
  52. }
  53. /**
  54. * Check allow to send new shipment email
  55. *
  56. * @param null|string|bool|int|Store $store
  57. * @return bool
  58. */
  59. public function canSendNewShipmentEmail($store = null)
  60. {
  61. return $this->scopeConfig->isSetFlag(
  62. \Magento\Sales\Model\Order\Email\Container\ShipmentIdentity::XML_PATH_EMAIL_ENABLED,
  63. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  64. $store
  65. );
  66. }
  67. /**
  68. * Check allow to send shipment comment email
  69. *
  70. * @param null|string|bool|int|Store $store
  71. * @return bool
  72. */
  73. public function canSendShipmentCommentEmail($store = null)
  74. {
  75. return $this->scopeConfig->isSetFlag(
  76. \Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity::XML_PATH_EMAIL_ENABLED,
  77. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  78. $store
  79. );
  80. }
  81. /**
  82. * Check allow to send new invoice email
  83. *
  84. * @param null|string|bool|int|Store $store
  85. * @return bool
  86. */
  87. public function canSendNewInvoiceEmail($store = null)
  88. {
  89. return $this->scopeConfig->isSetFlag(
  90. \Magento\Sales\Model\Order\Email\Container\InvoiceIdentity::XML_PATH_EMAIL_ENABLED,
  91. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  92. $store
  93. );
  94. }
  95. /**
  96. * Check allow to send invoice comment email
  97. *
  98. * @param null|string|bool|int|Store $store
  99. * @return bool
  100. */
  101. public function canSendInvoiceCommentEmail($store = null)
  102. {
  103. return $this->scopeConfig->isSetFlag(
  104. \Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity::XML_PATH_EMAIL_ENABLED,
  105. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  106. $store
  107. );
  108. }
  109. /**
  110. * Check allow to send new creditmemo email
  111. *
  112. * @param null|string|bool|int|Store $store
  113. * @return bool
  114. */
  115. public function canSendNewCreditmemoEmail($store = null)
  116. {
  117. return $this->scopeConfig->isSetFlag(
  118. \Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity::XML_PATH_EMAIL_ENABLED,
  119. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  120. $store
  121. );
  122. }
  123. /**
  124. * Check allow to send creditmemo comment email
  125. *
  126. * @param null|string|bool|int|Store $store
  127. * @return bool
  128. */
  129. public function canSendCreditmemoCommentEmail($store = null)
  130. {
  131. return $this->scopeConfig->isSetFlag(
  132. \Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity::XML_PATH_EMAIL_ENABLED,
  133. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  134. $store
  135. );
  136. }
  137. }