Sarbacane_Sarbacanedesktop - Version 1.0.0.4

Version Notes

Huge improvement. No longer storing lists informations in database.
No longer need last call date to generate the diff

Download this release

Release Info

Developer Sarbacane Software
Extension Sarbacane_Sarbacanedesktop
Version 1.0.0.4
Comparing to
See all releases


Code changes from version 1.0.0.1 to 1.0.0.4

app/code/community/Sarbacane/Sarbacanedesktop/Helper/Data.php CHANGED
@@ -72,15 +72,11 @@ class Sarbacane_Sarbacanedesktop_Helper_Data extends Mage_Core_Helper_Abstract
72
  {
73
  $resource = Mage::getSingleton('core/resource');
74
  $db_write = $resource->getConnection('core_write');
75
- $sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
76
  $rq_sql = '
77
  DELETE FROM `' . $sarbacanedesktop . '`
78
- WHERE `list_type` = ' . $db_write->quote($list_type) . '
79
- AND `store_id` = ' . $db_write->quote($store_id);
80
- if ($sd_id != '') {
81
- $rq_sql .= '
82
- AND `sd_id` = ' . $db_write->quote($sd_id);
83
- }
84
  $db_write->query($rq_sql);
85
  }
86
 
@@ -138,38 +134,13 @@ class Sarbacane_Sarbacanedesktop_Helper_Data extends Mage_Core_Helper_Abstract
138
  }
139
  }
140
  }
141
-
142
- public function setConfiguration($field, $value)
143
- {
144
- $sql_field = '';
145
- if ($field == 'identifier') {
146
- $sql_field = 'lastname';
147
- } else if ($field == 'sd_list') {
148
- $sql_field = 'firstname';
149
- } else if ($field == 'sd_token') {
150
- $sql_field = 'orders_data';
151
- }
152
- if ($sql_field != '') {
153
- $resource = Mage::getSingleton('core/resource');
154
- $db_write = $resource->getConnection('core_write');
155
- $sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
156
- $rq_sql = '
157
- UPDATE `' . $sarbacanedesktop . '`
158
- SET `' . $sql_field . '` = ' . $db_write->quote($value) . '
159
- WHERE `email` = \'-\'
160
- AND `store_id` = \'-\'
161
- AND `list_type` = \'-\'';
162
- $db_write->query($rq_sql);
163
- }
164
- }
165
 
166
  public function deleteSdid($sd_id){
167
  $resource = Mage::getSingleton('core/resource');
168
  $db_write = $resource->getConnection('core_write');
169
- $sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
170
  $sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
171
 
172
- $rq_sql = 'DELETE FROM sarbacanedesktop WHERE sd_id = (SELECT sd_id FROM sarbacanedesktop_users WHERE sd_type= "sd_id" AND sd_value="'. $sd_id .'")';
173
  $db_write->query($rq_sql);
174
  }
175
 
72
  {
73
  $resource = Mage::getSingleton('core/resource');
74
  $db_write = $resource->getConnection('core_write');
75
+ $sarbacanedesktop = $resource->getTableName('sarbacanedesktop_users');
76
  $rq_sql = '
77
  DELETE FROM `' . $sarbacanedesktop . '`
78
+ WHERE `sd_type` = "sd_id"
79
+ AND `sd_id` = ' . $db_write->quote($sd_id);
 
 
 
 
80
  $db_write->query($rq_sql);
81
  }
82
 
134
  }
135
  }
136
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
  public function deleteSdid($sd_id){
139
  $resource = Mage::getSingleton('core/resource');
140
  $db_write = $resource->getConnection('core_write');
 
141
  $sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
142
 
143
+ $rq_sql = 'DELETE FROM '.$sarbacanedesktop_users.' WHERE sd_value = "'.$sd_id.'" AND sd_type="sd_id"';
144
  $db_write->query($rq_sql);
145
  }
146
 
app/code/community/Sarbacane/Sarbacanedesktop/controllers/Adminhtml/SarbacanedesktopController.php CHANGED
@@ -68,7 +68,6 @@ class Sarbacane_Sarbacanedesktop_Adminhtml_SarbacanedesktopController extends Ma
68
  }
69
  }
70
  $old_sd_list_array = Mage::helper('sarbacanedesktop')->getListConfiguration('array');
71
- Mage::helper('sarbacanedesktop')->setConfiguration('sd_list', $shops);
72
  $rq_sql = '
73
  UPDATE `' . $sarbacanedesktop_users . '`
74
  SET `sd_value` = ' . $db_write->quote($shops) . '
@@ -88,9 +87,7 @@ class Sarbacane_Sarbacanedesktop_Adminhtml_SarbacanedesktopController extends Ma
88
  private function createTokenParameterConfiguration(){
89
  $resource = Mage::getSingleton('core/resource');
90
  $db_write = $resource->getConnection('core_write');
91
- $sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
92
  $sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
93
- $rq_sql = 'TRUNCATE `' . $sarbacanedesktop . '`';
94
  $rq_sql = 'TRUNCATE `' . $sarbacanedesktop_users . '`';
95
  $db_write->query($rq_sql);
96
  $token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
@@ -102,10 +99,7 @@ class Sarbacane_Sarbacanedesktop_Adminhtml_SarbacanedesktopController extends Ma
102
  {
103
  $resource = Mage::getSingleton('core/resource');
104
  $db_write = $resource->getConnection('core_write');
105
- $sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
106
  $sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
107
- $rq_sql = 'TRUNCATE `' . $sarbacanedesktop . '`';
108
- $db_write->query($rq_sql);
109
  $token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
110
  $rq_sql = '
111
  UPDATE `' . $sarbacanedesktop_users . '`
68
  }
69
  }
70
  $old_sd_list_array = Mage::helper('sarbacanedesktop')->getListConfiguration('array');
 
71
  $rq_sql = '
72
  UPDATE `' . $sarbacanedesktop_users . '`
73
  SET `sd_value` = ' . $db_write->quote($shops) . '
