Campaign_Commander_Transactional_Email_1_5 - Version 1.2.1

Version Notes

Send your transactional e-mails through the Campaign Commander NMP platform

Download this release

Release Info

Developer Magento Core Team
Extension Campaign_Commander_Transactional_Email_1_5
Version 1.2.1
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.1

app/code/community/Emv/Core/Model/Service/Soap/Api.php CHANGED
@@ -308,6 +308,16 @@ class Emv_Core_Model_Service_Soap_Api
308
  */
309
  public function sendEmv($emvTemplate, $variable, $mail, $content = '')
310
  {
 
 
 
 
 
 
 
 
 
 
311
  try {
312
  if(!is_array($mail))
313
  {
@@ -329,8 +339,15 @@ class Emv_Core_Model_Service_Soap_Api
329
  'synchrotype' => 'NOTHING',
330
  'uidkey' => 'EMAIL',
331
  ));
 
 
 
 
332
  $wsResult = $this->_notificationService->sendObject($params);
333
 
 
 
 
334
  $returnString .= $oneMail . ' : ' . $wsResult->return . ' / ';
335
  }
336
 
308
  */
309
  public function sendEmv($emvTemplate, $variable, $mail, $content = '')
310
  {
311
+ Mage::log('-- Entré dans sendEmv', null, Mage::helper('emvcore')->LOG_FILE);
312
+ Mage::log(' param $emvTemplate', null, Mage::helper('emvcore')->LOG_FILE);
313
+ Mage::log($emvTemplate, null, Mage::helper('emvcore')->LOG_FILE);
314
+ Mage::log(' param $variable', null, Mage::helper('emvcore')->LOG_FILE);
315
+ Mage::log($variable, null, Mage::helper('emvcore')->LOG_FILE);
316
+ Mage::log(' param $mail', null, Mage::helper('emvcore')->LOG_FILE);
317
+ Mage::log($mail, null, Mage::helper('emvcore')->LOG_FILE);
318
+ Mage::log(' param $content', null, Mage::helper('emvcore')->LOG_FILE);
319
+ Mage::log($content, null, Mage::helper('emvcore')->LOG_FILE);
320
+
321
  try {
322
  if(!is_array($mail))
323
  {
339
  'synchrotype' => 'NOTHING',
340
  'uidkey' => 'EMAIL',
341
  ));
342
+
343
+ Mage::log(' var interne $params', null, Mage::helper('emvcore')->LOG_FILE);
344
+ Mage::log($params, null, Mage::helper('emvcore')->LOG_FILE);
345
+
346
  $wsResult = $this->_notificationService->sendObject($params);
347
 
348
+ Mage::log(' var interne $wsResult', null, Mage::helper('emvcore')->LOG_FILE);
349
+ Mage::log($wsResult, null, Mage::helper('emvcore')->LOG_FILE);
350
+
351
  $returnString .= $oneMail . ' : ' . $wsResult->return . ' / ';
352
  }
353
 
app/code/community/Emv/Emt/Model/Mage/Core/Email/Template.php CHANGED
@@ -116,8 +116,9 @@ class Emv_Emt_Model_Mage_Core_Email_Template extends Mage_Core_Model_Email_Templ
116
  * @param array $var array of magento instance (cutomer, order ...) where we going to
117
  * pick values
118
  */
119
- public function prepareAttributes($attributesArray ,$var)
120
  {
 
121
  $attributesWithValues = array();
122
  foreach($attributesArray as $emv => $mage)
123
  {
@@ -125,23 +126,37 @@ class Emv_Emt_Model_Mage_Core_Email_Template extends Mage_Core_Model_Email_Templ
125
  {
126
  //regexp match so it's a magento variable syntax
127
  preg_match(
128
- '@\{\{.*var[=?|\s+]\$?(?P<entity>[a-z0-9_/:]+)\.(?P<entityAttribute>[a-z0-9_/\(\):]+).*\}\}@is',
129
  $mage, $matches);
130
 
 
 
131
  //check if the magento template variable is a method (string finished by a ')')
132
- if(preg_match('@\)$@is', $matches['entityAttribute']))
133
- {
134
- preg_match('@^(?P<methodName>.*)\(@is', $matches['entityAttribute'], $matchedMethod);
135
- $method = $matchedMethod['methodName'];
136
- }
137
- else
138
  {
139
- $method = 'get'.ucfirst($matches['entityAttribute']);
 
 
 
 
 
 
 
 
140
  }
141
- if(array_key_exists($matches['entity'], $var))
 
142
  {
143
- $value = call_user_func(array($var[$matches['entity']], $method));
144
- $attributesWithValues[$emv] = $value;
 
 
 
 
 
 
 
 
145
  }
146
  }
147
  else
@@ -150,6 +165,7 @@ class Emv_Emt_Model_Mage_Core_Email_Template extends Mage_Core_Model_Email_Templ
150
  $attributesWithValues[$emv] = $mage;
151
  }
152
  }
 
