Version Notes
If you have ideas for improvements or find bugs, please send them to Jean-Sébastien Hederer at contact@asperience.fr, with ASPerience_DeleteAllOrders as part of the subject line.
Download this release
Release Info
Developer | Jean-Sébastien Hederer |
Extension | Asperience_DeleteAllOrders |
Version | 0.1.7 |
Comparing to | |
See all releases |
Code changes from version 0.1.6 to 0.1.7
- app/code/community/Asperience/DeleteAllOrders/Model/Observer.php +21 -8
- app/code/community/Asperience/DeleteAllOrders/Model/Order.php +2 -5
- app/code/community/Asperience/DeleteAllOrders/controllers/IndexController.php +3 -4
- app/code/community/Asperience/DeleteAllOrders/etc/config.xml +3 -3
- app/code/community/Asperience/DeleteAllOrders/etc/system.xml +2 -2
- app/locale/de_DE/Asperience_DeleteAllOrders.csv +2 -1
- app/locale/en_US/Asperience_DeleteAllOrders.csv +2 -1
- app/locale/fr_FR/Asperience_DeleteAllOrders.csv +2 -1
- package.xml +9 -12
app/code/community/Asperience/DeleteAllOrders/Model/Observer.php
CHANGED
@@ -9,18 +9,31 @@
|
|
9 |
|
10 |
class Asperience_DeleteAllOrders_Model_Observer
|
11 |
{
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
{
|
14 |
-
|
15 |
if ($observer->getEvent()->getBlock()->getId() == 'sales_order_grid') {
|
16 |
$massBlock = $observer->getEvent()->getBlock()->getMassactionBlock();
|
17 |
if ($massBlock) {
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
}
|
26 |
}
|
9 |
|
10 |
class Asperience_DeleteAllOrders_Model_Observer
|
11 |
{
|
12 |
+
const XML_PATH_SALES_IS_ACTIVE = 'sales/delete_order/is_active';
|
13 |
+
const XML_PATH_SALES_DELETE_ALL = 'sales/delete_order/delete_all';
|
14 |
+
const XML_PATH_SALES_STATUS = 'sales/delete_order/order_status';
|
15 |
+
|
16 |
+
public function addOptionToSelect($observer)
|
17 |
{
|
|
|
18 |
if ($observer->getEvent()->getBlock()->getId() == 'sales_order_grid') {
|
19 |
$massBlock = $observer->getEvent()->getBlock()->getMassactionBlock();
|
20 |
if ($massBlock) {
|
21 |
+
if(Mage::getStoreConfig(self::XML_PATH_SALES_IS_ACTIVE)) {
|
22 |
+
if(Mage::getStoreConfig(self::XML_PATH_SALES_DELETE_ALL)) {
|
23 |
+
$massBlock->addItem('delete_order', array(
|
24 |
+
'label'=> Mage::helper('deleteallorders')->__('Delete All !'),
|
25 |
+
'url' => Mage::helper('adminhtml')->getUrl('deleteallorders'),
|
26 |
+
'confirm' => Mage::helper('deleteallorders')->__('Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!'),
|
27 |
+
));
|
28 |
+
} else {
|
29 |
+
$massBlock->addItem('delete_order', array(
|
30 |
+
'label'=> Mage::helper('deleteallorders')->__('Delete All !'),
|
31 |
+
'url' => Mage::helper('adminhtml')->getUrl('deleteallorders'),
|
32 |
+
'confirm' => Mage::helper('deleteallorders')->__('Are you sure to delete the selected sales orders?'),
|
33 |
+
));
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
}
|
38 |
}
|
39 |
}
|
app/code/community/Asperience/DeleteAllOrders/Model/Order.php
CHANGED
@@ -20,20 +20,17 @@ class Asperience_DeleteAllOrders_Model_Order extends Mage_Sales_Model_Order
|
|
20 |
|
21 |
public function hasAvalaibleState()
|
22 |
{
|
23 |
-
|
24 |
}
|
25 |
|
26 |
|
27 |
public function hasNoOrdersRelated()
|
28 |
{
|
29 |
-
if (Mage::getStoreConfig(self::XML_PATH_SALES_DELETE_ALL)) {
|
30 |
-
return true;
|
31 |
-
}
|
32 |
return (!$this->hasInvoices() && !$this->hasShipments() && !$this->hasCreditmemos());
|
33 |
}
|
34 |
|
35 |
public function canDelete()
|
36 |
{
|
37 |
-
return ($this->hasAvalaibleState() && $this->hasNoOrdersRelated());
|
38 |
}
|
39 |
}
|
20 |
|
21 |
public function hasAvalaibleState()
|
22 |
{
|
23 |
+
return (in_array($this->getState(), $this->getDeleteStateIds()));
|
24 |
}
|
25 |
|
26 |
|
27 |
public function hasNoOrdersRelated()
|
28 |
{
|
|
|
|
|
|
|
29 |
return (!$this->hasInvoices() && !$this->hasShipments() && !$this->hasCreditmemos());
|
30 |
}
|
31 |
|
32 |
public function canDelete()
|
33 |
{
|
34 |
+
return (Mage::getStoreConfig(self::XML_PATH_SALES_IS_ACTIVE) && $this->hasAvalaibleState() && (Mage::getStoreConfig(self::XML_PATH_SALES_DELETE_ALL) || $this->hasNoOrdersRelated()));
|
35 |
}
|
36 |
}
|
app/code/community/Asperience/DeleteAllOrders/controllers/IndexController.php
CHANGED
@@ -20,7 +20,7 @@ class Asperience_DeleteAllOrders_IndexController extends Mage_Adminhtml_Sales_Or
|
|
20 |
public function indexAction()
|
21 |
{
|
22 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
23 |
-
if (Mage::getStoreConfig(Asperience_DeleteAllOrders_Model_Order::XML_PATH_SALES_IS_ACTIVE)) {
|
24 |
$countDeleteOrder = 0;
|
25 |
$countDeleteInvoice = 0;
|
26 |
$countDeleteShipment = 0;
|
@@ -83,7 +83,6 @@ class Asperience_DeleteAllOrders_IndexController extends Mage_Adminhtml_Sales_Or
|
|
83 |
} else {
|
84 |
$this->_getSession()->addError($this->__('This feature was deactivated.'));
|
85 |
}
|
86 |
-
$this->_redirect('adminhtml/sales_order/', array());
|
87 |
-
|
88 |
}
|
89 |
-
}
|
20 |
public function indexAction()
|
21 |
{
|
22 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
23 |
+
if (Mage::getStoreConfig(Asperience_DeleteAllOrders_Model_Order::XML_PATH_SALES_IS_ACTIVE)) {
|
24 |
$countDeleteOrder = 0;
|
25 |
$countDeleteInvoice = 0;
|
26 |
$countDeleteShipment = 0;
|
83 |
} else {
|
84 |
$this->_getSession()->addError($this->__('This feature was deactivated.'));
|
85 |
}
|
86 |
+
$this->_redirect('adminhtml/sales_order/', array());
|
|
|
87 |
}
|
88 |
+
}
|
app/code/community/Asperience/DeleteAllOrders/etc/config.xml
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Asperience_DeleteAllOrders>
|
13 |
-
<version>0.1.
|
14 |
</Asperience_DeleteAllOrders>
|
15 |
</modules>
|
16 |
|
@@ -70,8 +70,8 @@
|
|
70 |
<delete_order>
|
71 |
<is_active>1</is_active>
|
72 |
<delete_all>1</delete_all>
|
73 |
-
<order_status>
|
74 |
</delete_order>
|
75 |
</sales>
|
76 |
</default>
|
77 |
-
</config>
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Asperience_DeleteAllOrders>
|
13 |
+
<version>0.1.7</version>
|
14 |
</Asperience_DeleteAllOrders>
|
15 |
</modules>
|
16 |
|
70 |
<delete_order>
|
71 |
<is_active>1</is_active>
|
72 |
<delete_all>1</delete_all>
|
73 |
+
<order_status>closed,canceled</order_status>
|
74 |
</delete_order>
|
75 |
</sales>
|
76 |
</default>
|
77 |
+
</config>
|
app/code/community/Asperience/DeleteAllOrders/etc/system.xml
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
<show_in_store>0</show_in_store>
|
30 |
</is_active>
|
31 |
<delete_all translate="label">
|
32 |
-
<label>
|
33 |
<frontend_type>select</frontend_type>
|
34 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
35 |
<sort_order>2</sort_order>
|
@@ -51,4 +51,4 @@
|
|
51 |
</groups>
|
52 |
</sales>
|
53 |
</sections>
|
54 |
-
</config>
|
29 |
<show_in_store>0</show_in_store>
|
30 |
</is_active>
|
31 |
<delete_all translate="label">
|
32 |
+
<label>Also remove orders with invoices, shipments or credit memos related</label>
|
33 |
<frontend_type>select</frontend_type>
|
34 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
35 |
<sort_order>2</sort_order>
|
51 |
</groups>
|
52 |
</sales>
|
53 |
</sections>
|
54 |
+
</config>
|
app/locale/de_DE/Asperience_DeleteAllOrders.csv
CHANGED
@@ -6,8 +6,9 @@
|
|
6 |
"An error arose during the deletion. %s","Bei Bestellung ereignete sich einen Irrtum."
|
7 |
"This feature was deactivated.","Diese Funktionalität war deaktiviert. "
|
8 |
"Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!","Sind Sie Sicher, dass Sie die ausgewählte Bestellung löschen wollen ? Die verbunden Einkaufsrechnungen/Artikelversande/Nachnahmen werden auch geloschen."
|
|
|
9 |
"Delete All !","Alles löschen !"
|
10 |
"Allow to delete the orders","Das Löschen der Bestellungen zulassen."
|
11 |
"Deletion of Orders","Löschen der Bestellungen."
|
12 |
"Delete order status","Delete order status"
|
13 |
-
"
|
6 |
"An error arose during the deletion. %s","Bei Bestellung ereignete sich einen Irrtum."
|
7 |
"This feature was deactivated.","Diese Funktionalität war deaktiviert. "
|
8 |
"Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!","Sind Sie Sicher, dass Sie die ausgewählte Bestellung löschen wollen ? Die verbunden Einkaufsrechnungen/Artikelversande/Nachnahmen werden auch geloschen."
|
9 |
+
"Are you sure to delete the selected sales orders?","Sind Sie Sicher, dass Sie die ausgewählte Bestellung löschen wollen ?"
|
10 |
"Delete All !","Alles löschen !"
|
11 |
"Allow to delete the orders","Das Löschen der Bestellungen zulassen."
|
12 |
"Deletion of Orders","Löschen der Bestellungen."
|
13 |
"Delete order status","Delete order status"
|
14 |
+
"Also remove orders with invoices, shipments or credit memos related","Also remove orders with invoices, shipments or credit memos related"
|
app/locale/en_US/Asperience_DeleteAllOrders.csv
CHANGED
@@ -6,8 +6,9 @@
|
|
6 |
"An error arose during the deletion. %s","An error arose during the deletion. %s"
|
7 |
"This feature was deactivated.","This feature was deactivated."
|
8 |
"Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!","Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!"
|
|
|
9 |
"Delete All !","Delete All !"
|
10 |
"Allow to delete the orders","Allow to delete the orders"
|
11 |
"Deletion of Orders","Deletion of Orders"
|
12 |
"Delete order status","Delete order status"
|
13 |
-
"
|
6 |
"An error arose during the deletion. %s","An error arose during the deletion. %s"
|
7 |
"This feature was deactivated.","This feature was deactivated."
|
8 |
"Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!","Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!"
|
9 |
+
"Are you sure to delete the selected sales orders?","Are you sure to delete the selected sales orders?"
|
10 |
"Delete All !","Delete All !"
|
11 |
"Allow to delete the orders","Allow to delete the orders"
|
12 |
"Deletion of Orders","Deletion of Orders"
|
13 |
"Delete order status","Delete order status"
|
14 |
+
"Also remove orders with invoices, shipments or credit memos related","Also remove orders with invoices, shipments or credit memos related"
|
app/locale/fr_FR/Asperience_DeleteAllOrders.csv
CHANGED
@@ -6,8 +6,9 @@
|
|
6 |
"An error arose during the deletion. %s","Une erreur est survenue lors de la suppression. %s"
|
7 |
"This feature was deactivated.","Cette fonctionnalité a été désactivée."
|
8 |
"Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!","Etes vous sûr de bien vouloir supprimer les commandes sélectionnées? Attention: les factures/expéditions/remboursements associés seront également effacés!"
|
|
|
9 |
"Delete All !","Supprimer tout !"
|
10 |
"Allow to delete the orders","Permettre de supprimer les commandes"
|
11 |
"Deletion of Orders","Suppression des commandes"
|
12 |
"Delete order status","Statuts des commandes supprimables"
|
13 |
-
"
|
6 |
"An error arose during the deletion. %s","Une erreur est survenue lors de la suppression. %s"
|
7 |
"This feature was deactivated.","Cette fonctionnalité a été désactivée."
|
8 |
"Are you sure to delete the selected sales orders? Warning: invoices/shipments/credit memos associated will be also deleted!","Etes vous sûr de bien vouloir supprimer les commandes sélectionnées? Attention: les factures/expéditions/remboursements associés seront également effacés!"
|
9 |
+
"Are you sure to delete the selected sales orders?","Etes vous sûr de bien vouloir supprimer les commandes sélectionnées?"
|
10 |
"Delete All !","Supprimer tout !"
|
11 |
"Allow to delete the orders","Permettre de supprimer les commandes"
|
12 |
"Deletion of Orders","Suppression des commandes"
|
13 |
"Delete order status","Statuts des commandes supprimables"
|
14 |
+
"Also remove orders with invoices, shipments or credit memos related","Supprimer aussi les commandes avec des factures, expéditions ou remboursements liés"
|
package.xml
CHANGED
@@ -1,23 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Asperience_DeleteAllOrders</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Extension allowing to delete
|
10 |
-
<description>This extension allows to delete selected sales orders, invoices, shipments and credit memos.
|
11 |
You can set the status of orders you want to delete in the configuration section.
|
12 |
-
|
13 |
-
|
14 |
-
&#
|
15 |
-
</
|
16 |
-
<
|
17 |
-
<
|
18 |
-
<date>2012-01-11</date>
|
19 |
-
<time>10:18:23</time>
|
20 |
-
<contents><target name="magecommunity"><dir name="Asperience"><dir name="DeleteAllOrders"><dir name="Helper"><file name="Data.php" hash="747caa90dd55fd313f5aa0a642f89b28"/></dir><dir name="Model"><file name="Observer.php" hash="b8dba70bd7129af744c9b45ec0181a86"/><file name="Order.php" hash="05b7023c48d5fcc09db3e0a5cbe59799"/></dir><dir name="controllers"><file name="IndexController.php" hash="f087896cbadd47c8c4e7c2ec40f0a4bc"/></dir><dir name="etc"><file name="config.xml" hash="35dc0076b23dd714e593f1e7539df4be"/><file name="system.xml" hash="b983a7573258e1fe4499cc8306c2b425"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Asperience_DeleteAllOrders.xml" hash="564d484d06362fee6d4f0b42660bfa85"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Asperience_DeleteAllOrders.csv" hash="133b85bcad208bc5142cb52cb7819116"/></dir><dir name="fr_FR"><file name="Asperience_DeleteAllOrders.csv" hash="f3cdb649700bb09b04ea9ed976d483d7"/></dir><dir name="de_DE"><file name="Asperience_DeleteAllOrders.csv" hash="ab96207271d57d4e1af94b5101e2ba75"/></dir></target></contents>
|
21 |
<compatible/>
|
22 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
23 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Asperience_DeleteAllOrders</name>
|
4 |
+
<version>0.1.7</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Extension allowing to delete orders</summary>
|
10 |
+
<description>This extension allows to delete either selected sales orders WITHOUT invoices, shipments and credit memos or selected sales orders WITH invoices, shipments and credit memos.
|
11 |
You can set the status of orders you want to delete in the configuration section.
|
12 |
+
Warning: It's preferable to delete only the testing orders during the development of your local website. Orders deletion is at your own risk.</description>
|
13 |
+
<notes>If you have ideas for improvements or find bugs, please send them to Jean-Sébastien Hederer at contact@asperience.fr, with ASPerience_DeleteAllOrders as part of the subject line.</notes>
|
14 |
+
<authors><author><name>Jean-Sébastien Hederer</name><user>hedererjs</user><email>hedererjs@asperience.fr</email></author></authors>
|
15 |
+
<date>2012-04-09</date>
|
16 |
+
<time>15:10:37</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Asperience"><dir name="DeleteAllOrders"><dir name="Helper"><file name="Data.php" hash="747caa90dd55fd313f5aa0a642f89b28"/></dir><dir name="Model"><file name="Observer.php" hash="ae9890811c2411ebe791bc3dce72d6c0"/><file name="Order.php" hash="fe02bff5f6311c26f5d8c58fae716035"/></dir><dir name="controllers"><file name="IndexController.php" hash="c496b80e6cee4c19cdce016ecbfb3e6e"/></dir><dir name="etc"><file name="config.xml" hash="1f6f7464c87ce1a8ee824d1ee5598a13"/><file name="system.xml" hash="02f4c05514bc9b3f1c92cce9e2c16681"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Asperience_DeleteAllOrders.csv" hash="3b17c8b23f90a9ade272559da0bc3ce0"/></dir><dir name="en_US"><file name="Asperience_DeleteAllOrders.csv" hash="9529fa6e4e87db30bca48ce104cb0d05"/></dir><dir name="fr_FR"><file name="Asperience_DeleteAllOrders.csv" hash="8334e497eb99d7496ab770e5311ef70e"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Asperience_DeleteAllOrders.xml" hash="564d484d06362fee6d4f0b42660bfa85"/></dir></target></contents>
|
|
|
|
|
|
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|