87
  private function createTokenParameterConfiguration(){
88
  $resource = Mage::getSingleton('core/resource');
89
  $db_write = $resource->getConnection('core_write');
 
90
  $sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
 
91
  $rq_sql = 'TRUNCATE `' . $sarbacanedesktop_users . '`';
92
  $db_write->query($rq_sql);
93
  $token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
99
  {
100
  $resource = Mage::getSingleton('core/resource');
101
  $db_write = $resource->getConnection('core_write');
 
102
  $sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
 
 
103
  $token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
104
  $rq_sql = '
105
  UPDATE `' . $sarbacanedesktop_users . '`
app/code/community/Sarbacane/Sarbacanedesktop/controllers/IndexController.php CHANGED
@@ -1,353 +1,306 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Sarbacane
16
- * @package Sarbacane_Sarbacanedesktop
17
- * @author Sarbacane Software <contact@sarbacane.com>
18
- * @copyright 2015 Sarbacane Software
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
- class Sarbacane_Sarbacanedesktop_IndexController extends Mage_Core_Controller_Front_Action {
22
- private function getSdidIdentifier($sdid) {
23
- $resource = Mage::getSingleton ( 'core/resource' );
24
- $db_read = $resource->getConnection ( 'core_read' );
25
- $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
 
 
 
26
  $rq_sql = '
27
- SELECT `sd_id`
28
- FROM `' . $sarbacanedesktop_users . '`
29
- WHERE `sd_type` = \'sd_id\'
30
- AND `sd_value` = ' . $db_read->quote ( $sdid );
31
- $rq = $db_read->query ( $rq_sql );
32
- while ( $r = $rq->fetch () ) {
33
- return $r ['sd_id'];
34
- }
35
- return '';
36
- }
37
- private function saveSdid($sdid) {
38
- $resource = Mage::getSingleton ( 'core/resource' );
39
- $db_write = $resource->getConnection ( 'core_write' );
40
- $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  $rq_sql = '
42
- INSERT INTO `' . $sarbacanedesktop_users . '` (`sd_type`, `sd_value`) VALUES
43
- (\'sd_id\', ' . $db_write->quote ( $sdid ) . ')';
44
- $rq = $db_write->query ( $rq_sql );
45
- return $this->getSdidIdentifier ( $sdid );
46
- }
47
- public function indexAction() {
48
- if (Mage::app ()->getRequest ()->getParam ( 'stk' ) && Mage::app ()->getRequest ()->getParam ( 'sdid' )) {
49
- $sdid = Mage::app ()->getRequest ()->getParam ( 'sdid' );
50
- if (Mage::app ()->getRequest ()->getParam ( 'stk' ) == Mage::helper ( 'sarbacanedesktop' )->getToken () && $sdid != '') {
51
- $identifier = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'identifier' );
52
- $sd_id = $this->getSdidIdentifier ( $sdid );
53
- if ($sd_id == '' && ! Mage::app ()->getRequest ()->getParam ( 'list' ))
54
- $sd_id = $this->saveSdid ( $sdid );
55
- if ($sd_id != '') {
56
- $configuration = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'all' );
57
- if ($configuration ['sd_token'] != '' && $configuration ['sd_list'] != '') {
58
- $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
59
- if ($sd_list_array != '') {
60
- if (Mage::app ()->getRequest ()->getParam ( 'list' )) {
61
- $list = Mage::app ()->getRequest ()->getParam ( 'list' );
62
- $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
63
- $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
64
- $list_type_array = Mage::helper ( 'sarbacanedesktop' )->getListTypeArray ();
65
- if (in_array ( $list_type, $list_type_array )) {
66
- $id_and_list = $store_id . $list_type;
67
- if (($list_type == 'N' && in_array ( $id_and_list . '0', $sd_list_array )) || ($list_type == 'C' && (in_array ( $id_and_list . '0', $sd_list_array ) || in_array ( $id_and_list . '1', $sd_list_array )))) {
68
- if (Mage::app ()->getRequest ()->getParam ( 'action' )) {
69
- if (Mage::app ()->getRequest ()->getParam ( 'action' ) == 'reset') {
70
- Mage::helper ( 'sarbacanedesktop' )->resetList ( $list_type, $store_id, $sd_id );
71
- }
72
- }
73
- $this->processNewUnsubcribersAndSubscribers ( $list_type, $store_id, $sd_id );
74
- }
75
- }
76
- } else {
77
- if('delete' == Mage::app ()->getRequest ()->getParam ( 'action' )){
78
- Mage::helper ( 'sarbacanedesktop' )->deleteSdid ( $sd_id );
79
- }else{
80
- $this->getFormattedContentShops ( $sd_id );
81
- }
82
- }
83
- }
84
- }
85
- }
86
- }
87
- } else {
88
- echo "Param&egrave;tre[s] manquant[s]";
89
- }
90
- }
91
- private function processNewUnsubcribersAndSubscribers($list_type, $store_id, $sd_id) {
92
- $line = 'email;lastname;firstname';
93
- if ($list_type == 'C') {
94
- if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
95
- $line .= ';date_first_order;date_last_order;amount_min_order;amount_max_order;amount_avg_order;nb_orders;amount_all_orders';
96
- }
97
- }
98
- $line .= ';action';
99
- echo $line;
100
- $this->processNewUnsubscribers ( $list_type, $store_id, $sd_id );
101
- $this->processNewSubscribers ( $list_type, $store_id, $sd_id );
102
- }
103
- private function getListTypeArray() {
104
- return array ('N','C'
105
- );
106
- }
107
- private function checkIfListWithCustomerData($list_type, $store_id) {
108
- $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
109
- if (in_array ( $store_id . $list_type . '1', $sd_list_array )) {
110
- return true;
111
- }
112
- return false;
113
- }
114
- private function getFormattedContentShops($sd_id) {
115
- $stores = Mage::helper ( 'sarbacanedesktop' )->getStoresArray ();
116
- echo 'list_id;name;reset;is_updated;type;version' . "\n";
117
- $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
118
- $list_array = array ();
119
- foreach ( $sd_list_array as $list ) {
120
- $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
121
- $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
122
- array_push ( $list_array, array ('store_id' => $store_id,'list_type' => $list_type
123
- ) );
124
- }
125
- foreach ( $stores as $store ) {
126
- foreach ( $list_array as $list ) {
127
- if ($store ['store_id'] == $list ['store_id']) {
128
- $store_list = "" . $store ['store_id'] . $list ['list_type'] . ';' . $this->dQuote ( $store ['store_name'] ) . ';'; // TEST
129
- $store_list .= $this->listIsResetted ( $store ['store_id'], $list ['list_type'], $sd_id ) . ';';
130
- $store_list .= $this->listIsUpdated ( $store ['store_id'], $list ['list_type'], $sd_id ) . ';';
131
- $store_list .= 'Magento;1.0.0.0' . "\n";
132
- echo $store_list;
133
- }
134
- }
135
- }
136
- }
137
- private function listIsResetted($store_id, $list_type, $sd_id) {
138
- $resource = Mage::getSingleton ( 'core/resource' );
139
- $db_read = $resource->getConnection ( 'core_read' );
140
- $sarbacanedesktop = $resource->getTableName ( 'sarbacanedesktop' );
141
- $rq_sql = '
142
- SELECT count(`email`) AS `nb_in_table`
143
- FROM ' . $sarbacanedesktop . '
144
- WHERE `list_type` = ' . $db_read->quote ( $list_type ) . '
145
- AND `store_id` = ' . $db_read->quote ( $store_id ) . '
146
- AND `sd_id` = ' . $db_read->quote ( $sd_id );
147
- $nb_in_table = $db_read->fetchOne ( $rq_sql );
148
- if ($nb_in_table == 0)
149
- return 'Y';
150
- return 'N';
151
- }
152
- private function listIsUpdated($store_id, $list_type, $sd_id) {
153
- $is_updated_list = 'N';
154
- if ($this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'is_updated' ) > 0) {
155
- $is_updated_list = 'Y';
156
- }
157
- if ($this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'is_updated' ) > 0) {
158
- $is_updated_list = 'Y';
159
- }
160
- return $is_updated_list;
161
- }
162
- private function dQuote($value) {
163
- $value = str_replace ( '"', '""', $value );
164
- if (strpos ( $value, ' ' ) || strpos ( $value, ';' )) {
165
- $value = '"' . $value . '"';
166
- }
167
- return $value;
168
- }
169
- private function processNewSubscribers($list_type, $store_id, $sd_id, $type_action = 'display') {
170
- $resource = Mage::getSingleton ( 'core/resource' );
171
- $db_read = $resource->getConnection ( 'core_read' );
172
- $db_write = $resource->getConnection ( 'core_write' );
173
- $newsletter_subscriber = $resource->getTableName ( 'newsletter_subscriber' );
174
- $sarbacanedesktop = $resource->getTableName ( 'sarbacanedesktop' );
175
- $sales_flat_order = $resource->getTableName ( 'sales_flat_order' );
176
- $customer_entity = $resource->getTableName ( 'customer_entity' );
177
- $customer_entity_varchar = $resource->getTableName ( 'customer_entity_varchar' );
178
- $core_store = $resource->getTableName ( 'core_store' ); // core store
179
- $attr_firstname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'firstname' )->getAttributeId ();
180
- $attr_lastname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'lastname' )->getAttributeId ();
181
- $rq_sql_limit = '2500';
182
- if ($type_action == 'is_updated')
183
- $rq_sql_limit = '1';
184
- if ($list_type == 'N') {
185
- $rq_sql = '
186
- SELECT t.* FROM (
187
  SELECT ns.`subscriber_email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
188
  FROM `' . $newsletter_subscriber . '` AS `ns`
189
  LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
190
  LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
191
- LEFT JOIN ' . $sarbacanedesktop . ' AS `s` ON s.`email` = ns.`subscriber_email` AND s.`store_id` = ns.`store_id` AND s.`list_type` = \'N\'
192
  WHERE ns.`subscriber_status` = 1
193
  AND ns.`store_id` = ' . ( int ) $store_id . '
194
- ) AS `t`
195
- LEFT JOIN ' . $sarbacanedesktop . ' AS `s` ON (s.`email` = t.`email` AND s.`list_type` = \'N\'
196
- AND s.`store_id` = ' . $db_write->quote ( $store_id ) . ' AND s.`sd_id` = ' . $db_write->quote ( $sd_id ) . '
197
- AND s.`lastname` = t.`lastname` AND s.`firstname` = t.`firstname`)
198
- WHERE s.`store_id` IS NULL
199
- LIMIT 0, ' . $rq_sql_limit;
200
- } else if ($list_type == 'C') {
201
- $add_customer_data = $this->checkIfListWithCustomerData ( $list_type, $store_id );
202
- // REVOIR REQUETE
203
- $rq_sql = ' SELECT c.email as email,cevfn.value AS firstname,cevln.value AS lastname';
204
- if ($add_customer_data) {
205
- $rq_sql .= ', MAX(sfo.base_grand_total) as amount_max_order, MIN(sfo.base_grand_total) as amount_min_order, AVG(sfo.base_grand_total) as amount_avg_order, MIN(sfo.created_at) as date_first_order, MAX(sfo.created_at) as date_last_order, COUNT(sfo.entity_id) as nb_orders, SUM(sfo.base_grand_total) as amount_all_orders,s.orders_data';
206
- }
207
- $rq_sql .= ' FROM ' . $customer_entity . ' c LEFT JOIN ' . $customer_entity_varchar . ' cevfn ON cevfn.entity_id=c.entity_id AND cevfn.attribute_id=5
208
- LEFT JOIN ' . $customer_entity_varchar . ' cevln ON cevln.entity_id = c.entity_id AND cevln.attribute_id=7 ';
209
- if ($add_customer_data) {
210
- $rq_sql .= ' LEFT JOIN ' . $sales_flat_order . ' sfo ON c.entity_id = sfo.customer_id AND sfo.state = "complete"';
211
- }
212
- $rq_sql .= " LEFT JOIN " . $sarbacanedesktop . " AS `s` ON s.`email` = c.email AND s.`list_type` = 'C' AND s.`sd_id` = " . $db_write->quote ( $sd_id );
213
- if($add_customer_data){
214
- $rq_sql .= " AND s.`store_id` = sfo.`store_id` ";
215
- }
216
- // On ajoute la clause WHERE
217
- if ($add_customer_data) {
218
- $rq_sql .= " WHERE (sfo.store_id=" . $store_id . " OR (c.store_id = 1 AND (lastname != s.lastname OR firstname != s.firstname))) ";
219
- }else{
220
- $rq_sql .= " WHERE (c.store_id=" . $store_id . ") AND (s.lastname IS NULL OR lastname != s.lastname OR s.firstname IS NULL OR firstname != s.firstname) ";
221
- }
222
- $rq_sql .= " GROUP BY c.entity_id";
223
- if ($add_customer_data) {
224
- $rq_sql .= " HAVING (s.orders_data ='' OR s.orders_data IS NULL OR s.orders_data != CONCAT(amount_min_order,amount_max_order,nb_orders,amount_all_orders) )";
225
- }
226
- $rq_sql .= ' LIMIT 0, ' . $rq_sql_limit;
227
- } else {
228
- return;
229
- }
230
- if ($type_action == 'is_updated') {
231
- $rq = $db_read->fetchAll ( $rq_sql );
232
- return count ( $rq );
233
- } else {
234
- $rq = $db_read->query ( $rq_sql );
235
- $rq_sql_insert = '';
236
- $i = 0;
237
- while ( $r = $rq->fetch () ) {
238
- $line = "\r\n" . $this->dQuote ( $r ['email'] ) . ';'; // TEST
239
- $line .= $this->dQuote ( $r ['lastname'] ) . ';' . $this->dQuote ( $r ['firstname'] );
240
- $orders_data = '';
241
- if ($list_type == 'C') {
242
- if ($add_customer_data) {
243
- $line .= ';' . $this->dQuote ( $r ['date_first_order'] ) . ';' . $this->dQuote ( $r ['date_last_order'] );
244
- $line .= ';' . ( float ) $r ['amount_min_order'] . ';' . ( float ) $r ['amount_max_order'] . ';' . ( float ) $r ['amount_avg_order'];
245
- $line .= ';' . $r ['nb_orders'] . ';' . ( float ) $r ['amount_all_orders'];
246
- $orders_data = $r ['amount_min_order'] . $r ['amount_max_order'];
247
- $orders_data .= $r ['nb_orders'] . $r ['amount_all_orders'];
248
- }
249
- }
250
- $line .= ';S';
251
- echo $line;
252
- $insert_values = $db_write->quote ( $r ['email'] ) . ', ' . $db_write->quote ( $list_type ) . ', ' . $db_write->quote ( $store_id ) . ', ' . $db_write->quote ( $sd_id );
253
- $insert_values .= ', ' . $db_write->quote ( $r ['lastname'] ) . ', ' . $db_write->quote ( $r ['firstname'] ) . ', ' . $db_write->quote ( $orders_data );
254
- $rq_sql_insert .= ' (' . $insert_values . '),';
255
- if ($i == 200) {
256
- $rq_sql_insert = substr ( $rq_sql_insert, 0, - 1 );
257
- $rq_sql = '
258
- INSERT INTO `' . $sarbacanedesktop . '` (`email`, `list_type`, `store_id`, `sd_id`, `lastname`, `firstname`, `orders_data`) VALUES
259
- ' . $rq_sql_insert . '
260
- ON DUPLICATE KEY UPDATE
261
- `lastname` = VALUES(`lastname`),
262
- `firstname` = VALUES(`firstname`),
263
- `orders_data` = VALUES(`orders_data`)';
264
- $db_write->query ( $rq_sql );
265
- $rq_sql_insert = '';
266
- $i = 0;
267
- }
268
- $i ++;
269
- }
270
- if ($rq_sql_insert != '') {
271
- $rq_sql_insert = substr ( $rq_sql_insert, 0, - 1 );
272
- $rq_sql = '
273
- INSERT INTO `' . $sarbacanedesktop . '` (`email`, `list_type`, `store_id`, `sd_id`, `lastname`, `firstname`, `orders_data`) VALUES
274
- ' . $rq_sql_insert . '
275
- ON DUPLICATE KEY UPDATE
276
- `lastname` = VALUES(`lastname`),
277
- `firstname` = VALUES(`firstname`),
278
- `orders_data` = VALUES(`orders_data`)';
279
- $db_write->query ( $rq_sql );
280
- }
281
- }
282
- }
283
- private function processNewUnsubscribers($list_type, $store_id, $sd_id, $type_action = 'display') {
284
- $resource = Mage::getSingleton ( 'core/resource' );
285
- $db_read = $resource->getConnection ( 'core_read' );
286
- $db_write = $resource->getConnection ( 'core_write' );
287
- $sarbacanedesktop = $resource->getTableName ( 'sarbacanedesktop' );
288
- $newsletter_subscriber = $resource->getTableName ( 'newsletter_subscriber' );
289
- $customer_entity = $resource->getTableName ( 'customer_entity' );
290
-
291
- $rq_sql_limit = '2500';
292
- if ($type_action == 'is_updated')
293
- $rq_sql_limit = '1';
294
- if ($list_type == 'N') {
295
- $rq_sql = '
296
- SELECT s.`email`, s.`store_id`
297
- FROM `' . $sarbacanedesktop . '` AS s
298
- LEFT JOIN `' . $newsletter_subscriber . '` AS ns ON (ns.`subscriber_email` = s.`email` AND ns.`store_id` = s.`store_id` AND ns.`subscriber_status` = 1)
299
- WHERE s.`list_type` = \'N\' AND s.`store_id` = ' . $db_write->quote ( $store_id ) . ' AND s.`sd_id` = ' . $db_write->quote ( $sd_id ) . ' AND ns.`store_id` IS NULL';
300
- } else if ($list_type == 'C') {
301
- // REVOIR REQUETE
302
- $rq_sql = "SELECT * FROM " . $sarbacanedesktop . " WHERE 1=2";
303
- // $rq_sql = '
304
- // SELECT s.email, s.store_id FROM `' . $sarbacanedesktop . '` AS `s` LEFT JOIN ' . $customer_entity . ' AS c ON s.email = c.email WHERE c.is_active = 0';
305
- } else {
306
- return;
307
- }
308
- if ($type_action == 'is_updated') {
309
- $rq = $db_read->fetchAll ( $rq_sql );
310
- return count ( $rq );
311
- } else {
312
- $rq = $db_read->query ( $rq_sql );
313
- $rq_sql_delete = '';
314
- $i = 0;
315
- while ( $r = $rq->fetch () ) {
316
- $line = "\n" . $this->dQuote ( $r ['email'] ) . ';;'; // TEST
317
- if ($list_type == 'C') {
318
- if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
319
- $line .= ';;;;;';
320
- }
321
- }
322
- $line .= ';U' . "\r\n";
323
- echo $line;
324
- $rq_sql_delete .= '(' . $db_write->quote ( $r ['email'] ) . '),';
325
- if ($i == 200) {
326
- $rq_sql_delete = substr ( $rq_sql_delete, 0, - 1 );
327
- $rq_sql = '
328
- DELETE FROM `' . $sarbacanedesktop . '`
329
- WHERE (`email`)
330
- IN (' . $rq_sql_delete . ')
331
- AND `list_type` = ' . $db_write->quote ( $list_type ) . '
332
- AND `store_id` = ' . $db_write->quote ( $store_id ) . '
333
- AND `sd_id` = ' . $db_write->quote ( $sd_id );
334
- $db_write->query ( $rq_sql );
335
- $rq_sql_delete = '';
336
- $i = 0;
337
- }
338
- $i ++;
339
- }
340
- if ($rq_sql_delete != '') {
341
- $rq_sql_delete = substr ( $rq_sql_delete, 0, - 1 );
342
- $rq_sql = '
343
- DELETE FROM `' . $sarbacanedesktop . '`
344
- WHERE (`email`)
345
- IN (' . $rq_sql_delete . ')
346
- AND `list_type` = ' . $db_write->quote ( $list_type ) . '
347
- AND `store_id` = ' . $db_write->quote ( $store_id ) . '
348
- AND `sd_id` = ' . $db_write->quote ( $sd_id );
349
- $db_write->query ( $rq_sql );
350
- }
351
- }
352
- }
353
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Sarbacane
16
+ * @package Sarbacane_Sarbacanedesktop
17
+ * @author Sarbacane Software <contact@sarbacane.com>
18
+ * @copyright 2015 Sarbacane Software
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+ class Sarbacane_Sarbacanedesktop_IndexController extends Mage_Core_Controller_Front_Action {
22
+ private function saveSdid($sdid, $list) {
23
+ $resource = Mage::getSingleton ( 'core/resource' );
24
+ $db_write = $resource->getConnection ( 'core_write' );
25
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
26
+
27
+ $rq_sql = 'DELETE FROM `' . $sarbacanedesktop_users . '` WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sdid . '\' AND list_id=\'' . $list . '\'';
28
+ $rq = $db_write->query ( $rq_sql );
29
  $rq_sql = '
30
+ INSERT INTO `' . $sarbacanedesktop_users . '` (`sd_type`, `sd_value`, `list_id`, `last_call_date` ) VALUES
31
+ (\'sd_id\', ' . $db_write->quote ( $sdid ) . ', \'' . $list . '\', \'' . date ( 'Y-m-d H:i:s' ) . '\')';
32
+ $rq = $db_write->query ( $rq_sql );
33
+ return;
34
+ }
35
+ public function indexAction() {
36
+ if (Mage::app ()->getRequest ()->getParam ( 'stk' ) && Mage::app ()->getRequest ()->getParam ( 'sdid' )) {
37
+ $sdid = Mage::app ()->getRequest ()->getParam ( 'sdid' );
38
+ if (Mage::app ()->getRequest ()->getParam ( 'stk' ) == Mage::helper ( 'sarbacanedesktop' )->getToken () && $sdid != '') {
39
+ $identifier = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'identifier' );
40
+ $sd_id = "";
41
+ $configuration = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'all' );
42
+ if ($configuration ['sd_token'] != '' && $configuration ['sd_list'] != '') {
43
+ $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
44
+ if ($sd_list_array != '') {
45
+ if (Mage::app ()->getRequest ()->getParam ( 'list' )) {
46
+ $list = Mage::app ()->getRequest ()->getParam ( 'list' );
47
+ $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
48
+ $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
49
+ $list_type_array = Mage::helper ( 'sarbacanedesktop' )->getListTypeArray ();
50
+ if (in_array ( $list_type, $list_type_array )) {
51
+ $id_and_list = $store_id . $list_type;
52
+ if (($list_type == 'N' && in_array ( $id_and_list . '0', $sd_list_array )) || ($list_type == 'C' && (in_array ( $id_and_list . '0', $sd_list_array ) || in_array ( $id_and_list . '1', $sd_list_array )))) {
53
+ $this->processNewUnsubcribersAndSubscribers ( $list_type, $store_id, $sdid );
54
+ $sd_id = $this->saveSdid ( $sdid, $list );
55
+ }else{
56
+ header ( 'HTTP/1.1 404 Not found' );
57
+ header ( "Content-type: application/json ; charset=utf-8" );
58
+ die ( 'FAILED_ID' );
59
+ }
60
+ } else {
61
+ header ( 'HTTP/1.1 404 Not found' );
62
+ header ( "Content-type: application/json ; charset=utf-8" );
63
+ die ( 'FAILED_ID' );
64
+ }
65
+ } else {
66
+ if ('delete' == Mage::app ()->getRequest ()->getParam ( 'action' )) {
67
+ Mage::helper ( 'sarbacanedesktop' )->deleteSdid ( $sd_id );
68
+ } else {
69
+ $this->getFormattedContentShops ( $sdid );
70
+ }
71
+ }
72
+ }
73
+ }
74
+ } else {
75
+ header ( "HTTP/1.1 403 Unauthorized" );
76
+ header ( "Content-type: application/json; charset=utf-8" );
77
+ die ( 'FAILED_SDTOKEN' );
78
+ }
79
+ } else {
80
+ echo "Param&egrave;tre[s] manquant[s]";
81
+ }
82
+ }
83
+ private function processNewUnsubcribersAndSubscribers($list_type, $store_id, $sd_id) {
84
+ $resource = Mage::getSingleton ( 'core/resource' );
85
+ $db_read = $resource->getConnection ( 'core_read' );
86
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
87
+ $rq_sql = 'SELECT last_call_date FROM ' . $sarbacanedesktop_users . ' WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sd_id . '\' AND list_id=\'' . $store_id . $list_type . '\'';
88
+ $last_call_date = $db_read->fetchOne ( $rq_sql );
89
+
90
+ $line = 'email;lastname;firstname';
91
+ if ($list_type == 'C') {
92
+ if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
93
+ $line .= ';date_first_order;date_last_order;amount_min_order;amount_max_order;amount_avg_order;nb_orders;amount_all_orders';
94
+ }
95
+ }
96
+ $line .= ';action';
97
+ echo $line;
98
+ $this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
99
+ $this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
100
+ }
101
+ private function getListTypeArray() {
102
+ return array (
103
+ 'N',
104
+ 'C'
105
+ );
106
+ }
107
+ private function checkIfListWithCustomerData($list_type, $store_id) {
108
+ $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
109
+ if (in_array ( $store_id . $list_type . '1', $sd_list_array )) {
110
+ return true;
111
+ }
112
+ return false;
113
+ }
114
+ private function getFormattedContentShops($sd_id) {
115
+ $stores = Mage::helper ( 'sarbacanedesktop' )->getStoresArray ();
116
+ echo 'list_id;name;reset;is_updated;type;version' . "\n";
117
+ $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
118
+ $list_array = array ();
119
+ foreach ( $sd_list_array as $list ) {
120
+ $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
121
+ $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
122
+ array_push ( $list_array, array (
123
+ 'store_id' => $store_id,
124
+ 'list_type' => $list_type,
125
+ 'list_id' => $list
126
+ ) );
127
+ }
128
+ foreach ( $stores as $store ) {
129
+ foreach ( $list_array as $list ) {
130
+ if ($store ['store_id'] == $list ['store_id']) {
131
+ $store_list = "" . $store ['store_id'] . $list ['list_type'] . ';' . $this->dQuote ( $store ['store_name'] ) . ';'; // TEST
132
+ $store_list .= $this->listIsResetted ( $store ['store_id'] . $list ['list_type'], $sd_id ) . ';';
133
+ $store_list .= $this->listIsUpdated ( $store ['store_id'], $list ['list_type'], $sd_id ) . ';';
134
+ $store_list .= 'Magento;1.0.0.4' . "\n";
135
+ echo $store_list;
136
+ }
137
+ }
138
+ }
139
+ }
140
+ private function listIsResetted($list_id, $sd_id) {
141
+ $resource = Mage::getSingleton ( 'core/resource' );
142
+ $db_read = $resource->getConnection ( 'core_read' );
143
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
144
  $rq_sql = '
145
+ SELECT count(*) AS `nb_in_table`
146
+ FROM ' . $sarbacanedesktop_users . '
147
+ WHERE `sd_type` = "sd_id"
148
+ AND `sd_value` = ' . $db_read->quote ( $sd_id ) . ' AND list_id="' . $list_id . '"';
149
+ $nb_in_table = $db_read->fetchOne ( $rq_sql );
150
+ if ($nb_in_table == 0)
151
+ return 'Y';
152
+ return 'N';
153
+ }
154
+ private function listIsUpdated($store_id, $list_type, $sd_id) {
155
+ $resource = Mage::getSingleton ( 'core/resource' );
156
+ $db_read = $resource->getConnection ( 'core_read' );
157
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
158
+ $rq_sql = 'SELECT last_call_date FROM ' . $sarbacanedesktop_users . ' WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sd_id . '\' AND list_id=\'' . $store_id . $list_type . '\'';
159
+ $last_call_date = $db_read->fetchOne ( $rq_sql );
160
+
161
+ $is_updated_list = 'N';
162
+ if ($this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
163
+ $is_updated_list = 'Y';
164
+ }
165
+ if ($this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
166
+ $is_updated_list = 'Y';
167
+ }
168
+ return $is_updated_list;
169
+ }
170
+ private function dQuote($value) {
171
+ $value = str_replace ( '"', '""', $value );
172
+ if (strpos ( $value, ' ' ) || strpos ( $value, ';' )) {
173
+ $value = '"' . $value . '"';
174
+ }
175
+ return $value;
176
+ }
177
+ private function processNewSubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
178
+ $resource = Mage::getSingleton ( 'core/resource' );
179
+ $db_read = $resource->getConnection ( 'core_read' );
180
+ $db_write = $resource->getConnection ( 'core_write' );
181
+ $sd_updates = $resource->getTableName ( 'sd_updates' );
182
+ $newsletter_subscriber = $resource->getTableName ( 'newsletter_subscriber' );
183
+ $sales_flat_order = $resource->getTableName ( 'sales_flat_order' );
184
+ $customer_entity = $resource->getTableName ( 'customer_entity' );
185
+ $customer_entity_varchar = $resource->getTableName ( 'customer_entity_varchar' );
186
+ $core_store = $resource->getTableName ( 'core_store' ); // core store
187
+ $attr_firstname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'firstname' )->getAttributeId ();
188
+ $attr_lastname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'lastname' )->getAttributeId ();
189
+ $rq_sql_limit = '2500';
190
+ if ($type_action == 'is_updated')
191
+ $rq_sql_limit = '1';
192
+ if ($list_type == 'N') {
193
+ if ($last_call_date != null && $last_call_date != '') {
194
+ $rq_sql = 'SELECT sdu.`email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
195
+ FROM `' . $sd_updates . '` AS `sdu`
196
+ LEFT JOIN ' . $newsletter_subscriber . ' ns ON ns.subscriber_email = sdu.email
197
+ LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
198
+ LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
199
+ WHERE ns.`subscriber_status` = 1 AND sdu.update_time > "' . $last_call_date . '" AND sdu.list_type="N" AND sdu.action="S"
200
+ AND ns.`store_id` = ' . ( int ) $store_id . '
201
+ LIMIT 0, ' . $rq_sql_limit;
202
+ } else {
203
+ $rq_sql = '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  SELECT ns.`subscriber_email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
205
  FROM `' . $newsletter_subscriber . '` AS `ns`
206
  LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
207
  LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
 
208
  WHERE ns.`subscriber_status` = 1
209
  AND ns.`store_id` = ' . ( int ) $store_id . '
210
+ LIMIT 0, ' . $rq_sql_limit;
211
+ }
212
+ } else if ($list_type == 'C') {
213
+ $add_customer_data = $this->checkIfListWithCustomerData ( $list_type, $store_id );
214
+ $rq_sql = "
215
+ SELECT c.email AS email ,cevln.value as lastname , cevfn.value as firstname";
216
+ if ($add_customer_data) {
217
+ $rq_sql .= ", MAX(sfo.base_grand_total) as amount_max_order, MIN(sfo.base_grand_total) as amount_min_order, AVG(sfo.base_grand_total) as amount_avg_order, MIN(sfo.created_at) as date_first_order, MAX(sfo.created_at) as date_last_order, COUNT(sfo.entity_id) as nb_orders, SUM(sfo.base_grand_total) as amount_all_orders";
218
+ }
219
+ $rq_sql .= " FROM $customer_entity c LEFT JOIN $customer_entity_varchar cevln ON cevln.entity_id = c.entity_id AND cevln.attribute_id=7
220
+ LEFT JOIN $customer_entity_varchar cevfn ON cevfn.entity_id = c.entity_id AND cevfn.attribute_id = 5";
221
+ if ($add_customer_data) {
222
+ $rq_sql .= " LEFT JOIN $sales_flat_order sfo ON sfo.customer_id = c.entity_id ";
223
+ }
224
+ $rq_sql .= " WHERE c.store_id = " . $store_id;
225
+ if ($last_call_date != null && $last_call_date != '') {
226
+ $rq_sql .= " AND (c.created_at > '" . $last_call_date . "' OR c.updated_at > '" . $last_call_date . "' OR sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
227
+ }
228
+ $rq_sql .= " GROUP BY c.email
229
+ UNION
230
+ SELECT sfo.customer_email AS email ,sfo.customer_lastname as lastname, sfo.customer_firstname as firstname";
231
+ if ($add_customer_data) {
232
+ $rq_sql .= ", MAX(sfo.base_grand_total) as amount_max_order, MIN(sfo.base_grand_total) as amount_min_order, AVG(sfo.base_grand_total) as amount_avg_order, MIN(sfo.created_at) as date_first_order, MAX(sfo.created_at) as date_last_order, COUNT(sfo.entity_id) as nb_orders, SUM(sfo.base_grand_total) as amount_all_orders";
233
+ }
234
+ $rq_sql .= "
235
+ FROM $sales_flat_order sfo
236
+ WHERE sfo.customer_id IS NULL AND sfo.store_id = " . $store_id;
237
+ if ($last_call_date != null && $last_call_date != '') {
238
+ $rq_sql .= " AND (sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
239
+ }
240
+ $rq_sql .= " GROUP BY sfo.customer_email ";
241
+
242
+ $rq_sql .= " LIMIT 0, " . $rq_sql_limit;
243
+ } else {
244
+ return;
245
+ }
246
+ if ($type_action == 'is_updated') {
247
+ $rq = $db_read->fetchAll ( $rq_sql );
248
+ return count ( $rq );
249
+ } else {
250
+ $rq = $db_read->query ( $rq_sql );
251
+ while ( $r = $rq->fetch () ) {
252
+ $line = "\r\n" . $this->dQuote ( $r ['email'] ) . ';'; // TEST
253
+ $line .= $this->dQuote ( $r ['lastname'] ) . ';' . $this->dQuote ( $r ['firstname'] );
254
+ $orders_data = '';
255
+ if ($list_type == 'C') {
256
+ if ($add_customer_data) {
257
+ $line .= ';' . $this->dQuote ( $r ['date_first_order'] ) . ';' . $this->dQuote ( $r ['date_last_order'] );
258
+ $line .= ';' . ( float ) $r ['amount_min_order'] . ';' . ( float ) $r ['amount_max_order'] . ';' . ( float ) $r ['amount_avg_order'];
259
+ $line .= ';' . $r ['nb_orders'] . ';' . ( float ) $r ['amount_all_orders'];
260
+ $orders_data = $r ['amount_min_order'] . $r ['amount_max_order'];
261
+ $orders_data .= $r ['nb_orders'] . $r ['amount_all_orders'];
262
+ }
263
+ }
264
+ $line .= ';S';
265
+ echo $line;
266
+ }
267
+ }
268
+ }
269
+ private function processNewUnsubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
270
+ $resource = Mage::getSingleton ( 'core/resource' );
271
+ $db_read = $resource->getConnection ( 'core_read' );
272
+
273
+ $sd_updates = $resource->getTableName ( 'sd_updates' );
274
+
275
+ $rq_sql_limit = '2500';
276
+ if ($type_action == 'is_updated')
277
+ $rq_sql_limit = '1';
278
+ switch ($list_type) {
279
+ case 'N' :
280
+ case 'C' :
281
+ $rq_sql = 'SELECT email FROM ' . $sd_updates . ' WHERE list_type="' . $list_type . '" AND action = "U"';
282
+ if ($last_call_date != null && $last_call_date != '') {
283
+ $rq_sql .= ' AND update_time > "' . $last_call_date . '"';
284
+ }
285
+ break;
286
+ default :
287
+ return;
288
+ }
289
+ if ($type_action == 'is_updated') {
290
+ $rq = $db_read->fetchAll ( $rq_sql );
291
+ return count ( $rq );
292
+ } else {
293
+ $rq = $db_read->query ( $rq_sql );
294
+ while ( $r = $rq->fetch () ) {
295
+ $line = "\n" . $this->dQuote ( $r ['email'] ) . ';;'; // TEST
296
+ if ($list_type == 'C') {
297
+ if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
298
+ $line .= ';;;;;';
299
+ }
300
+ }
301
+ $line .= ';U' . "\r\n";
302
+ echo $line;
303
+ }
304
+ }
305
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
app/code/community/Sarbacane/Sarbacanedesktop/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
  <config>