153
  return $attributesWithValues;
154
  }
155
  }
116
  * @param array $var array of magento instance (cutomer, order ...) where we going to
117
  * pick values
118
  */
119
+ public function prepareAttributes($attributesArray, $var)
120
  {
121
+
122
  $attributesWithValues = array();
123
  foreach($attributesArray as $emv => $mage)
124
  {
126
  {
127
  //regexp match so it's a magento variable syntax
128
  preg_match(
129
+ '@\{\{.*var[=?|\s+]\$?(?P<entity>[a-z0-9_/:]+)\.?(?P<entityAttribute>[a-z0-9_/\(\):]+)?.*\}\}@is',
130
  $mage, $matches);
131
 
132
+ $method = null;
133
+
134
  //check if the magento template variable is a method (string finished by a ')')
135
+ if(array_key_exists('entityAttribute', $matches))
 
 
 
 
 
136
  {
137
+ if(preg_match('@\)$@is', $matches['entityAttribute']))
138
+ {
139
+ preg_match('@^(?P<methodName>.*)\(@is', $matches['entityAttribute'], $matchedMethod);
140
+ $method = $matchedMethod['methodName'];
141
+ }
142
+ else
143
+ {
144
+ $method = 'get'.ucfirst($matches['entityAttribute']);
145
+ }
146
  }
147
+
148
+ if(array_key_exists('entity', $matches))
149
  {
150
+ if($method === null)
151
+ {
152
+ // just a variable content
153
+ $attributesWithValues[$emv] = $var[$matches['entity']];
154
+ }
155
+ elseif($method !== null && array_key_exists($matches['entity'], $var))
156
+ {
157
+ $value = call_user_func(array($var[$matches['entity']], $method));
158
+ $attributesWithValues[$emv] = $value;
159
+ }
160
  }
161
  }
162
  else
165
  $attributesWithValues[$emv] = $mage;
166
  }
167
  }
168
+
169
  return $attributesWithValues;
170
  }
171
  }
app/code/community/Emv/Emt/Model/Mysql4/Emt/Collection.php CHANGED
@@ -57,17 +57,36 @@ class Emv_Emt_Model_Mysql4_Emt_Collection extends Mage_Core_Model_Mysql4_Collect
57
  foreach ($this as $emt)
