Wyomind_OrdersEraser - Version 3.1.2

Version Notes

none

Download this release

Release Info

Developer Magento Core Team
Extension Wyomind_OrdersEraser
Version 3.1.2
Comparing to
See all releases


Code changes from version 3.1.1 to 3.1.2

app/code/community/Wyomind/Orderseraser/Block/Order/Grid.php CHANGED
@@ -1 +1 @@
1
- <?phpclass Wyomind_Orderseraser_Block_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid { public function __construct() { parent::__construct(); } protected function _prepareCollection() { $actions = array(); if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) { $actions[] = array( 'caption' => Mage::helper('sales')->__('View'), 'url' => array('base' => '*/sales_order/view'), 'field' => 'order_id' ); } if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) { $actions[] = array( 'caption' => Mage::helper('sales')->__('Delete'), 'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'), 'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '), 'field' => 'order_id' ); } $this->addColumn('action', array( 'header' => Mage::helper('sales')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => $actions, 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true, )); return parent::_prepareCollection(); } protected function _prepareColumns() { return parent::_prepareColumns(); } protected function _prepareMassaction() { parent::_prepareMassaction(); if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) { $this->getMassactionBlock()->addItem('delete_order', array( 'label' => Mage::helper('sales')->__('Delete'), 'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'), )); } return $this; }}
2
  public function __construct() {
3
  parent::__construct();
4
 
5
  }
6
 
7
  protected function _prepareCollection() {
8
 
9
  $actions = array();
10
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
11
  $actions[] = array(
12
  'caption' => Mage::helper('sales')->__('View'),
13
  'url' => array('base' => '*/sales_order/view'),
14
  'field' => 'order_id'
15
  );
16
  }
17
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
18
  $actions[] = array(
19
  'caption' => Mage::helper('sales')->__('Delete'),
20
  'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
21
  'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
22
  'field' => 'order_id'
23
  );
24
  }
25
  $this->addColumn('action', array(
26
  'header' => Mage::helper('sales')->__('Action'),
27
  'width' => '50px',
28
  'type' => 'action',
29
  'getter' => 'getId',
30
  'actions' => $actions,
31
  'filter' => false,
32
  'sortable' => false,
33
  'index' => 'stores',
34
  'is_system' => true,
35
  ));
36
 
37
  return parent::_prepareCollection();
38
  }
39
 
40
  protected function _prepareColumns() {
41
  return parent::_prepareColumns();
42
  }
43
  protected function _prepareMassaction() {
44
 
45
  parent::_prepareMassaction();
46
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
47
  $this->getMassactionBlock()->addItem('delete_order', array(
48
  'label' => Mage::helper('sales')->__('Delete'),
49
  'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
50
  ));
51
  }
52
  return $this;
53
  }
1
+ <?php
2
  public function __construct() {
3
  parent::__construct();
4
 
5
  }
6
 
7
  protected function _prepareCollection() {
8
 
9
  $actions = array();
10
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
11
  $actions[] = array(
12
  'caption' => Mage::helper('sales')->__('View'),
13
  'url' => array('base' => '*/sales_order/view'),
14
  'field' => 'order_id'
15
  );
16
  }
17
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
18
  $actions[] = array(
19
  'caption' => Mage::helper('sales')->__('Delete'),
20
  'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
21
  'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
22
  'field' => 'order_id'
23
  );
24
  }
25
  $this->addColumn('action', array(
26
  'header' => Mage::helper('sales')->__('Action'),
27
  'width' => '50px',
28
  'type' => 'action',
29
  'getter' => 'getId',
30
  'actions' => $actions,
31
  'filter' => false,
32
  'sortable' => false,
33
  'index' => 'stores',
34
  'is_system' => true,
35
  ));
36
 
37
  return parent::_prepareCollection();
38
  }
39
 
40
  protected function _prepareColumns() {
41
  return parent::_prepareColumns();
42
  }
43
  protected function _prepareMassaction() {
44
 
45
  parent::_prepareMassaction();
46
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
47
  $this->getMassactionBlock()->addItem('delete_order', array(
48
  'label' => Mage::helper('sales')->__('Delete'),
49
  'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
50
  ));
51
  }
