Wyomind_OrdersEraser - Version 4.0.0

Version Notes

none

Download this release

Release Info

Developer Wyomind
Extension Wyomind_OrdersEraser
Version 4.0.0
Comparing to
See all releases


Code changes from version 3.1.2 to 4.0.0

app/code/community/Wyomind/Orderseraser/Block/Order/Grid.php CHANGED
@@ -1 +1 @@
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
  }
 
54
  public function __construct() {
55
  parent::__construct();
56
  }
57
 
58
  protected function _prepareCollection() {
59
 
60
  $actions = array();
61
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
62
  $actions[] = array(
63
  'caption' => Mage::helper('sales')->__('View'),
64
  'url' => array('base' => '*/sales_order/view'),
65
  'field' => 'order_id'
66
  );
67
  }
68
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
69
  $actions[] = array(
70
  'caption' => Mage::helper('sales')->__('Delete'),
71
  'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
72
  'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
73
  'field' => 'order_id'
74
  );
75
  }
76
  $this->addColumn('action', array(
77
  'header' => Mage::helper('sales')->__('Action'),
78
  'width' => '50px',
79
  'type' => 'action',
80
  'getter' => 'getId',
81
  'actions' => $actions,
82
  'filter' => false,
83
  'sortable' => false,
84
  'index' => 'stores',
85
  'is_system' => true,
86
  ));
87
 
88
  return parent::_prepareCollection();
89
  }
90
 
91
  protected function _prepareColumns() {
92
  return parent::_prepareColumns();
93
  }
94
  protected function _prepareMassaction() {
95
 
96
  parent::_prepareMassaction();
97
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
98
  $this->getMassactionBlock()->addItem('delete_order', array(
99
  'label' => Mage::helper('sales')->__('Delete'),
100
  'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
101
  ));
102
  }
103
  return $this;
104
  }
 
1
  public function __construct() {
2
  parent::__construct();
3
 
4
  }
5
 
6
  protected function _prepareCollection() {
7
 
8
  $actions = array();
9
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
10
  $actions[] = array(
11
  'caption' => Mage::helper('sales')->__('View'),
12
  'url' => array('base' => '*/sales_order/view'),
13
  'field' => 'order_id'
14
  );
15
  }
16
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
17
  $actions[] = array(
18
  'caption' => Mage::helper('sales')->__('Delete'),
19
  'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
20
  'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
21
  'field' => 'order_id'
22
  );
23
  }
24
  $this->addColumn('action', array(
25
  'header' => Mage::helper('sales')->__('Action'),
26
  'width' => '50px',
27
  'type' => 'action',
28
  'getter' => 'getId',
29
  'actions' => $actions,
30
  'filter' => false,
31
  'sortable' => false,
32
  'index' => 'stores',
33
  'is_system' => true,
34
  ));
35
 
36
  return parent::_prepareCollection();
37
  }
38
 
39
  protected function _prepareColumns() {
40
  return parent::_prepareColumns();
41
  }
42
  protected function _prepareMassaction() {
43
 
44
  parent::_prepareMassaction();
45
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
46
  $this->getMassactionBlock()->addItem('delete_order', array(
47
  'label' => Mage::helper('sales')->__('Delete'),
48
  'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
49
  ));
50
  }
51
  return $this;
52
  }
53
+ <?php
54
  public function __construct() {
55
  parent::__construct();
56
  }
57
 
58
  protected function _prepareCollection() {
59
 
60
  $actions = array();
61
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
62
  $actions[] = array(
63
  'caption' => Mage::helper('sales')->__('View'),
64
  'url' => array('base' => '*/sales_order/view'),
65
  'field' => 'order_id'
66
  );
67
  }
68
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
69
  $actions[] = array(
70
  'caption' => Mage::helper('sales')->__('Delete'),
71
  'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
72
  'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
73
  'field' => 'order_id'
74
  );
75
  }
76
  $this->addColumn('action', array(
77
  'header' => Mage::helper('sales')->__('Action'),
78
  'width' => '50px',
79
  'type' => 'action',
80
  'getter' => 'getId',
81
  'actions' => $actions,
82
  'filter' => false,
83
  'sortable' => false,
84
  'index' => 'stores',
85
  'is_system' => true,
86
  ));
87
 
88
  return parent::_prepareCollection();
89
  }
90
 
