Temando_Installer - Version 1.0.5

Version Notes

- Coding stardard

Download this release

Release Info

Developer Temando
Extension Temando_Installer
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

Files changed (24) hide show
  1. app/code/community/Temando/Installer/Block/Adminhtml/Installer.php +32 -30
  2. app/code/community/Temando/Installer/Block/Adminhtml/Installer/Grid.php +115 -86
  3. app/code/community/Temando/Installer/Block/Adminhtml/Notifications.php +18 -17
  4. app/code/community/Temando/Installer/Block/Adminhtml/System/Config/Form/Button/Manage.php +24 -23
  5. app/code/community/Temando/Installer/Helper/Data.php +264 -254
  6. app/code/community/Temando/Installer/Model/Api/Rest/Client.php +129 -121
  7. app/code/community/Temando/Installer/Model/Connect.php +150 -140
  8. app/code/community/Temando/Installer/Model/Cron.php +69 -62
  9. app/code/community/Temando/Installer/Model/Installer.php +225 -210
  10. app/code/community/Temando/Installer/Model/{Mysql4 → Resource}/Installer.php +14 -14
  11. app/code/community/Temando/Installer/Model/{Mysql4 → Resource}/Installer/Collection.php +16 -16
  12. app/code/community/Temando/Installer/Model/Tester.php +130 -122
  13. app/code/community/Temando/Installer/controllers/Adminhtml/Temandoinstaller/InstallerController.php +94 -58
  14. app/code/community/Temando/Installer/data/temandoinstaller_setup/data-install-1.0.0.php +26 -31
  15. app/code/community/Temando/Installer/data/temandoinstaller_setup/data-upgrade-1.0.2-1.0.3.php +28 -27
  16. app/code/community/Temando/Installer/etc/adminhtml.xml +40 -40
  17. app/code/community/Temando/Installer/etc/config.xml +5 -5
  18. app/code/community/Temando/Installer/etc/system.xml +43 -43
  19. app/code/community/Temando/Installer/sql/temandoinstaller_setup/mysql4-install-1.0.0.php +28 -30
  20. app/design/adminhtml/default/default/layout/temandoinstaller.xml +15 -15
  21. app/design/adminhtml/default/default/template/temando/installer/notifications.phtml +16 -16
  22. app/etc/modules/Temando_Installer.xml +8 -8
  23. app/locale/fr_FR/Temando_Installer.csv +44 -44
  24. package.xml +5 -5