52
  return $this;
53
  }
app/code/community/Wyomind/Orderseraser/Model/Orderseraser.php CHANGED
@@ -1,50 +1,50 @@
1
- <?php
2
-
3
-
4
- class Wyomind_Orderseraser_Model_Orderseraser extends Varien_Object {
5
-
6
- public function _erase1($orderId) {
7
-
8
- $resource = Mage::getSingleton('core/resource');
9
- $delete = $resource->getConnection('core_read');
10
- $tableSo = $resource->getTableName('sales_order');
11
- $tableSoe = $resource->getTableName('sales_order_entity');
12
- $tableSoei = $resource->getTableName('sales_order_entity_int');
13
- $tableEa = $resource->getTableName('eav_attribute');
14
- $tableSfoi = $resource->getTableName('sales_flat_order_item');
15
-
16
- $sql = "DELETE FROM " . $tableSo . " WHERE entity_id = " . $orderId . ";";
17
- $delete->query($sql);
18
- $sql = "DELETE FROM " . $tableSoe . " WHERE parent_id = " . $orderId . ";";
19
- $delete->query($sql);
20
- $sql = "DELETE s FROM " . $tableSoe . " s
21
- JOIN " . $tableSoei . " si on s.entity_id = si.entity_id
22
- JOIN " . $tableEa . " a on si.attribute_id = a.attribute_id
23
- WHERE a.attribute_code = 'order_id'
24
- AND si.value = " . $orderId . ";";
25
- $delete->query($sql);
26
- $sql = "DELETE FROM " . $tableSfoi . " WHERE order_id=" . $orderId . ";";
27
- $delete->query($sql);
28
-
29
- return true;
30
- }
31
- public function _erase2($orderId) {
32
-
33
- $resource = Mage::getSingleton('core/resource');
34
- $delete = $resource->getConnection('core_read');
35
- $tableSfo = $resource->getTableName('sales_flat_order');
36
- $tableSfog = $resource->getTableName('sales_flat_order_grid');
37
-
38
-
39
- $sql = "DELETE FROM " . $tableSfo . " WHERE entity_id = " . $orderId . ";";
40
-
41
- $delete->query($sql);
42
- $sql = "DELETE FROM " . $tableSfog . " WHERE entity_id = " . $orderId . ";";
43
- $delete->query($sql);
44
-
45
-
46
- return true;
47
- }
48
-
49
- }
50
-
1
+ <?php
2
+
3
+
4
+ class Wyomind_Orderseraser_Model_Orderseraser extends Varien_Object {
5
+
6
+ public function _erase1($orderId) {
7
+
8
+ $resource = Mage::getSingleton('core/resource');
9
+ $delete = $resource->getConnection('core_read');
10
+ $tableSo = $resource->getTableName('sales_order');
11
+ $tableSoe = $resource->getTableName('sales_order_entity');
12
+ $tableSoei = $resource->getTableName('sales_order_entity_int');
13
+ $tableEa = $resource->getTableName('eav_attribute');
14
+ $tableSfoi = $resource->getTableName('sales_flat_order_item');
15
+
16
+ $sql = "DELETE FROM " . $tableSo . " WHERE entity_id = " . $orderId . ";";
17
+ $delete->query($sql);
18
+ $sql = "DELETE FROM " . $tableSoe . " WHERE parent_id = " . $orderId . ";";
19
+ $delete->query($sql);
20
+ $sql = "DELETE s FROM " . $tableSoe . " s
21
+ JOIN " . $tableSoei . " si on s.entity_id = si.entity_id
22
+ JOIN " . $tableEa . " a on si.attribute_id = a.attribute_id
23
+ WHERE a.attribute_code = 'order_id'
24
+ AND si.value = " . $orderId . ";";
25
+ $delete->query($sql);
26
+ $sql = "DELETE FROM " . $tableSfoi . " WHERE order_id=" . $orderId . ";";
27
+ $delete->query($sql);
28
+
29
+ return true;
30
+ }
31
+ public function _erase2($orderId) {
32
+
33
+ $resource = Mage::getSingleton('core/resource');
34
+ $delete = $resource->getConnection('core_read');
35
+ $tableSfo = $resource->getTableName('sales_flat_order');
36
+ $tableSfog = $resource->getTableName('sales_flat_order_grid');
37
+
38
+
39
+ $sql = "DELETE FROM " . $tableSfo . " WHERE entity_id = " . $orderId . ";";
40
+
41
+ $delete->query($sql);
42
+ $sql = "DELETE FROM " . $tableSfog . " WHERE entity_id = " . $orderId . ";";
43
+ $delete->query($sql);
44
+
45
+
46
+ return true;
47
+ }
48
+
49
+ }
50
+
app/code/community/Wyomind/Orderseraser/controllers/Adminhtml/OrderseraserController.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
-
3
- class Wyomind_Orderseraser_Adminhtml_OrderseraserController extends Mage_Adminhtml_Controller_Action {
4
-
5
- public function getVersion() {
6
- return substr(Mage::getVersion(), 0, 3);
7
- }
8
-
9
-
10
-
11
- public function massDeleteAction() {
12
-
13
- $orderIds = $this->getRequest()->getPost('order_ids', array());
14
- $countDeleteOrder = 0;
15
- foreach ($orderIds as $orderId) {
16
- if ($this->getVersion() <= 1.3 && Mage::getModel('orderseraser/orderseraser')->_erase1($orderId))
17
- $countDeleteOrder++;
18
- elseif (Mage::getModel('orderseraser/orderseraser')->_erase2($orderId))
19
- $countDeleteOrder++;
20
- }
21
- if ($countDeleteOrder > 0) {
22
- $this->_getSession()->addSuccess($this->__('%s order(s) successfully deleted', $countDeleteOrder));
23
- } else {
24
- $this->_getSession()->addError($this->__('Unable to delete orders.'));
25
- }
26
-
27
- $this->_redirect('adminhtml/sales_order/');
28
-
29
- }
30
-
31
- public function deleteAction() {
32
-
33
- if ($orderId = $this->getRequest()->getParam('order_id')) {
34
-
35
- try {
36
-
37
- if ($this->getVersion() <= 1.3)
38
- Mage::getModel('orderseraser/orderseraser')->_erase1($orderId);
39
- else
40
-
41
- Mage::getModel('orderseraser/orderseraser')->_erase2($orderId);
42
-
43
- $this->_getSession()->addSuccess(
44
- $this->__('Order was successfully deleted.')
45
- );
46
- } catch (Mage_Core_Exception $e) {
47
- $this->_getSession()->addError($e->getMessage());
48
- } catch (Exception $e) {
49
- $this->_getSession()->addError($this->__('Unable to delete order.'));
50
- }
51
-
52
- $this->_redirect('adminhtml/sales_order/');
53
-
54
- }
55
- }
56
-
57
  }