91
  protected function _prepareColumns() {
92
  return parent::_prepareColumns();
93
  }
94
  protected function _prepareMassaction() {
95
 
96
  parent::_prepareMassaction();
97
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
98
  $this->getMassactionBlock()->addItem('delete_order', array(
99
  'label' => Mage::helper('sales')->__('Delete'),
100
  'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
101
  ));
102
  }
103
  return $this;
104
  }
app/code/community/Wyomind/Orderseraser/Model/Observer.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Wyomind_Orderseraser_Model_Observer {
4
+
5
+ public function addActionColumn(Varien_Event_Observer $observer) {
6
+
7
+ $block = $observer->getEvent()->getBlock();
8
+ $this->_block = $block;
9
+
10
+ if (get_class($block) == "Wyomind_Advancedinventory_Block_Adminhtml_Sales_Order_Grid") {
11
+ //Mage::getStoreConfig("orderseraser/system/grid");
12
+ $actions = array();
13
+
14
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
15
+ $actions[] = array(
16
+ 'caption' => Mage::helper('sales')->__('Delete'),
17
+ 'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
18
+ 'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
19
+ 'field' => 'order_id'
20
+ );
21
+
22
+
23
+
24
+ $block->addColumnAfter('Delete', array(
25
+ 'header' => Mage::helper('sales')->__('Delete'),
26
+ 'width' => '50px',
27
+ 'type' => 'action',
28
+ 'getter' => 'getId',
29
+ 'actions' => $actions,
30
+ 'filter' => false,
31
+ 'sortable' => false,
32
+ 'is_system' => true,
33
+ ), 'status');
34
+ }
35
+ }
36
+
37
+ return $observer;
38
+ }
39
+
40
+ public function addMassAction($observer) {
41
+
42
+ $block = $observer->getEvent()->getBlock();
43
+ $this->_block = $block;
44
+ if (get_class($block) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction'
45
+ && $block->getRequest()->getControllerName() == 'sales_order') {
46
+
47
+
48
+ $block->addItem('delete_order', array(
49
+ 'label' => Mage::helper('sales')->__('Delete'),
50
+ 'url' => $block->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
51
+ ));
52
+ }
53
+ }
54
+
55
+ }
56
+
app/code/community/Wyomind/Orderseraser/controllers/Adminhtml/OrderseraserController.php CHANGED
@@ -13,7 +13,7 @@ class Wyomind_Orderseraser_Adminhtml_OrderseraserController extends Mage_Adminht
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++;
@@ -34,7 +34,7 @@ class Wyomind_Orderseraser_Adminhtml_OrderseraserController extends Mage_Adminht
34
 