24
  <modules>
25
  <Sarbacane_Sarbacanedesktop>
26
- <version>1.0.0.0</version>
27
  </Sarbacane_Sarbacanedesktop>
28
  </modules>
29
  <frontend>
23
  <config>
24
  <modules>
25
  <Sarbacane_Sarbacanedesktop>
26
+ <version>1.0.0.4</version>
27
  </Sarbacane_Sarbacanedesktop>
28
  </modules>
29
  <frontend>
app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.0-1.0.0.1.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Sarbacane
16
+ * @package Sarbacane_Sarbacanedesktop
17
+ * @author Sarbacane Software <contact@sarbacane.com>
18
+ * @copyright 2015 Sarbacane Software
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+
22
+ $installer = $this;
23
+ $installer->startSetup();
24
+
25
+ $installer->endSetup();
app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.1-1.0.0.2.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Sarbacane
16
+ * @package Sarbacane_Sarbacanedesktop
17
+ * @author Sarbacane Software <contact@sarbacane.com>
18
+ * @copyright 2015 Sarbacane Software
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+
22
+ $installer = $this;
23
+ $installer->startSetup();
24
+
25
+ $installer->endSetup();
app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.2-1.0.0.3.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Sarbacane
16
+ * @package Sarbacane_Sarbacanedesktop
17
+ * @author Sarbacane Software <contact@sarbacane.com>
18
+ * @copyright 2015 Sarbacane Software
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+
22
+ $installer = $this;
23
+ $installer->startSetup();
24
+
25
+ $installer->endSetup();
app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.3-1.0.0.4.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Sarbacane
16
+ * @package Sarbacane_Sarbacanedesktop
17
+ * @author Sarbacane Software <contact@sarbacane.com>
18
+ * @copyright 2015 Sarbacane Software
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+
22
+ $installer = $this;
23
+ $installer->startSetup();
24
+
25
+ $installer->run("DROP TABLE IF EXISTS `{$this->getTable('sarbacanedesktop')}`;");
26
+ $installer->run("DROP TABLE IF EXISTS `{$this->getTable('sd_updates')}`;");
27
+
28
+ $installer->run("ALTER TABLE `{$this->getTable('sarbacanedesktop_users')}` ADD COLUMN `list_id` VARCHAR(50) NULL DEFAULT NULL AFTER `sd_value`;");
29
+ $installer->run("ALTER TABLE `{$this->getTable('sarbacanedesktop_users')}` ADD COLUMN `last_call_date` VARCHAR(50) NULL DEFAULT NULL AFTER `list_id`;");
30
+
31
+ $installer->run("
32
+ CREATE TABLE `{$this->getTable('sd_updates')}` (
33
+ `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
34
+ `email` VARCHAR(50) NOT NULL COLLATE 'utf8_bin',
35
+ `update_time` DATETIME NOT NULL,
36
+ `action` VARCHAR(5) NOT NULL COLLATE 'utf8_bin',
37
+ `list_type` VARCHAR(10) NULL DEFAULT NULL COLLATE 'utf8_bin',
38
+ PRIMARY KEY (`id`),
39
+ INDEX `update_time_action` (`update_time`, `action`)
40
+ )
41
+ COMMENT='Contains useful data used by SD/MF plugin'
42
+ COLLATE='utf8_bin'
43
+ ENGINE=InnoDB
44
+ ;");
45
+
46
+ $installer->run("DROP TRIGGER IF EXISTS sd_newsletter_update;");
47
+ $installer->run("DROP TRIGGER IF EXISTS sd_customer_delete;");
48
+
49
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
50
+
51
+ $sql= "
52
+ CREATE TRIGGER `sd_newsletter_update`
53
+ AFTER UPDATE ON `{$this->getTable('newsletter_subscriber')}`
54
+ FOR EACH ROW BEGIN
55
+ DELETE FROM {$this->getTable('sd_updates')} WHERE email=NEW.subscriber_email AND list_type='N';
56
+ IF NEW.subscriber_status = 1 THEN
57
+ INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'S','N');
58
+ ELSE
59
+ INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'U','N');
60
+ END IF;
61
+ END;";
62
+ $write->exec($sql);
63
+
64
+ $sql= "
65
+ CREATE TRIGGER `sd_newsletter_insert`
66
+ AFTER INSERT ON `{$this->getTable('newsletter_subscriber')}`
67
+ FOR EACH ROW BEGIN
68
+ DELETE FROM {$this->getTable('sd_updates')} WHERE email=NEW.subscriber_email AND list_type='N';
69
+ IF NEW.subscriber_status = 1 THEN
70
+ INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'S','N');
71
+ ELSE
72
+ INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'U','N');
73
+ END IF;
74
+ END;";
75
+ $write->exec($sql);
76
+
77
+ $sql = "
78
+ CREATE TRIGGER `sd_customer_delete`
79
+ BEFORE DELETE ON `{$this->getTable('customer_entity')}`
80
+ FOR EACH ROW BEGIN
81
+ DELETE FROM {$this->getTable('sd_updates')} WHERE email=OLD.email AND list_type='C';
82
+ INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (OLD.email,UTC_TIMESTAMP(),'U','C');
83
+ END";
84
+ $write->exec($sql);
85
+
86
+
87
+ $installer->endSetup();
app/locale/en_US/Sarbacane_Sarbacanedesktop.csv ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "sarbacane","sarbacane"
2
+ "It's easy to manage your newsletter and email campaigns","It's easy to manage your newsletter and email campaigns"
3
+ "https://www.youtube.com/embed/eLMy2tSSYgE","https://www.youtube.com/embed/eLMy2tSSYgE"
4
+ "This Prestashop module enables you to synchronize clients and accounts that have subscribed to your newsletter from your shop online using Sarbacane Desktop's email marketing software.","This Magento module enables you to synchronize clients and accounts that have subscribed to your newsletter from your shop online using Sarbacane Desktop's email marketing software."
5
+ "Begin the set-up","Begin the set-up"
6
+ "Synchronization of your shop data","Synchronization of your shop data"
7
+ "Responsive visual editor","Responsive visual editor"
8
+ "Detailed statistics","Detailed statistics"
9
+ "Optimal deliverability","Optimal deliverability"
10
+ "Synchronize and manage all the email lists from your Prestashop store","Synchronize and manage all the email lists from your Magento store"
11
+ "NEW! Create awesome, responsive newsletters thanks to the EmailBuilder","NEW! Create awesome, responsive newsletters thanks to the EmailBuilder"
12
+ "Geolocation, openings, opening time, clicks, opt-outs...","Geolocation, openings, opening time, clicks, opt-outs..."
13
+ "Optimal deliverability thanks to our renowned professional routing platform","Optimal deliverability thanks to our renowned professional routing platform"
14
+ "Create your account for free and start sending emails","Create your account for free and start sending emails"
15
+ "No strings attached","No strings attached"
16
+ "Why choose Sarbacane?","Why choose Sarbacane?"
17
+ "Create your account for free and start sending emails,","Create your account for free and start sending emails,"
18
+ "Trusted by over 20,000 users worldwide.","Trusted by over 20,000 users worldwide."
19
+ "Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)","Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)"
20
+ "All you need to succeed: design, customize, send, and follow-up on your campaigns","All you need to succeed: design, customize, send, and follow-up on your campaigns"
21
+ "A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips...","A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips..."
22
+ "Need help?","Need help?"
23
+ "Email:","Email:"
24
+ "support@sarbacane.com","support@sarbacane.com"
25
+ "Tel:","Tel:"
26
+ "+33(0) 328 328 040","+33(0) 328 328 040"
27
+ "Website:","Website:"
28
+ "http://www.sarbacane.com/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","http://www.sarbacane.com/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop"
29
+ "http://www.sarbacane.com","http://www.sarbacane.com"
30
+ "How to set up the module?","How to set up the module?"
31
+ "Do you already have a Sarbacane Desktop account?","Do you already have a Sarbacane Desktop account?"
32
+ "Yes","Yes"
33
+ "No","No"
34
+ "Next","Next"
35
+ "Select your shop and pick your settings","Select your shop and pick your settings"
36
+ "Create a list in Sarbacane Desktop with newsletter opt-ins","Create a list in Sarbacane Desktop with newsletter opt-ins"
37
+ "Create a list in Sarbacane Desktop with your clients who have an account or who have placed an order online","Create a list in Sarbacane Desktop with your clients who have an account or who have placed an order online"
38
+ "Add order data (date, amount, etc...)","Add order data (date, amount, etc...)"
39
+ "As you enable data from orders, you can also gather extra info in your contact list, and target your recipients in Sarbacane Desktop.","As you enable data from orders, you can also gather extra info in your contact list, and target your recipients in Sarbacane Desktop."
40
+ "Below are pieces of information that will be added to your contact list:","Below are pieces of information that will be added to your contact list:"
41
+ "- Date of first order","- Date of first order"
42
+ "- Date of latest order","- Date of latest order"
43
+ "- Total number of orders","- Total number of orders"
44
+ "- Total amount of orders","- Total amount of orders"
45
+ "- Amount of the cheapest order","- Amount of the cheapest order"
46
+ "- Amount of the most expensive order","- Amount of the most expensive order"
47
+ "- Average amount of the orders placed","- Average amount of the orders placed"
48
+ "Previous","Previous"
49
+ "Download and install Sarbacane","Download and install Sarbacane"
50
+ "https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo","https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo"
51
+ "Create your free account","Create your free account"
52
+ "Enable the Prestashop extension in our extensions menu, and then fill in the following fields:","Enable the Magento extension in our extensions menu, and then fill in the following fields:"
53
+ "Url","Url"
54
+ "Key","Key"
55
+ "Generate a new key","Generate a new key"
56
+ "Read more","Read more"
57
+ "http://www.sarbacane.com/faq/extensions/configuration-plugin-prestashop/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","http://www.sarbacane.com/faq/extensions/configuration-plugin-prestashop/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop"
58
+ "in the help section online","in the help section online"
app/locale/fr_FR/Sarbacane_Sarbacanedesktop.csv CHANGED
@@ -1,7 +1,7 @@
1
  "sarbacane","sarbacane"
2
  "It's easy to manage your newsletter and email campaigns","G&eacute;rez vos newsletters et emailing en toute simplicit&eacute;"
3
  "https://www.youtube.com/embed/eLMy2tSSYgE","https://www.youtube.com/embed/eLMy2tSSYgE"
4
- "This Prestashop module enables you to synchronize clients and accounts that have subscribed to your newsletter from your shop online using Sarbacane Desktop's email marketing software.","Ce module Prestashop vous permet de synchroniser les clients, comptes, inscrits &agrave; la newsletter de votre boutique avec le logiciel emailing Sarbacane Desktop, et de profiter de ses innombrables fonctionnalit&eacute;s..."
5
  "Begin the set-up","D&eacute;marrer la configuration"
6
  "Synchronization of your shop data","Donn&eacute;es boutique synchronis&eacute;es"
7
  "Responsive visual editor","Editeur graphique responsive"
@@ -49,7 +49,7 @@
49
  "Download and install Sarbacane","T&eacute;l&eacute;chargez et installez Sarbacane"
50
  "https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo","https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo"
51
  "Create your free account","Cr&eacute;er gratuitement votre compte"
52
- "Enable the Prestashop extension in our extensions menu, and then fill in the following fields:","Rendez-vous dans la section ''extensions'' et activez l'extension Prestashop, puis renseignez les &eacute;l&eacute;ments suivants :"
53
  "Url","Url"
54
  "Key","Cl&eacute;"
55
  "Generate a new key","G&eacute;n&eacute;rer une nouvelle cl&eacute;"
1
  "sarbacane","sarbacane"
2
  "It's easy to manage your newsletter and email campaigns","G&eacute;rez vos newsletters et emailing en toute simplicit&eacute;"
3
  "https://www.youtube.com/embed/eLMy2tSSYgE","https://www.youtube.com/embed/eLMy2tSSYgE"
4
+ "This Prestashop module enables you to synchronize clients and accounts that have subscribed to your newsletter from your shop online using Sarbacane Desktop's email marketing software.","Ce module Magento vous permet de synchroniser les clients, comptes, inscrits &agrave; la newsletter de votre boutique avec le logiciel emailing Sarbacane Desktop, et de profiter de ses innombrables fonctionnalit&eacute;s..."
5
  "Begin the set-up","D&eacute;marrer la configuration"
6
  "Synchronization of your shop data","Donn&eacute;es boutique synchronis&eacute;es"
7
  "Responsive visual editor","Editeur graphique responsive"
49
  "Download and install Sarbacane","T&eacute;l&eacute;chargez et installez Sarbacane"
50
  "https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo","https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo"
51
  "Create your free account","Cr&eacute;er gratuitement votre compte"
52
+ "Enable the Prestashop extension in our extensions menu, and then fill in the following fields:","Rendez-vous dans la section ''extensions'' et activez l'extension Magento, puis renseignez les &eacute;l&eacute;ments suivants :"
53
  "Url","Url"
54
  "Key","Cl&eacute;"
55
  "Generate a new key","G&eacute;n&eacute;rer une nouvelle cl&eacute;"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sarbacane_Sarbacanedesktop</name>
4
- <version>1.0.0.1</version>
5
  <stability>stable</stability>
6
  <license>AFL</license>
7
  <channel>community</channel>
@@ -11,11 +11,12 @@
11
  &#xD;
12
  Ces donn&#xE9;es comprennent les inscrits &#xE0; la newsletter et les clients.&#xD;
13
  En plus des donn&#xE9;es client (email, nom, pr&#xE9;nom) vous avez &#xE9;galement la possibilit&#xE9; de synchroniser les donn&#xE9;es des commandes.</description>
14
- <notes>Correction de chemins, correction lors de la suppression de l'interconnexion</notes>
 
15
  <authors><author><name>Sarbacane Software</name><user>egavard</user><email>connectors@sarbacane.com</email></author></authors>
16
- <date>2015-05-12</date>
17
- <time>08:52:15</time>
18
- <contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Sarbacanedesktop"><dir name="Block"><dir name="Adminhtml"><file name="Sarbacanedesktop.php" hash="96c46a692c69e8c13942d73509436af5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="4665aef624f733aa4e34e8aa71539f0b"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SarbacanedesktopController.php" hash="00e26008dd78ecd8f6552676367d91f7"/></dir><file name="IndexController.php" hash="072b45a88861dcb48900a8af2a98e245"/></dir><dir name="etc"><file name="config.xml" hash="cbf078af2fdf6d470ab71ee094274a6d"/></dir><dir name="sql"><dir name="sarbacanedesktop_setup"><file name="mysql4-install-1.0.0.0.php" hash="82834af7ce95c1bd9d3063ffdf3a11f5"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.css" hash="6fcee54bdab10db72a361ec5a139cc7c"/></dir></dir><dir name="js"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.js" hash="d38d9ec858dfdce14e0156acc87c1c50"/></dir></dir><dir name="images"><file name="sd.png" hash="2038d3c503e8f59d14177a131bef7537"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sarbacanedesktop"><file name="sarbacanedesktop.phtml" hash="eac0a580f51ac9cbc19f0239f8b467d1"/></dir></dir><dir name="layout"><file name="sarbacanedesktop.xml" hash="4ec1fc007e23a1eb2d96c719f1e7c128"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sarbacane_Sarbacanedesktop.xml" hash="a922981e127e22e989a09b8c33be6f85"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sarbacane_Sarbacanedesktop.csv" hash="c192993fb75c398bff4f6291a6df0ea3"/></dir></target></contents>
19
  <compatible/>
20
- <dependencies><required><php><min>5.0.0</min><max>5.6.6</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sarbacane_Sarbacanedesktop</name>
4
+ <version>1.0.0.4</version>
5
  <stability>stable</stability>
6
  <license>AFL</license>
7
  <channel>community</channel>
11
  &#xD;
12
  Ces donn&#xE9;es comprennent les inscrits &#xE0; la newsletter et les clients.&#xD;
13
  En plus des donn&#xE9;es client (email, nom, pr&#xE9;nom) vous avez &#xE9;galement la possibilit&#xE9; de synchroniser les donn&#xE9;es des commandes.</description>
14
+ <notes>Huge improvement. No longer storing lists informations in database.&#xD;
15
+ No longer need last call date to generate the diff</notes>
16
  <authors><author><name>Sarbacane Software</name><user>egavard</user><email>connectors@sarbacane.com</email></author></authors>
17
+ <date>2015-06-25</date>
18
+ <time>15:05:27</time>
19
+ <contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Sarbacanedesktop"><dir name="Block"><dir name="Adminhtml"><file name="Sarbacanedesktop.php" hash="96c46a692c69e8c13942d73509436af5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="14007d42c0a5042129ce40e504059058"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SarbacanedesktopController.php" hash="afa6695d1dbd72a0cfca2f9423a52080"/></dir><file name="IndexController.php" hash="8b9016106ffd95d64e2cc5b82579e7eb"/></dir><dir name="etc"><file name="config.xml" hash="237f59c4b1a761f81402c2cf0c263c28"/></dir><dir name="sql"><dir name="sarbacanedesktop_setup"><file name="mysql4-install-1.0.0.0.php" hash="82834af7ce95c1bd9d3063ffdf3a11f5"/><file name="mysql4-upgrade-1.0.0.0-1.0.0.1.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.1-1.0.0.2.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.2-1.0.0.3.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.3-1.0.0.4.php" hash="a2a43fe29d015f53eae5479f2d5fcb3d"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.css" hash="6fcee54bdab10db72a361ec5a139cc7c"/></dir></dir><dir name="js"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.js" hash="d38d9ec858dfdce14e0156acc87c1c50"/></dir></dir><dir name="images"><file name="sd.png" hash="2038d3c503e8f59d14177a131bef7537"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sarbacanedesktop"><file name="sarbacanedesktop.phtml" hash="eac0a580f51ac9cbc19f0239f8b467d1"/></dir></dir><dir name="layout"><file name="sarbacanedesktop.xml" hash="4ec1fc007e23a1eb2d96c719f1e7c128"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sarbacane_Sarbacanedesktop.xml" hash="a922981e127e22e989a09b8c33be6f85"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sarbacane_Sarbacanedesktop.csv" hash="dca60c2bc436effe557388a8b510b0f1"/></dir><dir name="en_US"><file name="Sarbacane_Sarbacanedesktop.csv" hash="20ecb2d1aacfa029d2bce2d2a577f733"/></dir></target></contents>
20
  <compatible/>
21
+ <dependencies><required><php><min>5.0.0</min><max>5.6.9</max></php></required></dependencies>
22
  </package>