1
+ <?php
2
+
3
+ class Wyomind_Orderseraser_Adminhtml_OrderseraserController extends Mage_Adminhtml_Controller_Action {
4
+
5
+ public function getVersion() {
6
+ return substr(Mage::getVersion(), 0, 3);
7
+ }
8
+
9
+
10
+
11
+ public function massDeleteAction() {
12
+
13
+ $orderIds = $this->getRequest()->getPost('order_ids', array());
14
+ $countDeleteOrder = 0;
15
+ foreach ($orderIds as $orderId) {
16
+ if ($this->getVersion() <= 1.3 && Mage::getModel('orderseraser/orderseraser')->_erase1($orderId))
17
+ $countDeleteOrder++;
18
+ elseif (Mage::getModel('orderseraser/orderseraser')->_erase2($orderId))
19
+ $countDeleteOrder++;
20
+ }
21
+ if ($countDeleteOrder > 0) {
22
+ $this->_getSession()->addSuccess($this->__('%s order(s) successfully deleted', $countDeleteOrder));
23
+ } else {
24
+ $this->_getSession()->addError($this->__('Unable to delete orders.'));
25
+ }
26
+
27
+ $this->_redirect('adminhtml/sales_order/');
28
+
29
+ }
30
+
31
+ public function deleteAction() {
32
+
33
+ if ($orderId = $this->getRequest()->getParam('order_id')) {
34
+
35
+ try {
36
+
37
+ if ($this->getVersion() <= 1.3)
38
+ Mage::getModel('orderseraser/orderseraser')->_erase1($orderId);
39
+ else
40
+
41
+ Mage::getModel('orderseraser/orderseraser')->_erase2($orderId);
42
+
43
+ $this->_getSession()->addSuccess(
44
+ $this->__('Order was successfully deleted.')
45
+ );
46
+ } catch (Mage_Core_Exception $e) {
47
+ $this->_getSession()->addError($e->getMessage());
48
+ } catch (Exception $e) {
49
+ $this->_getSession()->addError($this->__('Unable to delete order.'));
50
+ }
51
+
52
+ $this->_redirect('adminhtml/sales_order/');
53
+
54
+ }
55
+ }
56
+
57
  }
