Mage_Laposta_Connect - Version 1.0.2

Version Notes

- Filter updated subscribers with updates since last sync time
- Fixed erroneous Laposta webhook handler

Download this release

Release Info

Developer Merten van Gerven
Extension Mage_Laposta_Connect
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Laposta/Connect/Model/Cron.php CHANGED
@@ -10,7 +10,7 @@ class Laposta_Connect_Model_Cron
10
  {
11
  /** @var $subscribers Laposta_Connect_Model_Mysql4_Subscriber_Collection */
12
  $subscribers = Mage::getModel('lapostaconnect/subscriber')->getCollection();
13
- // $subscribers->getSelect()->where('`updated_time` > `sync_time`')->orWhere('`sync_time` IS NULL');
14
 
15
  Mage::helper('lapostaconnect/sync')->syncSubscribers($subscribers);
16
  }
10
  {
11
  /** @var $subscribers Laposta_Connect_Model_Mysql4_Subscriber_Collection */
12
  $subscribers = Mage::getModel('lapostaconnect/subscriber')->getCollection();
13
+ $subscribers->getSelect()->where('`updated_time` > `sync_time`')->orWhere('`sync_time` IS NULL');
14
 
15
  Mage::helper('lapostaconnect/sync')->syncSubscribers($subscribers);
16
  }
app/code/community/Laposta/Connect/controllers/WebhookController.php CHANGED
@@ -38,7 +38,11 @@ class Laposta_Connect_WebhookController extends Mage_Core_Controller_Front_Actio
38
  /** @var $lists Laposta_Connect_Model_Mysql4_List_Collection */
39
  $lists = Mage::getModel('lapostaconnect/list')->getCollection();
40
  /** @var $list Laposta_Connect_Model_List */
41
- $list = $lists->getItemsByColumnValue('webhook_token', $listToken);
 
 
 
 
42
 
43
  if (!$list instanceof Laposta_Connect_Model_List) {
44
  return $this->log("Unable to consume events. '$listToken' is not a valid webhook token.");
@@ -164,10 +168,14 @@ class Laposta_Connect_WebhookController extends Mage_Core_Controller_Front_Actio
164
  if ($status !== 'active') {
165
  $newsletterSubscriber->unsubscribe();
166
 
 
 
167
  return $this;
168
  }
169
 
170
- $newsletterSubscriber->subscribeCustomer($customer);
 
 
171
 
172
  return $this;
173
  }
38
  /** @var $lists Laposta_Connect_Model_Mysql4_List_Collection */
39
  $lists = Mage::getModel('lapostaconnect/list')->getCollection();
40
  /** @var $list Laposta_Connect_Model_List */
41
+ $list = array_shift(
42
+ $lists->getItemsByColumnValue('webhook_token', $listToken)
43
+ );
44
+
45
+ $this->log("Found list using webhook token '$listToken'", $list);
46
 
