Version Notes
Initial Release
Download this release
Release Info
Developer | Carotechs |
Extension | Carotechs_Audittrack |
Version | 0.1.1 |
Comparing to | |
See all releases |
Code changes from version 0.1.0 to 0.1.1
- app/code/local/Carotechs/Audittrack/Block/Aboutconfig.php +22 -0
- app/code/local/Carotechs/Audittrack/Block/Aboutprice.php +23 -0
- app/code/local/Carotechs/Audittrack/Block/Adminhtml/Audittrack.php +13 -0
- app/code/local/Carotechs/Audittrack/Block/Adminhtml/Audittrack/Grid.php +91 -0
- app/code/local/Carotechs/Audittrack/Block/Audittrack.php +17 -0
- app/code/local/Carotechs/Audittrack/Helper/Data.php +15 -0
- app/code/local/Carotechs/Audittrack/Model/Audittrack.php +9 -0
- app/code/local/Carotechs/Audittrack/Model/Mysql4/Audittrack.php +9 -0
- app/code/local/Carotechs/Audittrack/Model/Mysql4/Audittrack/Collection.php +9 -0
- app/code/local/Carotechs/Audittrack/controllers/Adminhtml/AudittrackController.php +68 -0
- app/code/local/Carotechs/Audittrack/controllers/Catalog/CategoryController.php +96 -0
- app/code/local/Carotechs/Audittrack/controllers/Catalog/Product/AttributeController.php +104 -0
- app/code/local/Carotechs/Audittrack/controllers/Catalog/Product/SetController.php +99 -0
- app/code/local/Carotechs/Audittrack/controllers/Catalog/ProductController.php +202 -0
- app/code/local/Carotechs/Audittrack/controllers/CustomerController.php +162 -0
- app/code/local/Carotechs/Audittrack/controllers/Promo/CatalogController.php +99 -0
- app/code/local/Carotechs/Audittrack/controllers/Promo/QuoteController.php +107 -0
- app/code/local/Carotechs/Audittrack/etc/adminhtml.xml +37 -0
- app/code/local/Carotechs/Audittrack/etc/config.xml +170 -0
- app/code/local/Carotechs/Audittrack/etc/system.xml +150 -0
- app/code/local/Carotechs/Audittrack/sql/audittrack_setup/mysql4-install-0.1.1.php +18 -0
- app/design/adminhtml/default/default/layout/audittrack.xml +1 -1
- package.xml +7 -9
app/code/local/Carotechs/Audittrack/Block/Aboutconfig.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Block_Aboutconfig
|
3 |
+
extends Mage_Adminhtml_Block_Abstract
|
4 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
5 |
+
{
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Render fieldset html
|
9 |
+
*
|
10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$html = <<<HTML
|
16 |
+
<div style="border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 10px;">
|
17 |
+
<p><b>You can enable or disable Audit Track to the following entities.</b></p>
|
18 |
+
</div>
|
19 |
+
HTML;
|
20 |
+
return $html;
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Carotechs/Audittrack/Block/Aboutprice.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Block_Aboutprice
|
3 |
+
extends Mage_Adminhtml_Block_Abstract
|
4 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
5 |
+
{
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Render fieldset html
|
9 |
+
*
|
10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$html = <<<HTML
|
16 |
+
<div style="border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 10px;">
|
17 |
+
<p><b>You may receive an email notification when product price is changed.</b>
|
18 |
+
<br/>Enable or Disable email notification alert here.</p>
|
19 |
+
</div>
|
20 |
+
HTML;
|
21 |
+
return $html;
|
22 |
+
}
|
23 |
+
}
|
app/code/local/Carotechs/Audittrack/Block/Adminhtml/Audittrack.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Block_Adminhtml_Audittrack extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_audittrack';
|
7 |
+
$this->_blockGroup = 'audittrack';
|
8 |
+
$this->_headerText = Mage::helper('audittrack')->__('Audit Tracks');
|
9 |
+
$this->_addButtonLabel = Mage::helper('audittrack')->__('Add Audittrack');
|
10 |
+
parent::__construct();
|
11 |
+
$this->_removeButton('add');
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Carotechs/Audittrack/Block/Adminhtml/Audittrack/Grid.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Block_Adminhtml_Audittrack_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('audittrackGrid');
|
8 |
+
$this->setDefaultSort('log_id');
|
9 |
+
$this->setDefaultDir('ASC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareCollection()
|
14 |
+
{
|
15 |
+
$collection = Mage::getModel('audittrack/audittrack')->getCollection()->setOrder('log_id', 'DESC');;
|
16 |
+
$this->setCollection($collection);
|
17 |
+
return parent::_prepareCollection();
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _prepareColumns()
|
21 |
+
{
|
22 |
+
$this->addColumn('log_id', array(
|
23 |
+
'header' => Mage::helper('audittrack')->__('ID'),
|
24 |
+
'align' =>'left',
|
25 |
+
'index' => 'log_id',
|
26 |
+
'width' => '20px'
|
27 |
+
));
|
28 |
+
$this->addColumn('log_date', array(
|
29 |
+
'header' => Mage::helper('audittrack')->__('Date'),
|
30 |
+
'align' =>'left',
|
31 |
+
'type' => 'datetime',
|
32 |
+
'index' => 'log_date',
|
33 |
+
'width' => '180px'
|
34 |
+
));
|
35 |
+
$this->addColumn('log_entity', array(
|
36 |
+
'header' => Mage::helper('audittrack')->__('Entity'),
|
37 |
+
'align' =>'left',
|
38 |
+
'index' => 'log_entity',
|
39 |
+
'width' => '180px'
|
40 |
+
));
|
41 |
+
$this->addColumn('log_action', array(
|
42 |
+
'header' => Mage::helper('audittrack')->__('Action'),
|
43 |
+
'align' =>'left',
|
44 |
+
'index' => 'log_action',
|
45 |
+
'width' => '180px'
|
46 |
+
));
|
47 |
+
$this->addColumn('log_comments', array(
|
48 |
+
'header' => Mage::helper('audittrack')->__('Details'),
|
49 |
+
'align' =>'left',
|
50 |
+
'index' => 'log_comments',
|
51 |
+
));
|
52 |
+
$this->addColumn('updated_by', array(
|
53 |
+
'header' => Mage::helper('audittrack')->__('Updated By'),
|
54 |
+
'align' =>'left',
|
55 |
+
'index' => 'updated_by',
|
56 |
+
));
|
57 |
+
$this->addColumn('adminrole', array(
|
58 |
+
'header' => Mage::helper('audittrack')->__('Role'),
|
59 |
+
'align' =>'left',
|
60 |
+
'index' => 'adminrole',
|
61 |
+
));
|
62 |
+
$this->addColumn('website', array(
|
63 |
+
'header' => Mage::helper('audittrack')->__('Website'),
|
64 |
+
'align' =>'left',
|
65 |
+
'index' => 'website',
|
66 |
+
));
|
67 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('audittrack')->__('CSV'));
|
68 |
+
$this->addExportType('*/*/exportXml', Mage::helper('audittrack')->__('XML'));
|
69 |
+
|
70 |
+
return parent::_prepareColumns();
|
71 |
+
}
|
72 |
+
|
73 |
+
protected function _prepareMassaction()
|
74 |
+
{
|
75 |
+
$this->setMassactionIdField('log_id');
|
76 |
+
$this->getMassactionBlock()->setFormFieldName('audittrack');
|
77 |
+
|
78 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
79 |
+
'label' => Mage::helper('audittrack')->__('Delete'),
|
80 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
81 |
+
'confirm' => Mage::helper('audittrack')->__('Are you sure?')
|
82 |
+
));
|
83 |
+
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
+
|
87 |
+
public function getRowUrl($row)
|
88 |
+
{
|
89 |
+
return "";//$this->getUrl('*/*/edit', array('id' => $row->getId()));
|
90 |
+
}
|
91 |
+
}
|
app/code/local/Carotechs/Audittrack/Block/Audittrack.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Block_Audittrack extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getAudittrack()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('audittrack')) {
|
12 |
+
$this->setData('audittrack', Mage::registry('audittrack'));
|
13 |
+
}
|
14 |
+
return $this->getData('audittrack');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Carotechs/Audittrack/Helper/Data.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CarotechsCaptcha Extension
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @category Carotechs
|
7 |
+
* @package Carotechs_Captcha
|
8 |
+
* @author Carotechs
|
9 |
+
* @copyright Copyright (c) 2011 Carotechs.
|
10 |
+
*/
|
11 |
+
class Carotechs_Audittrack_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
}
|
15 |
+
?>
|
app/code/local/Carotechs/Audittrack/Model/Audittrack.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Model_Audittrack extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('audittrack/audittrack');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Carotechs/Audittrack/Model/Mysql4/Audittrack.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Model_Mysql4_Audittrack extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
// Note that the audittrack_id refers to the key field in your database table.
|
7 |
+
$this->_init('audittrack/audittrack', 'log_id');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Carotechs/Audittrack/Model/Mysql4/Audittrack/Collection.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Model_Mysql4_Audittrack_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('audittrack/audittrack');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Carotechs/Audittrack/controllers/Adminhtml/AudittrackController.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Carotechs_Audittrack_Adminhtml_AudittrackController extends Mage_Adminhtml_Controller_action
|
3 |
+
{
|
4 |
+
protected function _initAction() {
|
5 |
+
$this->loadLayout()
|
6 |
+
->_setActiveMenu('audittrack/items')
|
7 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
8 |
+
|
9 |
+
return $this;
|
10 |
+
}
|
11 |
+
public function indexAction()
|
12 |
+
{
|
13 |
+
$this->_initAction()->renderLayout();
|
14 |
+
}
|
15 |
+
public function exportCsvAction()
|
16 |
+
{
|
17 |
+
$fileName = 'audittrack.csv';
|
18 |
+
$content = $this->getLayout()->createBlock('audittrack/adminhtml_audittrack_grid')
|
19 |
+
->getCsv();
|
20 |
+
|
21 |
+
$this->_sendUploadResponse($fileName, $content);
|
22 |
+
}
|
23 |
+
public function exportXmlAction()
|
24 |
+
{
|
25 |
+
$fileName = 'audittrack.xml';
|
26 |
+
$content = $this->getLayout()->createBlock('audittrack/adminhtml_audittrack_grid')
|
27 |
+
->getXml();
|
28 |
+
|
29 |
+
$this->_sendUploadResponse($fileName, $content);
|
30 |
+
}
|
31 |
+
|
32 |
+
public function massDeleteAction() {
|
33 |
+
$audittrackIds = $this->getRequest()->getParam('audittrack');
|
34 |
+
if(!is_array($audittrackIds)) {
|
35 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
36 |
+
} else {
|
37 |
+
try {
|
38 |
+
foreach ($audittrackIds as $audittrackId) {
|
39 |
+
$audittrack = Mage::getModel('audittrack/audittrack')->load($audittrackId);
|
40 |
+
$audittrack->delete();
|
41 |
+
}
|
42 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
43 |
+
Mage::helper('adminhtml')->__(
|
44 |
+
'Total of %d record(s) were successfully deleted', count($audittrackIds)
|
45 |
+
)
|
46 |
+
);
|
47 |
+
} catch (Exception $e) {
|
48 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
49 |
+
}
|
50 |
+
}
|
51 |
+
$this->_redirect('*/*/index');
|
52 |
+
}
|
53 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
54 |
+
{
|
55 |
+
$response = $this->getResponse();
|
56 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
57 |
+
$response->setHeader('Pragma', 'public', true);
|
58 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
59 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
60 |
+
$response->setHeader('Last-Modified', date('r'));
|
61 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
62 |
+
$response->setHeader('Content-Length', strlen($content));
|
63 |
+
$response->setHeader('Content-type', $contentType);
|
64 |
+
$response->setBody($content);
|
65 |
+
$response->sendResponse();
|
66 |
+
die;
|
67 |
+
}
|
68 |
+
}
|
app/code/local/Carotechs/Audittrack/controllers/Catalog/CategoryController.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Carotechs Audittrack Extension
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @category Carotechs
|
7 |
+
* @package Carotechs_Audittrack
|
8 |
+
* @author Carotechs
|
9 |
+
* @copyright Copyright (c) 2011 Carotechs.
|
10 |
+
|
11 |
+
*/
|
12 |
+
|
13 |
+
include_once("Mage/Adminhtml/controllers/Catalog/CategoryController.php");
|
14 |
+
|
15 |
+
class Carotechs_Audittrack_Catalog_CategoryController extends Mage_Adminhtml_Catalog_CategoryController
|
16 |
+
{
|
17 |
+
|
18 |
+
protected function _construct()
|
19 |
+
{
|
20 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
21 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function variables()
|
25 |
+
{
|
26 |
+
$this->_user=Mage::getSingleton('admin/session')->getUser();
|
27 |
+
$this->_userFirstname = $this->_user->getUsername();
|
28 |
+
$this->_roleId = implode('', $this->_user->getRoles());
|
29 |
+
$this->_roleName = Mage::getModel('admin/roles')->load($this->_roleId)->getRoleName();
|
30 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
31 |
+
$this->_store_name=Mage::getModel('core/store')->load($this->_store_id)->getName();
|
32 |
+
if($this->_store_name=='')
|
33 |
+
$this->_store_name='default';
|
34 |
+
}
|
35 |
+
|
36 |
+
public function saveAction()
|
37 |
+
{
|
38 |
+
parent::saveAction();
|
39 |
+
$this->variables();
|
40 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Category"))
|
41 |
+
{
|
42 |
+
$cat = Mage::registry('category');
|
43 |
+
$catId = $cat->getId();
|
44 |
+
$_category = Mage::getModel('catalog/category')->load($catId);
|
45 |
+
$name= $_category->getName();
|
46 |
+
$str="Id->".$catId.", Name->".$name;
|
47 |
+
$now=date('Y-m-d');
|
48 |
+
|
49 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
50 |
+
|
51 |
+
$data['log_action']='Updated';
|
52 |
+
$data['adminrole']=$this->_roleName;
|
53 |
+
$data['website']=$this->_store_name;
|
54 |
+
$data['updated_by']=$this->_userFirstname;
|
55 |
+
$data['log_comments']=$str;
|
56 |
+
$data['log_entity']='Category';
|
57 |
+
$audittrack_model->setData($data);
|
58 |
+
$audittrack_model->save();
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
public function editAction()
|
63 |
+
{
|
64 |
+
//calling parent action.
|
65 |
+
parent::editAction();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function deleteAction()
|
69 |
+
{
|
70 |
+
$this->variables();
|
71 |
+
|
72 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Category"))
|
73 |
+
{
|
74 |
+
$_category_id = $this->getRequest()->getParam('id');
|
75 |
+
$_category = Mage::getModel('catalog/category')->load($_category_id);
|
76 |
+
$url= $_category->getUrl();
|
77 |
+
$name= $_category->getName();
|
78 |
+
|
79 |
+
$str="Id->".$_category_id.", Name->".$name;
|
80 |
+
$now=date('Y-m-d');
|
81 |
+
|
82 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
83 |
+
|
84 |
+
$data['log_action']='Deleted';
|
85 |
+
$data['adminrole']=$this->_roleName;
|
86 |
+
$data['website']=$this->_store_name;
|
87 |
+
$data['updated_by']=$this->_userFirstname;
|
88 |
+
$data['log_comments']=$str;
|
89 |
+
$data['log_entity']='Category';
|
90 |
+
$audittrack_model->setData($data);
|
91 |
+
$audittrack_model->save();
|
92 |
+
}
|
93 |
+
parent::deleteAction();
|
94 |
+
}
|
95 |
+
}
|
96 |
+
?>
|
app/code/local/Carotechs/Audittrack/controllers/Catalog/Product/AttributeController.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Carotechs Audittrack Extension
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @category Carotechs
|
7 |
+
* @package Carotechs_Audittrack
|
8 |
+
* @author Carotechs
|
9 |
+
* @copyright Copyright (c) 2011 Carotechs.
|
10 |
+
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
include_once("Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php");
|
15 |
+
class Carotechs_Audittrack_Catalog_Product_AttributeController extends Mage_Adminhtml_Catalog_Product_AttributeController
|
16 |
+
{
|
17 |
+
|
18 |
+
protected function _construct()
|
19 |
+
{
|
20 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
21 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function variables()
|
25 |
+
{
|
26 |
+
$this->_user=Mage::getSingleton('admin/session')->getUser();
|
27 |
+
$this->_userFirstname = $this->_user->getUsername();
|
28 |
+
$this->_roleId = implode('', $this->_user->getRoles());
|
29 |
+
$this->_roleName = Mage::getModel('admin/roles')->load($this->_roleId)->getRoleName();
|
30 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
31 |
+
$this->_store_name=Mage::getModel('core/store')->load($this->_store_id)->getName();
|
32 |
+
if($this->_store_name=='')
|
33 |
+
$this->_store_name='default';
|
34 |
+
}
|
35 |
+
|
36 |
+
public function saveAction()
|
37 |
+
{
|
38 |
+
//calling parent action.
|
39 |
+
parent::saveAction();
|
40 |
+
$this->variables();
|
41 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Attribute"))
|
42 |
+
{
|
43 |
+
$now=date('Y-m-d');
|
44 |
+
$id=$this->getRequest()->getParam('attribute_id');
|
45 |
+
if($id!='')
|
46 |
+
{
|
47 |
+
$model = Mage::getModel('catalog/resource_eav_attribute');
|
48 |
+
$_setattr = $model->load($id);
|
49 |
+
$name=$_setattr->getAttributeCode();
|
50 |
+
$str='Updated';
|
51 |
+
$msg="Id->".$id.", Code->".$name;
|
52 |
+
}
|
53 |
+
else
|
54 |
+
{
|
55 |
+
$data=$this->getRequest()->getPost();
|
56 |
+
$str='Added';
|
57 |
+
$msg="Code->".$data['attribute_code'];
|
58 |
+
}
|
59 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
60 |
+
|
61 |
+
$data['log_action']=$str;
|
62 |
+
$data['adminrole']=$this->_roleName;
|
63 |
+
$data['website']=$this->_store_name;
|
64 |
+
$data['updated_by']=$this->_userFirstname;
|
65 |
+
$data['log_comments']=$msg;
|
66 |
+
$data['log_entity']='Attribute';
|
67 |
+
$audittrack_model->setData($data);
|
68 |
+
$audittrack_model->save();
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
public function editAction()
|
73 |
+
{
|
74 |
+
//calling parent action.
|
75 |
+
parent::editAction();
|
76 |
+
}
|
77 |
+
|
78 |
+
public function deleteAction()
|
79 |
+
{
|
80 |
+
$this->variables();
|
81 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Attribute"))
|
82 |
+
{
|
83 |
+
$id = $this->getRequest()->getParam('attribute_id');
|
84 |
+
$model = Mage::getModel('catalog/resource_eav_attribute');
|
85 |
+
$_att = $model->load($id);
|
86 |
+
$name=$_att->getName();
|
87 |
+
$str="Id->".$id.", Code->".$name;
|
88 |
+
$now=date('Y-m-d');
|
89 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
90 |
+
|
91 |
+
$data['log_action']='Deleted';
|
92 |
+
$data['adminrole']=$this->_roleName;
|
93 |
+
$data['website']=$this->_store_name;
|
94 |
+
$data['updated_by']=$this->_userFirstname;
|
95 |
+
$data['log_comments']=$str;
|
96 |
+
$data['log_entity']='Attribute';
|
97 |
+
$audittrack_model->setData($data);
|
98 |
+
$audittrack_model->save();
|
99 |
+
}
|
100 |
+
parent::deleteAction();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
?>
|
app/code/local/Carotechs/Audittrack/controllers/Catalog/Product/SetController.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Carotechs Audittrack Extension
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @category Carotechs
|
8 |
+
* @package Carotechs_Audittrack
|
9 |
+
* @author Carotechs
|
10 |
+
* @copyright Copyright (c) 2011 Carotechs.
|
11 |
+
|
12 |
+
*/
|
13 |
+
include_once("Mage/Adminhtml/controllers/Catalog/Product/SetController.php");
|
14 |
+
|
15 |
+
class Carotechs_Audittrack_Catalog_Product_SetController extends Mage_Adminhtml_Catalog_Product_SetController
|
16 |
+
{
|
17 |
+
protected function _construct()
|
18 |
+
{
|
19 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
20 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function variables()
|
24 |
+
{
|
25 |
+
$this->_user=Mage::getSingleton('admin/session')->getUser();
|
26 |
+
$this->_userFirstname = $this->_user->getUsername();
|
27 |
+
$this->_roleId = implode('', $this->_user->getRoles());
|
28 |
+
$this->_roleName = Mage::getModel('admin/roles')->load($this->_roleId)->getRoleName();
|
29 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
30 |
+
$this->_store_name=Mage::getModel('core/store')->load($this->_store_id)->getName();
|
31 |
+
if($this->_store_name=='')
|
32 |
+
$this->_store_name='default';
|
33 |
+
}
|
34 |
+
|
35 |
+
public function saveAction()
|
36 |
+
{
|
37 |
+
parent::saveAction();
|
38 |
+
$this->variables();
|
39 |
+
$now=date('Y-m-d');
|
40 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Attributeset"))
|
41 |
+
{
|
42 |
+
$id=$this->getRequest()->getParam('id');
|
43 |
+
if($id!='')
|
44 |
+
{
|
45 |
+
$model = Mage::getModel('eav/entity_attribute_set');
|
46 |
+
$_setattr = $model->load($id);
|
47 |
+
$name=$_setattr->getAttributeSetName();
|
48 |
+
$str='Updated';
|
49 |
+
$msg="Id->".$id.", Name->".$name;
|
50 |
+
}
|
51 |
+
else
|
52 |
+
{
|
53 |
+
$data=$this->getRequest()->getPost();
|
54 |
+
$str='Added';
|
55 |
+
$msg="Code->".$data['attribute_set_name'];
|
56 |
+
}
|
57 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
58 |
+
|
59 |
+
$data['log_action']=$str;
|
60 |
+
$data['adminrole']=$this->_roleName;
|
61 |
+
$data['website']=$this->_store_name;
|
62 |
+
$data['updated_by']=$this->_userFirstname;
|
63 |
+
$data['log_comments']=$msg;
|
64 |
+
$data['log_entity']='Attribute Set';
|
65 |
+
$audittrack_model->setData($data);
|
66 |
+
$audittrack_model->save();
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
public function editAction()
|
71 |
+
{
|
72 |
+
parent::editAction();
|
73 |
+
}
|
74 |
+
|
75 |
+
public function deleteAction()
|
76 |
+
{
|
77 |
+
$this->variables();
|
78 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Attributeset"))
|
79 |
+
{
|
80 |
+
$id = $this->getRequest()->getParam('id');
|
81 |
+
$model = Mage::getModel('eav/entity_attribute_set');
|
82 |
+
$_setattr = $model->load($id);
|
83 |
+
$name= $_setattr->getAttributeSetName();
|
84 |
+
$str="Id->".$id.", Name->".$name;
|
85 |
+
$now=date('Y-m-d');
|
86 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
87 |
+
|
88 |
+
$data['log_action']='Deleted';
|
89 |
+
$data['adminrole']=$this->_roleName;
|
90 |
+
$data['website']=$this->_store_name;
|
91 |
+
$data['updated_by']=$this->_userFirstname;
|
92 |
+
$data['log_comments']=$str;
|
93 |
+
$data['log_entity']='Attribute Set';
|
94 |
+
$audittrack_model->setData($data);
|
95 |
+
$audittrack_model->save();
|
96 |
+
}
|
97 |
+
parent::deleteAction();
|
98 |
+
}
|
99 |
+
}
|
app/code/local/Carotechs/Audittrack/controllers/Catalog/ProductController.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Carotechs Audittrack Extension
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @category Carotechs
|
7 |
+
* @package Carotechs_Audittrack
|
8 |
+
* @author Carotechs
|
9 |
+
* @copyright Copyright (c) 2011 Carotechs.
|
10 |
+
|
11 |
+
*/
|
12 |
+
|
13 |
+
include_once("Mage/Adminhtml/controllers/Catalog/ProductController.php");
|
14 |
+
|
15 |
+
class Carotechs_Audittrack_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
|
16 |
+
{
|
17 |
+
protected function _construct()
|
18 |
+
{
|
19 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
20 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function variables()
|
24 |
+
{
|
25 |
+
$this->_user=Mage::getSingleton('admin/session')->getUser();
|
26 |
+
$this->_userFirstname = $this->_user->getUsername();
|
27 |
+
$this->_roleId = implode('', $this->_user->getRoles());
|
28 |
+
$this->_roleName = Mage::getModel('admin/roles')->load($this->_roleId)->getRoleName();
|
29 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
30 |
+
$this->_store_name=Mage::getModel('core/store')->load($this->_store_id)->getName();
|
31 |
+
if($this->_store_name=='')
|
32 |
+
$this->_store_name='default';
|
33 |
+
}
|
34 |
+
public function saveAction()
|
35 |
+
{
|
36 |
+
//calling parent action.
|
37 |
+
$this->variables();
|
38 |
+
$productId1 = $this->getRequest()->getParam('id');
|
39 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
40 |
+
//get product details from product id
|
41 |
+
$model1 = Mage::getModel('catalog/product');
|
42 |
+
$_product1 = $model1->setStoreId($this->_store_id)->load($productId1);
|
43 |
+
$price = $_product1->getPrice();
|
44 |
+
|
45 |
+
parent::saveAction();
|
46 |
+
|
47 |
+
$p_data = $this->getRequest()->getPost();
|
48 |
+
$current_price=$p_data['product']['price'];
|
49 |
+
|
50 |
+
$pro = Mage::registry('product');
|
51 |
+
$productId = $pro->getId();
|
52 |
+
|
53 |
+
//get product details from product id
|
54 |
+
$model = Mage::getModel('catalog/product');
|
55 |
+
$_product = $model->setStoreId($this->_store_id)->load($productId);
|
56 |
+
$name= $_product->getName();
|
57 |
+
$p_name= $_product->getName();
|
58 |
+
$sku= $_product->getSku();
|
59 |
+
|
60 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Product"))
|
61 |
+
{
|
62 |
+
//echo $this->_userFirstname;die();
|
63 |
+
if($price!='')
|
64 |
+
{
|
65 |
+
$msg='Updated';
|
66 |
+
}
|
67 |
+
else
|
68 |
+
{
|
69 |
+
$msg='Added';
|
70 |
+
}
|
71 |
+
$str="Id->".$productId.", "."Name->".$name.", "."Sku->".$sku;
|
72 |
+
$now=date('Y-m-d');
|
73 |
+
//connect to Database
|
74 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
75 |
+
$data['log_action']=$msg;
|
76 |
+
$data['adminrole']=$this->_roleName;
|
77 |
+
$data['website']=$this->_store_name;
|
78 |
+
$data['updated_by']=$this->_userFirstname;
|
79 |
+
$data['log_comments']=$str;
|
80 |
+
$data['log_entity']='Product';
|
81 |
+
$audittrack_model->setData($data);
|
82 |
+
$audittrack_model->save();
|
83 |
+
|
84 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/AudittrackPriceAlert/Productprice"))
|
85 |
+
{
|
86 |
+
if($price!=$current_price)
|
87 |
+
{
|
88 |
+
//trans_email_ident_custom1_email
|
89 |
+
/* Sender Name */
|
90 |
+
$from=Mage::getStoreConfig('trans_email/ident_custom2/name');
|
91 |
+
/* Sender Email */
|
92 |
+
$to=Mage::getStoreConfig("Carotechs_Audittrack/AudittrackPriceAlert/Email");
|
93 |
+
$subject='Product update notification.';
|
94 |
+
$headers = 'From: BDS Sales <sales@backdropsource.com>' . "\r\n";
|
95 |
+
$headers .= "Content-type: text/html\r\n";
|
96 |
+
$message = 'Product Details are changed for <b>'.$p_name.'</b><br/>';
|
97 |
+
$message .= '<b> ID :</b>'.$productId.'<br/><b>Sku :</b>'.$sku.'<br/><b>Previous Price : </b>'.$price.'<br/><b>Current Price :</b>'.$current_price.'<br/><b>Website :</b>'.$this->_store_name;
|
98 |
+
//echo $message;die();
|
99 |
+
mail($to,$subject,$message,$headers);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
public function editAction()
|
107 |
+
{
|
108 |
+
//calling parent action.
|
109 |
+
parent::editAction();
|
110 |
+
}
|
111 |
+
|
112 |
+
public function deleteAction()
|
113 |
+
{
|
114 |
+
$this->variables();
|
115 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Product"))
|
116 |
+
{
|
117 |
+
//get product id from parameter
|
118 |
+
$productId = $this->getRequest()->getParam('id');
|
119 |
+
//get product details from product id
|
120 |
+
$model = Mage::getModel('catalog/product');
|
121 |
+
$_product = $model->setStoreId($this->_store_id)->load($productId);
|
122 |
+
$name= $_product->getName();
|
123 |
+
$price= $_product->getPrice();
|
124 |
+
$url= $_product->getProductUrl();
|
125 |
+
$sku= $_product->getSku();
|
126 |
+
|
127 |
+
//get details of current user
|
128 |
+
|
129 |
+
$str="Id->".$productId.", "."Name->".$name.", "."Sku->".$sku;
|
130 |
+
$now=date('Y-m-d');
|
131 |
+
|
132 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
133 |
+
|
134 |
+
$data['log_action']='Deleted';
|
135 |
+
$data['adminrole']=$this->_roleName;
|
136 |
+
$data['website']=$this->_store_name;
|
137 |
+
$data['updated_by']=$this->_userFirstname;
|
138 |
+
$data['log_comments']=$str;
|
139 |
+
$data['log_entity']='Product';
|
140 |
+
$audittrack_model->setData($data);
|
141 |
+
$audittrack_model->save();
|
142 |
+
}
|
143 |
+
|
144 |
+
parent::deleteAction();
|
145 |
+
}
|
146 |
+
|
147 |
+
public function massDeleteAction()
|
148 |
+
{
|
149 |
+
$this->variables();
|
150 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Product"))
|
151 |
+
{
|
152 |
+
$productIds = $this->getRequest()->getParam('product');
|
153 |
+
|
154 |
+
$str='Deleted Products: ';
|
155 |
+
$now=date('Y-m-d');
|
156 |
+
$i=1;
|
157 |
+
|
158 |
+
foreach ($productIds as $productId)
|
159 |
+
{
|
160 |
+
$product = Mage::getSingleton('catalog/product')->setStoreId($this->_store_id)->load($productId);
|
161 |
+
$str .= ' ('.$i.') '."Id->".$productId.", "."Name->".$product->getName().", "."Sku->".$product->getSku();
|
162 |
+
$i++;
|
163 |
+
}
|
164 |
+
|
165 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
166 |
+
$data['log_action']='Mass Delete';
|
167 |
+
$data['adminrole']=$this->_roleName;
|
168 |
+
$data['website']=$this->_store_name;
|
169 |
+
$data['updated_by']=$this->_userFirstname;
|
170 |
+
$data['log_comments']=$str;
|
171 |
+
$data['log_entity']='Product';
|
172 |
+
$audittrack_model->setData($data);
|
173 |
+
$audittrack_model->save();
|
174 |
+
}
|
175 |
+
parent::massDeleteAction();
|
176 |
+
}
|
177 |
+
|
178 |
+
public function massStatusAction()
|
179 |
+
{
|
180 |
+
parent::massStatusAction();
|
181 |
+
$this->variables();
|
182 |
+
$productIds = (array)$this->getRequest()->getParam('product');
|
183 |
+
$str='Updated Products: ';
|
184 |
+
$i=1;
|
185 |
+
foreach ($productIds as $productId)
|
186 |
+
{
|
187 |
+
$product = Mage::getSingleton('catalog/product')->setStoreId($this->_store_id)->load($productId);
|
188 |
+
$str .= ' ('.$i.') '."Id->".$productId.", "."Name->".$product->getName().", "."Sku->".$product->getSku();
|
189 |
+
$i++;
|
190 |
+
}
|
191 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
192 |
+
$data['log_action']='Mass Status Update';
|
193 |
+
$data['adminrole']=$this->_roleName;
|
194 |
+
$data['website']=$this->_store_name;
|
195 |
+
$data['updated_by']=$this->_userFirstname;
|
196 |
+
$data['log_comments']=$str;
|
197 |
+
$data['log_entity']='Product';
|
198 |
+
$audittrack_model->setData($data);
|
199 |
+
$audittrack_model->save();
|
200 |
+
}
|
201 |
+
}
|
202 |
+
?>
|
app/code/local/Carotechs/Audittrack/controllers/CustomerController.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2011 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 admin controller
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
include_once("Mage/Adminhtml/controllers/CustomerController.php");
|
35 |
+
|
36 |
+
class Carotechs_Audittrack_CustomerController extends Mage_Adminhtml_CustomerController
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Save customer action
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
44 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
45 |
+
}
|
46 |
+
|
47 |
+
public function variables()
|
48 |
+
{
|
49 |
+
$this->_user=Mage::getSingleton('admin/session')->getUser();
|
50 |
+
$this->_userFirstname = $this->_user->getUsername();
|
51 |
+
$this->_roleId = implode('', $this->_user->getRoles());
|
52 |
+
$this->_roleName = Mage::getModel('admin/roles')->load($this->_roleId)->getRoleName();
|
53 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
54 |
+
$this->_store_name=Mage::getModel('core/store')->load($this->_store_id)->getName();
|
55 |
+
if($this->_store_name=='')
|
56 |
+
$this->_store_name='default';
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
public function saveAction()
|
61 |
+
{
|
62 |
+
parent::saveAction();
|
63 |
+
$this->variables();
|
64 |
+
|
65 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Customer"))
|
66 |
+
{
|
67 |
+
$data = $this->getRequest()->getPost();
|
68 |
+
//get product id from registry
|
69 |
+
$customer = Mage::registry('current_customer');
|
70 |
+
$customerId = $customer->getId();
|
71 |
+
|
72 |
+
//get product details from product id
|
73 |
+
$model = Mage::getModel('customer/customer');
|
74 |
+
$customer = $model->load($customerId);
|
75 |
+
$email = $customer->getEmail(); // To get Email Address of a customer.
|
76 |
+
|
77 |
+
$firstname = $customer->getFirstname(); // To get Firstname of a customer.
|
78 |
+
$lastname= $customer->getLastname();
|
79 |
+
//get details of current user
|
80 |
+
|
81 |
+
$str='Id->'.$customerId.', Name->'.$firstname.' '.$lastname;
|
82 |
+
$now=date('Y-m-d');
|
83 |
+
|
84 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
85 |
+
|
86 |
+
$data['log_action']='Updated';
|
87 |
+
$data['adminrole']=$this->_roleName;
|
88 |
+
$data['website']=$this->_store_name;
|
89 |
+
$data['updated_by']=$this->_userFirstname;
|
90 |
+
$data['log_comments']=$str;
|
91 |
+
$data['log_entity']='Customer';
|
92 |
+
$audittrack_model->setData($data);
|
93 |
+
$audittrack_model->save();
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
public function editAction()
|
99 |
+
{
|
100 |
+
parent::editAction();
|
101 |
+
}
|
102 |
+
|
103 |
+
public function deleteAction()
|
104 |
+
{
|
105 |
+
$this->variables();
|
106 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Customer"))
|
107 |
+
{
|
108 |
+
$customerId = $this->getRequest()->getParam('id');
|
109 |
+
$model = Mage::getModel('customer/customer');
|
110 |
+
$customer = $model->load($customerId);
|
111 |
+
$email = $customer->getEmail(); // To get Email Address of a customer.
|
112 |
+
|
113 |
+
$firstname = $customer->getFirstname(); // To get Firstname of a customer.
|
114 |
+
$lastname= $customer->getLastname();
|
115 |
+
|
116 |
+
$str='Id->'.$customerId.', Name->'.$firstname.' '.$lastname;
|
117 |
+
$now=date('Y-m-d');
|
118 |
+
|
119 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
120 |
+
|
121 |
+
$data['log_action']='Deleted';
|
122 |
+
$data['adminrole']=$this->_roleName;
|
123 |
+
$data['website']=$this->_store_name;
|
124 |
+
$data['updated_by']=$this->_userFirstname;
|
125 |
+
$data['log_comments']=$str;
|
126 |
+
$data['log_entity']='Customer';
|
127 |
+
$audittrack_model->setData($data);
|
128 |
+
$audittrack_model->save();
|
129 |
+
}
|
130 |
+
parent::deleteAction();
|
131 |
+
}
|
132 |
+
|
133 |
+
public function massDeleteAction()
|
134 |
+
{
|
135 |
+
$this->variables();
|
136 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Customer"))
|
137 |
+
{
|
138 |
+
$customersIds = $this->getRequest()->getParam('customer');
|
139 |
+
|
140 |
+
$str='Deleted Customers: ';
|
141 |
+
$now=date('Y-m-d');
|
142 |
+
$i=1;
|
143 |
+
foreach ($customersIds as $customerId)
|
144 |
+
{
|
145 |
+
$customer = Mage::getSingleton('customer/customer')->load($customerId);
|
146 |
+
$str .= ' ('.$i.') '."Id->".$customerId.", "."Name->".$customer->getName();
|
147 |
+
$i++;
|
148 |
+
}
|
149 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
150 |
+
|
151 |
+
$data['log_action']='Mass Delete';
|
152 |
+
$data['adminrole']=$this->_roleName;
|
153 |
+
$data['website']=$this->_store_name;
|
154 |
+
$data['updated_by']=$this->_userFirstname;
|
155 |
+
$data['log_comments']=$str;
|
156 |
+
$data['log_entity']='Customer';
|
157 |
+
$audittrack_model->setData($data);
|
158 |
+
$audittrack_model->save();
|
159 |
+
}
|
160 |
+
parent::massDeleteAction();
|
161 |
+
}
|
162 |
+
}
|
app/code/local/Carotechs/Audittrack/controllers/Promo/CatalogController.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Carotechs Audittrack Extension
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @category Carotechs
|
7 |
+
* @package Carotechs_Audittrack
|
8 |
+
* @author Carotechs
|
9 |
+
* @copyright Copyright (c) 2011 Carotechs.
|
10 |
+
|
11 |
+
*/
|
12 |
+
include_once("Mage/Adminhtml/controllers/Promo/CatalogController.php");
|
13 |
+
|
14 |
+
class Carotechs_Audittrack_Promo_CatalogController extends Mage_Adminhtml_Promo_CatalogController
|
15 |
+
{
|
16 |
+
protected function _construct()
|
17 |
+
{
|
18 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
19 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function variables()
|
23 |
+
{
|
24 |
+
$this->_user=Mage::getSingleton('admin/session')->getUser();
|
25 |
+
$this->_userFirstname = $this->_user->getUsername();
|
26 |
+
$this->_roleId = implode('', $this->_user->getRoles());
|
27 |
+
$this->_roleName = Mage::getModel('admin/roles')->load($this->_roleId)->getRoleName();
|
28 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
29 |
+
$this->_store_name=Mage::getModel('core/store')->load($this->_store_id)->getName();
|
30 |
+
if($this->_store_name=='')
|
31 |
+
$this->_store_name='default';
|
32 |
+
}
|
33 |
+
|
34 |
+
public function saveAction()
|
35 |
+
{
|
36 |
+
parent::saveAction();
|
37 |
+
$this->variables();
|
38 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Promocat"))
|
39 |
+
{
|
40 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
41 |
+
$str='';
|
42 |
+
$data=$this->getRequest()->getPost();
|
43 |
+
if($data['rule_id']!='')
|
44 |
+
{
|
45 |
+
$id=$data['rule_id'];
|
46 |
+
$model = Mage::getModel('catalogrule/rule')->load($id);
|
47 |
+
$name = $model->getName();
|
48 |
+
$str="Id->".$id.", Name->".$name;
|
49 |
+
$msg='Updated';
|
50 |
+
}
|
51 |
+
else
|
52 |
+
{
|
53 |
+
$msg='Added';
|
54 |
+
$str="Name->".$data['name'];
|
55 |
+
}
|
56 |
+
$now=date('Y-m-d');
|
57 |
+
$data['log_date']=$now;
|
58 |
+
$data['log_action']=$msg;
|
59 |
+
$data['adminrole']=$this->_roleName;
|
60 |
+
$data['website']=$this->_store_name;
|
61 |
+
$data['updated_by']=$this->_userFirstname;
|
62 |
+
$data['log_comments']=$str;
|
63 |
+
$data['log_entity']='Catalog Price Rule';
|
64 |
+
$audittrack_model->setData($data);
|
65 |
+
$audittrack_model->save();
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
public function editAction()
|
70 |
+
{
|
71 |
+
//calling parent action.
|
72 |
+
parent::editAction();
|
73 |
+
}
|
74 |
+
|
75 |
+
public function deleteAction()
|
76 |
+
{
|
77 |
+
$this->variables();
|
78 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Promocat"))
|
79 |
+
{
|
80 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
81 |
+
$id = $this->getRequest()->getParam('id');
|
82 |
+
$model = Mage::getModel('catalogrule/rule')->load($id);
|
83 |
+
$name = $model->getName();
|
84 |
+
$str="Id->".$id.", Name->".$name;
|
85 |
+
$now=date('Y-m-d');
|
86 |
+
$data['log_date']=$now;
|
87 |
+
$data['log_action']='Deleted';
|
88 |
+
$data['adminrole']=$this->_roleName;
|
89 |
+
$data['website']=$this->_store_name;
|
90 |
+
$data['updated_by']=$this->_userFirstname;
|
91 |
+
$data['log_comments']=$str;
|
92 |
+
$data['log_entity']='Catalog Price Rule';
|
93 |
+
$audittrack_model->setData($data);
|
94 |
+
$audittrack_model->save();
|
95 |
+
|
96 |
+
}
|
97 |
+
parent::deleteAction();
|
98 |
+
}
|
99 |
+
}
|
app/code/local/Carotechs/Audittrack/controllers/Promo/QuoteController.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Carotechs Audittrack Extension
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @category Carotechs
|
7 |
+
* @package Carotechs_Audittrack
|
8 |
+
* @author Carotechs
|
9 |
+
* @copyright Copyright (c) 2011 Carotechs.
|
10 |
+
|
11 |
+
*/
|
12 |
+
|
13 |
+
include_once("Mage/Adminhtml/controllers/Promo/QuoteController.php");
|
14 |
+
|
15 |
+
class Carotechs_Audittrack_Promo_QuoteController extends Mage_Adminhtml_Promo_QuoteController
|
16 |
+
{
|
17 |
+
|
18 |
+
protected function _construct()
|
19 |
+
{
|
20 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
21 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function variables()
|
25 |
+
{
|
26 |
+
$this->_user=Mage::getSingleton('admin/session')->getUser();
|
27 |
+
$this->_userFirstname = $this->_user->getUsername();
|
28 |
+
$this->_roleId = implode('', $this->_user->getRoles());
|
29 |
+
$this->_roleName = Mage::getModel('admin/roles')->load($this->_roleId)->getRoleName();
|
30 |
+
$this->_store_id= $this->getRequest()->getParam('store');
|
31 |
+
$this->_store_name=Mage::getModel('core/store')->load($this->_store_id)->getName();
|
32 |
+
if($this->_store_name=='')
|
33 |
+
$this->_store_name='default';
|
34 |
+
}
|
35 |
+
public function saveAction()
|
36 |
+
{
|
37 |
+
//calling parent action.
|
38 |
+
parent::saveAction();
|
39 |
+
$this->variables();
|
40 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Promoshop"))
|
41 |
+
{
|
42 |
+
|
43 |
+
$str='';
|
44 |
+
$data=$this->getRequest()->getPost();
|
45 |
+
if($data['rule_id']!='')
|
46 |
+
{
|
47 |
+
$id=$data['rule_id'];
|
48 |
+
$model = Mage::getModel('salesrule/rule')->load($id);
|
49 |
+
$name = $model->getName();
|
50 |
+
$str=" Id->".$id.", Name->".$name;
|
51 |
+
$msg='Updated';
|
52 |
+
}
|
53 |
+
else
|
54 |
+
{
|
55 |
+
$msg='Added';
|
56 |
+
$str="Name->".$data['name'];
|
57 |
+
}
|
58 |
+
|
59 |
+
$now=date('Y-m-d');
|
60 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
61 |
+
$data['log_date']=$now;
|
62 |
+
$data['log_action']=$msg;
|
63 |
+
$data['adminrole']=$this->_roleName;
|
64 |
+
$data['website']=$this->_store_name;
|
65 |
+
$data['updated_by']=$this->_userFirstname;
|
66 |
+
$data['log_comments']=$str;
|
67 |
+
$data['log_entity']='Shopping Cart Price Rule';
|
68 |
+
$audittrack_model->setData($data);
|
69 |
+
$audittrack_model->save();
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
public function editAction()
|
74 |
+
{
|
75 |
+
//calling parent action.
|
76 |
+
parent::editAction();
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
public function deleteAction()
|
81 |
+
{
|
82 |
+
$this->variables();
|
83 |
+
if(Mage::getStoreConfig("Carotechs_Audittrack/Audittrack/Promoshop"))
|
84 |
+
{
|
85 |
+
//get id from parameter
|
86 |
+
$id = $this->getRequest()->getParam('id');
|
87 |
+
|
88 |
+
//get details from id
|
89 |
+
$model = Mage::getModel('salesrule/rule')->load($id);
|
90 |
+
$name = $model->getName();
|
91 |
+
$str="Id->".$id.", Name->".$name;
|
92 |
+
|
93 |
+
$now=date('Y-m-d');
|
94 |
+
$audittrack_model=Mage::getModel('audittrack/audittrack');
|
95 |
+
$data['log_date']=$now;
|
96 |
+
$data['log_action']='Deleted';
|
97 |
+
$data['adminrole']=$this->_roleName;
|
98 |
+
$data['website']=$this->_store_name;
|
99 |
+
$data['updated_by']=$this->_userFirstname;
|
100 |
+
$data['log_comments']=$str;
|
101 |
+
$data['log_entity']='Shopping Cart Price Rule';
|
102 |
+
$audittrack_model->setData($data);
|
103 |
+
$audittrack_model->save();
|
104 |
+
}
|
105 |
+
parent::deleteAction();
|
106 |
+
}
|
107 |
+
}
|
app/code/local/Carotechs/Audittrack/etc/adminhtml.xml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<adminhtml>
|
2 |
+
<menu>
|
3 |
+
<audittrack>
|
4 |
+
<title>Audit Tracks</title>
|
5 |
+
<sort_order>72</sort_order>
|
6 |
+
<children>
|
7 |
+
<items module="audittrack">
|
8 |
+
<title>View Track</title>
|
9 |
+
<sort_order>71</sort_order>
|
10 |
+
<action>audittrack/adminhtml_audittrack</action>
|
11 |
+
</items>
|
12 |
+
</children>
|
13 |
+
</audittrack>
|
14 |
+
</menu>
|
15 |
+
<acl>
|
16 |
+
<resources>
|
17 |
+
<all>
|
18 |
+
<title>Allow Everything</title>
|
19 |
+
</all>
|
20 |
+
<admin>
|
21 |
+
<children>
|
22 |
+
<Carotechs_Audittrack>
|
23 |
+
<title>Audittrack Module</title>
|
24 |
+
<sort_order>10</sort_order>
|
25 |
+
</Carotechs_Audittrack>
|
26 |
+
</children>
|
27 |
+
</admin>
|
28 |
+
</resources>
|
29 |
+
</acl>
|
30 |
+
<layout>
|
31 |
+
<updates>
|
32 |
+
<audittrack>
|
33 |
+
<file>audittrack.xml</file>
|
34 |
+
</audittrack>
|
35 |
+
</updates>
|
36 |
+
</layout>
|
37 |
+
</adminhtml>
|
app/code/local/Carotechs/Audittrack/etc/config.xml
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Carotechs
|
5 |
+
* @package Carotechs_Audittrack
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Carotechs_Audittrack>
|
13 |
+
<version>0.1.1</version>
|
14 |
+
</Carotechs_Audittrack>
|
15 |
+
</modules>
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<audittrack>
|
19 |
+
<use>standard</use>
|
20 |
+
<args>
|
21 |
+
<module>Carotechs_Audittrack</module>
|
22 |
+
<frontName>audittrack</frontName>
|
23 |
+
</args>
|
24 |
+
</audittrack>
|
25 |
+
</routers>
|
26 |
+
<layout>
|
27 |
+
<updates>
|
28 |
+
<audittrack>
|
29 |
+
<file>audittrack.xml</file>
|
30 |
+
</audittrack>
|
31 |
+
</updates>
|
32 |
+
</layout>
|
33 |
+
</frontend>
|
34 |
+
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<adminhtml>
|
38 |
+
<use>admin</use>
|
39 |
+
<args>
|
40 |
+
<!--<module>Carotechs_Audittrack</module>-->
|
41 |
+
<modules><Carotechs_Audittrack before="Mage_Adminhtml">Carotechs_Audittrack</Carotechs_Audittrack></modules>
|
42 |
+
</args>
|
43 |
+
<!--<modules><Carotechs_Audittrack before="Mage_Adminhtml">Carotechs_Audittrack</Carotechs_Audittrack></modules>-->
|
44 |
+
</adminhtml>
|
45 |
+
</routers>
|
46 |
+
</admin>
|
47 |
+
|
48 |
+
<admin>
|
49 |
+
<routers>
|
50 |
+
<audittrack>
|
51 |
+
<use>admin</use>
|
52 |
+
<args>
|
53 |
+
<module>Carotechs_Audittrack</module>
|
54 |
+
<frontName>audittrack</frontName>
|
55 |
+
</args>
|
56 |
+
</audittrack>
|
57 |
+
</routers>
|
58 |
+
</admin>
|
59 |
+
|
60 |
+
|
61 |
+
<adminhtml>
|
62 |
+
<menu>
|
63 |
+
<audittrack>
|
64 |
+
<title>Audit Tracks</title>
|
65 |
+
<children>
|
66 |
+
<items module="audittrack">
|
67 |
+
<title>View Track</title>
|
68 |
+
<sort_order>5</sort_order>
|
69 |
+
<action>audittrack/adminhtml_audittrack/index</action>
|
70 |
+
</items>
|
71 |
+
</children>
|
72 |
+
</audittrack>
|
73 |
+
</menu>
|
74 |
+
<acl>
|
75 |
+
<resources>
|
76 |
+
<all>
|
77 |
+
<title>Allow Everything</title>
|
78 |
+
</all>
|
79 |
+
<admin>
|
80 |
+
<children>
|
81 |
+
<Carotechs_Audittrack>
|
82 |
+
<title>Tracks</title>
|
83 |
+
<sort_order>10</sort_order>
|
84 |
+
<children>
|
85 |
+
<items module="audittrack">
|
86 |
+
<title>View Tracks</title>
|
87 |
+
</items>
|
88 |
+
</children>
|
89 |
+
</Carotechs_Audittrack>
|
90 |
+
</children>
|
91 |
+
</admin>
|
92 |
+
</resources>
|
93 |
+
</acl>
|
94 |
+
<layout>
|
95 |
+
<updates>
|
96 |
+
<audittrack>
|
97 |
+
<file>audittrack.xml</file>
|
98 |
+
</audittrack>
|
99 |
+
</updates>
|
100 |
+
</layout>
|
101 |
+
</adminhtml>
|
102 |
+
<adminhtml>
|
103 |
+
<acl>
|
104 |
+
<resources>
|
105 |
+
<admin>
|
106 |
+
<children>
|
107 |
+
<system>
|
108 |
+
<children>
|
109 |
+
<config>
|
110 |
+
<children>
|
111 |
+
<Carotechs_Audittrack translate="title" module="audittrack">
|
112 |
+
<title>Carotechs Section</title>
|
113 |
+
<sort_order>100</sort_order>
|
114 |
+
</Carotechs_Audittrack>
|
115 |
+
</children>
|
116 |
+
</config>
|
117 |
+
</children>
|
118 |
+
</system>
|
119 |
+
</children>
|
120 |
+
</admin>
|
121 |
+
</resources>
|
122 |
+
</acl>
|
123 |
+
</adminhtml>
|
124 |
+
<global>
|
125 |
+
<models>
|
126 |
+
<audittrack>
|
127 |
+
<class>Carotechs_Audittrack_Model</class>
|
128 |
+
<resourceModel>audittrack_mysql4</resourceModel>
|
129 |
+
</audittrack>
|
130 |
+
<audittrack_mysql4>
|
131 |
+
<class>Carotechs_Audittrack_Model_Mysql4</class>
|
132 |
+
<entities>
|
133 |
+
<audittrack>
|
134 |
+
<table>caro_log_details</table>
|
135 |
+
</audittrack>
|
136 |
+
</entities>
|
137 |
+
</audittrack_mysql4>
|
138 |
+
</models>
|
139 |
+
<resources>
|
140 |
+
<audittrack_setup>
|
141 |
+
<setup>
|
142 |
+
<module>Carotechs_Audittrack</module>
|
143 |
+
</setup>
|
144 |
+
<connection>
|
145 |
+
<use>core_setup</use>
|
146 |
+
</connection>
|
147 |
+
</audittrack_setup>
|
148 |
+
<audittrack_write>
|
149 |
+
<connection>
|
150 |
+
<use>core_write</use>
|
151 |
+
</connection>
|
152 |
+
</audittrack_write>
|
153 |
+
<audittrack_read>
|
154 |
+
<connection>
|
155 |
+
<use>core_read</use>
|
156 |
+
</connection>
|
157 |
+
</audittrack_read>
|
158 |
+
</resources>
|
159 |
+
<blocks>
|
160 |
+
<audittrack>
|
161 |
+
<class>Carotechs_Audittrack_Block</class>
|
162 |
+
</audittrack>
|
163 |
+
</blocks>
|
164 |
+
<helpers>
|
165 |
+
<audittrack>
|
166 |
+
<class>Carotechs_Audittrack_Helper</class>
|
167 |
+
</audittrack>
|
168 |
+
</helpers>
|
169 |
+
</global>
|
170 |
+
</config>
|
app/code/local/Carotechs/Audittrack/etc/system.xml
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* CarotechsCaptcha Extension
|
5 |
+
*
|
6 |
+
* @category Carotechs
|
7 |
+
* @package Carotechs_Captcha
|
8 |
+
* @author Carotechs
|
9 |
+
* @copyright Copyright (c) 2010 Carotechs.
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<tabs>
|
14 |
+
<Carotechs_extensions translate="label" module="audittrack">
|
15 |
+
<label>Carotechs Extensions</label>
|
16 |
+
<sort_order>1000000</sort_order>
|
17 |
+
</Carotechs_extensions>
|
18 |
+
</tabs>
|
19 |
+
<sections>
|
20 |
+
<Carotechs_Audittrack translate="label" module="audittrack">
|
21 |
+
<label>Audit Track</label>
|
22 |
+
<tab>Carotechs_extensions</tab>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<sort_order>999999</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>0</show_in_website>
|
27 |
+
<show_in_store>0</show_in_store>
|
28 |
+
<groups>
|
29 |
+
<Audittrack translate="label" module="audittrack">
|
30 |
+
<label>Audit Track Configuration</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<sort_order>1</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>0</show_in_website>
|
35 |
+
<show_in_store>0</show_in_store>
|
36 |
+
<fields>
|
37 |
+
<configinfo translate="label">
|
38 |
+
<frontend_model>audittrack/aboutconfig</frontend_model>
|
39 |
+
<sort_order>1</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>0</show_in_website>
|
42 |
+
<show_in_store>0</show_in_store>
|
43 |
+
</configinfo>
|
44 |
+
|
45 |
+
<Product translate="label" module="audittrack">
|
46 |
+
<label>Product</label>
|
47 |
+
<frontend_type>select</frontend_type>
|
48 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
49 |
+
<sort_order>1</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>0</show_in_website>
|
52 |
+
<show_in_store>0</show_in_store>
|
53 |
+
</Product>
|
54 |
+
<Category translate="label" module="audittrack">
|
55 |
+
<label>Catgeory</label>
|
56 |
+
<frontend_type>select</frontend_type>
|
57 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
58 |
+
<sort_order>2</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>0</show_in_website>
|
61 |
+
<show_in_store>0</show_in_store>
|
62 |
+
</Category>
|
63 |
+
<Attribute translate="label" module="audittrack">
|
64 |
+
<label>Attribute</label>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
67 |
+
<sort_order>3</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>0</show_in_website>
|
70 |
+
<show_in_store>0</show_in_store>
|
71 |
+
</Attribute>
|
72 |
+
<Attributeset translate="label" module="audittrack">
|
73 |
+
<label>Attribute Set</label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
76 |
+
<sort_order>3</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>0</show_in_website>
|
79 |
+
<show_in_store>0</show_in_store>
|
80 |
+
</Attributeset>
|
81 |
+
<Promocat translate="label" module="audittrack">
|
82 |
+
<label>Catalog Price Rule</label>
|
83 |
+
<frontend_type>select</frontend_type>
|
84 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
85 |
+
<sort_order>3</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>0</show_in_website>
|
88 |
+
<show_in_store>0</show_in_store>
|
89 |
+
</Promocat>
|
90 |
+
<Promoshop translate="label" module="audittrack">
|
91 |
+
<label>Shopping Cart Price</label>
|
92 |
+
<frontend_type>select</frontend_type>
|
93 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
94 |
+
<sort_order>3</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>0</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</Promoshop>
|
99 |
+
<Customer translate="label" module="audittrack">
|
100 |
+
<label>Customer</label>
|
101 |
+
<frontend_type>select</frontend_type>
|
102 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
103 |
+
<sort_order>4</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
<show_in_website>0</show_in_website>
|
106 |
+
<show_in_store>0</show_in_store>
|
107 |
+
</Customer>
|
108 |
+
</fields>
|
109 |
+
</Audittrack>
|
110 |
+
<AudittrackPriceAlert>
|
111 |
+
<label>Price Update Notification</label>
|
112 |
+
<frontend_type>text</frontend_type>
|
113 |
+
<sort_order>2</sort_order>
|
114 |
+
<show_in_default>1</show_in_default>
|
115 |
+
<show_in_website>0</show_in_website>
|
116 |
+
<show_in_store>0</show_in_store>
|
117 |
+
<fields>
|
118 |
+
<info translate="label">
|
119 |
+
<frontend_model>audittrack/aboutprice</frontend_model>
|
120 |
+
<sort_order>1</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>0</show_in_website>
|
123 |
+
<show_in_store>0</show_in_store>
|
124 |
+
</info>
|
125 |
+
|
126 |
+
<Productprice translate="label" module="audittrack">
|
127 |
+
<label>Send Notification</label>
|
128 |
+
<frontend_type>select</frontend_type>
|
129 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
130 |
+
<sort_order>2</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>0</show_in_website>
|
133 |
+
<show_in_store>0</show_in_store>
|
134 |
+
</Productprice>
|
135 |
+
|
136 |
+
<Email translate="label" module="audittrack">
|
137 |
+
<label>Email for notification</label>
|
138 |
+
<comment>example: john@gmail.com</comment>
|
139 |
+
<frontend_type>text</frontend_type>
|
140 |
+
<sort_order>3</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>0</show_in_website>
|
143 |
+
<show_in_store>0</show_in_store>
|
144 |
+
</Email>
|
145 |
+
</fields>
|
146 |
+
</AudittrackPriceAlert>
|
147 |
+
</groups>
|
148 |
+
</Carotechs_Audittrack>
|
149 |
+
</sections>
|
150 |
+
</config>
|
app/code/local/Carotechs/Audittrack/sql/audittrack_setup/mysql4-install-0.1.1.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->run("DROP TABLE IF EXISTS {$this->getTable('caro_log_details')};
|
5 |
+
CREATE TABLE `caro_log_details` (
|
6 |
+
`log_id` int(11) NOT NULL auto_increment,
|
7 |
+
`log_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
8 |
+
`log_action` varchar(50) NOT NULL,
|
9 |
+
`adminrole` varchar(25) NOT NULL,
|
10 |
+
`website` varchar(25) NOT NULL,
|
11 |
+
`updated_by` varchar(25) NOT NULL,
|
12 |
+
`log_comments` varchar(255) NOT NULL,
|
13 |
+
`log_entity` varchar(50) NOT NULL,
|
14 |
+
PRIMARY KEY (`log_id`)
|
15 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
16 |
+
");
|
17 |
+
$installer->endSetup();
|
18 |
+
?>
|
app/design/adminhtml/default/default/layout/audittrack.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.
|
3 |
<audittrack_adminhtml_audittrack_index>
|
4 |
<reference name="content">
|
5 |
<block type="audittrack/adminhtml_audittrack" name="audittrack" />
|
1 |
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.1">
|
3 |
<audittrack_adminhtml_audittrack_index>
|
4 |
<reference name="content">
|
5 |
<block type="audittrack/adminhtml_audittrack" name="audittrack" />
|
package.xml
CHANGED
@@ -1,20 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Carotechs_Audittrack</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
|
12 |
-
It also allows to send email notification when the product price is updated.</description>
|
13 |
-
<notes>First Release</notes>
|
14 |
<authors><author><name>Carotechs</name><user>carotechsinc</user><email>apps@carotechs.com</email></author></authors>
|
15 |
-
<date>2013-07-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magelocal"><dir name="Carotechs"><file name="Audittrack" hash=""/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="audittrack.xml" hash="
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Carotechs_Audittrack</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Audittrack log all actions you perform in key Magento entities in the backend of your Magento store!</summary>
|
10 |
+
<description>AuditLog extension is simple but powerful mechanism to log and track the changes made in the major Magento entities in the Magento Admin. It also allows to send email notification when the product price is updated. List of entities logged: Product, Category, Attribute, Attribute Set, Price Rules and Customer.</description>
|
11 |
+
<notes>Initial Release</notes>
|
|
|
|
|
12 |
<authors><author><name>Carotechs</name><user>carotechsinc</user><email>apps@carotechs.com</email></author></authors>
|
13 |
+
<date>2013-07-18</date>
|
14 |
+
<time>04:46:05</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Carotechs"><dir name="Audittrack"><dir name="Block"><file name="Aboutconfig.php" hash="59aef46dfc28403283126fedf6c37b48"/><file name="Aboutprice.php" hash="2326296050f48c8688ba02e8eae3b0da"/><dir name="Adminhtml"><dir name="Audittrack"><file name="Grid.php" hash="89088141bc7e65ed7f9e10cd6411b2df"/></dir><file name="Audittrack.php" hash="e951f4d043132c20fe27b796680ddc12"/></dir><file name="Audittrack.php" hash="9b00af50e8207c1309b2e40b2612a311"/></dir><dir name="Helper"><file name="Data.php" hash="8bda5cc47def24a8b64e7e6dd87ad7de"/></dir><dir name="Model"><file name="Audittrack.php" hash="57cc96db1fd2d1dcd6925da2f454bc35"/><dir name="Mysql4"><dir name="Audittrack"><file name="Collection.php" hash="19a55edf9900150dda6e05ad5e785646"/></dir><file name="Audittrack.php" hash="36b6b2d3c082fa116f6359ee7ae12a57"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AudittrackController.php" hash="fc646ed73c774a280df64c8fb9ad72dc"/></dir><dir name="Catalog"><file name="CategoryController.php" hash="a8488e3d28ab0ffdfa3a34ab00a10532"/><dir name="Product"><file name="AttributeController.php" hash="49aabe7443707ae7a3606a4cf4aec13d"/><file name="SetController.php" hash="c862c562fd686a4377b4723a98c83f98"/></dir><file name="ProductController.php" hash="12f0a4fd3d3e071d7571dd30bdca18f3"/></dir><file name="CustomerController.php" hash="f0a322b2bde60283c422da58f25c4ffd"/><dir name="Promo"><file name="CatalogController.php" hash="61e30758870a13b45aa6cc46bedf40dd"/><file name="QuoteController.php" hash="e2aed1ce668a0b47517eb33b4e5084b3"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5f6b82a7ee69ac288d76482cbaecfbbb"/><file name="config.xml" hash="4ea1b5e8bf91db45ecc7a743b84693d8"/><file name="system.xml" hash="6c451bfa506cd6474c0ae27fb39ae566"/></dir><dir name="sql"><dir name="audittrack_setup"><file name="mysql4-install-0.1.1.php" hash="ed8af37952d290c0632666172892794b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="audittrack.xml" hash="fc25d9a6aef583a103422a926f76677b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Carotechs_Audittrack.xml" hash="9f1a85ba90bd65b2bb44127e02b40331"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|