app/code/community/Wyomind/Orderseraser/etc/config.xml CHANGED
@@ -1,94 +1,94 @@
1
- <?xml version="1.0"?>
2
-
3
-
4
- <config>
5
-
6
- <modules>
7
-
8
- <Wyomind_Orderseraser>
9
-
10
- <version>3.1.1</version>
11
-
12
- </Wyomind_Orderseraser>
13
-
14
- </modules>
15
-
16
- <admin>
17
- <routers>
18
- <orderseraser>
19
- <use>admin</use>
20
- <args>
21
- <module>Wyomind_Orderseraser</module>
22
- <frontName>orderseraser</frontName>
23
- </args>
24
- </orderseraser>
25
- </routers>
26
- </admin>
27
- <adminhtml>
28
- <acl>
29
- <resources>
30
- <all>
31
- <title>Allow Everything</title>
32
- </all>
33
- <admin>
34
- <children>
35
- <sales>
36
- <children>
37
- <order>
38
- <children>
39
- <actions>
40
- <children>
41
- <delete translate="title">
42
- <title>Delete (Orders Eraser)</title>
43
- </delete>
44
- </children>
45
- </actions>
46
- </children>
47
- </order>
48
- </children>
49
- </sales>
50
- </children>
51
- </admin>
52
- </resources>
53
- </acl>
54
-
55
- </adminhtml>
56
- <global>
57
-
58
- <models>
59
- <orderseraser>
60
- <class>Wyomind_Orderseraser_Model</class>
61
- </orderseraser>
62
- </models>
63
- <resources>
64
- <orderseraser_write>
65
- <connection>
66
- <use>core_write</use>
67
- </connection>
68
- </orderseraser_write>
69
- <orderseraser_read>
70
- <connection>
71
- <use>core_read</use>
72
- </connection>
73
- </orderseraser_read>
74
- </resources>
75
- <blocks>
76
- <adminhtml>
77
- <rewrite>
78
- <sales_order_grid>Wyomind_Orderseraser_Block_Order_Grid</sales_order_grid>
79
- </rewrite>
80
- </adminhtml>
81
- </blocks>
82
- <helpers>
83
- <orderseraser>
84
- <class>Wyomind_Orderseraser_Helper</class>
85
- </orderseraser>
86
- </helpers>
87
- </global>
88
- </config>
89
-
90
-
91
-
92
-
93
-
94
-
1
+ <?xml version="1.0"?>
2
+
3
+
4
+ <config>
5
+
6
+ <modules>
7
+
8
+ <Wyomind_Orderseraser>
9
+
10
+ <version>3.1.2</version>
11
+
12
+ </Wyomind_Orderseraser>
13
+
14
+ </modules>
15
+
16
+ <admin>
17
+ <routers>
18
+ <orderseraser>
19
+ <use>admin</use>
20
+ <args>
21
+ <module>Wyomind_Orderseraser</module>
22
+ <frontName>orderseraser</frontName>
23
+ </args>
24
+ </orderseraser>
25
+ </routers>
26
+ </admin>
27
+ <adminhtml>
28
+ <acl>
29
+ <resources>
30
+ <all>
31
+ <title>Allow Everything</title>
32
+ </all>
33
+ <admin>
34
+ <children>
35
+ <sales>
36
+ <children>
37
+ <order>
38
+ <children>
39
+ <actions>
40
+ <children>
41
+ <delete translate="title">
42
+ <title>Delete (Orders Eraser)</title>
43
+ </delete>
44
+ </children>
45
+ </actions>
46
+ </children>
47
+ </order>
48
+ </children>
49
+ </sales>
50
+ </children>
51
+ </admin>
52
+ </resources>
53
+ </acl>
54
+
55
+ </adminhtml>
56
+ <global>
57
+
58
+ <models>
59
+ <orderseraser>
60
+ <class>Wyomind_Orderseraser_Model</class>
61
+ </orderseraser>
62
+ </models>
63
+ <resources>
64
+ <orderseraser_write>
65
+ <connection>
66
+ <use>core_write</use>
67
+ </connection>
68
+ </orderseraser_write>
69
+ <orderseraser_read>
70
+ <connection>
71
+ <use>core_read</use>
72
+ </connection>
73
+ </orderseraser_read>
74
+ </resources>
75
+ <blocks>
76
+ <adminhtml>
77
+ <rewrite>
78
+ <sales_order_grid>Wyomind_Orderseraser_Block_Order_Grid</sales_order_grid>
79
+ </rewrite>
80
+ </adminhtml>
81
+ </blocks>
82
+ <helpers>
83
+ <orderseraser>
84
+ <class>Wyomind_Orderseraser_Helper</class>
85
+ </orderseraser>
86
+ </helpers>
87
+ </global>
88
+ </config>
89
+
90
+
91
+
92
+
93
+
94
+
app/etc/modules/Wyomind_Orderseraser.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+
4
+ <config>
5
+
6
+ <modules>
7
+
8
+ <Wyomind_Orderseraser>
9
+
10
+ <active>true</active>
11
+
12
+ <codePool>community</codePool>
13
+
14
+ </Wyomind_Orderseraser>
15
+
16
+ </modules>
17
+
18
+ </config>
package.xml CHANGED
@@ -1,8 +1,8 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wyomind_OrdersEraser</name>
4
- <version>3.1.1</version>
5
- <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
@@ -10,9 +10,9 @@
10
  <description>Orders eraser allows to simply clean your sales database by deleting any useless orders and linked invoices and/or shipping in once.</description>