47
  if (!$list instanceof Laposta_Connect_Model_List) {
48
  return $this->log("Unable to consume events. '$listToken' is not a valid webhook token.");
168
  if ($status !== 'active') {
169
  $newsletterSubscriber->unsubscribe();
170
 
171
+ return $this->log("Customer '{$customer->getEmail()}' for subscriber with laposta id '$memberId' has been unsubscribed.");
172
+
173
  return $this;
174
  }
175
 
176
+ $newsletterSubscriber->subscribe($customer->getEmail());
177
+
178
+ return $this->log("Customer '{$customer->getEmail()}' for subscriber with laposta id '$memberId' has been subscribed.");
179
 
180
  return $this;
181
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Laposta_Connect</name>
4
- <version>1.0.1</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>
@@ -24,12 +24,13 @@
24
  &#xD;
25
  &lt;h2&gt;Questions&lt;/h2&gt;&#xD;
26
  &lt;p&gt;Please see the FAQ section for questions.&lt;/p&gt;</description>
27
- <notes>- Removed redundant newsletter menu item&#xD;
28
- - Added reset for synchronised entries when API key is changed</notes>
 
29
  <authors><author><name>Merten van Gerven</name><user>mertenvg</user><email>merten@codeblanche.com</email></author></authors>
30
- <date>2014-04-25</date>
31
- <time>17:51:55</time>
32
- <contents><target name="magecommunity"><dir name="Laposta"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Mapfields.php" hash="2c88b8a08121c09ba5748f631205a282"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Customer.php" hash="8a54f573c56f8ce9e248506bb9514561"/><file name="Data.php" hash="8f9e28d0f28f9375385432d227ec1d06"/><file name="Fields.php" hash="51bc0aa26167219b038c04b3babb19af"/><file name="Laposta.php" hash="9085c0c80dcd314d402bfc960b8f861e"/><file name="Subscribe.php" hash="f58bc248ee3b4d229b58de8b4efbccf3"/><file name="Sync.php" hash="ad94bd49cf666fb99fa043bef1ba8bcf"/></dir><dir name="Model"><file name="Cron.php" hash="7a6a22b317282c049f5fa10a59622d58"/><file name="Field.php" hash="42e1857bdb7d90b31be189e2921ac8fd"/><file name="List.php" hash="99f590a5e5ea3b1a14869c641f49eaed"/><dir name="Mysql4"><dir name="Field"><file name="Collection.php" hash="f8133202231937b1ec14d8cdc39903fe"/></dir><file name="Field.php" hash="c49743d6acd1d4ce2b69aadf22838839"/><dir name="List"><file name="Collection.php" hash="fcc556452fff91bb3e9f933c68fff630"/></dir><file name="List.php" hash="6fef1b36f5d3a5560f83bafe205be614"/><dir name="Subscriber"><file name="Collection.php" hash="05db928eb656f132e4fa16ac740ce3c5"/></dir><file name="Subscriber.php" hash="9f73d39e97d4a19f8d8ad3c19f83a699"/></dir><file name="Observer.php" hash="1f22b2201a11543b725bc76f133b803d"/><file name="Subscriber.php" hash="cba5176e53a7dcab9b9014190f13485d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LapostaController.php" hash="cc2a0d62caf63469258042e3b29616e4"/></dir><file name="IndexController.php" hash="7577e30abee9624d59901edb5cecd3e9"/><file name="SubscribeAllController.php" hash="160ac8e5229bb1003d7220116a9b06f7"/><file name="WebhookController.php" hash="dbdb6706b908bffd29e5d69f97c6809f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="71f985837d4b79e3db94c529bfee1e47"/><file name="config.xml" hash="325b71820df2ffd4b265810cb7c680f6"/><file name="system.xml" hash="6ee7d5de56541573f16a2caf94dc0418"/></dir><dir name="sql"><dir name="connect_setup"><file name="mysql4-install-0.1.0.php" hash="96c1911d06392a5e9496829411102479"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="lapostaconnect.xml" hash=""/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Laposta_Connect.xml" hash="ab7675e19ea96d39c5980bee835f0e76"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Laposta_Connect.csv" hash="4f8f28790602cdd01633c0bb00f70585"/></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
35
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Laposta_Connect</name>
4
+ <version>1.0.2</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>
24
  &#xD;
25
  &lt;h2&gt;Questions&lt;/h2&gt;&#xD;
26
  &lt;p&gt;Please see the FAQ section for questions.&lt;/p&gt;</description>
27
+ <notes>- Filter updated subscribers with updates since last sync time&#xD;
28
+ - Fixed erroneous Laposta webhook handler&#xD;
29
+ </notes>
30
  <authors><author><name>Merten van Gerven</name><user>mertenvg</user><email>merten@codeblanche.com</email></author></authors>
31
+ <date>2014-05-13</date>
32
+ <time>11:43:09</time>
33
+ <contents><target name="magecommunity"><dir name="Laposta"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Mapfields.php" hash="2c88b8a08121c09ba5748f631205a282"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Customer.php" hash="8a54f573c56f8ce9e248506bb9514561"/><file name="Data.php" hash="8f9e28d0f28f9375385432d227ec1d06"/><file name="Fields.php" hash="51bc0aa26167219b038c04b3babb19af"/><file name="Laposta.php" hash="9085c0c80dcd314d402bfc960b8f861e"/><file name="Subscribe.php" hash="f58bc248ee3b4d229b58de8b4efbccf3"/><file name="Sync.php" hash="ad94bd49cf666fb99fa043bef1ba8bcf"/></dir><dir name="Model"><file name="Cron.php" hash="270a2289a1de1bc678dfc4e6264c095b"/><file name="Field.php" hash="42e1857bdb7d90b31be189e2921ac8fd"/><file name="List.php" hash="99f590a5e5ea3b1a14869c641f49eaed"/><dir name="Mysql4"><dir name="Field"><file name="Collection.php" hash="f8133202231937b1ec14d8cdc39903fe"/></dir><file name="Field.php" hash="c49743d6acd1d4ce2b69aadf22838839"/><dir name="List"><file name="Collection.php" hash="fcc556452fff91bb3e9f933c68fff630"/></dir><file name="List.php" hash="6fef1b36f5d3a5560f83bafe205be614"/><dir name="Subscriber"><file name="Collection.php" hash="05db928eb656f132e4fa16ac740ce3c5"/></dir><file name="Subscriber.php" hash="9f73d39e97d4a19f8d8ad3c19f83a699"/></dir><file name="Observer.php" hash="1f22b2201a11543b725bc76f133b803d"/><file name="Subscriber.php" hash="cba5176e53a7dcab9b9014190f13485d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LapostaController.php" hash="cc2a0d62caf63469258042e3b29616e4"/></dir><file name="IndexController.php" hash="7577e30abee9624d59901edb5cecd3e9"/><file name="SubscribeAllController.php" hash="160ac8e5229bb1003d7220116a9b06f7"/><file name="WebhookController.php" hash="f31bcf69d894e4dd8562f6f5a8f3ddf0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="71f985837d4b79e3db94c529bfee1e47"/><file name="config.xml" hash="325b71820df2ffd4b265810cb7c680f6"/><file name="system.xml" hash="6ee7d5de56541573f16a2caf94dc0418"/></dir><dir name="sql"><dir name="connect_setup"><file name="mysql4-install-0.1.0.php" hash="96c1911d06392a5e9496829411102479"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="lapostaconnect.xml" hash=""/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Laposta_Connect.xml" hash="ab7675e19ea96d39c5980bee835f0e76"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Laposta_Connect.csv" hash="4f8f28790602cdd01633c0bb00f70585"/></dir></target></contents>
34
  <compatible/>
35
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
36
  </package>