app/code/community/Temando/Installer/Block/Adminhtml/Installer.php CHANGED
@@ -1,30 +1,32 @@
1
- <?php
2
- /**
3
- * Adminhtml Installer
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Block_Adminhtml_Installer extends Mage_Adminhtml_Block_Widget_Grid_Container
9
- {
10
- public function __construct()
11
- {
12
- $this->_blockGroup = 'temandoinstaller';
13
- $this->_controller = 'adminhtml_installer';
14
- $this->_headerText = $this->__('Manage Temando');
15
- $this->_addButtonLabel = $this->__('Install Temando');
16
- // if (Mage::helper('temandoinstaller')->getTemandoVersionNumber()) {
17
- // $this->_addButton('connectionSettings', array(
18
- // 'label' => $this->__('Test Connection Settings'),
19
- // 'id' => 'connectionSettings',
20
- // 'onclick' => "window.location = '" . $this->getUrl('adminhtml/temandoinstaller_installer/testConnectionSettings') . "'",
21
- // 'value' => '',
22
- // 'class' => 'go',
23
- // ));
24
- // }
25
- parent::__construct();
26
- if (Mage::helper('temandoinstaller')->getTemandoVersionNumber()) {
27
- $this->removeButton('add');
28
- }
29
- }
30
- }
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml Installer
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Block_Adminhtml_Installer extends Mage_Adminhtml_Block_Widget_Grid_Container
10
+ {
11
+ public function __construct()
12
+ {
13
+ $this->_blockGroup = 'temandoinstaller';
14
+ $this->_controller = 'adminhtml_installer';
15
+ $this->_headerText = $this->__('Manage Temando');
16
+ $this->_addButtonLabel = $this->__('Install Temando');
17
+ /** if (Mage::helper('temandoinstaller')->getTemandoVersionNumber()) {
18
+ $this->_addButton('connectionSettings', array(
19
+ 'label' => $this->__('Test Connection Settings'),
20
+ 'id' => 'connectionSettings',
21
+ 'onclick' => "window.location = '" .
22
+ $this->getUrl('adminhtml/temandoinstaller_installer/testConnectionSettings') . "'",
23
+ 'value' => '',
24
+ 'class' => 'go',
25
+ ));
26
+ }*/
27
+ parent::__construct();
28
+ if (Mage::helper('temandoinstaller')->getTemandoVersionNumber()) {
29
+ $this->removeButton('add');
30
+ }
31
+ }
32
+ }
app/code/community/Temando/Installer/Block/Adminhtml/Installer/Grid.php CHANGED
@@ -1,86 +1,115 @@
1
- <?php
2
- /**
3
- * Adminhtml Installer Grid
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Block_Adminhtml_Installer_Grid extends Mage_Adminhtml_Block_Widget_Grid
9
- {
10
- public function _construct()
11
- {
12
- parent::_construct();
13
- $this->setDefaultSort('id');
14
- $this->setDefaultDir('DESC');
15
- $this->setSaveParametersInSession(true);
16
- }
17
-
18
- protected function _prepareCollection()
19
- {
20
- $collection = Mage::getModel('temandoinstaller/installer')->getCollection();
21
- $this->setCollection($collection);
22
- parent::_prepareCollection();
23
- }
24
-
25
- protected function _prepareColumns()
26
- {
27
- $this->addColumn('name', array(
28
- 'header' => Mage::helper('temandoinstaller')->__('Name'),
29
- 'index' => 'name',
30
- ));
31
-
32
- $this->addColumn('version', array(
33
- 'header' => Mage::helper('temandoinstaller')->__('Version'),
34
- 'index' => 'version',
35
- ));
36
- $this->addColumn('token', array(
37
- 'header' => Mage::helper('temandoinstaller')->__('Token'),
38
- 'index' => 'token',
39
- ));
40
-
41
- $this->addColumn('install_date', array(
42
- 'header' => Mage::helper('temandoinstaller')->__('Install date'),
43
- 'type' => 'datetime',
44
- 'index' => 'install_date',
45
- ));
46
-
47
- $this->addColumn('update_date', array(
48
- 'header' => Mage::helper('temandoinstaller')->__('Update date'),
49
- 'type' => 'datetime',
50
- 'index' => 'update_date',
51
- ));
52
-
53
- $this->addColumn('update_details', array(
54
- 'header' => Mage::helper('temandoinstaller')->__('Update available'),
55
- 'index' => 'update_details',
56
- 'filter' => false,
57
- ));
58
-
59
- parent::_prepareColumns();
60
- }
61
-
62
- public function _prepareMassaction()
63
- {
64
- parent::_prepareMassaction();
65
- $this->getMassactionBlock()->addItem('uninstall', array(
66
- 'label'=> Mage::helper('temandoinstaller')->__('Uninstall'),
67
- 'url' => $this->getUrl('*/*/uninstall'),
68
- 'confirm' => Mage::helper('temandoinstaller')->__('Are you sure you want to uninstall the Temando module?'),
69
- ));
70
-
71
- $this->getMassactionBlock()->addItem('update', array(
72
- 'label' => Mage::helper('temandoinstaller')->__('Update'),
73
- 'url' => $this->getUrl('*/*/update'),
74
- 'confirm' => Mage::helper('temandoinstaller')->__('Are you sure you want to update the Temando module?'),
75
- ));
76
-
77
- $this->setMassactionIdField('id');
78
- $this->getMassactionBlock()->setUseSelectAll(false);
79
- return $this;
80
- }
81
-
82
- public function getRowUrl($row)
83
- {
84
- return;
85
- }
86
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml Installer Grid
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Block_Adminhtml_Installer_Grid extends Mage_Adminhtml_Block_Widget_Grid
10
+ {
11
+ public function _construct()
12
+ {
13
+ parent::_construct();
14
+ $this->setDefaultSort('id');
15
+ $this->setDefaultDir('DESC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection()
20
+ {
21
+ $collection = Mage::getModel('temandoinstaller/installer')->getCollection();
22
+ $this->setCollection($collection);
23
+ parent::_prepareCollection();
24
+ }
25
+
26
+ protected function _prepareColumns()
27
+ {
28
+ $this->addColumn(
29
+ 'name',
30
+ array(
31
+ 'header' => Mage::helper('temandoinstaller')->__('Name'),
32
+ 'index' => 'name',
33
+ )
34
+ );
35
+
36
+ $this->addColumn(
37
+ 'version',
38
+ array(
39
+ 'header' => Mage::helper('temandoinstaller')->__('Version'),
40
+ 'index' => 'version',
41
+ )
42
+ );
43
+
44
+ $this->addColumn(
45
+ 'token',
46
+ array(
47
+ 'header' => Mage::helper('temandoinstaller')->__('Token'),
48
+ 'index' => 'token',
49
+ )
50
+ );
51
+
52
+ $this->addColumn(
53
+ 'install_date',
54
+ array(
55
+ 'header' => Mage::helper('temandoinstaller')->__('Install date'),
56
+ 'type' => 'datetime',
57
+ 'index' => 'install_date',
58
+ )
59
+ );
60
+
61
+ $this->addColumn(
62
+ 'update_date',
63
+ array(
64
+ 'header' => Mage::helper('temandoinstaller')->__('Update date'),
65
+ 'type' => 'datetime',
66
+ 'index' => 'update_date',
67
+ )
68
+ );
69
+
70
+ $this->addColumn(
71
+ 'update_details',
72
+ array(
73
+ 'header' => Mage::helper('temandoinstaller')->__('Update available'),
74
+ 'index' => 'update_details',
75
+ 'filter' => false,
76
+ )
77
+ );
78
+
79
+ parent::_prepareColumns();
80
+ }
81
+
82
+ public function _prepareMassaction()
83
+ {
84
+ parent::_prepareMassaction();
85
+ $this->getMassactionBlock()->addItem(
86
+ 'uninstall',
87
+ array(
88
+ 'label'=> Mage::helper('temandoinstaller')->__('Uninstall'),
89
+ 'url' => $this->getUrl('*/*/uninstall'),
90
+ 'confirm' => Mage::helper('temandoinstaller')->
91
+ __('Are you sure you want to uninstall the Temando module?'),
92
+ )
93
+ );
94
+
95
+ $this->getMassactionBlock()->addItem(
96
+ 'update',
97
+ array(
98
+ 'label' => Mage::helper('temandoinstaller')->__('Update'),
99
+ 'url' => $this->getUrl('*/*/update'),
100
+ 'confirm' => Mage::helper('temandoinstaller')->
101
+ __('Are you sure you want to update the Temando module?'),
102
+ )
103
+ );
104
+
105
+ $this->setMassactionIdField('id');
106
+ $this->getMassactionBlock()->setUseSelectAll(false);
107
+ return $this;
108
+ }
109
+
110
+ /**
111
+ public function getRowUrl($row)
112
+ {
113
+ return;
114
+ } */
115
+ }
app/code/community/Temando/Installer/Block/Adminhtml/Notifications.php CHANGED
@@ -1,17 +1,18 @@
1
- <?php
2
- /**
3
- * Adminhtml Notifications
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
9
- {
10
- public function getModuleNotifications()
11
- {
12
- $installerModules = Mage::getModel('temandoinstaller/installer')->getCollection();
13
- $installerModules->addFieldToFilter('update_dismissed', false);
14
- $installerModules->addFieldToFilter('update_available', true);
15
- return $installerModules;
16
- }
17
- }
 
1
+ <?php
2
+ /**
3
+ * Adminhtml Notifications
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
10
+ {
11
+ public function getModuleNotifications()
12
+ {
13
+ $installerModules = Mage::getModel('temandoinstaller/installer')->getCollection();
14
+ $installerModules->addFieldToFilter('update_dismissed', false);
15
+ $installerModules->addFieldToFilter('update_available', true);
16
+ return $installerModules;
17
+ }
18
+ }
app/code/community/Temando/Installer/Block/Adminhtml/System/Config/Form/Button/Manage.php CHANGED
@@ -1,23 +1,24 @@
1
- <?php
2
- /**
3
- * Adminhtml System Config Form Button Manage
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Block_Adminhtml_System_Config_Form_Button_Manage
9
- extends Mage_Adminhtml_Block_System_Config_Form_Field {
10
-
11
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
12
- {
13
- $this->setElement($element);
14
- $html = $this->getLayout()
15
- ->createBlock('adminhtml/widget_button')
16
- ->setType('button')->setClass('scalable go')
17
- ->setLabel(Mage::helper('temandoinstaller')->__('Manage Temando Installation'))
18
- ->setOnClick('setLocation(\'' . $this->getUrl('adminhtml/temandoinstaller_installer') .'\')')
19
- ->setTitle(Mage::helper('temandoinstaller')->__('Manage Temando Installation'))
20
- ->toHtml();
21
- return $html;
22
- }
23
- }
 
1
+ <?php
2
+ /**
3
+ * Adminhtml System Config Form Button Manage
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Block_Adminhtml_System_Config_Form_Button_Manage
10
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
11
+ {
12
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
13
+ {
14
+ $this->setElement($element);
15
+ $html = $this->getLayout()
16
+ ->createBlock('adminhtml/widget_button')
17
+ ->setType('button')->setClass('scalable go')
18
+ ->setLabel(Mage::helper('temandoinstaller')->__('Manage Temando Installation'))
19
+ ->setOnClick('setLocation(\'' . $this->getUrl('adminhtml/temandoinstaller_installer') .'\')')
20
+ ->setTitle(Mage::helper('temandoinstaller')->__('Manage Temando Installation'))
21
+ ->toHtml();
22
+ return $html;
23
+ }
24
+ }
app/code/community/Temando/Installer/Helper/Data.php CHANGED
@@ -1,254 +1,264 @@
1
- <?php
2
- /**
3
- * Helper Data
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Helper_Data extends Mage_Core_Helper_Abstract
9
- {
10
-
11
- const TMD_VERSION_STARTER = '1.0.0';
12
- const TMD_VERSION_PROFFESIONAL = '2.0.0';
13
- const TMD_VERSION_BUSINESS = '3.0.0';
14
- const TMD_VERSION_ENTERPRISE = '4.0.0';
15
- const TEMANDO_VERSION_STARTER = 'magento-starter';
16
- const TEMANDO_VERSION_PROFESSIONAL = 'magento-professional';
17
- const TEMANDO_VERSION_BUSINESS = 'magento-business';
18
- const TEMANDO_VERSION_ENTERPRISE = 'magento-enterprise';
19
- const TMD_MODULE_NAME = 'Temando_Temando';
20
-
21
- protected $_tmdVersion = null;
22
-
23
- /**
24
- * Gets version of main Temando_Temando extension
25
- *
26
- * @return string
27
- */
28
- public function getTemandoVersion()
29
- {
30
- if (!$this->_tmdVersion) {
31
- $version = (string) Mage::getConfig()->getNode()->modules->Temando_Temando->version;
32
- if (version_compare($version, self::TMD_VERSION_PROFFESIONAL, '<')) {
33
- //anything less than 2.0.0
34
- $this->_tmdVersion = self::TMD_VERSION_STARTER;
35
- }
36
- if (version_compare($version, self::TMD_VERSION_PROFFESIONAL, '>=')
37
- && version_compare($version, self::TMD_VERSION_BUSINESS, '<')) {
38
- //equals or greater than 2.0.0 but less then 3.0.0
39
- $this->_tmdVersion = self::TMD_VERSION_PROFFESIONAL;
40
- }
41
- if (version_compare($version, self::TMD_VERSION_BUSINESS, '>=')
42
- && version_compare($version, self::TMD_VERSION_ENTERPRISE, '<')) {
43
- //equals or greater than 2.0.0 but less then 3.0.0
44
- $this->_tmdVersion = self::TMD_VERSION_BUSINESS;
45
- }
46
- if (version_compare($version, self::TMD_VERSION_ENTERPRISE, '>=')) {
47
- $this->_tmdVersion = self::TMD_VERSION_ENTERPRISE;
48
- }
49
- if (!$version) {
50
- $this->_tmdVersion = null;
51
- }
52
- }
53
- return $this->_tmdVersion;
54
- }
55
-
56
- /**
57
- * Retrieves an element from the module configuration data.
58
- *
59
- * @param string $field
60
- */
61
- public function getConfigData($field)
62
- {
63
- $path = 'temandoinstaller/' . $field;
64
- return Mage::getStoreConfig($path);
65
- }
66
-
67
- public function getTemandoVersionName()
68
- {
69
- $versionName = null;
70
- switch ($this->getTemandoVersion()) {
71
- case self::TMD_VERSION_STARTER:
72
- $versionName = 'starter';
73
- break;
74
- case self::TMD_VERSION_PROFFESIONAL:
75
- $versionName = 'professional';
76
- break;
77
- case self::TMD_VERSION_BUSINESS:
78
- $versionName = 'business';
79
- break;
80
- case self::TMD_VERSION_ENTERPRISE:
81
- $versionName = 'enterprise';
82
- break;
83
- }
84
- return $versionName;
85
- }
86
-
87
- public function getVersions()
88
- {
89
- return array(
90
- self::TEMANDO_VERSION_STARTER,
91
- self::TEMANDO_VERSION_PROFESSIONAL,
92
- self::TEMANDO_VERSION_BUSINESS,
93
- self::TEMANDO_VERSION_ENTERPRISE);
94
- }
95
-
96
- public function getVersionNameFromSlug($slug)
97
- {
98
- $strippedSlug = substr($slug, 0, -3);
99
- $names = array(
100
- self::TEMANDO_VERSION_STARTER => 'Temando Starter',
101
- self::TEMANDO_VERSION_PROFESSIONAL => 'Temando Professional',
102
- self::TEMANDO_VERSION_BUSINESS => 'Temando Business',
103
- self::TEMANDO_VERSION_ENTERPRISE => 'Temando Enterprise'
104
- );
105
- return $names[$strippedSlug];
106
- }
107
-
108
- public function getTemandoVersionNumber()
109
- {
110
- $version = (string) Mage::getConfig()->getNode()->modules->Temando_Temando->version;
111
- return $version;
112
- }
113
-
114
- public function getTemandoModuleName()
115
- {
116
- return self::TMD_MODULE_NAME;
117
- }
118
-
119
- public function getTemandoToken()
120
- {
121
- return $this->getConfigData('general/token');
122
- }
123
-
124
- public function getTemandoWarehouses()
125
- {
126
- return Mage::getResourceModel('temando/warehouse_collection');
127
- }
128
-
129
- public function getTemandoRules()
130
- {
131
- return Mage::getResourceModel('temando/rule_collection');
132
- }
133
-
134
- public function testAccountDetails()
135
- {
136
- try {
137
- $api = $this->connect();
138
- $result = $api->getLocations(array('clientId' => Mage::helper('temando')->getClientId()));
139
- if (!$result) {
140
- return 'Could not connect to the api';
141
- }
142
- } catch (Exception $e) {
143
- return $e->getMessage();
144
- }
145
- return false;
146
- }
147
-
148
- /**
149
- * @return Temando_Temando_Model_Api_Client
150
- */
151
- public function connect()
152
- {
153
- $api = Mage::getModel('temando/api_client');
154
- switch ($this->getTemandoVersion()) {
155
- case self::TMD_VERSION_BUSINESS:
156
- $api = $api->connect($this->getTemandoProfile());
157
- break;
158
- default:
159
- $api = $api->connect(
160
- Mage::helper('temando')->getConfigData('general/username'),
161
- Mage::helper('temando')->getConfigData('general/password'),
162
- Mage::helper('temando')->getConfigData('general/sandbox')
163
- );
164
- break;
165
- }
166
- return $api;
167
- }
168
-
169
- /**
170
- * Returns cheapest available quote for dummy order
171
- *
172
- * @return null|Temando_Temando_Model_Quote
173
- */
174
- public function loadCheapestQuote()
175
- {
176
- //get first origin location
177
- $origins = $this->getTemandoWarehouses();
178
- foreach ($origins as $origin) {
179
- continue;
180
- }
181
-
182
- if (!$origin) {
183
- return null;
184
- }
185
- /* @var $origin Temando_Temando_Model_Warehouse */
186
- $allowed_carriers = explode(',', Mage::getStoreConfig('carriers/temando/allowed_methods'));
187
- $request = Mage::getModel('temando/api_request');
188
- /* @var $request Temando_Temando_Model_Api_Request */
189
-
190
- switch ($this->getTemandoVersion()) {
191
- case self::TMD_VERSION_BUSINESS:
192
- $request->setConnectionParams($origin->getTemandoProfile());
193
- break;
194
- default:
195
- $request
196
- ->setUsername(Mage::helper('temando')->getConfigData('general/username'))
197
- ->setPassword(Mage::helper('temando')->getConfigData('general/password'))
198
- ->setSandbox(Mage::helper('temando')->getConfigData('general/sandbox'));
199
- break;
200
- }
201
-
202
- $request
203
- ->setMagentoQuoteId(100000000 + mt_rand(0, 100000))
204
- ->setDestination(
205
- 'AU',
206
- '2000',
207
- 'SYDNEY',
208
- '123 Pitt Street'
209
- )
210
-
211
- ->setOrigin($origin->getName())
212
- ->setItems($this->getTestBox())
213
- ->setReady()
214
- ->setAllowedCarriers($allowed_carriers);
215
-
216
- $quotes = $request->getQuotes()->getItems();
217
- return Mage::helper('temando/functions')->getCheapestQuote($quotes);
218
- }
219
-
220
- /**
221
- * Creates a test box
222
- * @return array
223
- */
224
- public function getTestBox()
225
- {
226
- $box = Mage::getModel('temando/box');
227
- /* @var $box Temando_Temando_Model_Box */
228
- $box
229
- ->setComment('My Package')
230
- ->setQty('1')
231
- ->setValue('10')
232
- ->setLength('10')
233
- ->setWidth('10')
234
- ->setHeight('10')
235
- ->setMeasureUnit(Temando_Temando_Model_System_Config_Source_Unit_Measure::CENTIMETRES)
236
- ->setWeight('100')
237
- ->setWeightUnit(Temando_Temando_Model_System_Config_Source_Unit_Weight::GRAMS)
238
- ->setPackaging(Temando_Temando_Model_System_Config_Source_Shipment_Packaging::BOX);
239
- //->setFragile($package['fragile'])
240
- //->setArticles($package['articles']);
241
- return array($box);
242
- }
243
-
244
- protected function getTemandoProfile()
245
- {
246
- return array(
247
- 'sandbox' => Mage::helper('temando')->getConfigData('general/sandbox'),
248
- 'clientid' => Mage::helper('temando')->getConfigData('general/client'),
249
- 'username' => Mage::helper('temando')->getConfigData('general/username'),
250
- 'password' => Mage::helper('temando')->getConfigData('general/password'),
251
- 'payment' => Mage::helper('temando')->getConfigData('general/payment_type'),
252
- );
253
- }
254
- }
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper Data
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Helper_Data extends Mage_Core_Helper_Abstract
10
+ {
11
+
12
+ const TMD_VERSION_STARTER = '1.0.0';
13
+ const TMD_VERSION_PROFFESIONAL = '2.0.0';
14
+ const TMD_VERSION_BUSINESS = '3.0.0';
15
+ const TMD_VERSION_ENTERPRISE = '4.0.0';
16
+ const TEMANDO_VERSION_STARTER = 'magento-starter';
17
+ const TEMANDO_VERSION_PROFESSIONAL = 'magento-professional';
18
+ const TEMANDO_VERSION_BUSINESS = 'magento-business';
19
+ const TEMANDO_VERSION_ENTERPRISE = 'magento-enterprise';
20
+ const TMD_MODULE_NAME = 'Temando_Temando';
21
+
22
+ protected $_tmdVersion = null;
23
+
24
+ /**
25
+ * Gets version of main Temando_Temando extension
26
+ *
27
+ * @return string
28
+ */
29
+ public function getTemandoVersion()
30
+ {
31
+ if (!$this->_tmdVersion) {
32
+ $version = (string) Mage::getConfig()->getNode()->modules->Temando_Temando->version;
33
+ if (version_compare($version, self::TMD_VERSION_PROFFESIONAL, '<')) {
34
+ //anything less than 2.0.0
35
+ $this->_tmdVersion = self::TMD_VERSION_STARTER;
36
+ }
37
+
38
+ if (version_compare($version, self::TMD_VERSION_PROFFESIONAL, '>=')
39
+ && version_compare($version, self::TMD_VERSION_BUSINESS, '<')) {
40
+ //equals or greater than 2.0.0 but less then 3.0.0
41
+ $this->_tmdVersion = self::TMD_VERSION_PROFFESIONAL;
42
+ }
43
+
44
+ if (version_compare($version, self::TMD_VERSION_BUSINESS, '>=')
45
+ && version_compare($version, self::TMD_VERSION_ENTERPRISE, '<')) {
46
+ //equals or greater than 2.0.0 but less then 3.0.0
47
+ $this->_tmdVersion = self::TMD_VERSION_BUSINESS;
48
+ }
49
+
50
+ if (version_compare($version, self::TMD_VERSION_ENTERPRISE, '>=')) {
51
+ $this->_tmdVersion = self::TMD_VERSION_ENTERPRISE;
52
+ }
53
+
54
+ if (!$version) {
55
+ $this->_tmdVersion = null;
56
+ }
57
+ }
58
+
59
+ return $this->_tmdVersion;
60
+ }
61
+
62
+ /**
63
+ * Retrieves an element from the module configuration data.
64
+ *
65
+ * @param string $field
66
+ */
67
+ public function getConfigData($field)
68
+ {
69
+ $path = 'temandoinstaller/' . $field;
70
+ return Mage::getStoreConfig($path);
71
+ }
72
+
73
+ public function getTemandoVersionName()
74
+ {
75
+ $versionName = null;
76
+ switch ($this->getTemandoVersion()) {
77
+ case self::TMD_VERSION_STARTER:
78
+ $versionName = 'starter';
79
+ break;
80
+ case self::TMD_VERSION_PROFFESIONAL:
81
+ $versionName = 'professional';
82
+ break;
83
+ case self::TMD_VERSION_BUSINESS:
84
+ $versionName = 'business';
85
+ break;
86
+ case self::TMD_VERSION_ENTERPRISE:
87
+ $versionName = 'enterprise';
88
+ break;
89
+ }
90
+
91
+ return $versionName;
92
+ }
93
+
94
+ public function getVersions()
95
+ {
96
+ return array(
97
+ self::TEMANDO_VERSION_STARTER,
98
+ self::TEMANDO_VERSION_PROFESSIONAL,
99
+ self::TEMANDO_VERSION_BUSINESS,
100
+ self::TEMANDO_VERSION_ENTERPRISE);
101
+ }
102
+
103
+ public function getVersionNameFromSlug($slug)
104
+ {
105
+ $strippedSlug = substr($slug, 0, -3);
106
+ $names = array(
107
+ self::TEMANDO_VERSION_STARTER => 'Temando Starter',
108
+ self::TEMANDO_VERSION_PROFESSIONAL => 'Temando Professional',
109
+ self::TEMANDO_VERSION_BUSINESS => 'Temando Business',
110
+ self::TEMANDO_VERSION_ENTERPRISE => 'Temando Enterprise'
111
+ );
112
+ return $names[$strippedSlug];
113
+ }
114
+
115
+ public function getTemandoVersionNumber()
116
+ {
117
+ $version = (string) Mage::getConfig()->getNode()->modules->Temando_Temando->version;
118
+ return $version;
119
+ }
120
+
121
+ public function getTemandoModuleName()
122
+ {
123
+ return self::TMD_MODULE_NAME;
124
+ }
125
+
126
+ public function getTemandoToken()
127
+ {
128
+ return $this->getConfigData('general/token');
129
+ }
130
+
131
+ public function getTemandoWarehouses()
132
+ {
133
+ return Mage::getResourceModel('temando/warehouse_collection');
134
+ }
135
+
136
+ public function getTemandoRules()
137
+ {
138
+ return Mage::getResourceModel('temando/rule_collection');
139
+ }
140
+
141
+ public function testAccountDetails()
142
+ {
143
+ try {
144
+ $api = $this->connect();
145
+ $result = $api->getLocations(array('clientId' => Mage::helper('temando')->getClientId()));
146
+ if (!$result) {
147
+ return 'Could not connect to the api';
148
+ }
149
+ } catch (Exception $e) {
150
+ return $e->getMessage();
151
+ }
152
+
153
+ return false;
154
+ }
155
+
156
+ /**
157
+ * @return Temando_Temando_Model_Api_Client
158
+ */
159
+ public function connect()
160
+ {
161
+ $api = Mage::getModel('temando/api_client');
162
+ switch ($this->getTemandoVersion()) {
163
+ case self::TMD_VERSION_BUSINESS:
164
+ $api = $api->connect($this->getTemandoProfile());
165
+ break;
166
+ default:
167
+ $api = $api->connect(
168
+ Mage::helper('temando')->getConfigData('general/username'),
169
+ Mage::helper('temando')->getConfigData('general/password'),
170
+ Mage::helper('temando')->getConfigData('general/sandbox')
171
+ );
172
+ break;
173
+ }
174
+
175
+ return $api;
176
+ }
177
+
178
+ /**
179
+ * Returns cheapest available quote for dummy order
180
+ *
181
+ * @return null|Temando_Temando_Model_Quote
182
+ */
183
+ public function loadCheapestQuote()
184
+ {
185
+ //get first origin location
186
+ $origins = $this->getTemandoWarehouses();
187
+ foreach ($origins as $origin) {
188
+ continue;
189
+ }
190
+
191
+ if (!$origin) {
192
+ return null;
193
+ }
194
+
195
+ /** @var $origin Temando_Temando_Model_Warehouse */
196
+ $allowedCarriers = explode(',', Mage::getStoreConfig('carriers/temando/allowed_methods'));
197
+ $request = Mage::getModel('temando/api_request');
198
+ /** @var $request Temando_Temando_Model_Api_Request */
199
+
200
+ switch ($this->getTemandoVersion()) {
201
+ case self::TMD_VERSION_BUSINESS:
202
+ $request->setConnectionParams($origin->getTemandoProfile());
203
+ break;
204
+ default:
205
+ $request
206
+ ->setUsername(Mage::helper('temando')->getConfigData('general/username'))
207
+ ->setPassword(Mage::helper('temando')->getConfigData('general/password'))
208
+ ->setSandbox(Mage::helper('temando')->getConfigData('general/sandbox'));
209
+ break;
210
+ }
211
+
212
+ $request
213
+ ->setMagentoQuoteId(100000000 + mt_rand(0, 100000))
214
+ ->setDestination(
215
+ 'AU',
216
+ '2000',
217
+ 'SYDNEY',
218
+ '123 Pitt Street'
219
+ )
220
+
221
+ ->setOrigin($origin->getName())
222
+ ->setItems($this->getTestBox())
223
+ ->setReady()
224
+ ->setAllowedCarriers($allowedCarriers);
225
+
226
+ $quotes = $request->getQuotes()->getItems();
227
+ return Mage::helper('temando/functions')->getCheapestQuote($quotes);
228
+ }
229
+
230
+ /**
231
+ * Creates a test box
232
+ * @return array
233
+ */
234
+ public function getTestBox()
235
+ {
236
+ $box = Mage::getModel('temando/box');
237
+ /** @var $box Temando_Temando_Model_Box */
238
+ $box
239
+ ->setComment('My Package')
240
+ ->setQty('1')
241
+ ->setValue('10')
242
+ ->setLength('10')
243
+ ->setWidth('10')
244
+ ->setHeight('10')
245
+ ->setMeasureUnit(Temando_Temando_Model_System_Config_Source_Unit_Measure::CENTIMETRES)
246
+ ->setWeight('100')
247
+ ->setWeightUnit(Temando_Temando_Model_System_Config_Source_Unit_Weight::GRAMS)
248
+ ->setPackaging(Temando_Temando_Model_System_Config_Source_Shipment_Packaging::BOX);
249
+ /** ->setFragile($package['fragile'])
250
+ ->setArticles($package['articles']); */
251
+ return array($box);
252
+ }
253
+
254
+ protected function getTemandoProfile()
255
+ {
256
+ return array(
257
+ 'sandbox' => Mage::helper('temando')->getConfigData('general/sandbox'),
258
+ 'clientid' => Mage::helper('temando')->getConfigData('general/client'),
259
+ 'username' => Mage::helper('temando')->getConfigData('general/username'),
260
+ 'password' => Mage::helper('temando')->getConfigData('general/password'),
261
+ 'payment' => Mage::helper('temando')->getConfigData('general/payment_type'),
262
+ );
263
+ }
264
+ }
app/code/community/Temando/Installer/Model/Api/Rest/Client.php CHANGED
@@ -1,121 +1,129 @@
1
- <?php
2
- /**
3
- * Api Rest Client
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- * @method StdClass getLastResponse()
8
- */
9
- class Temando_Installer_Model_Api_Rest_Client
10
- extends Mage_Core_Model_Abstract {
11
-
12
- /**
13
- * Auth token
14
- * @var string
15
- */
16
- protected $_token = null;
17
-
18
- /**
19
- * The HTTP Client
20
- * @var Varien_Http_Client
21
- */
22
- protected $_client = null;
23
-
24
- /**
25
- * Service Uri
26
- * @var string
27
- */
28
- protected $_uri = null;
29
-
30
-
31
- public function _construct()
32
- {
33
- parent::_construct();
34
- $this->_prepareClient();
35
- }
36
-
37
-
38
- public function getService($request, $jsonDecode = true)
39
- {
40
- if (!$this->_validate($request)) {
41
- return false;
42
- }
43
- try {
44
- if ($jsonDecode) {
45
- $this->_client
46
- ->setHeaders(array('Authorization' => 'Bearer ' . $this->_token))
47
- ->setUri($this->_uri);
48
- } else {
49
- $this->_client
50
- ->setUri($this->_uri . '?access_token=' . $this->_token);
51
- }
52
-
53
- /**
54
- * Getting response via raw body and decoding coz of a bug in Zend yielding
55
- * exception when ->getBody() is used to decode and return response
56
- */
57
-
58
- $rawBody = $this->_client->request(Varien_Http_Client::GET)->getRawBody();
59
-
60
- if ($jsonDecode) {
61
- $response = Mage::helper('core')->jsonDecode($rawBody, Zend_Json::TYPE_OBJECT);
62
- } else {
63
- $response = $rawBody;
64
- }
65
-
66
- if ($this->_client->getLastResponse()->getStatus() == 200 && count($response)) {
67
- //all good
68
- } else {
69
- Mage::logException(new Exception($this->_client->getLastResponse()));
70
- Mage::log($this->_client->getLastRequest(), null, 'tmd-http-request.log', true);
71
- Mage::log($this->_client->getLastResponse(), null, 'tmd-http-response.log', true);
72
- }
73
- return $response;
74
-
75
- } catch (Exception $e) {
76
- Mage::logException($e);
77
- if (!$this->_sandbox) {
78
- Mage::log($this->_client->getLastRequest(), null, 'tmd-http-request.log', true);
79
- Mage::log($this->_client->getLastResponse(), null, 'tmd-http-response.log', true);
80
- }
81
- return false;
82
- }
83
- }
84
-
85
- /**
86
- * Validate data before sending request
87
- *
88
- * @return boolean
89
- */
90
- protected function _validate($request)
91
- {
92
- if (!$this->_uri) {
93
- $this->_uri = $request['uri'];
94
- }
95
- if (!$this->_uri) {
96
- Mage::logException(new Exception(__CLASS__.': missing request url.'));
97
- return false;
98
- }
99
- if (!$this->_token) {
100
- Mage::logException(new Exception(__CLASS__.': missing authorisation token.'));
101
- return false;
102
- }
103
- return true;
104
- }
105
-
106
- /**
107
- * Initializes http client to communicate with Temando REST Api
108
- *
109
- * @return \Temando_Installer_Model_Api_Rest_Client
110
- */
111
- protected function _prepareClient()
112
- {
113
- if (!$this->_client) {
114
- $this->_client = new Varien_Http_Client();
115
- }
116
- if (!$this->_token) {
117
- $this->_token = Mage::helper('temandoinstaller')->getTemandoToken();
118
- }
119
- return $this;
120
- }
121
- }
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Api Rest Client
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ * @method StdClass getLastResponse()
8
+ */
9
+
10
+ class Temando_Installer_Model_Api_Rest_Client
11
+ extends Mage_Core_Model_Abstract
12
+ {
13
+
14
+ /**
15
+ * Auth token
16
+ * @var string
17
+ */
18
+ protected $_token = null;
19
+
20
+ /**
21
+ * The HTTP Client
22
+ * @var Varien_Http_Client
23
+ */
24
+ protected $_client = null;
25
+
26
+ /**
27
+ * Service Uri
28
+ * @var string
29
+ */
30
+ protected $_uri = null;
31
+
32
+
33
+ public function _construct()
34
+ {
35
+ parent::_construct();
36
+ $this->_prepareClient();
37
+ }
38
+
39
+
40
+ public function getService($request, $jsonDecode = true)
41
+ {
42
+ if (!$this->_validate($request)) {
43
+ return false;
44
+ }
45
+
46
+ try {
47
+ if ($jsonDecode) {
48
+ $this->_client
49
+ ->setHeaders(array('Authorization' => 'Bearer ' . $this->_token))
50
+ ->setUri($this->_uri);
51
+ } else {
52
+ $this->_client
53
+ ->setUri($this->_uri . '?access_token=' . $this->_token);
54
+ }
55
+
56
+ /**
57
+ * Getting response via raw body and decoding coz of a bug in Zend yielding
58
+ * exception when ->getBody() is used to decode and return response
59
+ */
60
+
61
+ $rawBody = $this->_client->request(Varien_Http_Client::GET)->getRawBody();
62
+
63
+ if ($jsonDecode) {
64
+ $response = Mage::helper('core')->jsonDecode($rawBody, Zend_Json::TYPE_OBJECT);
65
+ } else {
66
+ $response = $rawBody;
67
+ }
68
+
69
+ if (!($this->_client->getLastResponse()->getStatus() == 200 && !empty($response))) {
70
+ //if not good, then log
71
+ Mage::logException(new Exception($this->_client->getLastResponse()));
72
+ Mage::log($this->_client->getLastRequest(), null, 'tmd-http-request.log', true);
73
+ Mage::log($this->_client->getLastResponse(), null, 'tmd-http-response.log', true);
74
+ }
75
+
76
+ return $response;
77
+ } catch (Exception $e) {
78
+ Mage::logException($e);
79
+ if (!$this->_sandbox) {
80
+ Mage::log($this->_client->getLastRequest(), null, 'tmd-http-request.log', true);
81
+ Mage::log($this->_client->getLastResponse(), null, 'tmd-http-response.log', true);
82
+ }
83
+
84
+ return false;
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Validate data before sending request
90
+ *
91
+ * @return boolean
92
+ */
93
+ protected function _validate($request)
94
+ {
95
+ if (!$this->_uri) {
96
+ $this->_uri = $request['uri'];
97
+ }
98
+
99
+ if (!$this->_uri) {
100
+ Mage::logException(new Exception(__CLASS__.': missing request url.'));
101
+ return false;
102
+ }
103
+
104
+ if (!$this->_token) {
105
+ Mage::logException(new Exception(__CLASS__.': missing authorisation token.'));
106
+ return false;
107
+ }
108
+
109
+ return true;
110
+ }
111
+
112
+ /**
113
+ * Initializes http client to communicate with Temando REST Api
114
+ *
115
+ * @return \Temando_Installer_Model_Api_Rest_Client
116
+ */
117
+ protected function _prepareClient()
118
+ {
119
+ if (!$this->_client) {
120
+ $this->_client = new Varien_Http_Client();
121
+ }
122
+
123
+ if (!$this->_token) {
124
+ $this->_token = Mage::helper('temandoinstaller')->getTemandoToken();
125
+ }
126
+
127
+ return $this;
128
+ }
129
+ }
app/code/community/Temando/Installer/Model/Connect.php CHANGED
@@ -1,140 +1,150 @@
1
- <?php
2
- /**
3
- * Connect
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Model_Connect extends Mage_Core_Model_Abstract
9
- {
10
- protected $_config;
11
- protected $_sconfig;
12
- protected $_frontend;
13
-
14
- const DEFAULT_DOWNLOADER_PATH = "downloader";
15
-
16
- /**
17
- * Default single config filename
18
- *
19
- * 'cache.cfg'
20
- */
21
- const DEFAULT_SCONFIG_FILENAME = 'cache.cfg';
22
-
23
- public function _construct()
24
- {
25
- parent::_construct();
26
- $this->initialize();
27
-
28
- }
29
-
30
- public function install($file)
31
- {
32
- try {
33
- Mage_Connect_Command::getCommands();
34
- $cmd = Mage_Connect_Command::getInstance('install-file');
35
- $cmd->setSconfig($this->_sconfig);
36
- $cmd->setConfigObject($this->_config);
37
- $cmd->setFrontendObject($this->_frontend);
38
- $params = array($file);
39
- $cmd->run('install-file', array(), $params);
40
- } catch (Exception $ex) {
41
- Mage::register('temandoinstaller_errors', array('There was an error installing'));
42
- return false;
43
- }
44
-
45
- if ($cmd->ui()->hasErrors()) {
46
- $errors = array();
47
- foreach ($cmd->ui()->getErrors() as $error) {
48
- $errors[] = $error[1];
49
- }
50
- Mage::register('temandoinstaller_errors', $errors);
51
- return false;
52
- }
53
- return true;
54
- }
55
-
56
- public function uninstall($module)
57
- {
58
- try {
59
- Mage_Connect_Command::getCommands();
60
- $cmd = Mage_Connect_Command::getInstance('uninstall');
61
- $cmd->setSconfig($this->_sconfig);
62
- $cmd->setConfigObject($this->_config);
63
- $cmd->setFrontendObject($this->_frontend);
64
- $package = $this->_sconfig->getPackageObject('community', $module);
65
- $contents = $package->getContents();
66
- $params = array('community', $module);
67
- $cmd->run('uninstall', array(), $params);
68
- } catch (Exception $ex) {
69
- Mage::register('temandoinstaller_errors', array('There was an error uninstalling'));
70
- return false;
71
- }
72
-
73
- if ($cmd->ui()->hasErrors()) {
74
- $errors = array();
75
- foreach ($cmd->ui()->getErrors() as $error) {
76
- $errors[] = $error[1];
77
- }
78
- Mage::register('temandoinstaller_errors', $errors);
79
- return false;
80
- }
81
- //clean the directories
82
- $targetPath = rtrim($this->_config->magento_root, "\\/");
83
- foreach ($contents as $file) {
84
- $fileName = basename($file);
85
- $filePath = dirname($file);
86
- $dest = $targetPath . DIRECTORY_SEPARATOR . $filePath . DIRECTORY_SEPARATOR . $fileName;
87
- $this->removeEmptyDirectory(dirname($dest));
88
-
89
- }
90
- return true;
91
-
92
- }
93
-
94
- /**
95
- * Return the single config class
96
- * @return Mage_Connect_Singleconfig
97
- */
98
- public function getSingleConfig()
99
- {
100
- return $this->_sconfig;
101
- }
102
-
103
- /**
104
- * Remove empty directories recursively up
105
- *
106
- * @param string $dir
107
- * @param Mage_Connect_Ftp $ftp
108
- */
109
- protected function removeEmptyDirectory($dir)
110
- {
111
- try {
112
- if (@rmdir($dir)) {
113
- $this->removeEmptyDirectory(dirname($dir));
114
- }
115
- } catch (Exception $ex) {
116
-
117
- }
118
- }
119
-
120
- protected function initialize()
121
- {
122
- if (!$this->_config) {
123
- $this->_config = new Mage_Connect_Config();
124
- $this->_config->magento_root = Mage::getBaseDir() .
125
- DIRECTORY_SEPARATOR.self::DEFAULT_DOWNLOADER_PATH . DIRECTORY_SEPARATOR.'..';
126
- }
127
-
128
- if (!$this->_sconfig) {
129
- $this->_sconfig = new Mage_Connect_Singleconfig(
130
- Mage::getBaseDir() . DIRECTORY_SEPARATOR .
131
- self::DEFAULT_DOWNLOADER_PATH . DIRECTORY_SEPARATOR .
132
- self::DEFAULT_SCONFIG_FILENAME
133
- );
134
- }
135
-
136
- if (!$this->_frontend) {
137
- $this->_frontend = new Mage_Connect_Frontend();
138
- }
139
- }
140
- }
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Connect
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Model_Connect extends Mage_Core_Model_Abstract
10
+ {
11
+ protected $_config;
12
+ protected $_sconfig;
13
+ protected $_frontend;
14
+
15
+ const DEFAULT_DOWNLOADER_PATH = "downloader";
16
+
17
+ /**
18
+ * Default single config filename
19
+ *
20
+ * 'cache.cfg'
21
+ */
22
+ const DEFAULT_SCONFIG_FILENAME = 'cache.cfg';
23
+
24
+ public function _construct()
25
+ {
26
+ parent::_construct();
27
+ $this->initialize();
28
+
29
+ }
30
+
31
+ public function install($file)
32
+ {
33
+ try {
34
+ Mage_Connect_Command::getCommands();
35
+ $cmd = Mage_Connect_Command::getInstance('install-file');
36
+ $cmd->setSconfig($this->_sconfig);
37
+ $cmd->setConfigObject($this->_config);
38
+ $cmd->setFrontendObject($this->_frontend);
39
+ $params = array($file);
40
+ $cmd->run('install-file', array(), $params);
41
+ } catch (Exception $ex) {
42
+ Mage::register('temandoinstaller_errors', array('There was an error installing'));
43
+ return false;
44
+ }
45
+
46
+ if ($cmd->ui()->hasErrors()) {
47
+ $errors = array();
48
+ foreach ($cmd->ui()->getErrors() as $error) {
49
+ $errors[] = $error[1];
50
+ }
51
+
52
+ Mage::register('temandoinstaller_errors', $errors);
53
+ return false;
54
+ }
55
+
56
+ return true;
57
+ }
58
+
59
+ public function uninstall($module)
60
+ {
61
+ try {
62
+ Mage_Connect_Command::getCommands();
63
+ $cmd = Mage_Connect_Command::getInstance('uninstall');
64
+ $cmd->setSconfig($this->_sconfig);
65
+ $cmd->setConfigObject($this->_config);
66
+ $cmd->setFrontendObject($this->_frontend);
67
+ $package = $this->_sconfig->getPackageObject('community', $module);
68
+ $contents = $package->getContents();
69
+ $params = array('community', $module);
70
+ $cmd->run('uninstall', array(), $params);
71
+ } catch (Exception $ex) {
72
+ Mage::register('temandoinstaller_errors', array('There was an error uninstalling'));
73
+ return false;
74
+ }
75
+
76
+ if ($cmd->ui()->hasErrors()) {
77
+ $errors = array();
78
+ foreach ($cmd->ui()->getErrors() as $error) {
79
+ $errors[] = $error[1];
80
+ }
81
+
82
+ Mage::register('temandoinstaller_errors', $errors);
83
+ return false;
84
+ }
85
+
86
+ //clean the directories
87
+ $targetPath = rtrim($this->_config->magento_root, "\\/");
88
+ // @codingStandardsIgnoreStart
89
+ foreach ($contents as $file) {
90
+ $fileName = basename($file);
91
+ $filePath = dirname($file);
92
+ $dest = $targetPath . DIRECTORY_SEPARATOR . $filePath . DIRECTORY_SEPARATOR . $fileName;
93
+ $this->removeEmptyDirectory(dirname($dest));
94
+ }
95
+ // @codingStandardsIgnoreEnd
96
+ return true;
97
+ }
98
+
99
+ /**
100
+ * Return the single config class
101
+ * @return Mage_Connect_Singleconfig
102
+ */
103
+ public function getSingleConfig()
104
+ {
105
+ return $this->_sconfig;
106
+ }
107
+
108
+ /**
109
+ * Remove empty directories recursively up
110
+ *
111
+ * @param string $dir
112
+ * @param Mage_Connect_Ftp $ftp
113
+ */
114
+ protected function removeEmptyDirectory($dir)
115
+ {
116
+ try {
117
+ // @codingStandardsIgnoreStart
118
+ if (@rmdir($dir)) {
119
+ $this->removeEmptyDirectory(dirname($dir));
120
+ }// @codingStandardsIgnoreEnd
121
+ } catch (Exception $ex) {
122
+ return false;
123
+ }
124
+ }
125
+
126
+ protected function initialize()
127
+ {
128
+ if (!$this->_config) {
129
+ // @codingStandardsIgnoreStart
130
+ $this->_config = new Mage_Connect_Config();
131
+ // @codingStandardsIgnoreEnd
132
+ $this->_config->magento_root = Mage::getBaseDir() .
133
+ DIRECTORY_SEPARATOR.self::DEFAULT_DOWNLOADER_PATH . DIRECTORY_SEPARATOR.'..';
134
+ }
135
+
136
+ if (!$this->_sconfig) {
137
+ // @codingStandardsIgnoreStart
138
+ $this->_sconfig = new Mage_Connect_Singleconfig(
139
+ Mage::getBaseDir() . DIRECTORY_SEPARATOR .
140
+ self::DEFAULT_DOWNLOADER_PATH . DIRECTORY_SEPARATOR .
141
+ self::DEFAULT_SCONFIG_FILENAME
142
+ );
143
+ }
144
+
145
+ if (!$this->_frontend) {
146
+ $this->_frontend = new Mage_Connect_Frontend();
147
+ }
148
+ // @codingStandardsIgnoreEnd
149
+ }
150
+ }
app/code/community/Temando/Installer/Model/Cron.php CHANGED
@@ -1,62 +1,69 @@
1
- <?php
2
- /**
3
- * Cron
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- *
8
- * Cron job currently for checking updates on the main Temando module
9
- */
10
- class Temando_Installer_Model_Cron extends Mage_Core_Model_Abstract
11
- {
12
- protected $_helper;
13
-
14
- public function _construct()
15
- {
16
- parent::_construct();
17
- $this->initialize();
18
- }
19
-
20
- public function checkReleases()
21
- {
22
- $module = Temando_Installer_Helper_Data::TMD_MODULE_NAME;
23
- $installer = Mage::getModel('temandoinstaller/installer');
24
- /* @var $installer Temando_Installer_Model_Installer */
25
-
26
- //check token
27
- $currentService = $installer->getCurrentService();
28
- if (!$currentService) {
29
- return;
30
- }
31
- //check the latest release
32
- if (!isset($currentService->links->software_latest_release->version)) {
33
- return;
34
- }
35
- //compare the current version
36
- if ($this->_helper->getTemandoVersionNumber() >= $currentService->links->software_latest_release->version) {
37
- //if the release version isn't higher than the current version return as there is no update available
38
- return;
39
- }
40
-
41
- $versionNumber = $currentService->links->software_latest_release->version;
42
- $updateDetails = 'Temando v' . $versionNumber . ' is available.';
43
- $installerModules = Mage::getModel('temandoinstaller/installer')->getCollection();
44
- $installerModules->addFieldToFilter('module', $module);
45
- $installerModules->addFieldToFilter('update_available', false);
46
- $installerModules->addFieldToFilter('update_dismissed', false);
47
- foreach ($installerModules as $module) {
48
- /* @var $module Temando_Installer_Model_Installer */
49
- $module
50
- ->setUpdateAvailable(true)
51
- ->setUpdateDetails($updateDetails)
52
- ->save();
53
- }
54
- }
55
-
56
- protected function initialize()
57
- {
58
- if (!$this->_helper) {
59
- $this->_helper = Mage::helper('temandoinstaller');
60
- }
61
- }
62
- }
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cron
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ *
8
+ * Cron job currently for checking updates on the main Temando module
9
+ */
10
+
11
+ class Temando_Installer_Model_Cron extends Mage_Core_Model_Abstract
12
+ {
13
+ protected $_helper;
14
+
15
+ public function _construct()
16
+ {
17
+ parent::_construct();
18
+ $this->initialize();
19
+ }
20
+
21
+ public function checkReleases()
22
+ {
23
+ $module = Temando_Installer_Helper_Data::TMD_MODULE_NAME;
24
+ $installer = Mage::getModel('temandoinstaller/installer');
25
+ /** @var $installer Temando_Installer_Model_Installer */
26
+
27
+ //check token
28
+ $currentService = $installer->getCurrentService();
29
+ if (!$currentService) {
30
+ return;
31
+ }
32
+
33
+ //check the latest release
34
+ if (!isset($currentService->links->software_latest_release->version)) {
35
+ return;
36
+ }
37
+
38
+ //compare the current version
39
+ if ($this->_helper->getTemandoVersionNumber() >= $currentService->links->software_latest_release->version) {
40
+ //if the release version isn't higher than the current version return as there is no update available
41
+ return;
42
+ }
43
+
44
+ $versionNumber = $currentService->links->software_latest_release->version;
45
+ $updateDetails = 'Temando v' . $versionNumber . ' is available.';
46
+ $installerModules = Mage::getModel('temandoinstaller/installer')->getCollection();
47
+ $installerModules->addFieldToFilter('module', $module);
48
+ $installerModules->addFieldToFilter('update_available', false);
49
+ $installerModules->addFieldToFilter('update_dismissed', false);
50
+ foreach ($installerModules as $module) {
51
+ $this->_saveInstaller($installer);
52
+ }
53
+ }
54
+
55
+ protected function _saveInstaller($installerModel)
56
+ {
57
+ /** @var $installer Temando_Installer_Model_Installer */
58
+ $installerModel
59
+ ->setUpdateAvailable(true)
60
+ ->setUpdateDetails($updateDetails)
61
+ ->save();
62
+ }
63
+ protected function initialize()
64
+ {
65
+ if (!$this->_helper) {
66
+ $this->_helper = Mage::helper('temandoinstaller');
67
+ }
68
+ }
69
+ }
app/code/community/Temando/Installer/Model/Installer.php CHANGED
@@ -1,210 +1,225 @@
1
- <?php
2
- /**
3
- * Installer
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Model_Installer extends Mage_Core_Model_Abstract
9
- {
10
- const TEMANDO_FINANCE_API = 'https://finance.temando.com/api/v1/user/subscriptions';
11
-
12
- public function _construct()
13
- {
14
- parent::_construct();
15
- $this->_init('temandoinstaller/installer');
16
- }
17
-
18
- /**
19
- * Gets the highest available service and returns it
20
- * @return boolean|object
21
- */
22
- public function getCurrentService()
23
- {
24
- $request = array();
25
- $request['uri'] = self::TEMANDO_FINANCE_API;
26
- $helper = Mage::helper('temandoinstaller');
27
- /* @var $helper Temando_Installer_Helper_Data */
28
- $api = Mage::getModel('temandoinstaller/api_rest_client');
29
- /* @var $api Temando_Installer_Model_Api_Rest_Client */
30
- $versions = $helper->getVersions();
31
- $response = $api->getService($request);
32
- if (!isset($response->subscriptions)) {
33
- return false;
34
- }
35
- $services = array();
36
- foreach ($response->subscriptions as $subscription) {
37
- if (!isset($subscription->links->service->href)) {
38
- continue;
39
- }
40
- if (!$subscription->active) {
41
- continue;
42
- }
43
- //collect available services
44
- $services[] = $this->getService($subscription->links->service->href);
45
- }
46
- $currentService = null;
47
- foreach ($versions as $version) {
48
- foreach ($services as $service) {
49
- if (substr($service->slug, 0, -3) == $version) {
50
- $currentService = $service;
51
- }
52
- }
53
- }
54
- return $currentService;
55
- }
56
-
57
- /**
58
- * Downloads the package
59
- * @param object $service
60
- * @return string|boolean
61
- */
62
- public function downloadPackage($service)
63
- {
64
- if (!isset($service->links->software_latest_release->href)) {
65
- return false;
66
- }
67
- $latestRelease = $this->getLatestRelease($service->links->software_latest_release->href);
68
- if (!isset($latestRelease->raw_url)) {
69
- return false;
70
- }
71
-
72
- $package = $this->getPackage($latestRelease->raw_url);
73
- if (!$package) {
74
- return false;
75
- }
76
- $file = 'Temando_Temando.tgz';
77
- $fileTemp = Mage::getBaseDir() . DS . "var/" . uniqid() . $file;
78
-
79
- if (!file_put_contents($fileTemp, $package)) {
80
- //there is an error saving the file on disk
81
- return false;
82
- } else {
83
- //everything is awesome
84
- return $fileTemp;
85
- }
86
- }
87
-
88
- /**
89
- * Gets the package
90
- * @param string $uri
91
- */
92
- public function getPackage($uri)
93
- {
94
- $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
95
- /* @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
96
- $packageRequest = array();
97
- $packageRequest['uri'] = $uri;
98
- $packageResponse = $serviceApi->getService($packageRequest, false);
99
- //validate the download here
100
- return $packageResponse;
101
- }
102
-
103
- /**
104
- * Gets the service object
105
- * @param string $uri
106
- * @return object
107
- */
108
- public function getService($uri)
109
- {
110
- $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
111
- /* @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
112
- $serviceRequest = array();
113
- $serviceRequest['uri'] = $uri;
114
- $serviceResponse = $serviceApi->getService($serviceRequest);
115
- if (!isset($serviceResponse->services)) {
116
- return;
117
- }
118
- return $serviceResponse->services;
119
- }
120
-
121
- /**
122
- * Returns the product object
123
- * @param string $uri
124
- * @return object
125
- */
126
- public function getProduct($uri)
127
- {
128
- $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
129
- /* @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
130
- $productRequest = array();
131
- $productRequest['uri'] = $uri;
132
- $productResponse = $serviceApi->getService($productRequest);
133
- if (!isset($productResponse->softwares->software)) {
134
- return;
135
- }
136
- return $productResponse->softwares->software;
137
- }
138
-
139
- /**
140
- * Returns the latest release object
141
- * @param string $uri
142
- * @return object
143
- */
144
- public function getLatestRelease($uri)
145
- {
146
- $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
147
- /* @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
148
- $releaseRequest = array();
149
- $releaseRequest['uri'] = $uri;
150
- $releaseResponse = $serviceApi->getService($releaseRequest);
151
- if (!isset($releaseResponse->release)) {
152
- return;
153
- }
154
- return $releaseResponse->release;
155
- }
156
-
157
- /**
158
- * Returns the service slug name
159
- * @param string $uri
160
- * @return string
161
- */
162
- public function getServiceSlug($uri)
163
- {
164
- $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
165
- /* @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
166
- $serviceRequest = array();
167
- $serviceRequest['uri'] = $uri;
168
- $serviceResponse = $serviceApi->getService($serviceRequest);
169
- if (!isset($serviceResponse->services->slug)) {
170
- return;
171
- }
172
- return $serviceResponse->services->slug;
173
- }
174
-
175
- /**
176
- * Gets the latest version of the service
177
- * @param string $uri
178
- * @return string
179
- */
180
- public function getServiceLatestVersion($uri)
181
- {
182
- $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
183
- /* @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
184
- $serviceRequest = array();
185
- $serviceRequest['uri'] = $uri;
186
- $serviceResponse = $serviceApi->getService($serviceRequest);
187
- if (!isset($serviceResponse->services->links->software_latest_release->version)) {
188
- return;
189
- }
190
- return $serviceResponse->services->links->software_latest_release->version;
191
- }
192
-
193
- /**
194
- * Returns the latest version uri
195
- * @param string $uri
196
- * @return string
197
- */
198
- public function getServiceLatestVersionUri($uri)
199
- {
200
- $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
201
- /* @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
202
- $serviceRequest = array();
203
- $serviceRequest['uri'] = $uri;
204
- $serviceResponse = $serviceApi->getService($serviceRequest);
205
- if (!isset($serviceResponse->services->links->software_latest_release->href)) {
206
- return;
207
- }
208
- return $serviceResponse->services->links->software_latest_release->href;
209
- }
210
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Installer
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Model_Installer extends Mage_Core_Model_Abstract
10
+ {
11
+ const TEMANDO_FINANCE_API = 'https://finance.temando.com/api/v1/user/subscriptions';
12
+
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('temandoinstaller/installer');
17
+ }
18
+
19
+ /**
20
+ * Gets the highest available service and returns it
21
+ * @return boolean|object
22
+ */
23
+ public function getCurrentService()
24
+ {
25
+ $request = array();
26
+ $request['uri'] = self::TEMANDO_FINANCE_API;
27
+ $helper = Mage::helper('temandoinstaller');
28
+ /** @var $helper Temando_Installer_Helper_Data */
29
+ $api = Mage::getModel('temandoinstaller/api_rest_client');
30
+ /** @var $api Temando_Installer_Model_Api_Rest_Client */
31
+ $versions = $helper->getVersions();
32
+ $response = $api->getService($request);
33
+ if (!isset($response->subscriptions)) {
34
+ return false;
35
+ }
36
+
37
+ $services = array();
38
+ foreach ($response->subscriptions as $subscription) {
39
+ if (!isset($subscription->links->service->href)) {
40
+ continue;
41
+ }
42
+
43
+ if (!$subscription->active) {
44
+ continue;
45
+ }
46
+
47
+ //collect available services
48
+ $services[] = $this->getService($subscription->links->service->href);
49
+ }
50
+
51
+ $currentService = null;
52
+ foreach ($versions as $version) {
53
+ foreach ($services as $service) {
54
+ if (substr($service->slug, 0, -3) == $version) {
55
+ $currentService = $service;
56
+ }
57
+ }
58
+ }
59
+
60
+ return $currentService;
61
+ }
62
+
63
+ /**
64
+ * Downloads the package
65
+ * @param object $service
66
+ * @return string|boolean
67
+ */
68
+ public function downloadPackage($service)
69
+ {
70
+ if (!isset($service->links->software_latest_release->href)) {
71
+ return false;
72
+ }
73
+
74
+ $rawUrl = $this->getLatestRelease($service->links->software_latest_release->href)->raw_url;
75
+ if (!isset($rawUrl)) {
76
+ return false;
77
+ }
78
+
79
+ $package = $this->getPackage($rawUrl);
80
+ if (!$package) {
81
+ return false;
82
+ }
83
+
84
+ $file = 'Temando_Temando.tgz';
85
+ $fileTemp = Mage::getBaseDir() . DS . "var/" . uniqid() . $file;
86
+ // @codingStandardsIgnoreStart
87
+ if (!file_put_contents($fileTemp, $package)) {
88
+ // @codingStandardsIgnoreEnd
89
+ //there is an error saving the file on disk
90
+ return false;
91
+ } else {
92
+ //everything is awesome
93
+ return $fileTemp;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Gets the package
99
+ * @param string $uri
100
+ */
101
+ public function getPackage($uri)
102
+ {
103
+ $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
104
+ /** @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
105
+ $packageRequest = array();
106
+ $packageRequest['uri'] = $uri;
107
+ $packageResponse = $serviceApi->getService($packageRequest, false);
108
+ //validate the download here
109
+ return $packageResponse;
110
+ }
111
+
112
+ /**
113
+ * Gets the service object
114
+ * @param string $uri
115
+ * @return object
116
+ */
117
+ public function getService($uri)
118
+ {
119
+ $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
120
+ /** @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
121
+ $serviceRequest = array();
122
+ $serviceRequest['uri'] = $uri;
123
+ $serviceResponse = $serviceApi->getService($serviceRequest);
124
+ if (!isset($serviceResponse->services)) {
125
+ return;
126
+ }
127
+
128
+ return $serviceResponse->services;
129
+ }
130
+
131
+ /**
132
+ * Returns the product object
133
+ * @param string $uri
134
+ * @return object
135
+ */
136
+ public function getProduct($uri)
137
+ {
138
+ $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
139
+ /** @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
140
+ $productRequest = array();
141
+ $productRequest['uri'] = $uri;
142
+ $productResponse = $serviceApi->getService($productRequest);
143
+ if (!isset($productResponse->softwares->software)) {
144
+ return;
145
+ }
146
+
147
+ return $productResponse->softwares->software;
148
+ }
149
+
150
+ /**
151
+ * Returns the latest release object
152
+ * @param string $uri
153
+ * @return object
154
+ */
155
+ public function getLatestRelease($uri)
156
+ {
157
+ $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
158
+ /** @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
159
+ $releaseRequest = array();
160
+ $releaseRequest['uri'] = $uri;
161
+ $releaseResponse = $serviceApi->getService($releaseRequest);
162
+ if (!isset($releaseResponse->release)) {
163
+ return;
164
+ }
165
+
166
+ return $releaseResponse->release;
167
+ }
168
+
169
+ /**
170
+ * Returns the service slug name
171
+ * @param string $uri
172
+ * @return string
173
+ */
174
+ public function getServiceSlug($uri)
175
+ {
176
+ $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
177
+ /** @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
178
+ $serviceRequest = array();
179
+ $serviceRequest['uri'] = $uri;
180
+ $serviceResponse = $serviceApi->getService($serviceRequest);
181
+ if (!isset($serviceResponse->services->slug)) {
182
+ return;
183
+ }
184
+
185
+ return $serviceResponse->services->slug;
186
+ }
187
+
188
+ /**
189
+ * Gets the latest version of the service
190
+ * @param string $uri
191
+ * @return string
192
+ */
193
+ public function getServiceLatestVersion($uri)
194
+ {
195
+ $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
196
+ /** @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
197
+ $serviceRequest = array();
198
+ $serviceRequest['uri'] = $uri;
199
+ $serviceResponse = $serviceApi->getService($serviceRequest);
200
+ if (!isset($serviceResponse->services->links->software_latest_release->version)) {
201
+ return;
202
+ }
203
+
204
+ return $serviceResponse->services->links->software_latest_release->version;
205
+ }
206
+
207
+ /**
208
+ * Returns the latest version uri
209
+ * @param string $uri
210
+ * @return string
211
+ */
212
+ public function getServiceLatestVersionUri($uri)
213
+ {
214
+ $serviceApi = Mage::getModel('temandoinstaller/api_rest_client');
215
+ /** @var $serviceApi Temando_Installer_Model_Api_Rest_Client */
216
+ $serviceRequest = array();
217
+ $serviceRequest['uri'] = $uri;
218
+ $serviceResponse = $serviceApi->getService($serviceRequest);
219
+ if (!isset($serviceResponse->services->links->software_latest_release->href)) {
220
+ return;
221
+ }
222
+
223
+ return $serviceResponse->services->links->software_latest_release->href;
224
+ }
225
+ }
app/code/community/Temando/Installer/Model/{Mysql4 → Resource}/Installer.php RENAMED
@@ -1,14 +1,14 @@
1
- <?php
2
- /**
3
- * Mysql4 Installer
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Model_Mysql4_Installer extends Mage_Core_Model_Mysql4_Abstract
9
- {
10
- public function _construct()
11
- {
12
- $this->_init('temandoinstaller/installer', 'id');
13
- }
14
- }
1
+ <?php
2
+ /**
3
+ * Mysql4 Installer
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+ class Temando_Installer_Model_Resource_Installer extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ $this->_init('temandoinstaller/installer', 'id');
13
+ }
14
+ }
app/code/community/Temando/Installer/Model/{Mysql4 → Resource}/Installer/Collection.php RENAMED
@@ -1,16 +1,16 @@
1
- <?php
2
- /**
3
- * Mysql4 Installer Collection
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Model_Mysql4_Installer_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
- {
10
- public function _construct()
11
- {
12
- parent::_construct();
13
- $this->_init('temandoinstaller/installer');
14
- }
15
-
16
- }
1
+ <?php
2
+ /**
3
+ * Mysql4 Installer Collection
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Model_Resource_Installer_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
+ {
11
+ public function _construct()
12
+ {
13
+ parent::_construct();
14
+ $this->_init('temandoinstaller/installer');
15
+ }
16
+ }
app/code/community/Temando/Installer/Model/Tester.php CHANGED
@@ -1,122 +1,130 @@
1
- <?php
2
- /**
3
- * Tester
4
- *
5
- * @package Temando_Installer
6
- * @author Temando Magento Team <marketing@temando.com>
7
- */
8
- class Temando_Installer_Model_Tester extends Mage_Core_Model_Abstract
9
- {
10
- protected $_helper;
11
-
12
- public function _construct()
13
- {
14
- parent::_construct();
15
- $this->initialize();
16
- }
17
-
18
- public function testSettings()
19
- {
20
- $tables = $this->checkTemandoSchema();
21
- $details = $this->testClientDetails();
22
-
23
- if (!$tables || !$details) {
24
- Mage::getSingleton('adminhtml/session')->addError(
25
- Mage::helper('temandoinstaller')->__('Could not complete get quotes test.')
26
- );
27
- } else {
28
- $quotes = $this->testGetQuotes();
29
- }
30
- return;
31
- }
32
-
33
- protected function testGetQuotes()
34
- {
35
- try {
36
- $result = $this->_helper->loadCheapestQuote();
37
- if ($result) {
38
- Mage::getSingleton('adminhtml/session')->addSuccess(
39
- Mage::helper('temandoinstaller')->__('Cheapest quote: %s', $result->getDescription())
40
- );
41
- }
42
- } catch (Exception $e) {
43
- Mage::getSingleton('adminhtml/session')->addError(
44
- Mage::helper('temandoinstaller')->__('Error connecting to the api: %s', $e->getMessage())
45
- );
46
- }
47
- return;
48
- }
49
-
50
- public function testClientDetails()
51
- {
52
- $result = $this->_helper->testAccountDetails();
53
- if (!$result) {
54
- Mage::getSingleton('adminhtml/session')->addSuccess(
55
- Mage::helper('temandoinstaller')->__('API Connection successful!')
56
- );
57
- return true;
58
- } else {
59
- Mage::getSingleton('adminhtml/session')->addError(
60
- Mage::helper('temandoinstaller')->__('Error connecting to the api: %s', $result)
61
- );
62
- return false;
63
- }
64
- }
65
-
66
- public function checkTemandoSchema()
67
- {
68
- $tableError = 0;
69
- if (!$this->checkTemandoWarehouse()) {
70
- Mage::getSingleton('adminhtml/session')->addNotice(
71
- Mage::helper('temandoinstaller')->__('Please add a warehouse to locations.')
72
- );
73
- $tableError++;
74
- } else {
75
- Mage::getSingleton('adminhtml/session')->addSuccess(
76
- Mage::helper('temandoinstaller')->__('Warehouses: %s', $this->checkTemandoWarehouse())
77
- );
78
- }
79
- if (!$this->checkTemandoRule()) {
80
- Mage::getSingleton('adminhtml/session')->addNotice(
81
- Mage::helper('temandoinstaller')->__('Please add a rule to the rule engine.')
82
- );
83
- $tableError++;
84
- } else {
85
- Mage::getSingleton('adminhtml/session')->addSuccess(
86
- Mage::helper('temandoinstaller')->__('Rules: %s', $this->checkTemandoRule())
87
- );
88
- }
89
- if ($tableError == 0) {
90
- return true;
91
- } else {
92
- return false;
93
- }
94
- }
95
-
96
- public function checkTemandoWarehouse()
97
- {
98
- $warehouses = 0;
99
- $warehouseCollection = $this->_helper->getTemandoWarehouses();
100
- foreach ($warehouseCollection as $warehouse) {
101
- $warehouses++;
102
- }
103
- return $warehouses;
104
- }
105
-
106
- public function checkTemandoRule()
107
- {
108
- $rules = 0;
109
- $ruleCollection = $this->_helper->getTemandoRules();
110
- foreach ($ruleCollection as $rule) {
111
- $rules++;
112
- }
113
- return $rules;
114
- }
115
-
116
- protected function initialize()
117
- {
118
- if (!$this->_helper) {
119
- $this->_helper = Mage::helper('temandoinstaller');
120
- }
121
- }
122
- }
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tester
4
+ *
5
+ * @package Temando_Installer
6
+ * @author Temando Magento Team <marketing@temando.com>
7
+ */
8
+
9
+ class Temando_Installer_Model_Tester extends Mage_Core_Model_Abstract
10
+ {
11
+ protected $_helper;
12
+
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->initialize();
17
+ }
18
+
19
+ public function testSettings()
20
+ {
21
+ $tables = $this->checkTemandoSchema();
22
+ $details = $this->testClientDetails();
23
+
24
+ if (!$tables || !$details) {
25
+ Mage::getSingleton('adminhtml/session')->addError(
26
+ Mage::helper('temandoinstaller')->__('Could not complete get quotes test.')
27
+ );
28
+ } else {
29
+ $quotes = $this->testGetQuotes();
30
+ }
31
+
32
+ /** return; */
33
+ }
34
+
35
+ protected function testGetQuotes()
36
+ {
37
+ try {
38
+ $result = $this->_helper->loadCheapestQuote();
39
+ if ($result) {
40
+ Mage::getSingleton('adminhtml/session')->addSuccess(
41
+ Mage::helper('temandoinstaller')->__('Cheapest quote: %s', $result->getDescription())
42
+ );
43
+ }
44
+ } catch (Exception $e) {
45
+ Mage::getSingleton('adminhtml/session')->addError(
46
+ Mage::helper('temandoinstaller')->__('Error connecting to the api: %s', $e->getMessage())
47
+ );
48
+ }
49
+
50
+ /** return; */
51
+ }
52
+
53
+ public function testClientDetails()
54
+ {
55
+ $result = $this->_helper->testAccountDetails();
56
+ if (!$result) {
57
+ Mage::getSingleton('adminhtml/session')->addSuccess(
58
+ Mage::helper('temandoinstaller')->__('API Connection successful!')
59
+ );
60
+ return true;
61
+ } else {
62
+ Mage::getSingleton('adminhtml/session')->addError(
63
+ Mage::helper('temandoinstaller')->__('Error connecting to the api: %s', $result)
64
+ );
65
+ return false;
66
+ }
67
+ }
68
+
69
+ public function checkTemandoSchema()
70
+ {
71
+ $tableError = 0;
72
+ if (!$this->checkTemandoWarehouse()) {
73
+ Mage::getSingleton('adminhtml/session')->addNotice(
74
+ Mage::helper('temandoinstaller')->__('Please add a warehouse to locations.')
75
+ );
76
+ $tableError++;
77
+ } else {
78
+ Mage::getSingleton('adminhtml/session')->addSuccess(
79
+ Mage::helper('temandoinstaller')->__('Warehouses: %s', $this->checkTemandoWarehouse())
80
+ );
81
+ }
82
+
83
+ if (!$this->checkTemandoRule()) {
84
+ Mage::getSingleton('adminhtml/session')->addNotice(
85
+ Mage::helper('temandoinstaller')->__('Please add a rule to the rule engine.')
86
+ );
87
+ $tableError++;
88
+ } else {
89
+ Mage::getSingleton('adminhtml/session')->addSuccess(
90
+ Mage::helper('temandoinstaller')->__('Rules: %s', $this->checkTemandoRule())
91
+ );
92
+ }
93
+
94
+ if ($tableError == 0) {
95
+ return true;
96
+ } else {
97
+ return false;
98
+ }
99
+ }
100
+
101
+ public function checkTemandoWarehouse()
102
+ {
103
+ $warehouses = 0;
104
+ $warehouseCollection = $this->_helper->getTemandoWarehouses();
105
+ foreach ($warehouseCollection as $warehouse) {
106
+ $warehouses++;
107
+ }
108
+
109
+ return $warehouses;
110
+ }
111
+
112
+ public function checkTemandoRule()
113
+ {
114
+ $rules = 0;
115
+ $ruleCollection = $this->_helper->getTemandoRules();
116
+ foreach ($ruleCollection as $rule) {
117
+ $rules++;
118
+ }
119
+
120
+ return $rules;
121
+ }
122
+
123
+ protected function initialize()
124
+ {
125
+ if (!$this->_helper) {
126
+ $this->_helper = Mage::helper('temandoinstaller');
127
+ }
128
+
129
+ }
130
+ }
app/code/community/Temando/Installer/controllers/Adminhtml/Temandoinstaller/InstallerController.php CHANGED
@@ -5,6 +5,7 @@
5
  * @package Temando_Installer
6
  * @author Temando Magento Team <marketing@temando.com>
7
  */
 
8
  class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends Mage_Adminhtml_Controller_Action
9
  {
10
  // @codingStandardsIgnoreStart
@@ -14,6 +15,17 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
14
  const NOTICE_ATTRIBUTES = 'Note: if upgrading from the Starter Extension to a Business Extension, please re-index your products.';
15
  // @codingStandardsIgnoreEnd
16
 
 
 
 
 
 
 
 
 
 
 
 
17
  public function indexAction()
18
  {
19
  $communityChannel = Mage::getModel('temandoinstaller/connect')->getSingleConfig()->isChannel('community');
@@ -22,6 +34,7 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
22
  Mage::helper('temandoinstaller')->__(self::NOTICE_NO_COMMUNITY)
23
  );
24
  }
 
25
  if ($this->checkSoap()) {
26
  Mage::getSingleton('adminhtml/session')->addError(
27
  Mage::helper('temandoinstaller')->__(self::ERR_NO_SOAP)
@@ -47,11 +60,11 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
47
 
48
  public function installAction()
49
  {
 
50
  $helper = Mage::helper('temandoinstaller');
51
- /* @var $helper Temando_Installer_Helper_Data */
52
 
 
53
  $installer = Mage::getModel('temandoinstaller/installer');
54
- /* @var $installer Temando_Installer_Model_Installer */
55
 
56
  if ($helper->getTemandoVersion()) {
57
  Mage::getSingleton('adminhtml/session')->addError(
@@ -70,6 +83,7 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
70
  $this->_redirect('*/*/');
71
  return;
72
  }
 
73
  //check the latest release
74
  if (!isset($currentService->links->software_latest_release->version)) {
75
  Mage::getSingleton('adminhtml/session')->addError(
@@ -99,8 +113,8 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
99
  ->setToken($helper->getTemandoToken())
100
  ->setVersion($currentService->links->software_latest_release->version)
101
  ->setModule(Temando_Installer_Helper_Data::TMD_MODULE_NAME)
102
- ->setInstallDate(date('Y-m-d H:i:s'))
103
- ->setUpdateDate(date('Y-m-d H:i:s'))
104
  ->setUpdateAvailable(false)
105
  ->setUpdateDismissed(false)
106
  ->setUpdateDetails(null)
@@ -109,7 +123,9 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
109
  }
110
 
111
  //delete file
 
112
  @unlink($file);
 
113
 
114
  if (Mage::registry('temandoinstaller_errors')) {
115
  foreach (Mage::registry('temandoinstaller_errors') as $error) {
@@ -122,16 +138,16 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
122
  }
123
 
124
  $this->_redirect('*/*/');
125
- return;
126
  }
127
 
128
  public function updateAction()
129
  {
130
  $helper = Mage::helper('temandoinstaller');
131
- /* @var $helper Temando_Installer_Helper_Data */
132
 
133
  $installer = Mage::getModel('temandoinstaller/installer');
134
- /* @var $installer Temando_Installer_Model_Installer */
135
 
136
  $params = $this->getRequest()->getParams();
137
  if (!isset($params['massaction']) || !is_array($params['massaction']) || empty($params['massaction'])) {
@@ -151,6 +167,7 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
151
  $this->_redirect('*/*/');
152
  return;
153
  }
 
154
  //check the latest release
155
  if (!isset($currentService->links->software_latest_release->version)) {
156
  Mage::getSingleton('adminhtml/session')->addError(
@@ -159,8 +176,13 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
159
  $this->_redirect('*/*/');
160
  return;
161
  }
 
162
  //compare the current version
163
- if (version_compare($helper->getTemandoVersionNumber(), $currentService->links->software_latest_release->version) > 0) {
 
 
 
 
164
  Mage::getSingleton('adminhtml/session')->addError(
165
  Mage::helper('temandoinstaller')->__('Current version is greater than or equal to the latest release.')
166
  );
@@ -172,46 +194,7 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
172
 
173
  //at the moment only one product will be on the grid - the mass action has been added for future use
174
  foreach ($installerIds as $id) {
175
- //check file
176
- $file = $installer->downloadPackage($currentService);
177
-
178
- if (!$file) {
179
- Mage::getSingleton('adminhtml/session')->addError(
180
- Mage::helper('temandoinstaller')->__('Error downloading file.')
181
- );
182
- $this->_redirect('*/*/');
183
- return;
184
- }
185
-
186
- $installer->load($id);
187
- $command = Mage::getModel('temandoinstaller/connect');
188
- if (!$command->uninstall($installer->getModule())) {
189
- Mage::getSingleton('adminhtml/session')->addError(
190
- Mage::helper('temandoinstaller')->__('There was an error uninstalling the current module.')
191
- );
192
- $this->_redirect('*/*/');
193
- return;
194
- }
195
- //clean cache before installing new module
196
- Mage::app()->cleanCache(array('CONFIG'));
197
- if ($command->install($file)) {
198
- //clean the cache after installing new module
199
- Mage::app()->cleanCache(array('CONFIG'));
200
- $installer
201
- ->setName('Temando')
202
- ->setToken($helper->getTemandoToken())
203
- ->setVersion($currentService->links->software_latest_release->version)
204
- ->setModule(Temando_Installer_Helper_Data::TMD_MODULE_NAME)
205
- ->setUpdateDate(date('Y-m-d H:i:s'))
206
- ->setUpdateAvailable(false)
207
- ->setUpdateDismissed(false)
208
- ->setUpdateDetails(null)
209
- ->setStatus(1)
210
- ->save();
211
- }
212
-
213
- //delete file
214
- @unlink($file);
215
  }
216
 
217
  if (Mage::registry('temandoinstaller_errors')) {
@@ -223,13 +206,60 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
223
  Mage::helper('temandoinstaller')->__('Package successfully updated.')
224
  );
225
  }
 
226
  $this->_redirect('*/*/');
227
  }
228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  public function uninstallAction()
230
  {
231
  $helper = Mage::helper('temandoinstaller');
232
- /* @var $helper Temando_Installer_Helper_Data */
233
 
234
  $params = $this->getRequest()->getParams();
235
  if (!isset($params['massaction']) || !is_array($params['massaction']) ||
@@ -245,11 +275,7 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
245
  $installerIds = $params['massaction'];
246
 
247
  foreach ($installerIds as $id) {
248
- $installer = Mage::getModel('temandoinstaller/installer')->load($id);
249
- $command = Mage::getModel('temandoinstaller/connect');
250
- if ($command->uninstall($installer->getModule())) {
251
- $installer->delete();
252
- }
253
  }
254
 
255
  if (Mage::registry('temandoinstaller_errors')) {
@@ -264,7 +290,16 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
264
 
265
  Mage::app()->cleanCache(array('CONFIG'));
266
  $this->_redirect('*/*/');
267
- return;
 
 
 
 
 
 
 
 
 
268
  }
269
 
270
  public function testConnectionSettingsAction()
@@ -275,9 +310,9 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
275
 
276
  public function dismissUpdateAction()
277
  {
278
- $module_id = $this->getRequest()->getParam('id');
279
- $module = Mage::getModel('temandoinstaller/installer')->load($module_id);
280
- /* @var $module Temando_Installer_Model_Installer */
281
 
282
  if (!$module->getId()) {
283
  Mage::getSingleton('adminhtml/session')->addError(
@@ -291,6 +326,7 @@ class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends M
291
  Mage::helper('temandoinstaller')->__('Temando update has been dismissed.')
292
  );
293
  }
 
294
  return $this->getResponse()->setRedirect($this->getRequest()->getServer('HTTP_REFERER'));
295
  }
296
 
5
  * @package Temando_Installer
6
  * @author Temando Magento Team <marketing@temando.com>
7
  */
8
+
9
  class Temando_Installer_Adminhtml_Temandoinstaller_InstallerController extends Mage_Adminhtml_Controller_Action
10
  {
11
  // @codingStandardsIgnoreStart
15
  const NOTICE_ATTRIBUTES = 'Note: if upgrading from the Starter Extension to a Business Extension, please re-index your products.';
16
  // @codingStandardsIgnoreEnd
17
 
18
+ /**
19
+ * Check admin permissions for this controller
20
+ *
21
+ * @return boolean
22
+ */
23
+ protected function _isAllowed()
24
+ {
25
+ return Mage::getSingleton('admin/session')
26
+ ->isAllowed('temando');
27
+ }
28
+
29
  public function indexAction()
30
  {
31
  $communityChannel = Mage::getModel('temandoinstaller/connect')->getSingleConfig()->isChannel('community');
34
  Mage::helper('temandoinstaller')->__(self::NOTICE_NO_COMMUNITY)
35
  );
36
  }
37
+
38
  if ($this->checkSoap()) {
39
  Mage::getSingleton('adminhtml/session')->addError(
40
  Mage::helper('temandoinstaller')->__(self::ERR_NO_SOAP)
60
 
61
  public function installAction()
62
  {
63
+ /** @var $helper Temando_Installer_Helper_Data */
64
  $helper = Mage::helper('temandoinstaller');
 
65
 
66
+ /** @var $installer Temando_Installer_Model_Installer */
67
  $installer = Mage::getModel('temandoinstaller/installer');
 
68
 
69
  if ($helper->getTemandoVersion()) {
70
  Mage::getSingleton('adminhtml/session')->addError(
83
  $this->_redirect('*/*/');
84
  return;
85
  }
86
+
87
  //check the latest release
88
  if (!isset($currentService->links->software_latest_release->version)) {
89
  Mage::getSingleton('adminhtml/session')->addError(
113
  ->setToken($helper->getTemandoToken())
114
  ->setVersion($currentService->links->software_latest_release->version)
115
  ->setModule(Temando_Installer_Helper_Data::TMD_MODULE_NAME)
116
+ ->setInstallDate(Mage::getSingleton('core/date')->gmtDate())
117
+ ->setUpdateDate(Mage::getSingleton('core/date')->gmtDate())
118
  ->setUpdateAvailable(false)
119
  ->setUpdateDismissed(false)
120
  ->setUpdateDetails(null)
123
  }
124
 
125
  //delete file
126
+ // @codingStandardsIgnoreStart
127
  @unlink($file);
128
+ // @codingStandardsIgnoreEnd
129
 
130
  if (Mage::registry('temandoinstaller_errors')) {
131
  foreach (Mage::registry('temandoinstaller_errors') as $error) {
138
  }
139
 
140
  $this->_redirect('*/*/');
141
+ /** return; */
142
  }
143
 
144
  public function updateAction()
145
  {
146
  $helper = Mage::helper('temandoinstaller');
147
+ /** @var $helper Temando_Installer_Helper_Data */
148
 
149
  $installer = Mage::getModel('temandoinstaller/installer');
150
+ /** @var $installer Temando_Installer_Model_Installer */
151
 
152
  $params = $this->getRequest()->getParams();
153
  if (!isset($params['massaction']) || !is_array($params['massaction']) || empty($params['massaction'])) {
167
  $this->_redirect('*/*/');
168
  return;
169
  }
170
+
171
  //check the latest release
172
  if (!isset($currentService->links->software_latest_release->version)) {
173
  Mage::getSingleton('adminhtml/session')->addError(
176
  $this->_redirect('*/*/');
177
  return;
178
  }
179
+
180
  //compare the current version
181
+ $versionCompare = version_compare(
182
+ $helper->getTemandoVersionNumber(),
183
+ $currentService->links->software_latest_release->version
184
+ );
185
+ if ($versionCompare > 0) {
186
  Mage::getSingleton('adminhtml/session')->addError(
187
  Mage::helper('temandoinstaller')->__('Current version is greater than or equal to the latest release.')
188
  );
194
 
195
  //at the moment only one product will be on the grid - the mass action has been added for future use
196
  foreach ($installerIds as $id) {
197
+ $this->_installPackage($installer, $id, $currentService, $helper);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  }
199
 
200
  if (Mage::registry('temandoinstaller_errors')) {
206
  Mage::helper('temandoinstaller')->__('Package successfully updated.')
207
  );
208
  }
209
+
210
  $this->_redirect('*/*/');
211
  }
212
 
213
+ protected function _installPackage($installer, $installerId, $currentService, $helper)
214
+ {
215
+ //check file
216
+ $file = $installer->downloadPackage($currentService);
217
+
218
+ if (!$file) {
219
+ Mage::getSingleton('adminhtml/session')->addError(
220
+ Mage::helper('temandoinstaller')->__('Error downloading file.')
221
+ );
222
+ $this->_redirect('*/*/');
223
+ return;
224
+ }
225
+
226
+ $installer->load($installerId);
227
+ $command = Mage::getModel('temandoinstaller/connect');
228
+ if (!$command->uninstall($installer->getModule())) {
229
+ Mage::getSingleton('adminhtml/session')->addError(
230
+ Mage::helper('temandoinstaller')->__('There was an error uninstalling the current module.')
231
+ );
232
+ $this->_redirect('*/*/');
233
+ return;
234
+ }
235
+
236
+ //clean cache before installing new module
237
+ Mage::app()->cleanCache(array('CONFIG'));
238
+ if ($command->install($file)) {
239
+ //clean the cache after installing new module
240
+ Mage::app()->cleanCache(array('CONFIG'));
241
+ $installer
242
+ ->setName('Temando')
243
+ ->setToken($helper->getTemandoToken())
244
+ ->setVersion($currentService->links->software_latest_release->version)
245
+ ->setModule(Temando_Installer_Helper_Data::TMD_MODULE_NAME)
246
+ ->setUpdateDate(Mage::getSingleton('core/date')->gmtDate())
247
+ ->setUpdateAvailable(false)
248
+ ->setUpdateDismissed(false)
249
+ ->setUpdateDetails(null)
250
+ ->setStatus(1)
251
+ ->save();
252
+ }
253
+
254
+ //delete file
255
+ // @codingStandardsIgnoreStart
256
+ @unlink($file);
257
+ // @codingStandardsIgnoreEnd
258
+ }
259
  public function uninstallAction()
260
  {
261
  $helper = Mage::helper('temandoinstaller');
262
+ /** @var $helper Temando_Installer_Helper_Data */
263
 
264
  $params = $this->getRequest()->getParams();
265
  if (!isset($params['massaction']) || !is_array($params['massaction']) ||
275
  $installerIds = $params['massaction'];
276
 
277
  foreach ($installerIds as $id) {
278
+ $this->_deletePackage($id);
 
 
 
 
279
  }
280
 
281
  if (Mage::registry('temandoinstaller_errors')) {
290
 
291
  Mage::app()->cleanCache(array('CONFIG'));
292
  $this->_redirect('*/*/');
293
+ /** return; */
294
+ }
295
+
296
+ protected function _deletePackage($installerId)
297
+ {
298
+ $installer = Mage::getModel('temandoinstaller/installer')->load($installerId);
299
+ $command = Mage::getModel('temandoinstaller/connect');
300
+ if ($command->uninstall($installer->getModule())) {
301
+ $installer->delete();
302
+ }
303
  }
304
 
305
  public function testConnectionSettingsAction()
310
 
311
  public function dismissUpdateAction()
312
  {
313
+ $moduleId = $this->getRequest()->getParam('id');
314
+ $module = Mage::getModel('temandoinstaller/installer')->load($moduleId);
315
+ /** @var $module Temando_Installer_Model_Installer */
316
 
317
  if (!$module->getId()) {
318
  Mage::getSingleton('adminhtml/session')->addError(
326
  Mage::helper('temandoinstaller')->__('Temando update has been dismissed.')
327
  );
328
  }
329
+
330
  return $this->getResponse()->setRedirect($this->getRequest()->getServer('HTTP_REFERER'));
331
  }
332
 
app/code/community/Temando/Installer/data/temandoinstaller_setup/data-install-1.0.0.php CHANGED
@@ -1,31 +1,26 @@
1
- <?php
2
-
3
- set_time_limit(0);
4
-
5
- /* @var $this Mage_Eav_Model_Entity_Setup */
6
- /* @var $installer Mage_Eav_Model_Entity_Setup */
7
-
8
- $installer = $this;
9
- $installer->startSetup();
10
-
11
- $helper = Mage::helper('temandoinstaller');
12
- /* @var $helper Temando_Installer_Helper_Data */
13
-
14
- //check if Temando is already installed and add a record of the current module if it is
15
- if ($helper->getTemandoVersion()) {
16
-
17
- $versionNumber = (string) Mage::getConfig()->getNode()->modules->Temando_Temando->version;
18
- $versionName = 'Temando ' . ucfirst($helper->getTemandoVersionName());
19
- //because there is no record of when it was originally installed/updated we will enter todays date
20
- $installDate = date('Y-m-d H:i:s');
21
- $updateDate = date('Y-m-d H:i:s');
22
-
23
- // @codingStandardsIgnoreStart
24
- $installer->run(
25
- "INSERT INTO {$this->getTable('temando_installer')} (`name`, `token`, `version`, `module`, `install_date`, `update_date`, `update_available`, `update_dismissed`, `update_details`, `status`) VALUES
26
- ('{$versionName}','Token not set','{$versionNumber}','Temando_Temando','{$installDate}','{$updateDate}',0,0,NULL,1);"
27
- );
28
- // @codingStandardsIgnoreEnd
29
- }
30
-
31
- $installer->endSetup();
1
+ <?php
2
+
3
+ /** set_time_limit(0); */
4
+
5
+ $installer = $this;
6
+ $installer->startSetup();
7
+
8
+ /** @var $helper Temando_Installer_Helper_Data */
9
+ $helper = Mage::helper('temandoinstaller');
10
+
11
+ //check if Temando is already installed and add a record of the current module if it is
12
+ if ($helper->getTemandoVersion()) {
13
+ $versionNumber = (string) Mage::getConfig()->getNode()->modules->Temando_Temando->version;
14
+ $versionName = 'Temando ' . ucfirst($helper->getTemandoVersionName());
15
+ //because there is no record of when it was originally installed/updated we will enter todays date
16
+ $installDate = Mage::getSingleton('core/date')->gmtDate();
17
+ $updateDate = Mage::getSingleton('core/date')->gmtDate();
18
+ // @codingStandardsIgnoreStart
19
+ $installer->run(
20
+ "INSERT INTO {$this->getTable('temando_installer')} (`name`, `token`, `version`, `module`, `install_date`, `update_date`, `update_available`, `update_dismissed`, `update_details`, `status`) VALUES
21
+ ('{$versionName}','Token not set','{$versionNumber}','Temando_Temando','{$installDate}','{$updateDate}',0,0,NULL,1);"
22
+ );
23
+ // @codingStandardsIgnoreEnd
24
+ }
25
+
26
+ $installer->endSetup();
 
 
 
 
 
app/code/community/Temando/Installer/data/temandoinstaller_setup/data-upgrade-1.0.2-1.0.3.php CHANGED
@@ -1,27 +1,28 @@
1
- <?php
2
-
3
- set_time_limit(0);
4
-
5
- $installer = $this;
6
- $installer->startSetup();
7
-
8
- /**
9
- * Remove unused files from the Adminhtml controller directory
10
- *
11
- * This is because of Magento security patch SUPEE-6788
12
- * Supresses errors when trying to delete.
13
- */
14
- $temandoFiles = array (
15
- 'InstallerController',
16
- );
17
-
18
- foreach ($temandoFiles as $temandoFile) {
19
- $directory = Mage::getModuleDir('controllers', 'Temando_Installer').DS.'Adminhtml';
20
- $filename = $directory.DS.$temandoFile.'.php';
21
- if (!file_exists($filename)) {
22
- continue;
23
- }
24
- @unlink($filename);
25
- }
26
-
27
- $installer->endSetup();
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ /**
7
+ * Remove unused files from the Adminhtml controller directory
8
+ *
9
+ * This is because of Magento security patch SUPEE-6788
10
+ * Supresses errors when trying to delete.
11
+ */
12
+ $temandoFiles = array (
13
+ 'InstallerController',
14
+ );
15
+
16
+ foreach ($temandoFiles as $temandoFile) {
17
+ $directory = Mage::getModuleDir('controllers', 'Temando_Installer').DS.'Adminhtml';
18
+ $filename = $directory.DS.$temandoFile.'.php';
19
+ // @codingStandardsIgnoreStart
20
+ if (!file_exists($filename)) {
21
+ continue;
22
+ }
23
+
24
+ @unlink($filename);
25
+ // @codingStandardsIgnoreEnd
26
+ }
27
+
28
+ $installer->endSetup();
app/code/community/Temando/Installer/etc/adminhtml.xml CHANGED
@@ -1,40 +1,40 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <menu>
4
- <system>
5
- <children>
6
- <extensions translate="title" module="connect">
7
- <children>
8
- <return translate="title" module="connect">
9
- <title>Temando Installer Manager</title>
10
- <sort_order>998</sort_order>
11
- <action>adminhtml/temandoinstaller_installer</action>
12
- </return>
13
- </children>
14
- </extensions>
15
- </children>
16
- </system>
17
- </menu>
18
- <acl>
19
- <resources>
20
- <all>
21
- <title>Allow Everything</title>
22
- </all>
23
- <admin>
24
- <children>
25
- <system>
26
- <children>
27
- <config>
28
- <children>
29
- <temandoinstaller>
30
- <title>Temando Installer</title>
31
- </temandoinstaller>
32
- </children>
33
- </config>
34
- </children>
35
- </system>
36
- </children>
37
- </admin>
38
- </resources>
39
- </acl>
40
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <system>
5
+ <children>
6
+ <extensions translate="title" module="connect">
7
+ <children>
8
+ <return translate="title" module="connect">
9
+ <title>Temando Installer Manager</title>
10
+ <sort_order>998</sort_order>
11
+ <action>adminhtml/temandoinstaller_installer</action>
12
+ </return>
13
+ </children>
14
+ </extensions>
15
+ </children>
16
+ </system>
17
+ </menu>
18
+ <acl>
19
+ <resources>
20
+ <all>
21
+ <title>Allow Everything</title>
22
+ </all>
23
+ <admin>
24
+ <children>
25
+ <system>
26
+ <children>
27
+ <config>
28
+ <children>
29
+ <temandoinstaller>
30
+ <title>Temando Installer</title>
31
+ </temandoinstaller>
32
+ </children>
33
+ </config>
34
+ </children>
35
+ </system>
36
+ </children>
37
+ </admin>
38
+ </resources>
39
+ </acl>
40
+ </config>
app/code/community/Temando/Installer/etc/config.xml CHANGED
@@ -2,21 +2,21 @@
2
  <config>
3
  <modules>
4
  <Temando_Installer>
5
- <version>1.0.4</version>
6
  </Temando_Installer>
7
  </modules>
8
  <global>
9
  <models>
10
  <temandoinstaller>
11
  <class>Temando_Installer_Model</class>
12
- <resourceModel>temandoinstaller_mysql4</resourceModel>
13
  </temandoinstaller>
14
- <temandoinstaller_mysql4>
15
- <class>Temando_Installer_Model_Mysql4</class>
16
  <entities>
17
  <installer><table>temando_installer</table></installer>
18
  </entities>
19
- </temandoinstaller_mysql4>
20
  </models>
21
  <blocks>
22
  <temandoinstaller>
2
  <config>
3
  <modules>
4
  <Temando_Installer>
5
+ <version>1.0.5</version>
6
  </Temando_Installer>
7
  </modules>
8
  <global>
9
  <models>
10
  <temandoinstaller>
11
  <class>Temando_Installer_Model</class>
12
+ <resourceModel>temandoinstaller_resource</resourceModel>
13
  </temandoinstaller>
14
+ <temandoinstaller_resource>
15
+ <class>Temando_Installer_Model_resource</class>
16
  <entities>
17
  <installer><table>temando_installer</table></installer>
18
  </entities>
19
+ </temandoinstaller_resource>
20
  </models>
21
  <blocks>
22
  <temandoinstaller>
app/code/community/Temando/Installer/etc/system.xml CHANGED
@@ -1,43 +1,43 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <temandoinstaller>
5
- <label>Temando Installer</label>
6
- <tab>sales</tab>
7
- <frontend_type>text</frontend_type>
8
- <sort_order>322</sort_order>
9
- <show_in_default>1</show_in_default>
10
- <show_in_website>0</show_in_website>
11
- <show_in_store>0</show_in_store>
12
- <groups>
13
- <general translate="label">
14
- <label>General</label>
15
- <sort_order>10</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- <comment><![CDATA[<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">If you don't have a Temando account, you can <a href="https://sso.temando.com/signup/" target="_blank">Sign Up</a> immediately.</div>]]></comment>
20
- <fields>
21
- <token>
22
- <label>Access Token</label>
23
- <frontend_type>text</frontend_type>
24
- <sort_order>10</sort_order>
25
- <show_in_default>1</show_in_default>
26
- <show_in_website>1</show_in_website>
27
- <show_in_store>1</show_in_store>
28
- </token>
29
- <manage_button translate="label">
30
- <label></label>
31
- <frontend_model>temandoinstaller/adminhtml_system_config_form_button_manage</frontend_model>
32
- <frontend_type>button</frontend_type>
33
- <sort_order>20</sort_order>
34
- <show_in_default>1</show_in_default>
35
- <show_in_website>1</show_in_website>
36
- <show_in_store>1</show_in_store>
37
- </manage_button>
38
- </fields>
39
- </general>
40
- </groups>
41
- </temandoinstaller>
42
- </sections>
43
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <temandoinstaller>
5
+ <label>Temando Installer</label>
6
+ <tab>sales</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>322</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>0</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <groups>
13
+ <general translate="label">
14
+ <label>General</label>
15
+ <sort_order>10</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <comment><![CDATA[<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">If you don't have a Temando account, you can <a href="https://sso.temando.com/signup/" target="_blank">Sign Up</a> immediately.</div>]]></comment>
20
+ <fields>
21
+ <token>
22
+ <label>Access Token</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>10</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </token>
29
+ <manage_button translate="label">
30
+ <label></label>
31
+ <frontend_model>temandoinstaller/adminhtml_system_config_form_button_manage</frontend_model>
32
+ <frontend_type>button</frontend_type>
33
+ <sort_order>20</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </manage_button>
38
+ </fields>
39
+ </general>
40
+ </groups>
41
+ </temandoinstaller>
42
+ </sections>
43
+ </config>
app/code/community/Temando/Installer/sql/temandoinstaller_setup/mysql4-install-1.0.0.php CHANGED
@@ -1,30 +1,28 @@
1
- <?php
2
-
3
- set_time_limit(0);
4
-
5
- /* @var $this Mage_Eav_Model_Entity_Setup */
6
- /* @var $installer Mage_Eav_Model_Entity_Setup */
7
-
8
- $installer = $this;
9
- $installer->startSetup();
10
-
11
- $installer->run(
12
- "DROP TABLE IF EXISTS {$this->getTable('temando_installer')};
13
- CREATE TABLE {$this->getTable('temando_installer')} (
14
- `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
15
- `name` TEXT NOT NULL,
16
- `token` TEXT NOT NULL,
17
- `version` TEXT NOT NULL,
18
- `module` varchar(50) NOT NULL,
19
- `install_date` DATETIME NULL DEFAULT NULL,
20
- `update_date` DATETIME NULL DEFAULT NULL,
21
- `update_available` tinyint(1) NOT NULL DEFAULT '0',
22
- `update_dismissed` tinyint(1) NOT NULL DEFAULT '0',
23
- `update_details` TEXT,
24
- `status` int(2) NOT NULL DEFAULT '0',
25
- PRIMARY KEY (`id`),
26
- UNIQUE `module` (`module`)
27
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
28
- );
29
-
30
- $installer->endSetup();
1
+ <?php
2
+
3
+ /** @var $this Mage_Eav_Model_Entity_Setup */
4
+ /** @var $installer Mage_Eav_Model_Entity_Setup */
5
+
6
+ $installer = $this;
7
+ $installer->startSetup();
8
+
9
+ $installer->run(
10
+ "DROP TABLE IF EXISTS {$this->getTable('temando_installer')};
11
+ CREATE TABLE {$this->getTable('temando_installer')} (
12
+ `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
13
+ `name` TEXT NOT NULL,
14
+ `token` TEXT NOT NULL,
15
+ `version` TEXT NOT NULL,
16
+ `module` varchar(50) NOT NULL,
17
+ `install_date` DATETIME NULL DEFAULT NULL,
18
+ `update_date` DATETIME NULL DEFAULT NULL,
19
+ `update_available` tinyint(1) NOT NULL DEFAULT '0',
20
+ `update_dismissed` tinyint(1) NOT NULL DEFAULT '0',
21
+ `update_details` TEXT,
22
+ `status` int(2) NOT NULL DEFAULT '0',
23
+ PRIMARY KEY (`id`),
24
+ UNIQUE `module` (`module`)
25
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
26
+ );
27
+
28
+ $installer->endSetup();
 
 
app/design/adminhtml/default/default/layout/temandoinstaller.xml CHANGED
@@ -1,15 +1,15 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <default>
4
- <reference name="notifications">
5
- <block type="temandoinstaller/adminhtml_notifications" name="temando_installer_notifications" template="temando/installer/notifications.phtml"/>
6
- </reference>
7
- </default>
8
- <adminhtml_temandoinstaller_installer_index>
9
- <reference name="content">
10
- <block type="temandoinstaller/adminhtml_installer" name="temando_installer">
11
- <block type="temandoinstaller/adminhtml_installer_grid" name="temando_installer_grid" />
12
- </block>
13
- </reference>
14
- </adminhtml_temandoinstaller_installer_index>
15
- </layout>
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="notifications">
5
+ <block type="temandoinstaller/adminhtml_notifications" name="temando_installer_notifications" template="temando/installer/notifications.phtml"/>
6
+ </reference>
7
+ </default>
8
+ <adminhtml_temandoinstaller_installer_index>
9
+ <reference name="content">
10
+ <block type="temandoinstaller/adminhtml_installer" name="temando_installer">
11
+ <block type="temandoinstaller/adminhtml_installer_grid" name="temando_installer_grid" />
12
+ </block>
13
+ </reference>
14
+ </adminhtml_temandoinstaller_installer_index>
15
+ </layout>
app/design/adminhtml/default/default/template/temando/installer/notifications.phtml CHANGED
@@ -1,16 +1,16 @@
1
- <?php
2
-
3
- /* @var $this Temando_Installer_Block_Adminhtml_Notifications */
4
- ?>
5
- <?php foreach ($this->getModuleNotifications() as $module):
6
- /* @var $module Temando_Installer_Model_Installer */ ?>
7
- <div class="notification-global notification-global-notice">
8
-
9
- <span class="f-right">
10
- <a href="<?php echo $this->getUrl('adminhtml/temandoinstaller_installer', array('_secure' => Mage::app()->getStore()->isCurrentlySecure())); ?>">Update</a> |
11
- <a href="<?php echo $this->getUrl('adminhtml/temandoinstaller_installer/dismissUpdate', array('id' => $module->getId(), '_secure' => Mage::app()->getStore()->isCurrentlySecure())); ?>">Dismiss</a>
12
- </span>
13
-
14
- <strong class="label"><?php echo Mage::helper('temandoinstaller')->__('Temando Message:'); ?></strong> <?php echo $module->getUpdateDetails(); ?>
15
- </div>
16
- <?php endforeach; ?>
1
+ <?php
2
+
3
+ /* @var $this Temando_Installer_Block_Adminhtml_Notifications */
4
+ ?>
5
+ <?php foreach ($this->getModuleNotifications() as $module):
6
+ /* @var $module Temando_Installer_Model_Installer */ ?>
7
+ <div class="notification-global notification-global-notice">
8
+
9
+ <span class="f-right">
10
+ <a href="<?php echo $this->getUrl('adminhtml/temandoinstaller_installer', array('_secure' => Mage::app()->getStore()->isCurrentlySecure())); ?>">Update</a> |
11
+ <a href="<?php echo $this->getUrl('adminhtml/temandoinstaller_installer/dismissUpdate', array('id' => $module->getId(), '_secure' => Mage::app()->getStore()->isCurrentlySecure())); ?>">Dismiss</a>
12
+ </span>
13
+
14
+ <strong class="label"><?php echo Mage::helper('temandoinstaller')->__('Temando Message:'); ?></strong> <?php echo $module->getUpdateDetails(); ?>
15
+ </div>
16
+ <?php endforeach; ?>
app/etc/modules/Temando_Installer.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Temando_Installer>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Temando_Installer>
8
- </modules>
9
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Temando_Installer>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Temando_Installer>
8
+ </modules>
9
  </config>
app/locale/fr_FR/Temando_Installer.csv CHANGED
@@ -1,44 +1,44 @@
1
- "Manage Temando","Gérer Temando"
2
- "Install Temando","Installer Temando"
3
- "Test Connection Settings","Test des paramètres de connexion"
4
- "Name","Nom"
5
- "Version","Version"
6
- "Token","Ticket"
7
- "Install date","Date d'installation"
8
- "Update","Mise à jour"
9
- "Update date","Date de mise à jour"
10
- "Update available","Mise à jour disponible"
11
- "Uninstall","Désinstaller"
12
- "Are you sure you want to uninstall the Temando module?","Voulez-vous vraiment désinstaller le module Temando ?"
13
- "Are you sure you want to update the Temando module?","Voulez-vous vraiment mettre à jour le module Temando ?"
14
- "Could not find latest release.","Impossible de trouver la dernière version."
15
- "Package successfully installed.","Le module a été installé avec succès."
16
- "No modules selected for update.","Vous n'avez sélectionné aucun module à mettre à jour."
17
- "Could not find valid service.","Impossible de trouver un service valide."
18
- "Current version is greater than or equal to the latest release.","La version actuelle est plus récente ou similaire à la dernière version disponible."
19
- "Package successfully updated.","Le module a été mis à jour avec succès."
20
- "No modules selected for removal.","Vous n'avez sélectionné aucun module à supprimer."
21
- "Package successfully uninstalled.","Le module a été désinstallé."
22
- "Modules does not exist.","Le module n'existe pas."
23
- "Temando update has been dismissed.","La mise à jour Temando a été rejetée."
24
- "Manage Temando Installation","Gérer l'installation de Temando"
25
- "SOAP is not enabled on this server. Please enable SOAP to use the Temando plugin.","SOAP n'est pas activé sur ce serveur. Il est nécessaire de l'activer pour utiliser le plugin Temando"
26
- "The community channel cannot be found. Please install the community channel for Magento Connect.","Impossible d'accéder au "community channel". Veuillez installer le "community channel" dans Magento Connect."
27
- "Note: if you have any customisations relating to your Temando extension, upgrading your Temando extension will remove these. Contact your Temando representative for guidance.","Attention, si vous avez des modifications sur votre extension Temando, le changement de version les supprimera. Contactez votre responsable Temando si vous avez besoin d'aide."
28
- "Note: if upgrading from the Starter Extension to a Business Extension, please re-index your products.","Note : Si vous passez de la version Starter à la version Business, vous devez réindexer votre base produit"
29
- "Temando is already installed.","Temando est déjà installé. "
30
- "Could not find valid subscription.","Impossible de trouver un abonnement valide."
31
- "Error downloading file.","Erreur lors du téléchargement du fichier."
32
- "There was an error uninstalling the current module.","Une erreur s'est produite lors de la désinstallation du module actuel."
33
- "Could not complete get quotes test.","Le test de requête d'offres de transport (GetQuote) a échoué."
34
- "Cheapest quote: %s","Offre la moins chère : %s"
35
- "Error connecting to the api: %s","Erreur lors de la connexion à l'API : %s"
36
- "API Connection successful!","La connection à l'API a réussi."
37
- "Please add a warehouse to locations.","Veuillez ajouter un entrepôt aux lieux"
38
- "Warehouses: %s","Entrepôts : %s"
39
- "Please add a rule to the rule engine.","Veuillez ajouter une règle au moteur de règles"
40
- "Rules: %s","Règles : %s"
41
- "<div style=""padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;"">If you don't have a Temando account, you can <a href=""https://sso.temando.com/signup/"" target=""_blank"">Sign Up</a> immediately.</div>","<div style=""padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;"">Si vous n'avez pas de compte Temando, vous pouvez <a href=""https://sso.temando.com/signup/"" target=""_blank"">vous inscrire</a>.</div>"
42
- "General","Générales"
43
- "Access Token","Accéder au ticket d'accés"
44
- "Temando Installer","Programme d'installation Temando"
1
+ "Manage Temando","Gérer Temando"
2
+ "Install Temando","Installer Temando"
3
+ "Test Connection Settings","Test des paramètres de connexion"
4
+ "Name","Nom"
5
+ "Version","Version"
6
+ "Token","Ticket"
7
+ "Install date","Date d'installation"
8
+ "Update","Mise à jour"
9
+ "Update date","Date de mise à jour"
10
+ "Update available","Mise à jour disponible"
11
+ "Uninstall","Désinstaller"
12
+ "Are you sure you want to uninstall the Temando module?","Voulez-vous vraiment désinstaller le module Temando ?"
13
+ "Are you sure you want to update the Temando module?","Voulez-vous vraiment mettre à jour le module Temando ?"
14
+ "Could not find latest release.","Impossible de trouver la dernière version."
15
+ "Package successfully installed.","Le module a été installé avec succès."
16
+ "No modules selected for update.","Vous n'avez sélectionné aucun module à mettre à jour."
17
+ "Could not find valid service.","Impossible de trouver un service valide."
18
+ "Current version is greater than or equal to the latest release.","La version actuelle est plus récente ou similaire à la dernière version disponible."
19
+ "Package successfully updated.","Le module a été mis à jour avec succès."
20
+ "No modules selected for removal.","Vous n'avez sélectionné aucun module à supprimer."
21
+ "Package successfully uninstalled.","Le module a été désinstallé."
22
+ "Modules does not exist.","Le module n'existe pas."
23
+ "Temando update has been dismissed.","La mise à jour Temando a été rejetée."
24
+ "Manage Temando Installation","Gérer l'installation de Temando"
25
+ "SOAP is not enabled on this server. Please enable SOAP to use the Temando plugin.","SOAP n'est pas activé sur ce serveur. Il est nécessaire de l'activer pour utiliser le plugin Temando"
26
+ "The community channel cannot be found. Please install the community channel for Magento Connect.","Impossible d'accéder au "community channel". Veuillez installer le "community channel" dans Magento Connect."
27
+ "Note: if you have any customisations relating to your Temando extension, upgrading your Temando extension will remove these. Contact your Temando representative for guidance.","Attention, si vous avez des modifications sur votre extension Temando, le changement de version les supprimera. Contactez votre responsable Temando si vous avez besoin d'aide."
28
+ "Note: if upgrading from the Starter Extension to a Business Extension, please re-index your products.","Note : Si vous passez de la version Starter à la version Business, vous devez réindexer votre base produit"
29
+ "Temando is already installed.","Temando est déjà installé. "
30
+ "Could not find valid subscription.","Impossible de trouver un abonnement valide."
31
+ "Error downloading file.","Erreur lors du téléchargement du fichier."
32
+ "There was an error uninstalling the current module.","Une erreur s'est produite lors de la désinstallation du module actuel."
33
+ "Could not complete get quotes test.","Le test de requête d'offres de transport (GetQuote) a échoué."
34
+ "Cheapest quote: %s","Offre la moins chère : %s"
35
+ "Error connecting to the api: %s","Erreur lors de la connexion à l'API : %s"
36
+ "API Connection successful!","La connection à l'API a réussi."
37
+ "Please add a warehouse to locations.","Veuillez ajouter un entrepôt aux lieux"
38
+ "Warehouses: %s","Entrepôts : %s"
39
+ "Please add a rule to the rule engine.","Veuillez ajouter une règle au moteur de règles"
40
+ "Rules: %s","Règles : %s"
41
+ "<div style=""padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;"">If you don't have a Temando account, you can <a href=""https://sso.temando.com/signup/"" target=""_blank"">Sign Up</a> immediately.</div>","<div style=""padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;"">Si vous n'avez pas de compte Temando, vous pouvez <a href=""https://sso.temando.com/signup/"" target=""_blank"">vous inscrire</a>.</div>"
42
+ "General","Générales"
43
+ "Access Token","Accéder au ticket d'accés"
44
+ "Temando Installer","Programme d'installation Temando"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Temando_Installer</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software Licence</license>
7
  <channel>community</channel>
@@ -11,11 +11,11 @@
11
  &#xD;
12
  Download the installer and enter your Temando Unique Access Token when prompted. From there, the extension will install the correct version you have signed up for.&#xD;
13
  </description>
14
- <notes>- Compare version of Temando in a correct way</notes>
15
  <authors><author><name>Temando</name><user>Temando</user><email>marketing@temando.com</email></author></authors>
16
- <date>2016-03-04</date>
17
- <time>01:42:33</time>
18
- <contents><target name="mageetc"><dir name="modules"><file name="Temando_Installer.xml" hash="d3d9fadbc5f6837ca68375f0c3e329f3"/></dir></target><target name="magecommunity"><dir name="Temando"><dir name="Installer"><dir name="Block"><dir name="Adminhtml"><dir name="Installer"><file name="Grid.php" hash="30c7ea128ed37706bcc4c9d352a6dacc"/></dir><file name="Installer.php" hash="26742c47a23d7d2e6da7509c2b224d7d"/><file name="Notifications.php" hash="d6fa3d5ba3bc466c7171b681fb4e3784"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Button"><file name="Manage.php" hash="f04920d9c9821620911a6239540da617"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="9b37cc0707a37b6528369de917ff1a93"/></dir><dir name="Model"><dir name="Api"><dir name="Rest"><file name="Client.php" hash="aa71a1f4e4b67d5d15cb910d34d7f9c5"/></dir></dir><file name="Connect.php" hash="292af2d80494f136c3eaeecb147f484b"/><file name="Cron.php" hash="f01e49b6bdbf392a9e3be1a60a41017c"/><file name="Installer.php" hash="4abc7be5f1a96a97d9c9f80aa6b2d076"/><dir name="Mysql4"><dir name="Installer"><file name="Collection.php" hash="35ae772e3e5a6aa37e73718959106e50"/></dir><file name="Installer.php" hash="5d0fa0d3f063a8291470aeff4936467d"/></dir><file name="Tester.php" hash="efbb7d84eb9c45ebb83f8aa949404625"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Temandoinstaller"><file name="InstallerController.php" hash="7b7399e343d70b24425b5f38033e5347"/></dir></dir></dir><dir name="data"><dir name="temandoinstaller_setup"><file name="data-install-1.0.0.php" hash="f1f63b190549e00266a14453a7c67430"/><file name="data-upgrade-1.0.2-1.0.3.php" hash="ff59e9d5ee2aef46cfefc479a3dbe4f2"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="3c5a9c397fb92a8f1379b65fb4c5011a"/><file name="config.xml" hash="cf02b750e3f1dda743e6d6198f6553e9"/><file name="system.xml" hash="03b09a2f7da6bb78952864a9d97c5218"/></dir><dir name="sql"><dir name="temandoinstaller_setup"><file name="mysql4-install-1.0.0.php" hash="24729468443b674a5d4ffc33fa6a91bc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="temandoinstaller.xml" hash="c82533b46412da5070ad0eef4d60c3ee"/></dir><dir name="template"><dir name="temando"><dir name="installer"><file name="notifications.phtml" hash="efe5ef5112881ece7ee6ddcd81b23f8d"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Temando_Installer.csv" hash="66e104316b152632964e6c0e0af635da"/></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Temando_Installer</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software Licence</license>
7
  <channel>community</channel>
11
  &#xD;
12
  Download the installer and enter your Temando Unique Access Token when prompted. From there, the extension will install the correct version you have signed up for.&#xD;
13
  </description>
14
+ <notes>- Coding stardard</notes>
15
  <authors><author><name>Temando</name><user>Temando</user><email>marketing@temando.com</email></author></authors>
16
+ <date>2016-11-28</date>
17
+ <time>03:03:56</time>
18
+ <contents><target name="mageetc"><dir name="modules"><file name="Temando_Installer.xml" hash="bdf389a38f64f2ada05e2f13fd98dcc3"/></dir></target><target name="magecommunity"><dir name="Temando"><dir name="Installer"><dir name="Block"><dir name="Adminhtml"><dir name="Installer"><file name="Grid.php" hash="dc99d115165dfcb087a2d048552ddefb"/></dir><file name="Installer.php" hash="14efc5fd9267a7b0c2550e2e2053b110"/><file name="Notifications.php" hash="a3e1b28a7d47cd03e6d4e1fa72882b33"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Button"><file name="Manage.php" hash="e3784b3b93ce9c0e58ee158a174f9393"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="28aac743b56bfcfde7ddf51f2587bb0e"/></dir><dir name="Model"><dir name="Api"><dir name="Rest"><file name="Client.php" hash="e9fee305a26b0f9002fa084da902e275"/></dir></dir><file name="Connect.php" hash="35a03c59b4bd1520adc10027a6037f4f"/><file name="Cron.php" hash="4f2c90ee0bdbbf3ee8dae62d825c376f"/><file name="Installer.php" hash="28ed83c3bec0b694353a1518238ee8b4"/><dir name="Resource"><dir name="Installer"><file name="Collection.php" hash="d6191d1b7760831b5df985e8e8fdf0ed"/></dir><file name="Installer.php" hash="95c1e4ccbfb50ccd66e2b692c04044ad"/></dir><file name="Tester.php" hash="ca760b63cc58be60d980976294d04dec"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Temandoinstaller"><file name="InstallerController.php" hash="fd532114bcc6625a8d53b098f7c1f198"/></dir></dir></dir><dir name="data"><dir name="temandoinstaller_setup"><file name="data-install-1.0.0.php" hash="abf993cdbb3048b0598ba0709b5367a1"/><file name="data-upgrade-1.0.2-1.0.3.php" hash="fdb38ba141e40be2b566a2450c043687"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="a100164be19194e830c4ab3ab989819e"/><file name="config.xml" hash="c4b2ed8ee04cfb74afd8fff8ca3c3b8a"/><file name="system.xml" hash="f47225f411184969c7504a9628656b61"/></dir><dir name="sql"><dir name="temandoinstaller_setup"><file name="mysql4-install-1.0.0.php" hash="e02d3066232d78576c0bf2ffb0dc7ddf"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="temandoinstaller.xml" hash="7623f7ecb0921288b57af88220582246"/></dir><dir name="template"><dir name="temando"><dir name="installer"><file name="notifications.phtml" hash="c2de260c2d458cdfd478f7cfe74d4f9d"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Temando_Installer.csv" hash="75ee73d99f36b766b010947dd8e22fa7"/></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
21
  </package>