Version Notes
0.9.2 Release
Download this release
Release Info
Developer | Magento Core Team |
Extension | Fooman_EmailAttachments |
Version | 0.9.5 |
Comparing to | |
See all releases |
Code changes from version 0.9.3 to 0.9.5
- app/code/community/Fooman/Common/Block/Adminhtml/Extensioninfo.php +42 -0
- app/code/community/Fooman/Common/Helper/Data.php +18 -0
- app/code/community/Fooman/Common/Helper/Debug.php +0 -38
- app/code/community/Fooman/Common/Model/Selftester.php +185 -0
- app/code/community/Fooman/Common/Model/Selftester/Abstract.php +126 -0
- app/code/community/Fooman/Common/Model/Selftester/Db.php +146 -0
- app/code/community/Fooman/Common/controllers/Adminhtml/SelftesterController.php +56 -0
- app/code/community/Fooman/Common/etc/config.xml +28 -1
- app/code/community/Fooman/Common/etc/system.xml +11 -3
- app/code/community/Fooman/EmailAttachments/Block/Adminhtml/Extensioninfo.php +8 -0
- app/code/community/Fooman/EmailAttachments/Helper/Data.php +39 -3
- app/code/community/Fooman/EmailAttachments/Model/Core/Email/Template/Mailer.php +39 -29
- app/code/community/Fooman/EmailAttachments/Model/Observer.php +67 -32
- app/code/community/Fooman/EmailAttachments/Model/Order/Pdf/Order.php +13 -5
- app/code/community/Fooman/EmailAttachments/Model/Selftester.php +66 -0
- app/code/community/Fooman/EmailAttachments/etc/config.xml +21 -2
- app/code/community/Fooman/EmailAttachments/etc/system.xml +43 -13
- package.xml +4 -4
app/code/community/Fooman/Common/Block/Adminhtml/Extensioninfo.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fooman Common
|
4 |
+
*
|
5 |
+
* @package Fooman_Common
|
6 |
+
* @author Kristof Ringleff <kristof@fooman.co.nz>
|
7 |
+
* @copyright Copyright (c) 2012 Fooman Limited (http://www.fooman.co.nz)
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Fooman_Common_Block_Adminhtml_Extensioninfo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
14 |
+
{
|
15 |
+
protected $_hasSelftest = false;
|
16 |
+
protected $_idString = '';
|
17 |
+
protected $_moduleName = '';
|
18 |
+
|
19 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
20 |
+
{
|
21 |
+
$this->setTemplate('fooman/common/selftester.phtml');
|
22 |
+
$this->setShowSelftestButton(false);
|
23 |
+
if ($this->_hasSelftest) {
|
24 |
+
if (Mage::getModel($this->_idString . '/selftester')) {
|
25 |
+
$this->setShowSelftestButton(true);
|
26 |
+
$this->setSelftestButtonUrl(
|
27 |
+
Mage::helper('adminhtml')->getUrl(
|
28 |
+
'adminhtml/selftester',
|
29 |
+
array(
|
30 |
+
'module' => $this->_idString,
|
31 |
+
'moduleName' => $this->_moduleName
|
32 |
+
)
|
33 |
+
)
|
34 |
+
);
|
35 |
+
$element->setReadonly(true, true);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
$this->setConfigVersion((string)Mage::getConfig()->getModuleConfig($this->_moduleName)->version);
|
39 |
+
|
40 |
+
return $this->_toHtml();
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Fooman/Common/Helper/Data.php
CHANGED
@@ -22,4 +22,22 @@ class Fooman_Common_Helper_Data extends Mage_Core_Helper_Abstract
|
|
22 |
{
|
23 |
return hash('sha256', str_replace(array("\r\n", "\n", "\r", " ", PHP_EOL), '', $serial));
|
24 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
22 |
{
|
23 |
return hash('sha256', str_replace(array("\r\n", "\n", "\r", " ", PHP_EOL), '', $serial));
|
24 |
}
|
25 |
+
|
26 |
+
public function getOverlayFileName()
|
27 |
+
{
|
28 |
+
if (file_exists(BP .DS.'skin'.DS.'adminhtml'.DS.'default'.DS.'default'.DS.'lib'.DS.'prototype'.DS.'windows'.DS.'themes'.DS.'magento.css')) {
|
29 |
+
return 'lib/prototype/windows/themes/magento.css';
|
30 |
+
} else {
|
31 |
+
return 'prototype/windows/themes/magento.css';
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getOverlayFileType()
|
36 |
+
{
|
37 |
+
if (file_exists(BP .DS.'skin'.DS.'adminhtml'.DS.'default'.DS.'default'.DS.'lib'.DS.'prototype'.DS.'windows'.DS.'themes'.DS.'magento.css')) {
|
38 |
+
return 'skin_css';
|
39 |
+
} else {
|
40 |
+
return 'js_css';
|
41 |
+
}
|
42 |
+
}
|
43 |
}
|
app/code/community/Fooman/Common/Helper/Debug.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @author Kristof Ringleff
|
5 |
-
* @package Fooman_Common
|
6 |
-
* @copyright Copyright (c) 2009 Fooman Limited (http://www.fooman.co.nz)
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
class Fooman_Common_Helper_Debug extends Mage_Core_Helper_Abstract
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* send to Firebug
|
16 |
-
*
|
17 |
-
* @param $content
|
18 |
-
*/
|
19 |
-
public function sendToFirebug($content)
|
20 |
-
{
|
21 |
-
$writer = new Zend_Log_Writer_Firebug();
|
22 |
-
$logger = new Zend_Log($writer);
|
23 |
-
|
24 |
-
$request = new Zend_Controller_Request_Http();
|
25 |
-
$response = new Zend_Controller_Response_Http();
|
26 |
-
$channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
|
27 |
-
$channel->setRequest($request);
|
28 |
-
$channel->setResponse($response);
|
29 |
-
|
30 |
-
// Start output buffering
|
31 |
-
ob_start();
|
32 |
-
$logger->log($content, Zend_Log::INFO);
|
33 |
-
|
34 |
-
// Flush log data to browser
|
35 |
-
$channel->flush();
|
36 |
-
$response->sendHeaders();
|
37 |
-
}
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Fooman/Common/Model/Selftester.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fooman Common
|
4 |
+
*
|
5 |
+
* @package Fooman_Common
|
6 |
+
* @author Kristof Ringleff <kristof@fooman.co.nz>
|
7 |
+
* @copyright Copyright (c) 2012 Fooman Limited (http://www.fooman.co.nz)
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Fooman_Common_Model_Selftester extends Fooman_Common_Model_Selftester_Abstract
|
14 |
+
{
|
15 |
+
public $messages = array();
|
16 |
+
public $errorOccurred = false;
|
17 |
+
protected $_fix = false;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Start the selftest
|
21 |
+
*
|
22 |
+
* @return $this
|
23 |
+
*/
|
24 |
+
public function main ()
|
25 |
+
{
|
26 |
+
$this->messages[] = 'Starting ' . get_class($this);
|
27 |
+
$failed = false;
|
28 |
+
try {
|
29 |
+
if (!$this->selfCheckLocation()) {
|
30 |
+
$failed = true;
|
31 |
+
}
|
32 |
+
if (Mage::app()->getRequest()->getParam('fix') == 'true') {
|
33 |
+
$this->_fix = true;
|
34 |
+
}
|
35 |
+
if (!$this->checkFileLocations()) {
|
36 |
+
$failed = true;
|
37 |
+
}
|
38 |
+
if (!$this->magentoRewrites()) {
|
39 |
+
$failed = true;
|
40 |
+
}
|
41 |
+
if (!$this->dbCheck()) {
|
42 |
+
$failed = true;
|
43 |
+
}
|
44 |
+
if (!$this->hasSettings()) {
|
45 |
+
$failed = true;
|
46 |
+
}
|
47 |
+
if (!$failed) {
|
48 |
+
$this->messages[] = 'Result: success';
|
49 |
+
} else {
|
50 |
+
$this->messages[] = 'Result: failure';
|
51 |
+
$this->errorOccurred = true;
|
52 |
+
}
|
53 |
+
} catch (Exception $e) {
|
54 |
+
$this->errorOccurred = true;
|
55 |
+
$this->messages[] = $e->getMessage();
|
56 |
+
}
|
57 |
+
$this->messages[] = 'Self-test finished';
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* preliminary tests if the selftest can find a Magento instance
|
63 |
+
*
|
64 |
+
* @return bool
|
65 |
+
* @throws Exception
|
66 |
+
*/
|
67 |
+
public function selfCheckLocation()
|
68 |
+
{
|
69 |
+
if (file_exists('app' . DIRECTORY_SEPARATOR . 'Mage.php')) {
|
70 |
+
require_once 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
|
71 |
+
Mage::app();
|
72 |
+
$this->messages[] = "Default store loaded";
|
73 |
+
$this->_getVersions();
|
74 |
+
} else {
|
75 |
+
$this->messages[] = 'Can\'t instantiate Magento. Is the file uploaded to your root Magento folder?';
|
76 |
+
throw new Exception();
|
77 |
+
}
|
78 |
+
return true;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function shouldFix()
|
82 |
+
{
|
83 |
+
return $this->_fix;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* test if all expected files exist and can be read/opened
|
88 |
+
*
|
89 |
+
* @return bool
|
90 |
+
*/
|
91 |
+
public function checkFileLocations()
|
92 |
+
{
|
93 |
+
$returnVal = true;
|
94 |
+
$this->messages[] = "Checking file locations";
|
95 |
+
foreach ($this->_getFiles() as $currentRow) {
|
96 |
+
|
97 |
+
if (empty($currentRow)) {
|
98 |
+
continue;
|
99 |
+
}
|
100 |
+
try {
|
101 |
+
if (!file_exists($currentRow)) {
|
102 |
+
throw new Exception('File ' . $currentRow . ' does not exist');
|
103 |
+
}
|
104 |
+
if (!is_readable($currentRow)) {
|
105 |
+
throw new Exception(
|
106 |
+
'Can\'t read file ' . $currentRow . ' - please check file permissions and file owner.'
|
107 |
+
);
|
108 |
+
}
|
109 |
+
|
110 |
+
$handleExtFile = fopen($currentRow, "r");
|
111 |
+
if (!$handleExtFile) {
|
112 |
+
throw new Exception(
|
113 |
+
'Can\'t read file contents ' . $currentRow
|
114 |
+
. ' - please check if the file got corrupted in the upload process.'
|
115 |
+
);
|
116 |
+
}
|
117 |
+
fclose($handleExtFile);
|
118 |
+
} catch (Exception $e) {
|
119 |
+
$this->messages[] = $e->getMessage();
|
120 |
+
$returnVal = false;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
return $returnVal;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* check that rewrites return expected classes
|
128 |
+
*
|
129 |
+
* @return bool
|
130 |
+
*/
|
131 |
+
public function magentoRewrites ()
|
132 |
+
{
|
133 |
+
$returnVal = true;
|
134 |
+
$this->messages[] = "Checking rewrites";
|
135 |
+
|
136 |
+
foreach ($this->_getRewrites() as $currentRow) {
|
137 |
+
|
138 |
+
if (empty($currentRow) || !$currentRow) {
|
139 |
+
continue;
|
140 |
+
}
|
141 |
+
try {
|
142 |
+
$this->_testRewriteRow($currentRow);
|
143 |
+
} catch (Exception $e) {
|
144 |
+
$this->messages[] = $e->getMessage();
|
145 |
+
$returnVal = false;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
return $returnVal;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* check the database for expected tables, columns and attributes
|
153 |
+
*
|
154 |
+
* @return bool
|
155 |
+
*/
|
156 |
+
public function dbCheck()
|
157 |
+
{
|
158 |
+
//we don't use getModel since the common extension might not yet be installed correctly
|
159 |
+
$dbCheckModel = new Fooman_Common_Model_Selftester_Db();
|
160 |
+
return $dbCheckModel->dbCheck($this);
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* retrieve current database info relevant for debugging
|
165 |
+
*
|
166 |
+
* @return bool
|
167 |
+
*/
|
168 |
+
public function hasSettings()
|
169 |
+
{
|
170 |
+
foreach ($this->_getSettings() as $table => $tableValues) {
|
171 |
+
|
172 |
+
$this->messages[] = $table;
|
173 |
+
foreach ($tableValues as $setting) {
|
174 |
+
$msg = array();
|
175 |
+
foreach ($setting as $key => $value) {
|
176 |
+
$msg[] = $key . ': ' . $value;
|
177 |
+
}
|
178 |
+
$this->messages[] = implode(' | ', $msg);
|
179 |
+
}
|
180 |
+
|
181 |
+
}
|
182 |
+
return true;
|
183 |
+
}
|
184 |
+
|
185 |
+
}
|
app/code/community/Fooman/Common/Model/Selftester/Abstract.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fooman Common
|
4 |
+
*
|
5 |
+
* @package Fooman_Common
|
6 |
+
* @author Kristof Ringleff <kristof@fooman.co.nz>
|
7 |
+
* @copyright Copyright (c) 2012 Fooman Limited (http://www.fooman.co.nz)
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Fooman_Common_Model_Selftester_Abstract extends Mage_Core_Model_Abstract
|
14 |
+
{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Helper to test for rewrites
|
18 |
+
*
|
19 |
+
* @param array $currentRow The rewrite info
|
20 |
+
*
|
21 |
+
* @throws Exception
|
22 |
+
*
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
protected function _testRewriteRow(array $currentRow)
|
26 |
+
{
|
27 |
+
switch ($currentRow[0]) {
|
28 |
+
case 'resource-model':
|
29 |
+
$model = Mage::getResourceModel($currentRow[1]);
|
30 |
+
if (get_class($model) != $currentRow[2]) {
|
31 |
+
throw new Exception(
|
32 |
+
'Trying to load class ' . $currentRow[2] . 'returns ' . get_class($model)
|
33 |
+
. '. Please refresh your Magento configuration cache and check
|
34 |
+
if you have any conflicting extensions installed.'
|
35 |
+
);
|
36 |
+
}
|
37 |
+
break;
|
38 |
+
|
39 |
+
case 'model':
|
40 |
+
$model = Mage::getModel($currentRow[1]);
|
41 |
+
if (!($model instanceof $currentRow[2])) {
|
42 |
+
throw new Exception(
|
43 |
+
'Trying to load class ' . $currentRow[2] . ' returns ' . get_class($model)
|
44 |
+
. '. Please refresh your Magento configuration cache and check
|
45 |
+
if you have any conflicting extensions installed.'
|
46 |
+
);
|
47 |
+
}
|
48 |
+
if (get_class($model) != $currentRow[2]) {
|
49 |
+
throw new Exception(
|
50 |
+
'Trying to load class ' . $currentRow[2] . ' returns correct instance but unexpected class '
|
51 |
+
. get_class($model). '. Please refresh your Magento configuration cache and check
|
52 |
+
if you have any conflicting extensions installed.'
|
53 |
+
);
|
54 |
+
}
|
55 |
+
break;
|
56 |
+
case 'block':
|
57 |
+
$block = Mage::app()->getLayout()->createBlock($currentRow[1]);
|
58 |
+
if (!($block instanceof $currentRow[2])) {
|
59 |
+
throw new Exception(
|
60 |
+
'Trying to load block ' . $currentRow[2] . ' returns ' . get_class($block)
|
61 |
+
. '. Please refresh your Magento configuration cache and check
|
62 |
+
if you have any conflicting extensions installed.'
|
63 |
+
);
|
64 |
+
}
|
65 |
+
if (get_class($block) != $currentRow[2]) {
|
66 |
+
throw new Exception(
|
67 |
+
'Trying to load block ' . $currentRow[2] . ' returns correct instance but unexpected class '
|
68 |
+
. get_class($block). '. Please refresh your Magento configuration cache and check
|
69 |
+
if you have any conflicting extensions installed.'
|
70 |
+
);
|
71 |
+
}
|
72 |
+
break;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* add Mage version to messages
|
78 |
+
*
|
79 |
+
* @return void
|
80 |
+
*/
|
81 |
+
public function _getVersions()
|
82 |
+
{
|
83 |
+
$this->messages[] = "Magento version: " . Mage::getVersion();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* stub for retrieval of database fields
|
88 |
+
*
|
89 |
+
* @return array
|
90 |
+
*/
|
91 |
+
public function _getDbFields()
|
92 |
+
{
|
93 |
+
return array();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* stub for retrieval of rewrite information
|
98 |
+
*
|
99 |
+
* @return array
|
100 |
+
*/
|
101 |
+
public function _getRewrites ()
|
102 |
+
{
|
103 |
+
return array();
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* stub for list of files
|
108 |
+
*
|
109 |
+
* @return array
|
110 |
+
*/
|
111 |
+
public function _getFiles ()
|
112 |
+
{
|
113 |
+
return array();
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* stub for db settings
|
118 |
+
*
|
119 |
+
* @return array
|
120 |
+
*/
|
121 |
+
public function _getSettings()
|
122 |
+
{
|
123 |
+
return array();
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
app/code/community/Fooman/Common/Model/Selftester/Db.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fooman Common
|
4 |
+
*
|
5 |
+
* @package Fooman_Common
|
6 |
+
* @author Kristof Ringleff <kristof@fooman.co.nz>
|
7 |
+
* @copyright Copyright (c) 2012 Fooman Limited (http://www.fooman.co.nz)
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Fooman_Common_Model_Selftester_Db extends Mage_Core_Model_Abstract
|
14 |
+
{
|
15 |
+
public $messages = array();
|
16 |
+
public $errorOccurred = false;
|
17 |
+
protected $_dbOkay = true;
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* check the database for expected tables, columns and attributes
|
22 |
+
*
|
23 |
+
* @param Fooman_Common_Model_Selftester $selftester
|
24 |
+
*
|
25 |
+
* @return bool
|
26 |
+
*/
|
27 |
+
public function dbCheck (Fooman_Common_Model_Selftester $selftester)
|
28 |
+
{
|
29 |
+
$localError = false;
|
30 |
+
$selftester->messages[] = "Checking database";
|
31 |
+
$installer = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
|
32 |
+
$installer->startSetup();
|
33 |
+
|
34 |
+
foreach ($selftester->_getDbFields() as $field) {
|
35 |
+
switch ($field[0]) {
|
36 |
+
case 'eav':
|
37 |
+
$localError = $this->_dbCheckEav($selftester, $field, $installer, $localError);
|
38 |
+
break;
|
39 |
+
case 'sql-column':
|
40 |
+
$localError = $this->_dbCheckSqlColumn($selftester, $field, $installer, $localError);
|
41 |
+
break;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
$installer->endSetup();
|
45 |
+
if (empty($localError)) {
|
46 |
+
return true;
|
47 |
+
} else {
|
48 |
+
if ($this->_dbOkay == false) {
|
49 |
+
$selftester->messages[]
|
50 |
+
= "<p>The selftest has found some problems with your database install.
|
51 |
+
You can attempt to fix this by clicking this <a href=\""
|
52 |
+
. htmlentities(Mage::helper('core/http')->getServer('PHP_SELF', ''))
|
53 |
+
. "?fix=true\">link</a>.</p><p style=\"color:red;\"><em>A DATABASE BACKUP IS strongly
|
54 |
+
RECOMMENDED BEFORE ATTEMPTING THIS!</em></p>";
|
55 |
+
}
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* check the DB for an expected EAV attribute
|
62 |
+
*
|
63 |
+
* @param Fooman_Common_Model_Selftester $selftester
|
64 |
+
* @param $field
|
65 |
+
* @param $installer
|
66 |
+
* @param $localError
|
67 |
+
*
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
protected function _dbCheckEav(Fooman_Common_Model_Selftester $selftester, $field, $installer, $localError)
|
71 |
+
{
|
72 |
+
try {
|
73 |
+
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode($field[1], $field[2]);
|
74 |
+
if (!$attribute->getId() > 0) {
|
75 |
+
$localError = true;
|
76 |
+
throw new Exception('eav attribute ' . $field[2] . ' is not installed');
|
77 |
+
}
|
78 |
+
$selftester->messages[] = "[OK] eav attribute " . $field[2]." with id ".$attribute->getId()."";
|
79 |
+
} catch (Exception $e) {
|
80 |
+
if ($selftester->shouldFix()) {
|
81 |
+
$selftester->messages[] = "Attempting fix for eav attribute " . $field[2]."";
|
82 |
+
try {
|
83 |
+
$installer->addAttribute($field[1], $field[2], $field[3]);
|
84 |
+
$selftester->messages[] = "[FIX OK] eav attribute " . $field[2]." fixed";
|
85 |
+
} catch (Exception $e) {
|
86 |
+
$selftester->messages[] = "[FAILED] fixing eav attribute " . $field[2]."";
|
87 |
+
$this->_dbOkay = false;
|
88 |
+
$selftester->messages[] = $e->getMessage();
|
89 |
+
$localError = true;
|
90 |
+
}
|
91 |
+
} else {
|
92 |
+
$selftester->messages[] = "[FAILED] eav attribute " . $field[2] . "";
|
93 |
+
$this->_dbOkay = false;
|
94 |
+
$selftester->messages[] = "[ERR] ".$e->getMessage();
|
95 |
+
$localError = true;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
return $localError;
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
/**
|
103 |
+
* check the DB for an expected table column
|
104 |
+
*
|
105 |
+
* @param Fooman_Common_Model_Selftester $selftester
|
106 |
+
* @param $field
|
107 |
+
* @param $installer
|
108 |
+
* @param $localError
|
109 |
+
*
|
110 |
+
* @return bool
|
111 |
+
*/
|
112 |
+
protected function _dbCheckSqlColumn(Fooman_Common_Model_Selftester $selftester, $field, $installer, $localError)
|
113 |
+
{
|
114 |
+
try {
|
115 |
+
if (!$installer->getConnection()->tableColumnExists($field[1], $field[2])) {
|
116 |
+
throw new Exception(sprintf('Did not find column %s in table %s'), $field[2], $field[1]);
|
117 |
+
}
|
118 |
+
$selftester->messages[] = "[OK] column " . $field[2]."";
|
119 |
+
} catch (Exception $e) {
|
120 |
+
if ($selftester->shouldFix()) {
|
121 |
+
$selftester->messages[] = "Attempting fix for column " . $field[2]."";
|
122 |
+
try {
|
123 |
+
$installer->getConnection()->addColumn(
|
124 |
+
$installer->getTable($field[1]),
|
125 |
+
$field[2],
|
126 |
+
$field[3]
|
127 |
+
);
|
128 |
+
$selftester->messages[] = "[FIX OK] column " . $field[2]." fixed";
|
129 |
+
} catch (Exception $e) {
|
130 |
+
$selftester->messages[] = "[FAILED] fixing column " . $field[2]."";
|
131 |
+
$this->_dbOkay = false;
|
132 |
+
$selftester->messages[] = $e->getMessage();
|
133 |
+
$localError = true;
|
134 |
+
}
|
135 |
+
} else {
|
136 |
+
$selftester->messages[] = "[FAILED] column " . $field[2]."";
|
137 |
+
$this->_dbOkay = false;
|
138 |
+
$selftester->messages[] = "[ERR] ".$e->getMessage();
|
139 |
+
$localError = true;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
return $localError;
|
143 |
+
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
app/code/community/Fooman/Common/controllers/Adminhtml/SelftesterController.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fooman_Common_Adminhtml_SelftesterController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected function _initAction()
|
6 |
+
{
|
7 |
+
return $this;
|
8 |
+
}
|
9 |
+
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
//Here we actually run the process of selftesting. All messages are returned to the session
|
13 |
+
$module = $this->getRequest()->getParam('module');
|
14 |
+
$selftester = Mage::getModel($module . '/selftester')->main();
|
15 |
+
//Here we get db version of the given module code
|
16 |
+
if (Mage::getModel('core/mysql4_resource')->getDbVersion($module . '_setup')) {
|
17 |
+
$dbVersion = Mage::getModel('core/mysql4_resource')->getDbVersion($module . '_setup');
|
18 |
+
} else {
|
19 |
+
$dbVersion = 'Not Available';
|
20 |
+
}
|
21 |
+
|
22 |
+
//Here we get data version of the given module code
|
23 |
+
if (Mage::getModel('core/mysql4_resource')->getDataVersion($module . '_setup')) {
|
24 |
+
$dataVersion = Mage::getModel('core/mysql4_resource')->getDataVersion($module . '_setup');
|
25 |
+
} else {
|
26 |
+
$dataVersion = 'Not Available';
|
27 |
+
}
|
28 |
+
//Here we get configuration version of the given module name
|
29 |
+
$moduleName = $this->getRequest()->getParam('moduleName');
|
30 |
+
$configVersion = (string)Mage::getConfig()->getModuleConfig($moduleName)->version;
|
31 |
+
$selftester->messages = array_merge(
|
32 |
+
array(
|
33 |
+
'Config Version: ' . $configVersion,
|
34 |
+
'DB Version: ' . $dbVersion,
|
35 |
+
'Data Version: ' . $dataVersion,
|
36 |
+
), $selftester->messages
|
37 |
+
);
|
38 |
+
|
39 |
+
if (!$selftester->errorOccurred) {
|
40 |
+
Mage::getSingleton('core/session')->addSuccess(implode("<br/>", $selftester->messages));
|
41 |
+
} else {
|
42 |
+
Mage::getSingleton('core/session')->addError(implode("<br/>", $selftester->messages));
|
43 |
+
}
|
44 |
+
//Here we load appropriate layout. In our case its popup
|
45 |
+
$layout = $this->getLayout();
|
46 |
+
$layout->getUpdate()->load('selftest_popup');
|
47 |
+
$layout->generateXml();
|
48 |
+
$layout->generateBlocks();
|
49 |
+
$output = $layout->getOutput();
|
50 |
+
|
51 |
+
$this->getResponse()->setBody($output);
|
52 |
+
//Here we clear all the messages of the current session, because otherwise we will get a number
|
53 |
+
//of duplicates from the previous page loads.
|
54 |
+
Mage::getSingleton('core/session')->getMesssages(true);
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Fooman/Common/etc/config.xml
CHANGED
@@ -9,10 +9,15 @@
|
|
9 |
<config>
|
10 |
<modules>
|
11 |
<Fooman_Common>
|
12 |
-
<version>1.1.
|
13 |
</Fooman_Common>
|
14 |
</modules>
|
15 |
<global>
|
|
|
|
|
|
|
|
|
|
|
16 |
<models>
|
17 |
<foomancommon>
|
18 |
<class>Fooman_Common_Model</class>
|
@@ -24,11 +29,33 @@
|
|
24 |
</foomancommon>
|
25 |
</helpers>
|
26 |
</global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
<adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
<acl>
|
29 |
<resources>
|
30 |
<admin>
|
31 |
<children>
|
|
|
|
|
|
|
|
|
32 |
<system>
|
33 |
<children>
|
34 |
<config>
|
9 |
<config>
|
10 |
<modules>
|
11 |
<Fooman_Common>
|
12 |
+
<version>1.1.1</version>
|
13 |
</Fooman_Common>
|
14 |
</modules>
|
15 |
<global>
|
16 |
+
<blocks>
|
17 |
+
<foomancommon>
|
18 |
+
<class>Fooman_Common_Block</class>
|
19 |
+
</foomancommon>
|
20 |
+
</blocks>
|
21 |
<models>
|
22 |
<foomancommon>
|
23 |
<class>Fooman_Common_Model</class>
|
29 |
</foomancommon>
|
30 |
</helpers>
|
31 |
</global>
|
32 |
+
<admin>
|
33 |
+
<routers>
|
34 |
+
<adminhtml>
|
35 |
+
<args>
|
36 |
+
<modules>
|
37 |
+
<foomancommon after="Mage_Adminhtml">Fooman_Common_Adminhtml</foomancommon>
|
38 |
+
</modules>
|
39 |
+
</args>
|
40 |
+
</adminhtml>
|
41 |
+
</routers>
|
42 |
+
</admin>
|
43 |
<adminhtml>
|
44 |
+
<layout>
|
45 |
+
<updates>
|
46 |
+
<foomancommon>
|
47 |
+
<file>fooman_common.xml</file>
|
48 |
+
</foomancommon>
|
49 |
+
</updates>
|
50 |
+
</layout>
|
51 |
<acl>
|
52 |
<resources>
|
53 |
<admin>
|
54 |
<children>
|
55 |
+
<foomancommon translate="title" module="foomancommon">
|
56 |
+
<title>Fooman Selftests</title>
|
57 |
+
<sort_order>-100</sort_order>
|
58 |
+
</foomancommon>
|
59 |
<system>
|
60 |
<children>
|
61 |
<config>
|
app/code/community/Fooman/Common/etc/system.xml
CHANGED
@@ -8,21 +8,29 @@
|
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
<foomancommon>
|
11 |
-
<label>
|
12 |
<tab>fooman</tab>
|
13 |
<show_in_default>1</show_in_default>
|
14 |
<show_in_website>1</show_in_website>
|
15 |
<show_in_store>1</show_in_store>
|
16 |
<sort_order>100</sort_order>
|
17 |
<groups>
|
18 |
-
|
19 |
<label>Update Notifications</label>
|
20 |
<comment>To receive notifications please make sure that your Magento cron.php is set up. Please refer to the Magento documentation on how to do this.</comment>
|
21 |
<sort_order>100</sort_order>
|
22 |
<show_in_default>1</show_in_default>
|
23 |
<show_in_website>1</show_in_website>
|
24 |
<show_in_store>0</show_in_store>
|
25 |
-
</notifications
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</groups>
|
27 |
</foomancommon>
|
28 |
</sections>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
<foomancommon>
|
11 |
+
<label>Support</label>
|
12 |
<tab>fooman</tab>
|
13 |
<show_in_default>1</show_in_default>
|
14 |
<show_in_website>1</show_in_website>
|
15 |
<show_in_store>1</show_in_store>
|
16 |
<sort_order>100</sort_order>
|
17 |
<groups>
|
18 |
+
<!--<notifications translate="label" module="foomancommon">
|
19 |
<label>Update Notifications</label>
|
20 |
<comment>To receive notifications please make sure that your Magento cron.php is set up. Please refer to the Magento documentation on how to do this.</comment>
|
21 |
<sort_order>100</sort_order>
|
22 |
<show_in_default>1</show_in_default>
|
23 |
<show_in_website>1</show_in_website>
|
24 |
<show_in_store>0</show_in_store>
|
25 |
+
</notifications>-->
|
26 |
+
<extensions translate="label" module="foomancommon">
|
27 |
+
<label>Extensions Installed</label>
|
28 |
+
<comment>Here you can find a list of all Fooman extensions currently installed on your system.</comment>
|
29 |
+
<sort_order>101</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>0</show_in_store>
|
33 |
+
</extensions>
|
34 |
</groups>
|
35 |
</foomancommon>
|
36 |
</sections>
|
app/code/community/Fooman/EmailAttachments/Block/Adminhtml/Extensioninfo.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fooman_EmailAttachments_Block_Adminhtml_Extensioninfo extends Fooman_Common_Block_Adminhtml_Extensioninfo
|
4 |
+
{
|
5 |
+
protected $_hasSelftest = true;
|
6 |
+
protected $_idString = 'emailattachments';
|
7 |
+
protected $_moduleName = 'Fooman_EmailAttachments';
|
8 |
+
}
|
app/code/community/Fooman/EmailAttachments/Helper/Data.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
class Fooman_EmailAttachments_Helper_Data extends Mage_Core_Helper_Abstract
|
13 |
{
|
14 |
|
15 |
-
const LOG_FILE_NAME='
|
16 |
|
17 |
/**
|
18 |
* render pdf and attach to email
|
@@ -52,7 +52,7 @@ class Fooman_EmailAttachments_Helper_Data extends Mage_Core_Helper_Abstract
|
|
52 |
try {
|
53 |
$this->debug('ADDING ATTACHMENT: ' . $file);
|
54 |
$filePath = Mage::getBaseDir('media') . DS . 'pdfs' . DS .$file;
|
55 |
-
if(file_exists($filePath)){
|
56 |
$mailObj->getMail()->createAttachment(
|
57 |
file_get_contents($filePath), 'application/pdf', Zend_Mime::DISPOSITION_ATTACHMENT,
|
58 |
Zend_Mime::ENCODING_BASE64, basename($filePath)
|
@@ -86,7 +86,7 @@ class Fooman_EmailAttachments_Helper_Data extends Mage_Core_Helper_Abstract
|
|
86 |
$agreement->load($agreement->getId());
|
87 |
$this->debug($agreement->getName());
|
88 |
$cmsHelper = Mage::helper('cms');
|
89 |
-
if (
|
90 |
$pdf = Mage::getModel('pdfcustomiser/agreement')->getPdf(array($storeId=> $agreement));
|
91 |
$this->addAttachment($pdf, $mailObj, urlencode($agreement->getName()));
|
92 |
} else {
|
@@ -136,4 +136,40 @@ class Fooman_EmailAttachments_Helper_Data extends Mage_Core_Helper_Abstract
|
|
136 |
{
|
137 |
return false;
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
12 |
class Fooman_EmailAttachments_Helper_Data extends Mage_Core_Helper_Abstract
|
13 |
{
|
14 |
|
15 |
+
const LOG_FILE_NAME='fooman_emailattachments.log';
|
16 |
|
17 |
/**
|
18 |
* render pdf and attach to email
|
52 |
try {
|
53 |
$this->debug('ADDING ATTACHMENT: ' . $file);
|
54 |
$filePath = Mage::getBaseDir('media') . DS . 'pdfs' . DS .$file;
|
55 |
+
if (file_exists($filePath)) {
|
56 |
$mailObj->getMail()->createAttachment(
|
57 |
file_get_contents($filePath), 'application/pdf', Zend_Mime::DISPOSITION_ATTACHMENT,
|
58 |
Zend_Mime::ENCODING_BASE64, basename($filePath)
|
86 |
$agreement->load($agreement->getId());
|
87 |
$this->debug($agreement->getName());
|
88 |
$cmsHelper = Mage::helper('cms');
|
89 |
+
if (Mage::helper('core')->isModuleEnabled('Fooman_PdfCustomiser')) {
|
90 |
$pdf = Mage::getModel('pdfcustomiser/agreement')->getPdf(array($storeId=> $agreement));
|
91 |
$this->addAttachment($pdf, $mailObj, urlencode($agreement->getName()));
|
92 |
} else {
|
136 |
{
|
137 |
return false;
|
138 |
}
|
139 |
+
|
140 |
+
public function addButton($block)
|
141 |
+
{
|
142 |
+
$block->addButton(
|
143 |
+
'print', array(
|
144 |
+
'label' => Mage::helper('sales')->__('Print'),
|
145 |
+
'class' => 'save',
|
146 |
+
'onclick' => 'setLocation(\'' . $this->getPrintUrl($block) . '\')'
|
147 |
+
)
|
148 |
+
);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* return url to print single order from order > view
|
153 |
+
*
|
154 |
+
* @param void
|
155 |
+
* @access protected
|
156 |
+
*
|
157 |
+
* @return string
|
158 |
+
*/
|
159 |
+
protected function getPrintUrl($block)
|
160 |
+
{
|
161 |
+
return $block->getUrl(
|
162 |
+
'emailattachments/admin_order/print',
|
163 |
+
array('order_id' => $block->getOrder()->getId())
|
164 |
+
);
|
165 |
+
}
|
166 |
+
|
167 |
+
public function getEmails($configPath, $storeId)
|
168 |
+
{
|
169 |
+
$data = Mage::getStoreConfig($configPath, $storeId);
|
170 |
+
if (!empty($data)) {
|
171 |
+
return explode(',', $data);
|
172 |
+
}
|
173 |
+
return false;
|
174 |
+
}
|
175 |
}
|
app/code/community/Fooman/EmailAttachments/Model/Core/Email/Template/Mailer.php
CHANGED
@@ -25,7 +25,7 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
25 |
$emailInfo = array_pop($this->_emailInfos);
|
26 |
$helper->debug('NEW EMAIL------------------------------------------');
|
27 |
$helper->debug($emailInfo->getToNames());
|
28 |
-
$this->dispatchAttachEvent($emailTemplate);
|
29 |
// Handle "Bcc" recepients of the current email
|
30 |
$emailTemplate->addBcc($emailInfo->getBccEmails());
|
31 |
// Set required design parameters and delegate email sending to Mage_Core_Model_Email_Template
|
@@ -38,7 +38,7 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
38 |
$this->getTemplateParams(),
|
39 |
$this->getStoreId()
|
40 |
);
|
41 |
-
|
42 |
}
|
43 |
return $this;
|
44 |
}
|
@@ -47,8 +47,9 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
47 |
* handle dispatching of events based on template being sent
|
48 |
*
|
49 |
* @param $emailTemplate
|
|
|
50 |
*/
|
51 |
-
public function dispatchAttachEvent($emailTemplate)
|
52 |
{
|
53 |
$storeId = $this->getStoreId();
|
54 |
$templateParams = $this->getTemplateParams();
|
@@ -62,9 +63,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
62 |
Mage::dispatchEvent(
|
63 |
'fooman_emailattachments_before_send_order',
|
64 |
array(
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
68 |
)
|
69 |
);
|
70 |
break;
|
@@ -74,9 +76,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
74 |
Mage::dispatchEvent(
|
75 |
'fooman_emailattachments_before_send_order',
|
76 |
array(
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
80 |
)
|
81 |
);
|
82 |
break;
|
@@ -87,9 +90,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
87 |
Mage::dispatchEvent(
|
88 |
'fooman_emailattachments_before_send_invoice',
|
89 |
array(
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
93 |
)
|
94 |
);
|
95 |
break;
|
@@ -100,9 +104,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
100 |
Mage::dispatchEvent(
|
101 |
'fooman_emailattachments_before_send_invoice',
|
102 |
array(
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
106 |
)
|
107 |
);
|
108 |
break;
|
@@ -113,9 +118,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
113 |
Mage::dispatchEvent(
|
114 |
'fooman_emailattachments_before_send_shipment',
|
115 |
array(
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
119 |
)
|
120 |
);
|
121 |
break;
|
@@ -126,9 +132,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
126 |
Mage::dispatchEvent(
|
127 |
'fooman_emailattachments_before_send_shipment',
|
128 |
array(
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
132 |
)
|
133 |
);
|
134 |
break;
|
@@ -139,9 +146,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
139 |
Mage::dispatchEvent(
|
140 |
'fooman_emailattachments_before_send_creditmemo',
|
141 |
array(
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
145 |
)
|
146 |
);
|
147 |
break;
|
@@ -154,9 +162,10 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
154 |
Mage::dispatchEvent(
|
155 |
'fooman_emailattachments_before_send_creditmemo',
|
156 |
array(
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
160 |
)
|
161 |
);
|
162 |
break;
|
@@ -164,8 +173,9 @@ class Fooman_EmailAttachments_Model_Core_Email_Template_Mailer extends Mage_Core
|
|
164 |
Mage::dispatchEvent(
|
165 |
'fooman_emailattachments_before_send',
|
166 |
array(
|
167 |
-
|
168 |
-
|
|
|
169 |
)
|
170 |
);
|
171 |
}
|
25 |
$emailInfo = array_pop($this->_emailInfos);
|
26 |
$helper->debug('NEW EMAIL------------------------------------------');
|
27 |
$helper->debug($emailInfo->getToNames());
|
28 |
+
$this->dispatchAttachEvent($emailTemplate, $emailInfo);
|
29 |
// Handle "Bcc" recepients of the current email
|
30 |
$emailTemplate->addBcc($emailInfo->getBccEmails());
|
31 |
// Set required design parameters and delegate email sending to Mage_Core_Model_Email_Template
|
38 |
$this->getTemplateParams(),
|
39 |
$this->getStoreId()
|
40 |
);
|
41 |
+
//$helper->debug('FINISHED SENDING - Sent Status: ' . (bool)$ret->getSentSuccess());
|
42 |
}
|
43 |
return $this;
|
44 |
}
|
47 |
* handle dispatching of events based on template being sent
|
48 |
*
|
49 |
* @param $emailTemplate
|
50 |
+
* @param $emailInfo
|
51 |
*/
|
52 |
+
public function dispatchAttachEvent($emailTemplate, $emailInfo)
|
53 |
{
|
54 |
$storeId = $this->getStoreId();
|
55 |
$templateParams = $this->getTemplateParams();
|
63 |
Mage::dispatchEvent(
|
64 |
'fooman_emailattachments_before_send_order',
|
65 |
array(
|
66 |
+
'update' => false,
|
67 |
+
'template' => $emailTemplate,
|
68 |
+
'object' => $templateParams['order'],
|
69 |
+
'email_info' => $emailInfo
|
70 |
)
|
71 |
);
|
72 |
break;
|
76 |
Mage::dispatchEvent(
|
77 |
'fooman_emailattachments_before_send_order',
|
78 |
array(
|
79 |
+
'update' => true,
|
80 |
+
'template' => $emailTemplate,
|
81 |
+
'object' => $templateParams['order'],
|
82 |
+
'email_info' => $emailInfo
|
83 |
)
|
84 |
);
|
85 |
break;
|
90 |
Mage::dispatchEvent(
|
91 |
'fooman_emailattachments_before_send_invoice',
|
92 |
array(
|
93 |
+
'update' => false,
|
94 |
+
'template' => $emailTemplate,
|
95 |
+
'object' => $templateParams['invoice'],
|
96 |
+
'email_info' => $emailInfo
|
97 |
)
|
98 |
);
|
99 |
break;
|
104 |
Mage::dispatchEvent(
|
105 |
'fooman_emailattachments_before_send_invoice',
|
106 |
array(
|
107 |
+
'update' => true,
|
108 |
+
'template' => $emailTemplate,
|
109 |
+
'object' => $templateParams['invoice'],
|
110 |
+
'email_info' => $emailInfo
|
111 |
)
|
112 |
);
|
113 |
break;
|
118 |
Mage::dispatchEvent(
|
119 |
'fooman_emailattachments_before_send_shipment',
|
120 |
array(
|
121 |
+
'update' => false,
|
122 |
+
'template' => $emailTemplate,
|
123 |
+
'object' => $templateParams['shipment'],
|
124 |
+
'email_info' => $emailInfo
|
125 |
)
|
126 |
);
|
127 |
break;
|
132 |
Mage::dispatchEvent(
|
133 |
'fooman_emailattachments_before_send_shipment',
|
134 |
array(
|
135 |
+
'update' => true,
|
136 |
+
'template' => $emailTemplate,
|
137 |
+
'object' => $templateParams['shipment'],
|
138 |
+
'email_info' => $emailInfo
|
139 |
)
|
140 |
);
|
141 |
break;
|
146 |
Mage::dispatchEvent(
|
147 |
'fooman_emailattachments_before_send_creditmemo',
|
148 |
array(
|
149 |
+
'update' => false,
|
150 |
+
'template' => $emailTemplate,
|
151 |
+
'object' => $templateParams['creditmemo'],
|
152 |
+
'email_info' => $emailInfo
|
153 |
)
|
154 |
);
|
155 |
break;
|
162 |
Mage::dispatchEvent(
|
163 |
'fooman_emailattachments_before_send_creditmemo',
|
164 |
array(
|
165 |
+
'update' => true,
|
166 |
+
'template' => $emailTemplate,
|
167 |
+
'object' => $templateParams['creditmemo'],
|
168 |
+
'email_info' => $emailInfo
|
169 |
)
|
170 |
);
|
171 |
break;
|
173 |
Mage::dispatchEvent(
|
174 |
'fooman_emailattachments_before_send',
|
175 |
array(
|
176 |
+
'template' => $emailTemplate,
|
177 |
+
'params' => $templateParams,
|
178 |
+
'email_info' => $emailInfo
|
179 |
)
|
180 |
);
|
181 |
}
|
app/code/community/Fooman/EmailAttachments/Model/Observer.php
CHANGED
@@ -12,6 +12,11 @@
|
|
12 |
class Fooman_EmailAttachments_Model_Observer
|
13 |
{
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* observe core_block_abstract_prepare_layout_after to add a Print Orders
|
17 |
* massaction to the actions dropdown menu
|
@@ -21,12 +26,15 @@ class Fooman_EmailAttachments_Model_Observer
|
|
21 |
public function addbutton($observer)
|
22 |
{
|
23 |
$block = $observer->getEvent()->getBlock();
|
|
|
24 |
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction
|
25 |
|| $block instanceof
|
26 |
Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction
|
27 |
) {
|
28 |
-
if ($block->getRequest()->getControllerName() == 'sales_order'
|
29 |
-
$block->getRequest()->getControllerName() == 'adminhtml_sales_order'
|
|
|
|
|
30 |
$block->addItem(
|
31 |
'pdforders_order', array(
|
32 |
'label'=> Mage::helper('emailattachments')->__('Print Orders'),
|
@@ -38,37 +46,9 @@ class Fooman_EmailAttachments_Model_Observer
|
|
38 |
);
|
39 |
}
|
40 |
}
|
|
|
41 |
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
|
42 |
-
|
43 |
-
'print', array(
|
44 |
-
'label' => Mage::helper('sales')->__('Print'),
|
45 |
-
'class' => 'save',
|
46 |
-
'onclick' => 'setLocation(\'' . $this->getPrintUrl($block) . '\')'
|
47 |
-
)
|
48 |
-
);
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* return url to print single order from order > view
|
54 |
-
*
|
55 |
-
* @param void
|
56 |
-
* @access protected
|
57 |
-
*
|
58 |
-
* @return string
|
59 |
-
*/
|
60 |
-
protected function getPrintUrl($block)
|
61 |
-
{
|
62 |
-
if ((string)Mage::getConfig()->getModuleConfig('Fooman_PdfCustomiser')->active == 'true') {
|
63 |
-
return $block->getUrl(
|
64 |
-
'pdfcustomiser/adminhtml_sales_order/print',
|
65 |
-
array('order_id' => $block->getOrder()->getId())
|
66 |
-
);
|
67 |
-
} else {
|
68 |
-
return $block->getUrl(
|
69 |
-
'emailattachments/admin_order/print',
|
70 |
-
array('order_id' => $block->getOrder()->getId())
|
71 |
-
);
|
72 |
}
|
73 |
}
|
74 |
|
@@ -86,7 +66,12 @@ class Fooman_EmailAttachments_Model_Observer
|
|
86 |
|
87 |
if (Mage::getStoreConfig('sales_email/' . $configPath . '/attachpdf', $order->getStoreId())) {
|
88 |
//Create Pdf and attach to email - play nicely with PdfCustomiser
|
|
|
|
|
|
|
|
|
89 |
$pdf = Mage::getModel('emailattachments/order_pdf_order')->getPdf(array($order));
|
|
|
90 |
$mailTemplate = Mage::helper('emailattachments')->addAttachment(
|
91 |
$pdf, $mailTemplate, Mage::helper('sales')->__('Order') . "_" . $order->getIncrementId()
|
92 |
);
|
@@ -102,6 +87,50 @@ class Fooman_EmailAttachments_Model_Observer
|
|
102 |
}
|
103 |
}
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
/**
|
106 |
* listen to invoice email send event to attach pdfs and agreements
|
107 |
*
|
@@ -152,6 +181,12 @@ class Fooman_EmailAttachments_Model_Observer
|
|
152 |
$mailTemplate = Mage::helper('emailattachments')->addAttachment(
|
153 |
$pdf, $mailTemplate, Mage::helper('sales')->__('Shipment') . "_" . $shipment->getIncrementId()
|
154 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
|
157 |
if (Mage::getStoreConfig('sales_email/' . $configPath . '/attachagreement', $shipment->getStoreId())) {
|
12 |
class Fooman_EmailAttachments_Model_Observer
|
13 |
{
|
14 |
|
15 |
+
const XML_PATH_ORDER_PACKINGSLIP_TEMPLATE = 'sales_email/order/shipment_template';
|
16 |
+
const XML_PATH_EMAIL_COPY_TO = 'sales_email/order/shipment_to';
|
17 |
+
|
18 |
+
const KEY_PACKING_SLIP_PROCESSED ='emailattachments-packingslip-processed';
|
19 |
+
|
20 |
/**
|
21 |
* observe core_block_abstract_prepare_layout_after to add a Print Orders
|
22 |
* massaction to the actions dropdown menu
|
26 |
public function addbutton($observer)
|
27 |
{
|
28 |
$block = $observer->getEvent()->getBlock();
|
29 |
+
//add button to dropdown
|
30 |
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction
|
31 |
|| $block instanceof
|
32 |
Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction
|
33 |
) {
|
34 |
+
if ($block->getRequest()->getControllerName() == 'sales_order'
|
35 |
+
|| $block->getRequest()->getControllerName() == 'adminhtml_sales_order'
|
36 |
+
|| $block->getRequest()->getControllerName() == 'sales_archive'
|
37 |
+
) {
|
38 |
$block->addItem(
|
39 |
'pdforders_order', array(
|
40 |
'label'=> Mage::helper('emailattachments')->__('Print Orders'),
|
46 |
);
|
47 |
}
|
48 |
}
|
49 |
+
//add button to single order view
|
50 |
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
|
51 |
+
Mage::helper('emailattachments')->addButton($block);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
}
|
54 |
|
66 |
|
67 |
if (Mage::getStoreConfig('sales_email/' . $configPath . '/attachpdf', $order->getStoreId())) {
|
68 |
//Create Pdf and attach to email - play nicely with PdfCustomiser
|
69 |
+
$appEmulation = Mage::getSingleton('core/app_emulation');
|
70 |
+
$initial = $appEmulation->startEnvironmentEmulation(
|
71 |
+
Mage_Core_Model_App::ADMIN_STORE_ID, Mage_Core_Model_App_Area::AREA_ADMINHTML, true
|
72 |
+
);
|
73 |
$pdf = Mage::getModel('emailattachments/order_pdf_order')->getPdf(array($order));
|
74 |
+
$appEmulation->stopEnvironmentEmulation($initial);
|
75 |
$mailTemplate = Mage::helper('emailattachments')->addAttachment(
|
76 |
$pdf, $mailTemplate, Mage::helper('sales')->__('Order') . "_" . $order->getIncrementId()
|
77 |
);
|
87 |
}
|
88 |
}
|
89 |
|
90 |
+
/**
|
91 |
+
* listen to order email send event to send packing slip
|
92 |
+
*
|
93 |
+
* @param $observer
|
94 |
+
*/
|
95 |
+
public function sendPackingSlip ($observer)
|
96 |
+
{
|
97 |
+
if (!Mage::registry(self::KEY_PACKING_SLIP_PROCESSED)) {
|
98 |
+
Mage::register(self::KEY_PACKING_SLIP_PROCESSED, true);
|
99 |
+
} else {
|
100 |
+
//only process this once
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
$update = $observer->getEvent()->getUpdate();
|
104 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
105 |
+
$order = $observer->getEvent()->getObject();
|
106 |
+
$configPath = $update ? 'order_comment' : 'order';
|
107 |
+
$emails = Mage::helper('emailattachments')->getEmails(self::XML_PATH_EMAIL_COPY_TO, $order->getStoreId());
|
108 |
+
|
109 |
+
if ($emails && Mage::getStoreConfig('sales_email/' . $configPath . '/sendpackingslip', $order->getStoreId())) {
|
110 |
+
$template = Mage::getStoreConfig(self::XML_PATH_ORDER_PACKINGSLIP_TEMPLATE, $order->getStoreId());
|
111 |
+
$pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf(array(),array($order->getId()));
|
112 |
+
$mailTemplate = Mage::helper('emailattachments')->addAttachment(
|
113 |
+
$pdf, $mailTemplate, Mage::helper('sales')->__('Shipment') . "_" . $order->getIncrementId()
|
114 |
+
);
|
115 |
+
foreach ($emails as $email) {
|
116 |
+
$mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $order->getStoreId()))
|
117 |
+
->sendTransactional(
|
118 |
+
$template,
|
119 |
+
Mage::getStoreConfig(
|
120 |
+
Mage_Sales_Model_Order_Shipment::XML_PATH_EMAIL_IDENTITY, $order->getStoreId()
|
121 |
+
),
|
122 |
+
$email,
|
123 |
+
'',
|
124 |
+
array(
|
125 |
+
'order' => $order
|
126 |
+
)
|
127 |
+
);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
/**
|
135 |
* listen to invoice email send event to attach pdfs and agreements
|
136 |
*
|
181 |
$mailTemplate = Mage::helper('emailattachments')->addAttachment(
|
182 |
$pdf, $mailTemplate, Mage::helper('sales')->__('Shipment') . "_" . $shipment->getIncrementId()
|
183 |
);
|
184 |
+
/*
|
185 |
+
$pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf($shipment->getOrder()->getInvoiceCollection());
|
186 |
+
$mailTemplate = Mage::helper('emailattachments')->addAttachment(
|
187 |
+
$pdf, $mailTemplate, Mage::helper('sales')->__('Invoices for Order') . "_" . $shipment->getOrder()->getIncrementId()
|
188 |
+
);
|
189 |
+
*/
|
190 |
}
|
191 |
|
192 |
if (Mage::getStoreConfig('sales_email/' . $configPath . '/attachagreement', $shipment->getStoreId())) {
|
app/code/community/Fooman/EmailAttachments/Model/Order/Pdf/Order.php
CHANGED
@@ -85,15 +85,11 @@ class Fooman_EmailAttachments_Model_Order_Pdf_Order extends Mage_Sales_Model_Ord
|
|
85 |
$this->insertOrder(
|
86 |
$page,
|
87 |
$order,
|
88 |
-
|
89 |
-
self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId()
|
90 |
-
)
|
91 |
);
|
92 |
|
93 |
-
|
94 |
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
95 |
$this->_setFontRegular($page);
|
96 |
-
$page->drawText(Mage::helper('sales')->__('Order # ') . $order->getIncrementId(), 35, 780, 'UTF-8');
|
97 |
|
98 |
/* Add table */
|
99 |
$page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
|
@@ -137,6 +133,18 @@ class Fooman_EmailAttachments_Model_Order_Pdf_Order extends Mage_Sales_Model_Ord
|
|
137 |
$order->setOrder($order);
|
138 |
$page = $this->insertTotals($page, $order);
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
if ($order->getStoreId()) {
|
141 |
Mage::app()->getLocale()->revert();
|
142 |
}
|
85 |
$this->insertOrder(
|
86 |
$page,
|
87 |
$order,
|
88 |
+
true
|
|
|
|
|
89 |
);
|
90 |
|
|
|
91 |
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
92 |
$this->_setFontRegular($page);
|
|
|
93 |
|
94 |
/* Add table */
|
95 |
$page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
|
133 |
$order->setOrder($order);
|
134 |
$page = $this->insertTotals($page, $order);
|
135 |
|
136 |
+
if (Mage::helper('core')->isModuleEnabled('Magemaven_OrderComment')
|
137 |
+
&& ($order->getCustomerComment() || $order->getCustomerNote())
|
138 |
+
) {
|
139 |
+
$comment = Mage::helper('ordercomment')->escapeHtml(
|
140 |
+
$order->getCustomerComment() ? $order->getCustomerComment() : $order->getCustomerNote()
|
141 |
+
);
|
142 |
+
$this->y -= 15;
|
143 |
+
$page->drawText(Mage::helper('ordercomment')->__('Order Comment'), 35, $this->y, 'UTF-8');
|
144 |
+
$this->y -= 15;
|
145 |
+
$page->drawText($comment, 35, $this->y, 'UTF-8');
|
146 |
+
}
|
147 |
+
|
148 |
if ($order->getStoreId()) {
|
149 |
Mage::app()->getLocale()->revert();
|
150 |
}
|
app/code/community/Fooman/EmailAttachments/Model/Selftester.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fooman_EmailAttachments_Model_Selftester extends Fooman_Common_Model_Selftester
|
3 |
+
{
|
4 |
+
|
5 |
+
public function _getVersions ()
|
6 |
+
{
|
7 |
+
parent::_getVersions();
|
8 |
+
$this->messages[] = "Fooman_EmailAttachments Config version: " . (string) Mage::getConfig()->getModuleConfig('Fooman_EmailAttachments')->version;
|
9 |
+
}
|
10 |
+
|
11 |
+
public function _getRewrites ()
|
12 |
+
{
|
13 |
+
return array(
|
14 |
+
array("model","core/email_template_mailer","Fooman_EmailAttachments_Model_Core_Email_Template_Mailer"),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
public function _getFiles ()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
"app/code/community/Fooman/EmailAttachments/controllers/Customer/OrderController.php",
|
22 |
+
"app/code/community/Fooman/EmailAttachments/controllers/Admin/OrderController.php",
|
23 |
+
"app/code/community/Fooman/EmailAttachments/etc/config.xml",
|
24 |
+
"app/code/community/Fooman/EmailAttachments/etc/system.xml",
|
25 |
+
"app/code/community/Fooman/EmailAttachments/Helper/Data.php",
|
26 |
+
"app/code/community/Fooman/EmailAttachments/Model/Order/Pdf/Order.php",
|
27 |
+
"app/code/community/Fooman/EmailAttachments/Model/Observer.php",
|
28 |
+
"app/code/community/Fooman/EmailAttachments/Model/Core/Email/Template/Mailer.php",
|
29 |
+
"app/code/community/Fooman/EmailAttachments/LICENSE.txt",
|
30 |
+
"app/etc/modules/Fooman_EmailAttachments.xml",
|
31 |
+
"app/locale/cs_CZ/Fooman_EmailAttachments.csv",
|
32 |
+
"app/locale/nl_NL/Fooman_EmailAttachments.csv",
|
33 |
+
"app/locale/en_US/Fooman_EmailAttachments.csv",
|
34 |
+
"app/locale/sv_SE/Fooman_EmailAttachments.csv",
|
35 |
+
"app/locale/gr_GR/Fooman_EmailAttachments.csv",
|
36 |
+
"app/locale/fr_FR/Fooman_EmailAttachments.csv",
|
37 |
+
"app/locale/fa_IR/Fooman_EmailAttachments.csv",
|
38 |
+
"app/locale/he_IL/Fooman_EmailAttachments.csv",
|
39 |
+
"app/locale/de_DE/Fooman_EmailAttachments.csv",
|
40 |
+
"app/locale/no_NO/Fooman_EmailAttachments.csv",
|
41 |
+
"app/locale/lt_LT/Fooman_EmailAttachments.csv",
|
42 |
+
"app/locale/pt_BR/Fooman_EmailAttachments.csv",
|
43 |
+
"app/locale/sk_SK/Fooman_EmailAttachments.csv",
|
44 |
+
"app/locale/nb_NO/Fooman_EmailAttachments.csv",
|
45 |
+
"app/locale/ko_KR/Fooman_EmailAttachments.csv",
|
46 |
+
"app/locale/ro_RO/Fooman_EmailAttachments.csv",
|
47 |
+
"app/locale/da_DK/Fooman_EmailAttachments.csv",
|
48 |
+
"app/locale/sl_SI/Fooman_EmailAttachments.csv",
|
49 |
+
"app/locale/et_EE/Fooman_EmailAttachments.csv",
|
50 |
+
"app/locale/ar_SA/Fooman_EmailAttachments.csv",
|
51 |
+
"app/locale/it_IT/Fooman_EmailAttachments.csv",
|
52 |
+
"app/locale/ru_RU/Fooman_EmailAttachments.csv",
|
53 |
+
"app/locale/pl_PL/Fooman_EmailAttachments.csv",
|
54 |
+
"app/locale/ca_ES/Fooman_EmailAttachments.csv",
|
55 |
+
"app/locale/fi_FI/Fooman_EmailAttachments.csv",
|
56 |
+
"app/locale/th_TH/Fooman_EmailAttachments.csv",
|
57 |
+
"app/locale/es_ES/Fooman_EmailAttachments.csv",
|
58 |
+
"app/locale/ja_JP/Fooman_EmailAttachments.csv",
|
59 |
+
"app/locale/hr_HR/Fooman_EmailAttachments.csv",
|
60 |
+
"app/locale/zh_CN/Fooman_EmailAttachments.csv",
|
61 |
+
"app/locale/lv_LV/Fooman_EmailAttachments.csv",
|
62 |
+
);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
|
app/code/community/Fooman/EmailAttachments/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Fooman_EmailAttachments>
|
5 |
-
<version>0.9.
|
6 |
<depends>
|
7 |
</depends>
|
8 |
</Fooman_EmailAttachments>
|
@@ -19,6 +19,11 @@
|
|
19 |
</rewrite>
|
20 |
</core>
|
21 |
</models>
|
|
|
|
|
|
|
|
|
|
|
22 |
<pdf>
|
23 |
<order>
|
24 |
<default>sales/order_pdf_items_invoice_default</default>
|
@@ -38,6 +43,11 @@
|
|
38 |
<class>emailattachments/observer</class>
|
39 |
<method>beforeSendOrder</method>
|
40 |
</fooman_emailattachments_before_send_order>
|
|
|
|
|
|
|
|
|
|
|
41 |
</observers>
|
42 |
</fooman_emailattachments_before_send_order>
|
43 |
<fooman_emailattachments_before_send_invoice>
|
@@ -68,6 +78,15 @@
|
|
68 |
</observers>
|
69 |
</fooman_emailattachments_before_send_creditmemo>
|
70 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
</global>
|
72 |
<adminhtml>
|
73 |
<events>
|
@@ -103,12 +122,12 @@
|
|
103 |
</emailattachments>
|
104 |
</routers>
|
105 |
</admin>
|
106 |
-
|
107 |
<default>
|
108 |
<sales_email>
|
109 |
<order>
|
110 |
<attachpdf>0</attachpdf>
|
111 |
<attachagreement>0</attachagreement>
|
|
|
112 |
</order>
|
113 |
<order_comment>
|
114 |
<attachpdf>0</attachpdf>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Fooman_EmailAttachments>
|
5 |
+
<version>0.9.5</version>
|
6 |
<depends>
|
7 |
</depends>
|
8 |
</Fooman_EmailAttachments>
|
19 |
</rewrite>
|
20 |
</core>
|
21 |
</models>
|
22 |
+
<blocks>
|
23 |
+
<emailattachments>
|
24 |
+
<class>Fooman_EmailAttachments_Block</class>
|
25 |
+
</emailattachments>
|
26 |
+
</blocks>
|
27 |
<pdf>
|
28 |
<order>
|
29 |
<default>sales/order_pdf_items_invoice_default</default>
|
43 |
<class>emailattachments/observer</class>
|
44 |
<method>beforeSendOrder</method>
|
45 |
</fooman_emailattachments_before_send_order>
|
46 |
+
<fooman_emailattachments_before_send_order2>
|
47 |
+
<type>singleton</type>
|
48 |
+
<class>emailattachments/observer</class>
|
49 |
+
<method>sendPackingSlip</method>
|
50 |
+
</fooman_emailattachments_before_send_order2>
|
51 |
</observers>
|
52 |
</fooman_emailattachments_before_send_order>
|
53 |
<fooman_emailattachments_before_send_invoice>
|
78 |
</observers>
|
79 |
</fooman_emailattachments_before_send_creditmemo>
|
80 |
</events>
|
81 |
+
<template>
|
82 |
+
<email>
|
83 |
+
<sales_email_order_shipment_template translate="label" module="emailattachments">
|
84 |
+
<label>Packingslip</label>
|
85 |
+
<file>sales/order_new_packingslip.html</file>
|
86 |
+
<type>html</type>
|
87 |
+
</sales_email_order_shipment_template>
|
88 |
+
</email>
|
89 |
+
</template>
|
90 |
</global>
|
91 |
<adminhtml>
|
92 |
<events>
|
122 |
</emailattachments>
|
123 |
</routers>
|
124 |
</admin>
|
|
|
125 |
<default>
|
126 |
<sales_email>
|
127 |
<order>
|
128 |
<attachpdf>0</attachpdf>
|
129 |
<attachagreement>0</attachagreement>
|
130 |
+
<shipment_template>sales_email_order_shipment_template</shipment_template>
|
131 |
</order>
|
132 |
<order_comment>
|
133 |
<attachpdf>0</attachpdf>
|
app/code/community/Fooman/EmailAttachments/etc/system.xml
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
<config>
|
2 |
<sections>
|
3 |
<foomancommon>
|
4 |
-
<label>All</label>
|
5 |
-
<tab>fooman</tab>
|
6 |
-
<show_in_default>1</show_in_default>
|
7 |
-
<show_in_website>1</show_in_website>
|
8 |
-
<show_in_store>1</show_in_store>
|
9 |
-
<sort_order>100</sort_order>
|
10 |
<groups>
|
11 |
-
<
|
12 |
-
<
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</groups>
|
19 |
</foomancommon>
|
20 |
<sales_email>
|
@@ -49,6 +49,36 @@
|
|
49 |
<show_in_website>1</show_in_website>
|
50 |
<show_in_store>1</show_in_store>
|
51 |
</attachfile>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
</fields>
|
53 |
</order>
|
54 |
<order_comment>
|
1 |
<config>
|
2 |
<sections>
|
3 |
<foomancommon>
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
<groups>
|
5 |
+
<extensions>
|
6 |
+
<fields>
|
7 |
+
<emailattachments translate="label" module="emailattachments">
|
8 |
+
<label>Email Attachments</label>
|
9 |
+
<frontend_type>label</frontend_type>
|
10 |
+
<frontend_model>emailattachments/adminhtml_extensioninfo</frontend_model>
|
11 |
+
<sort_order>31</sort_order>
|
12 |
+
<show_in_default>1</show_in_default>
|
13 |
+
<show_in_website>1</show_in_website>
|
14 |
+
<show_in_store>1</show_in_store>
|
15 |
+
</emailattachments>
|
16 |
+
</fields>
|
17 |
+
</extensions>
|
18 |
</groups>
|
19 |
</foomancommon>
|
20 |
<sales_email>
|
49 |
<show_in_website>1</show_in_website>
|
50 |
<show_in_store>1</show_in_store>
|
51 |
</attachfile>
|
52 |
+
<sendpackingslip translate="label">
|
53 |
+
<if_module_enabled>Fooman_PdfCustomiser</if_module_enabled>
|
54 |
+
<label>Send Packing Slip</label>
|
55 |
+
<frontend_type>select</frontend_type>
|
56 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
57 |
+
<sort_order>85</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</sendpackingslip>
|
62 |
+
<shipment_template translate="label">
|
63 |
+
<if_module_enabled>Fooman_PdfCustomiser</if_module_enabled>
|
64 |
+
<label>Packingslip Template</label>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
67 |
+
<sort_order>86</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</shipment_template>
|
72 |
+
<shipment_to translate="label comment">
|
73 |
+
<if_module_enabled>Fooman_PdfCustomiser</if_module_enabled>
|
74 |
+
<label>Send Packingslip To</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>87</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment>Comma-separated.</comment>
|
81 |
+
</shipment_to>
|
82 |
</fields>
|
83 |
</order>
|
84 |
<order_comment>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fooman_EmailAttachments</name>
|
4 |
-
<version>0.9.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -17,9 +17,9 @@
|
|
17 |
Fine grained options offer complete control over what to attach to which email</description>
|
18 |
<notes>0.9.2 Release</notes>
|
19 |
<authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
|
20 |
-
<date>2013-
|
21 |
-
<time>
|
22 |
-
<contents><target name="magecommunity"><dir name="Fooman"><dir name="EmailAttachments"><dir name="Block"><file name="View.php" hash="d1236b00671ee81013b2aecc86bae50c"/></dir><dir name="Helper"><file name="Data.php" hash="
|
23 |
<compatible/>
|
24 |
<dependencies/>
|
25 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fooman_EmailAttachments</name>
|
4 |
+
<version>0.9.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
17 |
Fine grained options offer complete control over what to attach to which email</description>
|
18 |
<notes>0.9.2 Release</notes>
|
19 |
<authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
|
20 |
+
<date>2013-11-16</date>
|
21 |
+
<time>21:56:09</time>
|
22 |
+
<contents><target name="magecommunity"><dir name="Fooman"><dir name="EmailAttachments"><dir name="Block"><dir name="Adminhtml"><file name="Extensioninfo.php" hash="d33347a9003e491cd0f1225bd0959b21"/></dir><file name="View.php" hash="d1236b00671ee81013b2aecc86bae50c"/></dir><dir name="Helper"><file name="Data.php" hash="416c04e5ba42353d6e6c63be3d0bef60"/></dir><dir name="Model"><dir name="Core"><dir name="Email"><dir name="Template"><file name="Mailer.php" hash="49e92d90e1d5f6404f8f3bd3639addc6"/></dir></dir></dir><dir name="Order"><dir name="Pdf"><file name="Order.php" hash="35e037ea6be0ffe46200dc573e684520"/></dir></dir><dir name="System"><file name="File.php" hash="70b05b8e860088b0d2769d7a79c38e0c"/></dir><file name="Observer.php" hash="93ef761b403f57d10315bad7631239a0"/><file name="Selftester.php" hash="b7d60b24d91849823b19a46e85834f4c"/><file name="Updates.php" hash="7bee51da61f188d75dd7707bc6301e9d"/></dir><dir name="controllers"><dir name="Admin"><file name="OrderController.php" hash="ba67951a6afa85f35b49ca9eb375a2bf"/></dir><dir name="Customer"><file name="OrderController.php" hash="bc8d1ae57801fcdf5bc1d5abbac0b879"/></dir></dir><dir name="etc"><file name="config.xml" hash="8aedde6f72958ea329710b21530215ed"/><file name="system.xml" hash="c5b6a16345eb4baf7b32d4dcf56a74e6"/></dir><file name="LICENSE.txt" hash="59563e7be45096d0833dade102989042"/></dir><dir name="Common"><dir name="Block"><dir name="Adminhtml"><file name="Extensioninfo.php" hash="d19e5888399f200904c765781a14e297"/></dir></dir><dir name="Helper"><file name="Data.php" hash="96d8bbc3d06c6a2ff8e8a6fb5b327c00"/></dir><dir name="Model"><dir name="Selftester"><file name="Abstract.php" hash="27590275aaa6a9047bf7bf3d8bfa6893"/><file name="Db.php" hash="e97c570a4d8f83359ee73c03ddd8807a"/></dir><file name="Selftester.php" hash="a4c6f779968a7220b52c880bd07a2460"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SelftesterController.php" hash="5f348318593ab78849163c51a086b516"/></dir></dir><dir name="etc"><file name="config.xml" hash="d765bbe29bb23e6976d72690a77c74da"/><file name="system.xml" hash="062afadb28b77803a0cf5fbdb472f23b"/></dir><file name="LICENSE.txt" hash="59563e7be45096d0833dade102989042"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fooman_EmailAttachments.xml" hash="041c20e1806af133c1c1505af9902001"/><file name="Fooman_Common.xml" hash="2555b2dd668865790df287b5cca61e35"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Fooman_EmailAttachments.csv" hash="572cca36b6b4a051b7722cb6488a636a"/></dir><dir name="de_DE"><file name="Fooman_EmailAttachments.csv" hash="7113fa7ee43f7daeb5511123d014ed57"/></dir><dir name="nl_NL"><file name="Fooman_EmailAttachments.csv" hash="7be7ad5c22ebbdb634f31f3e8d19fbd8"/></dir><dir name="fr_FR"><file name="Fooman_EmailAttachments.csv" hash="4e8c2ae3faf280874e5372d5fccb065d"/></dir><dir name="es_ES"><file name="Fooman_EmailAttachments.csv" hash="d898982c6a29dd52b84a9142dc5cf64f"/></dir><dir name="ro_RO"><file name="Fooman_EmailAttachments.csv" hash="e680cb11b15fc2f63e3123624daed1e1"/></dir><dir name="th_TH"><file name="Fooman_EmailAttachments.csv" hash="572cca36b6b4a051b7722cb6488a636a"/></dir><dir name="da_DK"><file name="Fooman_EmailAttachments.csv" hash="129927e87ec7d8b3d4466a58e5215b09"/></dir><dir name="ar_SA"><file name="Fooman_EmailAttachments.csv" hash="6ed6e4fda26b7dd3bd206538df12e8ab"/></dir><dir name="ca_ES"><file name="Fooman_EmailAttachments.csv" hash="a81b65ca792f534072511a18a91423c9"/></dir><dir name="cs_CZ"><file name="Fooman_EmailAttachments.csv" hash="86f4cac9569ca2708b44a5240496d00a"/></dir><dir name="et_EE"><file name="Fooman_EmailAttachments.csv" hash="206f6d731c2e2ef3664869a6be68b95f"/></dir><dir name="he_IL"><file name="Fooman_EmailAttachments.csv" hash="81b7326525ee4839e41be971709f9e96"/></dir><dir name="it_IT"><file name="Fooman_EmailAttachments.csv" hash="572cca36b6b4a051b7722cb6488a636a"/></dir><dir name="ja_JP"><file name="Fooman_EmailAttachments.csv" hash="5618c215a5cbb924d2951c879d42573f"/></dir><dir name="lt_LT"><file name="Fooman_EmailAttachments.csv" hash="18fff03b09d88b8b938bed19639b4f8f"/></dir><dir name="lv_LV"><file name="Fooman_EmailAttachments.csv" hash="15714286f2b7e009f7674a9f747a1cd4"/></dir><dir name="no_NO"><file name="Fooman_EmailAttachments.csv" hash="9d201c51cfc24326a0a677b2f7cd838e"/></dir><dir name="pt_BR"><file name="Fooman_EmailAttachments.csv" hash="463ca55f2f52b4422ff2f275f8649b85"/></dir><dir name="sl_SI"><file name="Fooman_EmailAttachments.csv" hash="288a189ee828dc6b91b72f20bc771452"/></dir><dir name="sv_SE"><file name="Fooman_EmailAttachments.csv" hash="96bb09816c468417dd6f280108d200d3"/></dir><dir name="fi_FI"><file name="Fooman_EmailAttachments.csv" hash="53f5fa6e60fb26effdd36422d8bf24f9"/></dir><dir name="gr_GR"><file name="Fooman_EmailAttachments.csv" hash="34187b2e6fded1ba9d065f9a9cb73ae8"/></dir><dir name="hr_HR"><file name="Fooman_EmailAttachments.csv" hash="6564938bfeefdc2ca37f183943bc5873"/></dir><dir name="ko_KR"><file name="Fooman_EmailAttachments.csv" hash="951a785b40eb519b6f460fccc7718b24"/></dir><dir name="nb_NO"><file name="Fooman_EmailAttachments.csv" hash="9d201c51cfc24326a0a677b2f7cd838e"/></dir><dir name="pl_PL"><file name="Fooman_EmailAttachments.csv" hash="db51bd721228cf6f3b8f25702282cced"/></dir><dir name="ru_RU"><file name="Fooman_EmailAttachments.csv" hash="5c111bca22d66855aa3f999a74b1fdba"/></dir><dir name="zh_CN"><file name="Fooman_EmailAttachments.csv" hash="f35148d8703229c2945565b3d8559455"/></dir></target></contents>
|
23 |
<compatible/>
|
24 |
<dependencies/>
|
25 |
</package>
|