11
  <notes>none</notes>
12
  <authors><author><name>Wyomind</name><user>auto-converted</user><email>contact@wyomind.com</email></author></authors>
13
- <date>2012-04-10</date>
14
- <time>14:09:44</time>
15
- <contents><target name="magecommunity"><dir name="Wyomind"><dir name="Orderseraser"><dir name="Block"><dir name="Order"><file name="Grid.php" hash="6aa448fcf6e45a3056d0742621c40ed8"/></dir></dir><dir name="Model"><file name="Orderseraser.php" hash="bab81858937f932c1f59bdc1205d15c4"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderseraserController.php" hash="c33cb6afd271284d56b200a01f6b4d20"/></dir></dir><dir name="etc"><file name="config.xml" hash="b5d7d6b5186df521195a1fe569b577d1"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wyomind_OrdersEraser</name>
4
+ <version>3.1.2</version>
5
+ <stability>beta</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
10
  <description>Orders eraser allows to simply clean your sales database by deleting any useless orders and linked invoices and/or shipping in once.</description>
11
  <notes>none</notes>
12
  <authors><author><name>Wyomind</name><user>auto-converted</user><email>contact@wyomind.com</email></author></authors>
13
+ <date>2012-05-15</date>
14
+ <time>12:30:39</time>
15
+ <contents><target name="magecommunity"><dir name="Wyomind"><dir name="Orderseraser"><dir name="Block"><dir name="Order"><file name="Grid.php" hash="4005a0d98668faa75bb080abc27008ba"/></dir></dir><dir name="Model"><file name="Orderseraser.php" hash="e526e08d4b600653aa72e37000ff13e3"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderseraserController.php" hash="ad47377c16349156a18988e863e27a2a"/></dir></dir><dir name="etc"><file name="config.xml" hash="7ba24f5929c9c9f0e635022b9787b356"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wyomind_Orderseraser.xml" hash="21f24202ef69e71be030f0ebd62ab7f2"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>