35
  try {
36
 
37
- if ($this->getVersion() <= 1.3)
38
  Mage::getModel('orderseraser/orderseraser')->_erase1($orderId);
39
  else
40
 
13
  $orderIds = $this->getRequest()->getPost('order_ids', array());
14
  $countDeleteOrder = 0;
15
  foreach ($orderIds as $orderId) {
16
+ if (version_compare(Mage::getVersion(), '1.3.0', '<=') && Mage::getModel('orderseraser/orderseraser')->_erase1($orderId))
17
  $countDeleteOrder++;
18
  elseif (Mage::getModel('orderseraser/orderseraser')->_erase2($orderId))
19
  $countDeleteOrder++;
34
 
35
  try {
36
 
37
+ if (version_compare(Mage::getVersion(), '1.3.0', '<='))
38
  Mage::getModel('orderseraser/orderseraser')->_erase1($orderId);
39
  else
40
 
app/code/community/Wyomind/Orderseraser/etc/config.xml CHANGED
@@ -2,17 +2,18 @@
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>
@@ -51,15 +52,40 @@
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>
@@ -72,13 +98,7 @@
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>
2
 
3
 
4
  <config>
 
5
  <modules>
 
6
  <Wyomind_Orderseraser>
7
+ <version>4.0.0</version>
 
 
8
  </Wyomind_Orderseraser>
 
9
  </modules>
10
+ <default>
11
+ <orderseraser>
12
+ <system>
13
+ <grid>Mage_Adminhtml_Block_Sales_Order_Grid</grid>
14
+ </system>
15
+ </orderseraser>
16
+ </default>
17
  <admin>
18
  <routers>
19
  <orderseraser>
52
  </admin>
53
  </resources>
54
  </acl>
55
+ <events>
56
+ <core_block_abstract_to_html_before>
57
+ <observers>
58
+ <wyomind_orderseraser_sales_order_grid>
59
+ <type>model</type>
60
+ <class>Wyomind_Orderseraser_Model_Observer</class>
61
+ <method>addActionColumn</method>
62
+ </wyomind_orderseraser_sales_order_grid>
63
+ </observers>
64
+ </core_block_abstract_to_html_before>
65
+ <core_block_abstract_prepare_layout_before>
66
+ <observers>
67
+ <newmodule_core_block_abstract_prepare_layout_before>
68
+ <type>model</type>
69
+ <class>Wyomind_Orderseraser_Model_Observer</class>
70
+ <method>addMassAction</method>
71
+ </newmodule_core_block_abstract_prepare_layout_before>
72
+ </observers>
73
+ </core_block_abstract_prepare_layout_before>
74
+ </events>
75
  </adminhtml>
76
  <global>
 
77
  <models>
78
  <orderseraser>
79
  <class>Wyomind_Orderseraser_Model</class>
80
  </orderseraser>
81
  </models>
82
+ <blocks>
83
+ <adminhtml>
84
+ <rewrite>
85
+ <!--<sales_order_grid>Wyomind_Orderseraser_Block_Order_Grid</sales_order_grid>-->
86
+ </rewrite>
87
+ </adminhtml>
88
+ </blocks>
89
  <resources>
90
  <orderseraser_write>
91
  <connection>
98
  </connection>
99
  </orderseraser_read>
100
  </resources>
101
+
 
 
 
 
 
 
102
  <helpers>
103
  <orderseraser>
104
  <class>Wyomind_Orderseraser_Helper</class>
app/code/community/Wyomind/Orderseraser/etc/system.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <WYOMIND translate="label">
5
+ <label>WYOMIND</label>
6
+ <sort_order>1000000</sort_order>
7
+ </WYOMIND>
8
+ </tabs>
9
+ <sections>
10
+ <orderseraser translate="label">
11
+ <label>Orders Eraser</label>
12
+ <tab>WYOMIND</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1010</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+
20
+
21
+ <system translate="label">
22
+ <label><![CDATA[ Core setting <span class="notice"> // Advanced users //</span>]]>
23
+ </label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>300</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ <fields>
30
+ <grid translate="label comment">
31
+ <label>Orders grid to display </label>
32
+ <comment>
33
+ <![CDATA[ <span class="notice"> Default value : `Mage_Adminhtml_Block_Sales_Order_Grid`</span>]]>
34
+ </comment>
35
+ <validate>required-entry validate-address</validate>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>1</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>0</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ </grid>
42
+
43
+ </fields>
44
+ </system>
45
+
46
+ </groups>
47
+
48
+
49
+ </orderseraser>
50
+ </sections>
51
+ </config>
52
+
53
+
54
+
55
+
package.xml CHANGED
@@ -1,18 +1,18 @@
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/>
9
  <summary>Orders eraser allows to simply clean your sales database by deleting any useless orders and linked invoices and/or shipping in once.</summary>
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wyomind_OrdersEraser</name>
4
+ <version>4.0.0</version>
5
+ <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Orders eraser allows to simply clean your sales database by deleting any useless orders and linked invoices and/or shipping in once.</summary>
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>Pierre</user><email>contact@wyomind.com</email></author></authors>
13
+ <date>2013-02-28</date>
14
+ <time>09:10:13</time>
15
+ <contents><target name="magecommunity"><dir name="Wyomind"><dir name="Orderseraser"><dir name="Block"><dir name="Order"><file name="Grid.php" hash="d61585596941f1360b6668185415617f"/></dir></dir><dir name="Model"><file name="Observer.php" hash="5c2b870ad2be1f6c8c7f5512e524a29a"/><file name="Orderseraser.php" hash="e526e08d4b600653aa72e37000ff13e3"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderseraserController.php" hash="fb9ec155f7e795700d43a43548ebfc77"/></dir></dir><dir name="etc"><file name="config.xml" hash="8b1b6df1b72469c9581f62cdd70121a2"/><file name="system.xml" hash="8d37d12b5d8c5673eff53db06569ae8d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wyomind_Orderseraser.xml" hash="21f24202ef69e71be030f0ebd62ab7f2"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>4.0.0</min><max>5.6.0</max></php></required></dependencies>
18
  </package>