Version Notes
Basic functionality completed.
Download this release
Release Info
Developer | Folio3 |
Extension | Folio3_UncancelOrder |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Folio3/UncancelOrder/Block/Adminhtml/Sales/Order/View.php +29 -0
- app/code/community/Folio3/UncancelOrder/Model/Observer.php +53 -0
- app/code/community/Folio3/UncancelOrder/Model/Resource/Status.php +12 -0
- app/code/community/Folio3/UncancelOrder/Model/Resource/Status/Collection.php +13 -0
- app/code/community/Folio3/UncancelOrder/Model/Status.php +13 -0
- app/code/community/Folio3/UncancelOrder/Model/System/Config/Status.php +13 -0
- app/code/community/Folio3/UncancelOrder/Model/Uncancel.php +104 -0
- app/code/community/Folio3/UncancelOrder/controllers/Adminhtml/Sales/OrderController.php +49 -0
- app/code/community/Folio3/UncancelOrder/etc/config.xml +99 -0
- app/code/community/Folio3/UncancelOrder/etc/system.xml +82 -0
- app/code/community/Folio3/UncancelOrder/sql/folio3_uncancelorder_setup/install-1.0.0.php +23 -0
- app/etc/modules/Folio3_UncancelOrder.xml +8 -0
- package.xml +18 -0
app/code/community/Folio3/UncancelOrder/Block/Adminhtml/Sales/Order/View.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Filename: View.php.
|
5 |
+
* Author: Muhammad Shahab Hameed
|
6 |
+
* Date: 10/10/2016
|
7 |
+
*/
|
8 |
+
class Folio3_UncancelOrder_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
9 |
+
|
10 |
+
public function __construct() {
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$order = $this->getOrder();
|
15 |
+
|
16 |
+
if ( $order->isCanceled() ) {
|
17 |
+
$this->_addButton( 'uncancel', array(
|
18 |
+
'label' => __( 'Uncancel Order' ),
|
19 |
+
'onclick' => 'deleteConfirm(\'' . __( 'Do you really want to uncancel this order?' ) . '\', \'' . $this->getUncancelOrderUrl() . '\')',
|
20 |
+
'class' => 'go'
|
21 |
+
), 0, 100, 'header', 'header' );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
private function getUncancelOrderUrl() {
|
26 |
+
return $this->getUrl( '*/*/uncancelorder' );
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/community/Folio3/UncancelOrder/Model/Observer.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Filename: Observer.php.
|
5 |
+
* Author: Muhammad Shahab Hameed
|
6 |
+
* Date: 10/10/2016
|
7 |
+
*/
|
8 |
+
class Folio3_UncancelOrder_Model_Observer extends Mage_Core_Model_Abstract {
|
9 |
+
|
10 |
+
public function massUncancel( Varien_Event_Observer $observer ) {
|
11 |
+
|
12 |
+
$block = $observer->getEvent()->getBlock();
|
13 |
+
|
14 |
+
if ( get_class( $block ) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction'
|
15 |
+
&& $block->getRequest()->getControllerName() == 'sales_order'
|
16 |
+
) {
|
17 |
+
|
18 |
+
$block->addItem( 'uncancel', array(
|
19 |
+
'label' => 'Uncancel',
|
20 |
+
'url' => $this->getUncancelUrl(),
|
21 |
+
) );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getUncancelUrl() {
|
26 |
+
return Mage::getUrl( '*/*/massuncancelorder' );
|
27 |
+
}
|
28 |
+
|
29 |
+
public function saveOrderStatus( Varien_Event_Observer $observer ) {
|
30 |
+
|
31 |
+
$order = $observer->getOrder();
|
32 |
+
|
33 |
+
// only save value in the database
|
34 |
+
if (isset($order) && $order->getStatus() != Mage_Sales_Model_Order::STATE_CANCELED) {
|
35 |
+
|
36 |
+
$model = Mage::getModel( 'folio3_uncancelorder/status' )->load($order->getId(), 'folio3_uncancelorder_order_id');
|
37 |
+
$model->setData( 'folio3_uncancelorder_order_id', $order->getId() );
|
38 |
+
$model->setData( 'folio3_uncancelorder_status_code', $order->getStatus() );
|
39 |
+
try {
|
40 |
+
if ( $model->getData( 'folio3_uncancelorder_created_time' ) == null || $model->getData( 'folio3_uncancelorder_modified_time' ) == null ) {
|
41 |
+
$model->setData( 'folio3_uncancelorder_created_time', now() )
|
42 |
+
->setData( 'folio3_uncancelorder_modified_time', now() );
|
43 |
+
} else {
|
44 |
+
$model->setData( 'folio3_uncancelorder_modified_time', now() );
|
45 |
+
}
|
46 |
+
$model->save();
|
47 |
+
|
48 |
+
} catch ( Exception $ex ) {
|
49 |
+
Mage::log( "Observer Cancel Order : " . $ex->getMessage() );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Folio3/UncancelOrder/Model/Resource/Status.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Filename: Status.php.
|
5 |
+
* Author: Muhammad Shahab Hameed
|
6 |
+
* Date: 10/14/2016
|
7 |
+
*/
|
8 |
+
class Folio3_UncancelOrder_Model_Resource_Status extends Mage_Core_Model_Resource_Db_Abstract {
|
9 |
+
protected function _construct() {
|
10 |
+
$this->_init( 'folio3_uncancelorder/status', 'folio3_uncancelorder_id' );
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Folio3/UncancelOrder/Model/Resource/Status/Collection.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Filename: Collection.php.
|
4 |
+
* Author: Muhammad Shahab Hameed
|
5 |
+
* Date: 10/14/2016
|
6 |
+
*/
|
7 |
+
class Folio3_UncancelOrder_Model_Resource_Status_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
8 |
+
{
|
9 |
+
public function _construct()
|
10 |
+
{
|
11 |
+
$this->_init('folio3_uncancelorder/status');
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Folio3/UncancelOrder/Model/Status.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Filename: Status.php.
|
5 |
+
* Author: Muhammad Shahab Hameed
|
6 |
+
* Date: 10/14/2016
|
7 |
+
*/
|
8 |
+
class Folio3_UncancelOrder_Model_Status extends Mage_Core_Model_Abstract {
|
9 |
+
|
10 |
+
protected function _construct() {
|
11 |
+
$this->_init( 'folio3_uncancelorder/status' );
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Folio3/UncancelOrder/Model/System/Config/Status.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Filename: Status.php.
|
5 |
+
* Author: Muhammad Shahab Hameed
|
6 |
+
* Date: 10/14/2016
|
7 |
+
*/
|
8 |
+
class Folio3_UncancelOrder_Model_System_Config_Status extends Varien_Object {
|
9 |
+
|
10 |
+
public function toOptionArray() {
|
11 |
+
return Mage::getModel( 'sales/order_status' )->getCollection()->toOptionArray();
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Folio3/UncancelOrder/Model/Uncancel.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Folio3_UncancelOrder_Model_Uncancel extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
public function uncancelOrder( $Id ) {
|
6 |
+
|
7 |
+
$order = Mage::getModel( 'sales/order' )->load( $Id );
|
8 |
+
|
9 |
+
if ( $order->getId() && $order->getStatus() == Mage_Sales_Model_Order::STATE_CANCELED ) {
|
10 |
+
|
11 |
+
// if the value is stored in database, then that will be preferred else default value.
|
12 |
+
$statusCommentConfigValue = Mage::getStoreConfig( 'sales/uncancel_order/status_comment' );
|
13 |
+
$isCommentVisibleConfigValue = Mage::getStoreConfig( 'sales/uncancel_order/is_comment_visible' );
|
14 |
+
$notifyCustomerConfigValue = Mage::getStoreConfig( 'sales/uncancel_order/notify_customer' );
|
15 |
+
$previousStatusDatabaseConfigValue = Mage::getStoreConfig( 'sales/uncancel_order/previous_status_database' );
|
16 |
+
$uncancelledStatusConfigValue = Mage::getStoreConfig( 'sales/uncancel_order/uncancelled_status' );
|
17 |
+
|
18 |
+
$state = Mage_Sales_Model_Order::STATE_NEW; // default value
|
19 |
+
$status = 'pending'; // default value
|
20 |
+
|
21 |
+
// checking if the previous status from the database needs to be restored
|
22 |
+
if ( isset( $previousStatusDatabaseConfigValue ) && $previousStatusDatabaseConfigValue ) {
|
23 |
+
|
24 |
+
// load database previous status and state
|
25 |
+
$previousValue = Mage::getModel( 'folio3_uncancelorder/status' )->load( $order->getId(), 'folio3_uncancelorder_order_id' );
|
26 |
+
if ( isset( $previousValue ) && $previousValue != null ) {
|
27 |
+
$status = $previousValue->getData( 'folio3_uncancelorder_status_code' );
|
28 |
+
}
|
29 |
+
|
30 |
+
// checking if the status value to be restored is set up manually.
|
31 |
+
} else if ( isset( $previousStatusDatabaseConfigValue ) && ! $previousStatusDatabaseConfigValue && isset( $uncancelledStatusConfigValue ) ) {
|
32 |
+
|
33 |
+
// load from manually configured status
|
34 |
+
$orderStatus = Mage::getResourceModel( 'sales/order_status_collection' )
|
35 |
+
->joinStates()
|
36 |
+
->addFieldToFilter( 'main_table.status', $uncancelledStatusConfigValue )
|
37 |
+
->getFirstItem();
|
38 |
+
$state = $orderStatus->getState();
|
39 |
+
$status = $uncancelledStatusConfigValue;
|
40 |
+
}
|
41 |
+
|
42 |
+
try {
|
43 |
+
|
44 |
+
// restoring all the items inside a given order.
|
45 |
+
foreach ( $order->getItemsCollection() as $item ) {
|
46 |
+
$item->setQtyCanceled( 0 );
|
47 |
+
$item->setTaxCanceled( 0 );
|
48 |
+
$item->setHiddenTaxCanceled( 0 );
|
49 |
+
$item->save();
|
50 |
+
}
|
51 |
+
|
52 |
+
$user = Mage::getSingleton( 'admin/session' );
|
53 |
+
$username = $user->getUser()->getUsername();
|
54 |
+
$comment = "Order uncancelled by $username.";
|
55 |
+
|
56 |
+
// restoring the order itself.
|
57 |
+
$order->setBaseDiscountCanceled( 0 )
|
58 |
+
->setBaseShippingCanceled( 0 )
|
59 |
+
->setBaseSubtotalCanceled( 0 )
|
60 |
+
->setBaseTaxCanceled( 0 )
|
61 |
+
->setBaseTotalCanceled( 0 )
|
62 |
+
->setDiscountCanceled( 0 )
|
63 |
+
->setShippingCanceled( 0 )
|
64 |
+
->setSubtotalCanceled( 0 )
|
65 |
+
->setTaxCanceled( 0 )
|
66 |
+
->setTotalCanceled( 0 )
|
67 |
+
->setState( $state )
|
68 |
+
->setStatus( $status )
|
69 |
+
->save();
|
70 |
+
|
71 |
+
// The order is now saved, doing post order save work.
|
72 |
+
if ( isset( $statusCommentConfigValue ) && $statusCommentConfigValue ) {
|
73 |
+
|
74 |
+
// whether to add a comment about uncancelation of order or not and if it should be visible on the front end.
|
75 |
+
$historyItem = $order->addStatusHistoryComment( $comment );
|
76 |
+
|
77 |
+
if ( isset( $isCommentVisibleConfigValue ) && $isCommentVisibleConfigValue ) {
|
78 |
+
$historyItem->setIsVisibleOnFront( true );
|
79 |
+
} else {
|
80 |
+
$historyItem->setIsVisibleOnFront( false );
|
81 |
+
}
|
82 |
+
|
83 |
+
// whether to notify customer or not about the uncancelation of order
|
84 |
+
if ( isset( $notifyCustomerConfigValue ) && $notifyCustomerConfigValue ) {
|
85 |
+
$historyItem->setIsCustomerNotified( true );
|
86 |
+
} else {
|
87 |
+
$historyItem->setIsCustomerNotified( false );
|
88 |
+
}
|
89 |
+
|
90 |
+
$historyItem->save();
|
91 |
+
}
|
92 |
+
|
93 |
+
return true;
|
94 |
+
|
95 |
+
} catch ( Exception $ex ) {
|
96 |
+
Mage::log( 'Order was not uncancelled. ' . $ex->getMessage() );
|
97 |
+
|
98 |
+
return false;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
}
|
app/code/community/Folio3/UncancelOrder/controllers/Adminhtml/Sales/OrderController.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Filename: OrderController.php.
|
5 |
+
* Author: Muhammad Shahab Hameed
|
6 |
+
* Date: 10/10/2016
|
7 |
+
*/
|
8 |
+
class Folio3_UncancelOrder_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Controller_Action {
|
9 |
+
|
10 |
+
public function uncancelorderAction() {
|
11 |
+
$orderId = $this->getRequest()->getParam( 'order_id' );
|
12 |
+
$uncancel = Mage::getModel( 'Folio3_UncancelOrder_Model_Uncancel' );
|
13 |
+
|
14 |
+
if ( $uncancel->uncancelOrder( $orderId ) ) {
|
15 |
+
$this->_getSession()->addSuccess( $this->__( 'Order was successfully uncancelled.' ) );
|
16 |
+
} else {
|
17 |
+
$this->_getSession()->addError( $this->__( 'Order was not uncancelled.' ) );
|
18 |
+
}
|
19 |
+
|
20 |
+
$this->_redirect( '*/sales_order/view', array( 'order_id' => $orderId ) );
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
public function massUncancelOrderAction() {
|
25 |
+
$orderIds = $this->getRequest()->getPost( 'order_ids', array() );
|
26 |
+
$countUnCancelOrder = 0;
|
27 |
+
$countNonUnCancelOrder = 0;
|
28 |
+
$uncancel = Mage::getModel( 'Folio3_UncancelOrder_Model_Uncancel' );
|
29 |
+
|
30 |
+
foreach ( $orderIds as $orderId ) {
|
31 |
+
if ( $uncancel->uncancelOrder( $orderId ) ) {
|
32 |
+
$countUnCancelOrder ++;
|
33 |
+
} else {
|
34 |
+
$countNonUnCancelOrder ++;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
if ( $countNonUnCancelOrder ) {
|
38 |
+
if ( $countUnCancelOrder ) {
|
39 |
+
$this->_getSession()->addError( $this->__( '%s order(s) cannot be uncanceled', $countNonUnCancelOrder ) );
|
40 |
+
} else {
|
41 |
+
$this->_getSession()->addError( $this->__( 'The order(s) cannot be uncanceled' ) );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
if ( $countUnCancelOrder ) {
|
45 |
+
$this->_getSession()->addSuccess( $this->__( '%s order(s) have been uncanceled.', $countUnCancelOrder ) );
|
46 |
+
}
|
47 |
+
$this->_redirect( '*/*/' );
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Folio3/UncancelOrder/etc/config.xml
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Folio3_UncancelOrder>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Folio3_UncancelOrder>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
|
10 |
+
<blocks>
|
11 |
+
<adminhtml>
|
12 |
+
<rewrite>
|
13 |
+
<sales_order_view>Folio3_UncancelOrder_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
14 |
+
</rewrite>
|
15 |
+
</adminhtml>
|
16 |
+
</blocks>
|
17 |
+
<models>
|
18 |
+
<folio3_uncancelorder>
|
19 |
+
<class>Folio3_UncancelOrder_Model</class>
|
20 |
+
<resourceModel>folio3_uncancelorder_resource</resourceModel>
|
21 |
+
</folio3_uncancelorder>
|
22 |
+
<folio3_uncancelorder_resource>
|
23 |
+
<class>Folio3_UncancelOrder_Model_Resource</class>
|
24 |
+
<entities>
|
25 |
+
<status>
|
26 |
+
<table>folio3_uncancelorder_status</table>
|
27 |
+
</status>
|
28 |
+
</entities>
|
29 |
+
</folio3_uncancelorder_resource>
|
30 |
+
</models>
|
31 |
+
<resources>
|
32 |
+
<folio3_uncancelorder_setup>
|
33 |
+
<setup>
|
34 |
+
<module>Folio3_UncancelOrder</module>
|
35 |
+
<class>Mage_Core_Model_Resource_Setup</class>
|
36 |
+
</setup>
|
37 |
+
<connection>
|
38 |
+
<use>core_setup</use>
|
39 |
+
</connection>
|
40 |
+
</folio3_uncancelorder_setup>
|
41 |
+
</resources>
|
42 |
+
<events>
|
43 |
+
<sales_order_place_after>
|
44 |
+
<observers>
|
45 |
+
<folio3_uncancelorder>
|
46 |
+
<class>Folio3_UncancelOrder_Model_Observer</class>
|
47 |
+
<method>saveOrderStatus</method>
|
48 |
+
<type>singleton</type>
|
49 |
+
</folio3_uncancelorder>
|
50 |
+
</observers>
|
51 |
+
</sales_order_place_after>
|
52 |
+
<sales_order_save_after>
|
53 |
+
<observers>
|
54 |
+
<folio3_uncancelorder_save_order_status_after_creation>
|
55 |
+
<class>Folio3_UncancelOrder_Model_Observer</class>
|
56 |
+
<method>saveOrderStatus</method>
|
57 |
+
<type>singleton</type>
|
58 |
+
</folio3_uncancelorder_save_order_status_after_creation>
|
59 |
+
</observers>
|
60 |
+
</sales_order_save_after>
|
61 |
+
</events>
|
62 |
+
|
63 |
+
</global>
|
64 |
+
<admin>
|
65 |
+
<routers>
|
66 |
+
<adminhtml>
|
67 |
+
<args>
|
68 |
+
<modules>
|
69 |
+
<Folio3_UncancelOrder before="Mage_Adminhtml">Folio3_UncancelOrder_Adminhtml</Folio3_UncancelOrder>
|
70 |
+
</modules>
|
71 |
+
</args>
|
72 |
+
</adminhtml>
|
73 |
+
</routers>
|
74 |
+
</admin>
|
75 |
+
<adminhtml>
|
76 |
+
<events>
|
77 |
+
<core_block_abstract_prepare_layout_before>
|
78 |
+
<observers>
|
79 |
+
<folio3_uncancelorder_core_block_abstract_prepare_layout_before>
|
80 |
+
<class>Folio3_UncancelOrder_Model_Observer</class>
|
81 |
+
<method>massUncancel</method>
|
82 |
+
<type>singleton</type>
|
83 |
+
</folio3_uncancelorder_core_block_abstract_prepare_layout_before>
|
84 |
+
</observers>
|
85 |
+
</core_block_abstract_prepare_layout_before>
|
86 |
+
</events>
|
87 |
+
</adminhtml>
|
88 |
+
<default>
|
89 |
+
<sales>
|
90 |
+
<uncancel_order>
|
91 |
+
<status_comment>0</status_comment>
|
92 |
+
<is_comment_visible>0</is_comment_visible>
|
93 |
+
<notify_customer>0</notify_customer>
|
94 |
+
<previous_status_database>1</previous_status_database>
|
95 |
+
<uncancelled_status>pending</uncancelled_status>
|
96 |
+
</uncancel_order>
|
97 |
+
</sales>
|
98 |
+
</default>
|
99 |
+
</config>
|
app/code/community/Folio3/UncancelOrder/etc/system.xml
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<sections>
|
3 |
+
<sales>
|
4 |
+
<groups>
|
5 |
+
<uncancel_order translate="label" module="sales">
|
6 |
+
<label>Uncancel Order</label>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>250</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<fields>
|
13 |
+
<status_comment translate="label">
|
14 |
+
<label>Add Order Status Comment</label>
|
15 |
+
<comment>
|
16 |
+
<![CDATA[Input your preference about whether to add order comment in case the order is uncancelled]]></comment>
|
17 |
+
<frontend_type>select</frontend_type>
|
18 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
19 |
+
<sort_order>1</sort_order>
|
20 |
+
<show_in_default>1</show_in_default>
|
21 |
+
<show_in_website>1</show_in_website>
|
22 |
+
<show_in_store>1</show_in_store>
|
23 |
+
</status_comment>
|
24 |
+
<is_comment_visible translate="label">
|
25 |
+
<label>Is Comment Visible on Frontend</label>
|
26 |
+
<comment>
|
27 |
+
<![CDATA[Input your preference about whether the uncancelled comment will be visible at the front end.]]></comment>
|
28 |
+
<frontend_type>select</frontend_type>
|
29 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
30 |
+
<sort_order>2</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<depends>
|
35 |
+
<status_comment>1</status_comment>
|
36 |
+
</depends>
|
37 |
+
</is_comment_visible>
|
38 |
+
<notify_customer translate="label">
|
39 |
+
<label>Notify Customer</label>
|
40 |
+
<comment>
|
41 |
+
<![CDATA[Input your preference about whether to notify customer in case the order is uncancelled]]></comment>
|
42 |
+
<frontend_type>select</frontend_type>
|
43 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
44 |
+
<sort_order>3</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<depends>
|
49 |
+
<status_comment>1</status_comment>
|
50 |
+
</depends>
|
51 |
+
</notify_customer>
|
52 |
+
<previous_status_database translate="label">
|
53 |
+
<label>Restore Previous Status</label>
|
54 |
+
<comment>
|
55 |
+
<![CDATA[Should the previous status be restored in case the order is uncancelled. If the value doesn't exists in the database it will default to 'Pending' status]]></comment>
|
56 |
+
<frontend_type>select</frontend_type>
|
57 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
58 |
+
<sort_order>41</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</previous_status_database>
|
63 |
+
<uncancelled_status translate="label">
|
64 |
+
<label>Status</label>
|
65 |
+
<comment>
|
66 |
+
<![CDATA[The status in which the order will be moved when it is uncancelled]]></comment>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>folio3_uncancelorder/system_config_status</source_model>
|
69 |
+
<sort_order>42</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
<depends>
|
74 |
+
<previous_status_database>0</previous_status_database>
|
75 |
+
</depends>
|
76 |
+
</uncancelled_status>
|
77 |
+
</fields>
|
78 |
+
</uncancel_order>
|
79 |
+
</groups>
|
80 |
+
</sales>
|
81 |
+
</sections>
|
82 |
+
</config>
|
app/code/community/Folio3/UncancelOrder/sql/folio3_uncancelorder_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Filename: install-1.0.0.php.
|
4 |
+
* Author: Muhammad Shahab Hameed
|
5 |
+
* Date: 10/14/2016
|
6 |
+
*/
|
7 |
+
$installer=$this;
|
8 |
+
$installer->startSetup();
|
9 |
+
|
10 |
+
$installer->run("
|
11 |
+
-- DROP TABLE IF EXISTS {$this->getTable('folio3_uncancelorder_status')};
|
12 |
+
CREATE TABLE {$this->getTable('folio3_uncancelorder_status')} (
|
13 |
+
`folio3_uncancelorder_id` int(11) unsigned NOT NULL auto_increment COMMENT 'Uncancel Order ID',
|
14 |
+
`folio3_uncancelorder_order_id` int(50) unsigned NULL COMMENT 'Order ID',
|
15 |
+
`folio3_uncancelorder_status_code` varchar(255) NOT NULL COMMENT 'Status',
|
16 |
+
`folio3_uncancelorder_created_time` datetime NULL COMMENT 'Entry created time',
|
17 |
+
`folio3_uncancelorder_modified_time` datetime NULL COMMENT 'Entry modified time',
|
18 |
+
PRIMARY KEY (`folio3_uncancelorder_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table is used to store order statuses';
|
20 |
+
|
21 |
+
");
|
22 |
+
$installer->endSetup();
|
23 |
+
?>
|
app/etc/modules/Folio3_UncancelOrder.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Folio3_UncancelOrder>
|
4 |
+
<active>true</active>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
</Folio3_UncancelOrder>
|
7 |
+
</modules>
|
8 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Folio3_UncancelOrder</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="www.folio3.com">Folio3 License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Folio3 Uncancel Order module gives the magento ecommerce website owner the ability to uncancel any accidentally canceled order.</summary>
|
10 |
+
<description>Folio3 Uncancel Order module gives the magento ecommerce website owner the ability to uncancel any accidentally canceled order.</description>
|
11 |
+
<notes>Basic functionality completed.</notes>
|
12 |
+
<authors><author><name>Folio3</name><user>MAG003179920</user><email>ecommerce@folio3.com</email></author></authors>
|
13 |
+
<date>2016-10-18</date>
|
14 |
+
<time>12:55:10</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Folio3_UncancelOrder.xml" hash="037d62886a3b8822736a369af9dfbf27"/></dir></target><target name="magecommunity"><dir name="Folio3"><dir name="UncancelOrder"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="ad27800f0e9186016b2cdd26be652983"/></dir></dir></dir></dir><dir name="Model"><file name="Observer.php" hash="3cc81a3bf4aded9149b108eb07de0f31"/><dir name="Resource"><dir name="Status"><file name="Collection.php" hash="9572875d10fafc6d1c378a733b6519e9"/></dir><file name="Status.php" hash="46652c615465c2dc4735a823759c6431"/></dir><file name="Status.php" hash="a5e73191a42e8c3561643fdc9b06d66b"/><dir name="System"><dir name="Config"><file name="Status.php" hash="8f1ae23d442eaabf08dc3d1b94b51622"/></dir></dir><file name="Uncancel.php" hash="95d7526acc1e273da5530d9f332f6732"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><file name="OrderController.php" hash="cabf196b41ce6086cec9cca24fb0c55e"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="ef451caf6a71e67da893dc1fc162e91e"/><file name="system.xml" hash="728a31a9565567e816ac4ecb5f24c9fd"/></dir><dir name="sql"><dir name="folio3_uncancelorder_setup"><file name="install-1.0.0.php" hash="42bcac04b43b1b0fc44e546728812168"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|