Wfs_DisableEmails - Version 1.0.0

Version Notes

Stable release

Download this release

Release Info

Developer Magento Core Team
Extension Wfs_DisableEmails
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Wfs/DisableEmails/Block/Adminhtml/System/Config/Form/Fieldset/DisableEmails.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WebFlakeStudio
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
11
+ *
12
+ *
13
+ * MAGENTO EDITION USAGE NOTICE
14
+ *
15
+ * This package designed for Magento COMMUNITY edition
16
+ * WebFlakeStudio does not guarantee correct work of this extension
17
+ * on any other Magento edition except Magento COMMUNITY edition.
18
+ * WebFlakeStudio does not provide extension support in case of
19
+ * incorrect edition usage.
20
+ *
21
+ * DISCLAIMER
22
+ *
23
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
24
+ * versions in the future.
25
+ *
26
+ * @category Wfs
27
+ * @package Wfs_DisableEmails
28
+ * @copyright Copyright (c) 2012 WebFlakeStudio (http://webflakestudio.com)
29
+ * @license http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
30
+ */
31
+ class Wfs_DisableEmails_Block_Adminhtml_System_Config_Form_Fieldset_DisableEmails
32
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
33
+ {
34
+ protected $_dummyElement;
35
+ protected $_fieldRenderer;
36
+ protected $_values;
37
+
38
+ /**
39
+ * Render form element
40
+ *
41
+ * @see Mage_Adminhtml_Block_System_Config_Form_Fieldset::render()
42
+ * @param Varien_Data_Form_Element_Abstract $element
43
+ * @return string
44
+ */
45
+ public function render(Varien_Data_Form_Element_Abstract $element)
46
+ {
47
+ $html = $this->_getHeaderHtml($element);
48
+
49
+ $emails = Mage_Core_Model_Email_Template::getDefaultTemplatesAsOptionsArray();
50
+ foreach ($emails as $notificationType) {
51
+ if ($notificationType['value']) {
52
+ $html.= $this->_getFieldHtml($element, $notificationType);
53
+ }
54
+ }
55
+ $html .= $this->_getFooterHtml($element);
56
+
57
+ return $html;
58
+ }
59
+
60
+ /**
61
+ * Get dummy element
62
+ *
63
+ * @return Varien_Object
64
+ */
65
+ protected function _getDummyElement()
66
+ {
67
+ if (empty($this->_dummyElement)) {
68
+ $this->_dummyElement = new Varien_Object(
69
+ array('show_in_default' => 1, 'show_in_website' => 1)
70
+ );
71
+ }
72
+ return $this->_dummyElement;
73
+ }
74
+
75
+ /**
76
+ * Get field renderer object
77
+ *
78
+ * @return Mage_Adminhtml_Block_System_Config_Form_Field
79
+ */
80
+ protected function _getFieldRenderer()
81
+ {
82
+ if (empty($this->_fieldRenderer)) {
83
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
84
+ }
85
+ return $this->_fieldRenderer;
86
+ }
87
+
88
+ /**
89
+ * Get form element values
90
+ *
91
+ * @return array
92
+ */
93
+ protected function _getValues()
94
+ {
95
+ if (empty($this->_values)) {
96
+ $this->_values = array(
97
+ array('label' => Mage::helper('wfs_disable_emails')->__('On'), 'value' => 0),
98
+ array('label' => Mage::helper('wfs_disable_emails')->__('Off'), 'value' => 1)
99
+ );
100
+ }
101
+ return $this->_values;
102
+ }
103
+
104
+ /**
105
+ * Get field html
106
+ *
107
+ * @param Varien_Data_Form_Element_Abstract $fieldset
108
+ * @param string $notificationType
109
+ * @return string
110
+ */
111
+ protected function _getFieldHtml($fieldset, $notificationType)
112
+ {
113
+ $configData = $this->getConfigData();
114
+ $path = Wfs_DisableEmails_Model_Email_Template::XML_PATH_PREFIX . $notificationType['value'];
115
+ if (isset($configData[$path])) {
116
+ $data = $configData[$path];
117
+ $inherit = false;
118
+ } else {
119
+ $data = (int)(string)$this->getForm()->getConfigRoot()->descend($path);
120
+ $inherit = true;
121
+ }
122
+
123
+ $e = $this->_getDummyElement();
124
+ $field = $fieldset->addField('notify_' . $notificationType['value'], 'select',
125
+ array(
126
+ 'name' => 'groups[wfs_disable_emails][fields][' . $notificationType['value'] . '][value]',
127
+ 'label' => $notificationType['label'],
128
+ 'value' => $data,
129
+ 'values' => $this->_getValues(),
130
+ 'inherit' => $inherit,
131
+ 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
132
+ 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
133
+ ))->setRenderer($this->_getFieldRenderer());
134
+
135
+ return $field->toHtml();
136
+ }
137
+ }
app/code/community/Wfs/DisableEmails/Helper/Data.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WebFlakeStudio
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
11
+ *
12
+ *
13
+ * MAGENTO EDITION USAGE NOTICE
14
+ *
15
+ * This package designed for Magento COMMUNITY edition
16
+ * WebFlakeStudio does not guarantee correct work of this extension
17
+ * on any other Magento edition except Magento COMMUNITY edition.
18
+ * WebFlakeStudio does not provide extension support in case of
19
+ * incorrect edition usage.
20
+ *
21
+ * DISCLAIMER
22
+ *
23
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
24
+ * versions in the future.
25
+ *
26
+ * @category Wfs
27
+ * @package Wfs_DisableEmails
28
+ * @copyright Copyright (c) 2012 WebFlakeStudio (http://webflakestudio.com)
29
+ * @license http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
30
+ */
31
+ class Wfs_DisableEmails_Helper_Data extends Mage_Core_Helper_Abstract
32
+ {
33
+ /**
34
+ * Check if given email template is disabled
35
+ *
36
+ * @param string $templateId
37
+ * @return boolean
38
+ */
39
+ public function isDisabled($templateId)
40
+ {
41
+ $path = Wfs_DisableEmails_Model_Email_Template::XML_PATH_PREFIX . $templateId;
42
+ return '1' === Mage::getStoreConfig($path);
43
+ }
44
+ }
app/code/community/Wfs/DisableEmails/Model/Email/Template.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WebFlakeStudio
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
11
+ *
12
+ *
13
+ * MAGENTO EDITION USAGE NOTICE
14
+ *
15
+ * This package designed for Magento COMMUNITY edition
16
+ * WebFlakeStudio does not guarantee correct work of this extension
17
+ * on any other Magento edition except Magento COMMUNITY edition.
18
+ * WebFlakeStudio does not provide extension support in case of
19
+ * incorrect edition usage.
20
+ *
21
+ * DISCLAIMER
22
+ *
23
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
24
+ * versions in the future.
25
+ *
26
+ * @category Wfs
27
+ * @package Wfs_DisableEmails
28
+ * @copyright Copyright (c) 2012 WebFlakeStudio (http://webflakestudio.com)
29
+ * @license http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
30
+ */
31
+ class Wfs_DisableEmails_Model_Email_Template extends Mage_Core_Model_Email_Template
32
+ {
33
+ const XML_PATH_PREFIX = 'system/wfs_disable_emails/';
34
+
35
+ /**
36
+ * Send transactional email to recipient
37
+ *
38
+ * @see Mage_Core_Model_Email_Template::sendTransactional()
39
+ * @param string $templateId
40
+ * @param string|array $sender sneder information, can be declared as part of config path
41
+ * @param string $email recipient email
42
+ * @param string $name recipient name
43
+ * @param array $vars varianles which can be used in template
44
+ * @param int|null $storeId
45
+ * @return Mage_Core_Model_Email_Template
46
+ */
47
+ public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
48
+ {
49
+ if (!Mage::helper('wfs_disable_emails')->isDisabled($templateId)) {
50
+ return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
51
+ } else {
52
+ $this->setSentSuccess(true);
53
+ return $this;
54
+ }
55
+ }
56
+ }
app/code/community/Wfs/DisableEmails/WFS-LICENSE-COMMUNITY.txt ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ WebFlakeStudio EULA
2
+ www.webflakestudio.com
3
+
4
+ THIS LICENSE AGREEMENT (HEREINAFTER AGREEMENT) IS AN AGREEMENT BETWEEN YOU (THE
5
+ PERSON OR COMPANY WHO IS BEING LICENSED TO USE THE SOFTWARE OR DOCUMENTATION)
6
+ AND WEBFLAKESTUDIO (HEREINAFTER WE/US/OUR). THE AGREEMENT APPLIES TO ALL
7
+ PRODUCTS/SOFTWARE/SCRIPTS/SERVICES YOU PURCHASE FROM US.
8
+
9
+ 1. By purchasing the Software you acknowledge that you have read this Agreement,
10
+ and that you agree to the content of the Agreement and its terms, and agree
11
+ to use the Software in compliance with this Agreement.
12
+
13
+ 2. The Agreement comes into legal force at the moment when you order our
14
+ Software from our site or receive it through email or on data medium at the
15
+ our discretion.
16
+
17
+ 3. We are the copyright holder of the Software. The Software or a portion of it
18
+ is a copyrightable matter and is liable to protection by the law. Any
19
+ activity that infringes terms of this Agreement violates copyright law and
20
+ will be prosecuted according to the current law. We reserve the right to
21
+ revoke the license of any user who is holding an invalid license.
22
+
23
+ 4. This Agreement gives you the right to use only one copy of the Software on
24
+ one Magento installation solely for your own personal or business use,
25
+ subject to all other terms of this Agreement. A separate License should be
26
+ purchased for each new Software installation. Any distribution of the Software
27
+ without our consent, including noncommercial distribution is regarded as
28
+ violation of this Agreement and entails liability, according to the current law.
29
+
30
+ 5. You may not use any part of the code in whole or part in any other software
31
+ or product or website.
32
+
33
+ 6. You may not give, sell, distribute, sub-license, rent, lease or lend any
34
+ portion of the Software or Documentation to anyone. You may not place the
35
+ Software on a server so that it is accessible via a public network such as
36
+ the Internet for distribution purposes.
37
+
38
+ 7. You are bound to preserve the copyright information intact, this includes the
39
+ text/link at bottom.
40
+
41
+ 8. We reserve the right to publish a selected list of users of our Software.
42
+
43
+ 9. We will not be liable to you for any damages (including any loss of
44
+ profits/saving, or incidental or consequential) caused to you, your
45
+ information and your business arising out of the use or inability to use
46
+ this Software.
47
+
48
+ 10. We are not liable for prosecution arising from use of the Software against
49
+ law or for any illegal use.
50
+
51
+ 11. If you fail to use the Software in accordance with the terms and conditions
52
+ of this License Agreement, it constitutes a breach of the agreement, and
53
+ your license to use the program is revoked.
54
+
55
+ 12. WebflakeStudio reserves the right to change this license agreement at any
56
+ time and impose its clauses at any given time.
57
+
58
+ 13. License agreement remains effective until terminated. We retain the right to
59
+ terminate your license to use the Software at any time, if in its sole
60
+ discretion, you are not abiding by the terms of the Agreement, including,
61
+ but not limited to, obscuring or removing any link or copyright notice as
62
+ specified in this agreement. You may terminate it at any time by destroying
63
+ all copies of the Software. Termination of this Agreement does not bind us
64
+ to return you the amount spent for purchase of the Software.
65
+
66
+ 14. If you continue to use the Software after WebflakeStudio gives you notice
67
+ of termination of your license, you hereby agree to accept an injunction to
68
+ enjoin you from its further use and to pay all costs (including but not
69
+ limited to reasonable attorney fees) to enforce our revocation of your
70
+ license and any damages suffered by us because of your misuse of
71
+ the Software.
72
+
73
+ 15. This software designed for Magento COMMUNITY edition. WebflakeStudio does not
74
+ guarantee correct work of this extension on any other Magento edition except
75
+ Magento COMMUNITY edition.
app/code/community/Wfs/DisableEmails/etc/config.xml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WebFlakeStudio
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
12
+ *
13
+ *
14
+ * MAGENTO EDITION USAGE NOTICE
15
+ *
16
+ * This package designed for Magento COMMUNITY edition
17
+ * WebFlakeStudio does not guarantee correct work of this extension
18
+ * on any other Magento edition except Magento COMMUNITY edition.
19
+ * WebFlakeStudio does not provide extension support in case of
20
+ * incorrect edition usage.
21
+ *
22
+ * DISCLAIMER
23
+ *
24
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
25
+ * versions in the future.
26
+ *
27
+ * @category Wfs
28
+ * @package Wfs_DisableEmails
29
+ * @copyright Copyright (c) 2012 WebFlakeStudio (http://webflakestudio.com)
30
+ * @license http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
31
+ */
32
+ -->
33
+ <config>
34
+ <modules>
35
+ <Wfs_DisableEmails>
36
+ <version>1.0.0</version>
37
+ </Wfs_DisableEmails>
38
+ </modules>
39
+ <global>
40
+ <helpers>
41
+ <wfs_disable_emails>
42
+ <class>Wfs_DisableEmails_Helper</class>
43
+ </wfs_disable_emails>
44
+ </helpers>
45
+ <models>
46
+ <core>
47
+ <rewrite>
48
+ <email_template>Wfs_DisableEmails_Model_Email_Template</email_template>
49
+ </rewrite>
50
+ </core>
51
+ </models>
52
+ <blocks>
53
+ <wfs_disableemails>
54
+ <class>Wfs_DisableEmails_Block</class>
55
+ </wfs_disableemails>
56
+ </blocks>
57
+ </global>
58
+ </config>
app/code/community/Wfs/DisableEmails/etc/system.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WebFlakeStudio
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
12
+ *
13
+ *
14
+ * MAGENTO EDITION USAGE NOTICE
15
+ *
16
+ * This package designed for Magento COMMUNITY edition
17
+ * WebFlakeStudio does not guarantee correct work of this extension
18
+ * on any other Magento edition except Magento COMMUNITY edition.
19
+ * WebFlakeStudio does not provide extension support in case of
20
+ * incorrect edition usage.
21
+ *
22
+ * DISCLAIMER
23
+ *
24
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
25
+ * versions in the future.
26
+ *
27
+ * @category Wfs
28
+ * @package Wfs_DisableEmails
29
+ * @copyright Copyright (c) 2012 WebFlakeStudio (http://webflakestudio.com)
30
+ * @license http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
31
+ */
32
+ -->
33
+ <config>
34
+ <sections>
35
+ <system>
36
+ <groups>
37
+ <wfs_disable_emails translate="label" module="wfs_disable_emails">
38
+ <label>Disable Email Notifications</label>
39
+ <frontend_type>text</frontend_type>
40
+ <frontend_model>wfs_disableemails/adminhtml_system_config_form_fieldset_disableEmails</frontend_model>
41
+ <sort_order>40</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </wfs_disable_emails>
46
+ </groups>
47
+ </system>
48
+ </sections>
49
+ </config>
app/etc/modules/Wfs_DisableEmails.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WebFlakeStudio
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
12
+ *
13
+ *
14
+ * MAGENTO EDITION USAGE NOTICE
15
+ *
16
+ * This package designed for Magento COMMUNITY edition
17
+ * WebFlakeStudio does not guarantee correct work of this extension
18
+ * on any other Magento edition except Magento COMMUNITY edition.
19
+ * WebFlakeStudio does not provide extension support in case of
20
+ * incorrect edition usage.
21
+ *
22
+ * DISCLAIMER
23
+ *
24
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
25
+ * versions in the future.
26
+ *
27
+ * @category Wfs
28
+ * @package Wfs_DisableEmails
29
+ * @copyright Copyright (c) 2012 WebFlakeStudio (http://webflakestudio.com)
30
+ * @license http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt
31
+ */
32
+ -->
33
+ <config>
34
+ <modules>
35
+ <Wfs_DisableEmails>
36
+ <active>true</active>
37
+ <codePool>community</codePool>
38
+ </Wfs_DisableEmails>
39
+ </modules>
40
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Wfs_DisableEmails</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://webflakestudio.com/WFS-LICENSE-COMMUNITY.txt">WebFlakeStudio custom license</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension allows to disable specific email notifications in Magento.</summary>
10
+ <description>Disable Emails extension from WebFlakeStudio allows to disable specific email notifications in Magento store. In some cases it is needed to disable particular transactional email. You can do this easily with Wfs_DisableEmails module.&#xD;
11
+ This extension can be used to disable all native Magento email notifications and even notifications of custom modules.&#xD;
12
+ But be careful, and don't disable Remind Password notification :)</description>
13
+ <notes>Stable release</notes>
14
+ <authors><author><name>WebFlakeStudio</name><user>auto-converted</user><email>webflakestudio@gmail.com</email></author></authors>
15
+ <date>2012-04-24</date>
16
+ <time>12:31:07</time>
17
+ <contents><target name="magecommunity"><dir name="Wfs"><dir name="DisableEmails"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><file name="DisableEmails.php" hash="c22d12aa471d2ff9ddad366c97dc8c62"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="44996e62b767efce86d7cbeae9ee56de"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="8e7d6db646896664929dc11278cc330a"/></dir></dir><dir name="etc"><file name="config.xml" hash="65bd5cddd7e50ed6e17c5fe032d9df64"/><file name="system.xml" hash="8a56a027b9e5dfa040b06c39265a3e95"/></dir><file name="WFS-LICENSE-COMMUNITY.txt" hash="5110d0940ef56f2f91bfd8da858c1c1f"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wfs_DisableEmails.xml" hash="0bbc0af646ff4c4d1e31e4bf844cc5ed"/></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies/>
20
+ </package>