58
  {
59
  $id = $emt->getEmvTemplateId();
60
- try {
61
- /* @var $account Emv_Core_Model_Account */
62
- $account = Mage::getModel('emvcore/account')->load($emt->getEmvAccountId());
63
 
64
- /* @var $soap Emv_Core_Model_Service_Soap_Api */
65
- $soap = Mage::getModel('emvcore/service_soap_api', $account);
 
66
 
67
- $emt->setEmvTemplateIdAndName( $id. ' / ' . $soap->getTemplateById($id)->name);
68
- } catch (Exception $e) {
69
- // if we couln't connect to the WS we just display the Id
70
- $emt->setEmvTemplateIdAndName( $id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
  }
73
 
57
  foreach ($this as $emt)
58
  {
59
  $id = $emt->getEmvTemplateId();
 
 
 
60
 
61
+ if($id !== null)
62
+ {
63
+ try {
64
 
65
+ /* @var $account Emv_Core_Model_Account */
66
+ $account = Mage::getModel('emvcore/account')->load($emt->getEmvAccountId());
67
+
68
+ /* @var $soap Emv_Core_Model_Service_Soap_Api */
69
+ $soap = Mage::getModel('emvcore/service_soap_api', $account);
70
+
71
+ $EMVTemplate = $soap->getTemplateById($id);
72
+
73
+ if(isset($EMVTemplate->name))
74
+ {
75
+ $emt->setEmvTemplateIdAndName( $id. ' / ' . $EMVTemplate->name);
76
+ }
77
+ else
78
+ {
79
+ $emt->setEmvTemplateIdAndName( $id. ' / No Name');
80
+ }
81
+
82
+ } catch (Exception $e) {
83
+ // if we couln't connect to the WS we just display the Id
84
+ $emt->setEmvTemplateIdAndName( $id );
85
+ }
86
+ }
87
+ else
88
+ {
89
+ $emt->setEmvTemplateIdAndName( '' );
90
  }
91
  }
92
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Campaign_Commander_Transactional_Email_1_5</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Send your transactional e-mails through the Campaign Commander NMP platform</description>
11
  <notes>Send your transactional e-mails through the Campaign Commander NMP platform</notes>
12
  <authors><author><name>Luis Diaz</name><user>auto-converted</user><email>ldiaz@emailvision.com</email></author></authors>
13
- <date>2012-02-20</date>
14
- <time>17:19:16</time>
15
- <contents><target name="magelocale"><dir name="en_US"><file name="Emv_Core.csv" hash="4a68f62b3bb6003f38632e8726c41d73"/><file name="Emv_Emt.csv" hash="9550fdad59ad6d262f3da8aa09e5b88e"/></dir><dir name="fr_FR"><file name="Emv_Core.csv" hash="5d7c94b493825d9efb5ef60178bdab50"/><file name="Emv_Emt.csv" hash="42e00b78ebb2c8ac9181f98566015506"/></dir></target><target name="mageetc"><dir name="modules"><file name="Emv_Core.xml" hash="e25dd0ea40fad09e0d1f6260f46e65ac"/><file name="Emv_Emt.xml" hash="d1e26edb25bce0b78e6c14792c07ac03"/></dir></target><target name="magecommunity"><dir name="Emv"><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Account"><dir name="Edit"><file name="Form.php" hash="9e090720d3b7fc7406d2e4d4f95dbc90"/></dir><file name="Edit.php" hash="34bc1566c3693acccaa4c8e40b31cb5c"/><file name="Grid.php" hash="3d175f0e1b7ccc7dec1c9ffa30cacb76"/></dir><file name="Accounts.php" hash="3f35eecb2bf23417c0fab4746bda6d0c"/></dir></dir><dir name="Helper"><file name="Config.php" hash="455cd67728b1e6876e9fd8d55ca3253b"/><file name="Data.php" hash="896b9955cc2d6b27b9eca4d2508b7169"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Account"><file name="Collection.php" hash="39c1a08471b3bdd0563f3002a32a4db8"/></dir><file name="Account.php" hash="cea2093a18291b7dd24e25b6f8ce0da0"/></dir><dir name="Resource"><file name="Setup.php" hash="6fc36453ff6c01ac0534731816355bd0"/></dir><dir name="Service"><dir name="Soap"><file name="Api.php" hash="83105a6b3d1775629dce4134bce2315d"/><file name="Config.php" hash="11eb39167cb8354f2da28215c16476e8"/><file name="SoapClient.php" hash="32117ab80f05f6e15b03edc879f806c1"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Account.php" hash="cbc4ee876efd1abcdaa5c57cc08714c2"/></dir></dir></dir><file name="Account.php" hash="a8a6c2c45ab0979666d09732e8d3eda2"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AccountController.php" hash="91447d74999979c278b65dd85f5c06d8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2e84807c5c503bd91ed673dfb5f579bd"/><file name="config.xml" hash="340537c059d97aede3a3a16eac148d76"/><file name="system.xml" hash="4e14237f7d69bd20a8f4fd7fded54ba7"/></dir><dir name="sql"><dir name="emvcore_setup"><file name="mysql4-install-0.1.0.php" hash="7bc6d6e7c03398c40008d89ed86e27bc"/></dir></dir><file name="Exception.php" hash="227e1046ebceb99af7bc2b441bb4997d"/></dir><dir name="Emt"><dir name="Block"><dir name="Adminhtml"><dir name="Emt"><dir name="Edit"><file name="Attributes.php" hash="cc2a88773ca64fe7e88b0f460b3b05fc"/><file name="Form.php" hash="7ff998d35df74c4733f06a9fa6ddcae4"/></dir><dir name="New"><file name="Form.php" hash="f2f06b70d36dc2eefe9d4bf7f49ab633"/></dir><file name="Edit.php" hash="be44792b12374f6d6f4c5687fd5e04b0"/><file name="Grid.php" hash="68a88335f6725d1fc818bf4519e01603"/><file name="New.php" hash="6ac499b1064c29fd6893c61cb29209c4"/></dir><file name="Emts.php" hash="b0e91f038bfea92da099a94cb5c232a3"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3bcd2a0563cf4a604cefac0a41884819"/><file name="Emvtemplate.php" hash="5e8ebfdb935fc132917aba8426e9b0cc"/></dir><dir name="Model"><dir name="Mage"><dir name="Core"><dir name="Email"><file name="Template.php" hash="cdbc280d75df51aa4c4fd258157832b5"/></dir></dir></dir><dir name="Mysql4"><dir name="Attribute"><file name="Collection.php" hash="a029255fdb8ccb45250959e08bd7f304"/></dir><dir name="Emt"><file name="Collection.php" hash="ab8126814474a5c7616f1fd9b40796e5"/></dir><dir name="Mailmode"><file name="Collection.php" hash="98b8005f11a230829c8b1664d9222f2c"/></dir><file name="Attribute.php" hash="13fe2d1ca2efa66b4184da68a629135c"/><file name="Emt.php" hash="9a5e2265b2e5841f07cb175229f79971"/><file name="Mailmode.php" hash="7585af6b9d102fc52788ac0083d338ae"/></dir><dir name="Resource"><file name="Setup.php" hash="62b3de559b3484cec6767a174cda42e9"/></dir><file name="Attribute.php" hash="430f2ba97ded59d319fcd8579555c53c"/><file name="Emt.php" hash="51ad525e79f8d3939bba7b5a5ec69f2f"/><file name="MageTemplate.php" hash="66051e8c63d2012c022d7bf45a3e880b"/><file name="Mailmode.php" hash="d77ce590e7302f0115dcd2075468595c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="EmtController.php" hash="e0d5dcab55e6b147ab8f3e7867f48fb8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="46610ec63dd5443130e59dbc900e3541"/><file name="config.xml" hash="837cdaf661abefaefba7fca6ab421419"/></dir><dir name="sql"><dir name="emvemt_setup"><file name="mysql4-install-0.1.0.php" hash="a7d12df049f2c1377a072fa7899dcb6c"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="34df942808b7609c10077b493e87f2c2"/></dir></dir><file name="Constants.php" hash="89e516eb1ad83482283537dc7911a2c6"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="emt"><file name="attributes.phtml" hash="b6508fa8b577e1fe2ae56c635f2ca923"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Campaign_Commander_Transactional_Email_1_5</name>
4
+ <version>1.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
10
  <description>Send your transactional e-mails through the Campaign Commander NMP platform</description>
11
  <notes>Send your transactional e-mails through the Campaign Commander NMP platform</notes>
12
  <authors><author><name>Luis Diaz</name><user>auto-converted</user><email>ldiaz@emailvision.com</email></author></authors>
13
+ <date>2012-03-29</date>
14
+ <time>12:49:05</time>
15
+ <contents><target name="magelocale"><dir name="en_US"><file name="Emv_Core.csv" hash="4a68f62b3bb6003f38632e8726c41d73"/><file name="Emv_Emt.csv" hash="9550fdad59ad6d262f3da8aa09e5b88e"/></dir><dir name="fr_FR"><file name="Emv_Core.csv" hash="5d7c94b493825d9efb5ef60178bdab50"/><file name="Emv_Emt.csv" hash="42e00b78ebb2c8ac9181f98566015506"/></dir></target><target name="mageetc"><dir name="modules"><file name="Emv_Core.xml" hash="e25dd0ea40fad09e0d1f6260f46e65ac"/><file name="Emv_Emt.xml" hash="d1e26edb25bce0b78e6c14792c07ac03"/></dir></target><target name="magecommunity"><dir name="Emv"><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Account"><dir name="Edit"><file name="Form.php" hash="9e090720d3b7fc7406d2e4d4f95dbc90"/></dir><file name="Edit.php" hash="34bc1566c3693acccaa4c8e40b31cb5c"/><file name="Grid.php" hash="3d175f0e1b7ccc7dec1c9ffa30cacb76"/></dir><file name="Accounts.php" hash="3f35eecb2bf23417c0fab4746bda6d0c"/></dir></dir><dir name="Helper"><file name="Config.php" hash="455cd67728b1e6876e9fd8d55ca3253b"/><file name="Data.php" hash="896b9955cc2d6b27b9eca4d2508b7169"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Account"><file name="Collection.php" hash="39c1a08471b3bdd0563f3002a32a4db8"/></dir><file name="Account.php" hash="cea2093a18291b7dd24e25b6f8ce0da0"/></dir><dir name="Resource"><file name="Setup.php" hash="6fc36453ff6c01ac0534731816355bd0"/></dir><dir name="Service"><dir name="Soap"><file name="Api.php" hash="955de656ecd2a93bfbbc44620620cded"/><file name="Config.php" hash="11eb39167cb8354f2da28215c16476e8"/><file name="SoapClient.php" hash="32117ab80f05f6e15b03edc879f806c1"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Account.php" hash="cbc4ee876efd1abcdaa5c57cc08714c2"/></dir></dir></dir><file name="Account.php" hash="a8a6c2c45ab0979666d09732e8d3eda2"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AccountController.php" hash="91447d74999979c278b65dd85f5c06d8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2e84807c5c503bd91ed673dfb5f579bd"/><file name="config.xml" hash="340537c059d97aede3a3a16eac148d76"/><file name="system.xml" hash="4e14237f7d69bd20a8f4fd7fded54ba7"/></dir><dir name="sql"><dir name="emvcore_setup"><file name="mysql4-install-0.1.0.php" hash="7bc6d6e7c03398c40008d89ed86e27bc"/></dir></dir><file name="Exception.php" hash="227e1046ebceb99af7bc2b441bb4997d"/></dir><dir name="Emt"><dir name="Block"><dir name="Adminhtml"><dir name="Emt"><dir name="Edit"><file name="Attributes.php" hash="cc2a88773ca64fe7e88b0f460b3b05fc"/><file name="Form.php" hash="7ff998d35df74c4733f06a9fa6ddcae4"/></dir><dir name="New"><file name="Form.php" hash="f2f06b70d36dc2eefe9d4bf7f49ab633"/></dir><file name="Edit.php" hash="be44792b12374f6d6f4c5687fd5e04b0"/><file name="Grid.php" hash="68a88335f6725d1fc818bf4519e01603"/><file name="New.php" hash="6ac499b1064c29fd6893c61cb29209c4"/></dir><file name="Emts.php" hash="b0e91f038bfea92da099a94cb5c232a3"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3bcd2a0563cf4a604cefac0a41884819"/><file name="Emvtemplate.php" hash="5e8ebfdb935fc132917aba8426e9b0cc"/></dir><dir name="Model"><dir name="Mage"><dir name="Core"><dir name="Email"><file name="Template.php" hash="6037b085c058ff699b0dcae3e944fff3"/></dir></dir></dir><dir name="Mysql4"><dir name="Attribute"><file name="Collection.php" hash="a029255fdb8ccb45250959e08bd7f304"/></dir><dir name="Emt"><file name="Collection.php" hash="5bb76339b2bcf526f440643b367b7682"/></dir><dir name="Mailmode"><file name="Collection.php" hash="98b8005f11a230829c8b1664d9222f2c"/></dir><file name="Attribute.php" hash="13fe2d1ca2efa66b4184da68a629135c"/><file name="Emt.php" hash="9a5e2265b2e5841f07cb175229f79971"/><file name="Mailmode.php" hash="7585af6b9d102fc52788ac0083d338ae"/></dir><dir name="Resource"><file name="Setup.php" hash="62b3de559b3484cec6767a174cda42e9"/></dir><file name="Attribute.php" hash="430f2ba97ded59d319fcd8579555c53c"/><file name="Emt.php" hash="51ad525e79f8d3939bba7b5a5ec69f2f"/><file name="MageTemplate.php" hash="66051e8c63d2012c022d7bf45a3e880b"/><file name="Mailmode.php" hash="d77ce590e7302f0115dcd2075468595c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="EmtController.php" hash="e0d5dcab55e6b147ab8f3e7867f48fb8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="46610ec63dd5443130e59dbc900e3541"/><file name="config.xml" hash="837cdaf661abefaefba7fca6ab421419"/></dir><dir name="sql"><dir name="emvemt_setup"><file name="mysql4-install-0.1.0.php" hash="a7d12df049f2c1377a072fa7899dcb6c"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="34df942808b7609c10077b493e87f2c2"/></dir></dir><file name="Constants.php" hash="89e516eb1ad83482283537dc7911a2c6"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="emt"><file name="attributes.phtml" hash="b6508fa8b577e1fe2ae56c635f2ca923"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>