Version Notes
First Release of Extension
Download this release
Release Info
Developer | Hitesh Agrawal |
Extension | Kvh_Deleteshipment |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Kvh/Deleteshipment/Block/Adminhtml/Order.php +47 -0
- app/code/local/Kvh/Deleteshipment/Block/Adminhtml/Order/View.php +66 -0
- app/code/local/Kvh/Deleteshipment/Helper/Data.php +6 -0
- app/code/local/Kvh/Deleteshipment/Model/Deleteshipment.php +78 -0
- app/code/local/Kvh/Deleteshipment/controllers/Adminhtml/DeleteshipmentController.php +69 -0
- app/code/local/Kvh/Deleteshipment/etc/config.xml +64 -0
- app/etc/modules/Kvh_Deleteshipment.xml +17 -0
- package.xml +18 -0
app/code/local/Kvh/Deleteshipment/Block/Adminhtml/Order.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Adminhtml sales orders block
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Kvh_Deleteshipment_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Sales_Order
|
35 |
+
{
|
36 |
+
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
parent::__construct();
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
}
|
app/code/local/Kvh/Deleteshipment/Block/Adminhtml/Order/View.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Adminhtml sales orders block
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Kvh_Deleteshipment_Block_Adminhtml_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
|
35 |
+
{
|
36 |
+
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
|
40 |
+
$order = $this->getOrder();
|
41 |
+
|
42 |
+
$shipment = $order->getShipmentsCollection();
|
43 |
+
|
44 |
+
if(count($shipment)>0):
|
45 |
+
$onclickJs = 'deleteConfirm(\''
|
46 |
+
. Mage::helper('sales')->__('Are you sure? This will Delete shipment and cannot be undoable')
|
47 |
+
. '\', \'' . $this->getDeleteshipmentUrl() . '\');';
|
48 |
+
$this->_addButton('order_delete_shipment', array(
|
49 |
+
'label' => Mage::helper('sales')->__('Delete Shipment'),
|
50 |
+
'onclick' => $onclickJs,
|
51 |
+
));
|
52 |
+
endif;
|
53 |
+
|
54 |
+
|
55 |
+
parent::__construct();
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getDeleteshipmentUrl()
|
60 |
+
{
|
61 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
62 |
+
return Mage::helper('adminhtml')->getUrl('deleteshipment/adminhtml_deleteshipment/delete/order_id/'.$orderId);
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
}
|
app/code/local/Kvh/Deleteshipment/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kvh_Deleteshipment_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Kvh/Deleteshipment/Model/Deleteshipment.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kvh_Deleteshipment_Model_Deleteshipment extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
public function deleteShipment($orderId)
|
16 |
+
{
|
17 |
+
|
18 |
+
try{
|
19 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
20 |
+
$shipment = $order->getShipmentsCollection();
|
21 |
+
$status= $order->getStatus();
|
22 |
+
|
23 |
+
$resource = Mage::getSingleton('core/resource');
|
24 |
+
$writeConnection = $resource->getConnection('core_write');
|
25 |
+
$readConnection = $resource->getConnection('core_read');
|
26 |
+
foreach($shipment as $sp)
|
27 |
+
{
|
28 |
+
$query="delete from sales_flat_shipment where increment_id =".$sp->getIncrementId();
|
29 |
+
$writeConnection->query($query);
|
30 |
+
|
31 |
+
$query="delete from sales_flat_shipment_comment where parent_id =".$sp->getId();
|
32 |
+
$writeConnection->query($query);
|
33 |
+
|
34 |
+
|
35 |
+
$query="delete from sales_flat_shipment_grid where increment_id =".$sp->getIncrementId();
|
36 |
+
$writeConnection->query($query);
|
37 |
+
|
38 |
+
$query="delete from sales_flat_shipment_track where parent_id =".$sp->getId();
|
39 |
+
$writeConnection->query($query);
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
$query="update sales_flat_order_item set qty_shipped=0 where order_id =".$order->getId();
|
44 |
+
$writeConnection->query($query);
|
45 |
+
|
46 |
+
$query="delete from sales_flat_order_status_history where entity_name ='shipment' and parent_id =".$order->getId();
|
47 |
+
$writeConnection->query($query);
|
48 |
+
|
49 |
+
|
50 |
+
$query="select entity_id from sales_flat_order_status_history where entity_name ='invoice' and parent_id =".$order->getId();
|
51 |
+
$entity_id = $readConnection->fetchOne($query);
|
52 |
+
|
53 |
+
if($entity_id>0)
|
54 |
+
{
|
55 |
+
$order_status=Mage_Sales_Model_Order::STATE_PROCESSING;
|
56 |
+
|
57 |
+
}
|
58 |
+
else
|
59 |
+
{
|
60 |
+
$order_status=Mage_Sales_Model_Order::STATE_PENDING;
|
61 |
+
}
|
62 |
+
|
63 |
+
$order->setState($order_status, true)->save();
|
64 |
+
|
65 |
+
return true;
|
66 |
+
|
67 |
+
}catch(Exception $e)
|
68 |
+
{
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
}
|
78 |
+
?>
|
app/code/local/Kvh/Deleteshipment/controllers/Adminhtml/DeleteshipmentController.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Customer
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Customer account controller
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Customer
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
|
35 |
+
class Kvh_Deleteshipment_Adminhtml_DeleteshipmentController extends Mage_Adminhtml_Controller_action
|
36 |
+
{
|
37 |
+
|
38 |
+
public function deleteAction()
|
39 |
+
{
|
40 |
+
|
41 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
42 |
+
|
43 |
+
if(Mage::getModel('deleteshipment/deleteshipment')->deleteShipment($orderId))
|
44 |
+
{
|
45 |
+
$message = $this->__('Shipment has been deleted succcessfully');
|
46 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sales')->__($message));
|
47 |
+
|
48 |
+
|
49 |
+
}
|
50 |
+
else
|
51 |
+
{
|
52 |
+
$message = $this->__('There is some problem in delete shipment');
|
53 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sales')->__($message));
|
54 |
+
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
$url= $this->getUrl("adminhtml/sales_order/view", array('order_id'=>$orderId));
|
59 |
+
|
60 |
+
$this->_redirectUrl($url);
|
61 |
+
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
}
|
app/code/local/Kvh/Deleteshipment/etc/config.xml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Kvh_Deleteshipment>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Kvh_Deleteshipment>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<deleteshipment>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Kvh_Deleteshipment</module>
|
14 |
+
<frontName>deleteshipment</frontName>
|
15 |
+
</args>
|
16 |
+
</deleteshipment>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<deleteshipment>
|
21 |
+
<file>deleteshipment.xml</file>
|
22 |
+
</deleteshipment>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<deleteshipment>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Kvh_Deleteshipment</module>
|
32 |
+
<frontName>deleteshipment</frontName>
|
33 |
+
</args>
|
34 |
+
</deleteshipment>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<global>
|
38 |
+
|
39 |
+
<blocks>
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
<adminhtml>
|
44 |
+
<rewrite>
|
45 |
+
<sales_order_view>Kvh_Deleteshipment_Block_Adminhtml_Order_View</sales_order_view>
|
46 |
+
|
47 |
+
</rewrite>
|
48 |
+
</adminhtml>
|
49 |
+
</blocks>
|
50 |
+
<models>
|
51 |
+
<deleteshipment>
|
52 |
+
<class>Kvh_Deleteshipment_Model</class>
|
53 |
+
</deleteshipment>
|
54 |
+
</models>
|
55 |
+
|
56 |
+
|
57 |
+
<helpers>
|
58 |
+
<deleteshipment>
|
59 |
+
<class>Kvh_Deleteshipment_Helper</class>
|
60 |
+
</deleteshipment>
|
61 |
+
</helpers>
|
62 |
+
</global>
|
63 |
+
|
64 |
+
</config>
|
app/etc/modules/Kvh_Deleteshipment.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
|
5 |
+
<modules>
|
6 |
+
|
7 |
+
<Kvh_Deleteshipment>
|
8 |
+
|
9 |
+
<active>true</active>
|
10 |
+
|
11 |
+
<codePool>local</codePool>
|
12 |
+
|
13 |
+
</Kvh_Deleteshipment>
|
14 |
+
|
15 |
+
</modules>
|
16 |
+
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Kvh_Deleteshipment</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension will delete shipment information of order</summary>
|
10 |
+
<description>This extension will delete all shipment information of particular order</description>
|
11 |
+
<notes>First Release of Extension</notes>
|
12 |
+
<authors><author><name>Hitesh Agrawal</name><user>hiteshmca111</user><email>hiteshagrawal84@gmail.com</email></author></authors>
|
13 |
+
<date>2014-07-22</date>
|
14 |
+
<time>16:24:15</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Kvh"><dir name="Deleteshipment"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><file name="View.php" hash="550f93d10b48bc0cad4711f4d7a168d9"/></dir><file name="Order.php" hash="4d6f422e221f5902fdaf77ff459a4a67"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a5b06247339344aec72f166cedb2b6b1"/></dir><dir name="Model"><file name="Deleteshipment.php" hash="34b4f2f531cf22bac266c33da9a7d882"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteshipmentController.php" hash="5c6782ee947497b61bd0cf853a185ad1"/></dir></dir><dir name="etc"><file name="config.xml" hash="4b5fc3801a998d0ee2f83f3355c0db30"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kvh_Deleteshipment.xml" hash="3872824499c27d0a5941cfb0b72f79e6"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|