Version Notes
Version number: 0.1.0 Stability: Stable Compatibility: 1.7, 1.8, 1.8.1, 1.9
Download this release
Release Info
Developer | Ashish Khuller |
Extension | netgains_deleteccsave |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Netgains/Deleteccsave/Block/Adminhtml/Deleteccsavebackend.php +5 -0
- app/code/local/Netgains/Deleteccsave/Block/Adminhtml/Sales/Order/Grid.php +18 -0
- app/code/local/Netgains/Deleteccsave/Helper/Data.php +5 -0
- app/code/local/Netgains/Deleteccsave/controllers/Adminhtml/DeleteccsavebackendController.php +46 -0
- app/code/local/Netgains/Deleteccsave/controllers/Adminhtml/DeleteccsavebackendController.php~ +46 -0
- app/code/local/Netgains/Deleteccsave/etc/config.xml +66 -0
- app/design/adminhtml/default/default/layout/deleteccsave.xml +8 -0
- app/design/adminhtml/default/default/template/deleteccsave/deleteccsavebackend.phtml +1 -0
- app/etc/modules/Netgains_Deleteccsave.xml +10 -0
- package.xml +25 -0
app/code/local/Netgains/Deleteccsave/Block/Adminhtml/Deleteccsavebackend.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Netgains_Deleteccsave_Block_Adminhtml_Deleteccsavebackend extends Mage_Adminhtml_Block_Template {
|
4 |
+
|
5 |
+
}
|
app/code/local/Netgains/Deleteccsave/Block/Adminhtml/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Netgains_Deleteccsave_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
|
3 |
+
{
|
4 |
+
|
5 |
+
protected function _prepareMassaction()
|
6 |
+
{
|
7 |
+
parent::_prepareMassaction();
|
8 |
+
|
9 |
+
// Append new mass action option
|
10 |
+
$this->getMassactionBlock()->addItem(
|
11 |
+
'newmodule',
|
12 |
+
array('label' => $this->__('Netgains-Delete Credit Card Information'),
|
13 |
+
'url' => $this->getUrl('deleteccsave/adminhtml_deleteccsavebackend/Deletecreditcard') //this should be the url where there will be mass operation
|
14 |
+
)
|
15 |
+
);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
app/code/local/Netgains/Deleteccsave/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Netgains_Deleteccsave_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
5 |
+
|
app/code/local/Netgains/Deleteccsave/controllers/Adminhtml/DeleteccsavebackendController.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Netgains_Deleteccsave_Adminhtml_DeleteccsavebackendController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->_title($this->__("Deleteorder"));
|
8 |
+
$this->renderLayout();
|
9 |
+
}
|
10 |
+
public function DeletecreditcardAction()
|
11 |
+
{
|
12 |
+
$i = 0;
|
13 |
+
$orderIds = $this->getRequest()->getParam('order_ids');
|
14 |
+
$resource = Mage::getSingleton('core/resource');
|
15 |
+
$readConnection = $resource->getConnection('core/resource');
|
16 |
+
try
|
17 |
+
{
|
18 |
+
foreach ($orderIds as $values)
|
19 |
+
{
|
20 |
+
$transactions=Mage::getModel('sales/order')->load($values);
|
21 |
+
if ($transactions->status == 'complete' || $transactions->status == 'canceled')
|
22 |
+
{
|
23 |
+
$updatefirsttable = "UPDATE `sales_flat_order_payment` SET `cc_number_enc` = NULL,`cc_exp_month`=NULL,`cc_exp_year`=NULL,`cc_type`=NULL WHERE `entity_id` =$transactions->entity_id";
|
24 |
+
$updatesecondtable = "UPDATE `sales_flat_quote_payment` SET `cc_number_enc` = NULL,`cc_exp_month`=NULL,`cc_exp_year`=NULL,`cc_type`=NULL WHERE `quote_id` =$transactions->quote_id";
|
25 |
+
$readConnection->query($updatefirsttable);
|
26 |
+
$readConnection->query($updatesecondtable);
|
27 |
+
$i++;
|
28 |
+
Mage::getSingleton('core/session')->addSuccess('CC DELETED SUCCESSFULLY For'.' '.$i.' '.'Orders');
|
29 |
+
}else
|
30 |
+
{
|
31 |
+
Mage::getSingleton('core/session')->addError('You cannot delete CC information because order is not in complete or canceled state');
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
catch(Exception $e)
|
38 |
+
{
|
39 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
40 |
+
}
|
41 |
+
|
42 |
+
$this->_redirect('adminhtml/sales_order');
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/local/Netgains/Deleteccsave/controllers/Adminhtml/DeleteccsavebackendController.php~
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Netgains_Deleteccsave_Adminhtml_DeleteccsavebackendController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->_title($this->__("Deleteorder"));
|
8 |
+
$this->renderLayout();
|
9 |
+
}
|
10 |
+
public function DeletecreditcardAction()
|
11 |
+
{
|
12 |
+
$i = 0;
|
13 |
+
$orderIds = $this->getRequest()->getParam('order_ids');
|
14 |
+
$resource = Mage::getSingleton('core/resource');
|
15 |
+
$readConnection = $resource->getConnection('core/resource');
|
16 |
+
try
|
17 |
+
{
|
18 |
+
foreach ($orderIds as $values)
|
19 |
+
{
|
20 |
+
$transactions=Mage::getModel('sales/order')->load($values);
|
21 |
+
if ($transactions->status == 'complete' || $transactions->status == 'canceled')
|
22 |
+
{
|
23 |
+
$updatefirsttable = "UPDATE `sales_flat_order_payment` SET `cc_number_enc` = NULL,`cc_exp_month`=NULL,`cc_exp_year`=NULL,`cc_type`=NULL WHERE `entity_id` =$transactions->entity_id";
|
24 |
+
$updatesecondtable = "UPDATE `sales_flat_quote_payment` SET `cc_number_enc` = NULL,`cc_exp_month`=NULL,`cc_exp_year`=NULL,`cc_type`=NULL WHERE `quote_id` =$transactions->quote_id";
|
25 |
+
$readConnection->query($updatefirsttable);
|
26 |
+
$readConnection->query($updatesecondtable);
|
27 |
+
$i++;
|
28 |
+
Mage::getSingleton('core/session')->addSuccess('CC DELETED SUCCESSFULLY For'.' '.$i.' '.'Orders');
|
29 |
+
}else
|
30 |
+
{
|
31 |
+
Mage::getSingleton('core/session')->addError('Order is not in Completed or Cancelled State');
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
catch(Exception $e)
|
38 |
+
{
|
39 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
40 |
+
}
|
41 |
+
|
42 |
+
$this->_redirect('adminhtml/sales_order');
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/local/Netgains/Deleteccsave/etc/config.xml
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Netgains_Deleteccsave>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Netgains_Deleteccsave>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<deleteccsave>
|
11 |
+
<class>Netgains_Deleteccsave_Helper</class>
|
12 |
+
</deleteccsave>
|
13 |
+
</helpers>
|
14 |
+
<blocks>
|
15 |
+
<deleteccsave>
|
16 |
+
<class>Netgains_Deleteccsave_Block</class>
|
17 |
+
</deleteccsave>
|
18 |
+
<adminhtml>
|
19 |
+
<rewrite>
|
20 |
+
<sales_order_grid>Netgains_Deleteccsave_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
21 |
+
</rewrite>
|
22 |
+
</adminhtml>
|
23 |
+
</blocks>
|
24 |
+
</global>
|
25 |
+
<admin>
|
26 |
+
<routers>
|
27 |
+
<deleteccsave>
|
28 |
+
<use>admin</use>
|
29 |
+
<args>
|
30 |
+
<module>Netgains_Deleteccsave</module>
|
31 |
+
<frontName>deleteccsave</frontName>
|
32 |
+
</args>
|
33 |
+
</deleteccsave>
|
34 |
+
</routers>
|
35 |
+
</admin>
|
36 |
+
<adminhtml>
|
37 |
+
|
38 |
+
<acl>
|
39 |
+
<resources>
|
40 |
+
<all>
|
41 |
+
<title>Allow Everything</title>
|
42 |
+
</all>
|
43 |
+
<admin>
|
44 |
+
<children>
|
45 |
+
<deleteccsave translate="title" module="deleteccsave">
|
46 |
+
<title>Deleteccsave</title>
|
47 |
+
<sort_order>1000</sort_order>
|
48 |
+
<children>
|
49 |
+
<deleteccsavebackend translate="title">
|
50 |
+
<title>Backend Page Title</title>
|
51 |
+
</deleteccsavebackend>
|
52 |
+
</children>
|
53 |
+
</deleteccsave>
|
54 |
+
</children>
|
55 |
+
</admin>
|
56 |
+
</resources>
|
57 |
+
</acl>
|
58 |
+
<layout>
|
59 |
+
<updates>
|
60 |
+
<deleteccsave>
|
61 |
+
<file>deleteccsave.xml</file>
|
62 |
+
</deleteccsave>
|
63 |
+
</updates>
|
64 |
+
</layout>
|
65 |
+
</adminhtml>
|
66 |
+
</config>
|
app/design/adminhtml/default/default/layout/deleteccsave.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<deleteccsave_adminhtml_deleteccsavebackend_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="deleteccsave/adminhtml_deleteccsavebackend" name="deleteccsavebackend" template="deleteccsave/deleteccsavebackend.phtml"/>
|
6 |
+
</reference>
|
7 |
+
</deleteccsave_adminhtml_deleteccsavebackend_index>
|
8 |
+
</layout>
|
app/design/adminhtml/default/default/template/deleteccsave/deleteccsavebackend.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
Demo Backend Page Content
|
app/etc/modules/Netgains_Deleteccsave.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Netgains_Deleteccsave>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</Netgains_Deleteccsave>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>netgains_deleteccsave</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Magento Creditcard Purger Extension: Custom credit card purger extension to secure CC information.</summary>
|
10 |
+
<description>Custom credit card purger extension to secure CC information and automatically remove (except than last 4 digits) the CC numbers from database once the order is marked Completed 
|
11 |
+

|
12 |
+
Features: 
|
13 |
+
1: Remove sensitive CC information from the database and only retain last 4 digits. 
|
14 |
+
2: Works as soon as the order is marked Completed. 
|
15 |
+
3: Proper check in place in case if the order status is pending, the extension won't remove the CC 
|
16 |
+

|
17 |
+
For any query or issue please email to support@netgains.org</description>
|
18 |
+
<notes>Version number: 0.1.0 Stability: Stable Compatibility: 1.7, 1.8, 1.8.1, 1.9</notes>
|
19 |
+
<authors><author><name>Ashish Khuller</name><user>Netgainsorg</user><email>biz@netgains.org</email></author></authors>
|
20 |
+
<date>2014-07-24</date>
|
21 |
+
<time>14:22:33</time>
|
22 |
+
<contents><target name="magelocal"><dir name="Netgains"><dir name="Deleteccsave"><dir name="Block"><dir name="Adminhtml"><file name="Deleteccsavebackend.php" hash="efa65afba4fb8cd59b720d619c6bd0ea"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="34671feaa3bd447bbce9c014ff80a2ed"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="4d540e12763355b98610317f27cef8e8"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteccsavebackendController.php" hash="045af0ba0c9b5c473b6b38272b24ed16"/><file name="DeleteccsavebackendController.php~" hash="889b21a8a9bcef19a910d07440c2c7ab"/></dir></dir><dir name="etc"><file name="config.xml" hash="efbb190fd2b5d32c09793dcbd524eaed"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Netgains_Deleteccsave.xml" hash="8140f8afdcb8d51cee4f16a8b70fb784"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="deleteccsave.xml" hash="8ea9590a758faa850d2f780f17492cf2"/></dir><dir name="template"><dir name="deleteccsave"><file name="deleteccsavebackend.phtml" hash="93ad3e798b60ad33539a944088478690"/></dir></dir></dir></dir></dir></target></contents>
|
23 |
+
<compatible/>
|
24 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
25 |
+
</package>
|