Getsquare_AdminOrderLog - Version 1.0.0

Version Notes

Initial Release

Download this release

Release Info

Developer GetSquare
Extension Getsquare_AdminOrderLog
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Getsquare/AdminOrderLog/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Getsquare_AdminOrderName
4
+ * @author Getsquare magento@getsquare.co.uk
5
+ * @copyright 2014 GetSquare
6
+ */
7
+ class Getsquare_AdminOrderLog_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+
10
+ }
app/code/community/Getsquare/AdminOrderLog/Model/Entry.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Getsquare_AdminOrderLog_Model_Entry extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('admin_order_log/entry');
8
+ }
9
+ }
app/code/community/Getsquare/AdminOrderLog/Model/Observer.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Getsquare_AdminOrderName
4
+ * @author Getsquare magento@getsquare.co.uk
5
+ * @copyright 2014 GetSquare
6
+ */
7
+ class Getsquare_AdminOrderLog_Model_Observer
8
+ {
9
+
10
+ /**
11
+ * Adds the username to order object
12
+ *
13
+ * @param Varien_Event_Observer $observer
14
+ *
15
+ * @return void
16
+ */
17
+ public function addUserName(Varien_Event_Observer $observer)
18
+ {
19
+ $order = $observer->getEvent()->getOrder();
20
+ $adminUser = Mage::getSingleton('admin/session')->getUser();
21
+ if (! $adminUser) {
22
+ return;
23
+ }
24
+ if (! $order) {
25
+ return;
26
+ }
27
+ $adminLog = Mage::getModel('admin_order_log/entry');
28
+ $adminLog->setData('placed_by_user', $adminUser->getUsername());
29
+ $adminLog->setData('log_order_increment_id', $order->getIncrementId());
30
+ $adminLog->save();
31
+ }
32
+
33
+ /**
34
+ * Add order placed to collection
35
+ *
36
+ * @param Varien_Event_Observer $observer
37
+ *
38
+ * @return void
39
+ */
40
+ public function salesOrderGridCollectionLoadBefore(Varien_Event_Observer $observer)
41
+ {
42
+ $collection = $observer->getOrderGridCollection();
43
+ $collection->getSelect()
44
+ ->joinLeft(
45
+ array(
46
+ 'sales_order_placed_by' => Mage::getSingleton('core/resource')->getTableName('admin_order_log/entry')
47
+ ),
48
+ 'main_table.increment_id = sales_order_placed_by.log_order_increment_id',
49
+ array('sales_order_placed_by.placed_by_user')
50
+ );
51
+ }
52
+ }
app/code/community/Getsquare/AdminOrderLog/Model/Resource/Entry.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Getsquare_AdminOrderLog_Model_Resource_Entry
4
+ extends Mage_Core_Model_Resource_Db_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ $this->_init('admin_order_log/entry', 'log_id');
9
+ }
10
+ }
app/code/community/Getsquare/AdminOrderLog/Model/Resource/Entry/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Getsquare_AdminOrderLog_Model_Resource_Entry_Collection
4
+ extends Mage_Core_Model_Resource_Db_Collection_Abstract
5
+ {
6
+ protected function _construct()
7
+ {
8
+ $this->_init('admin_order_log/entry');
9
+ }
10
+
11
+ }
app/code/community/Getsquare/AdminOrderLog/etc/config.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Getsquare_AdminOrderLog>
5
+ <version>0.1.0</version>
6
+ </Getsquare_AdminOrderLog>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <getsquare_admin_order_log>
11
+ <class>Getsquare_AdminOrderLog_Helper</class>
12
+ </getsquare_admin_order_log>
13
+ </helpers>
14
+ <models>
15
+ <admin_order_log>
16
+ <class>Getsquare_AdminOrderLog_Model</class>
17
+ <resourceModel>admin_order_log_resource</resourceModel>
18
+ </admin_order_log>
19
+ <admin_order_log_resource>
20
+ <class>Getsquare_AdminOrderLog_Model_Resource</class>
21
+ <entities>
22
+ <entry>
23
+ <table>getsquare_admin_order_log</table>
24
+ </entry>
25
+ </entities>
26
+ </admin_order_log_resource>
27
+ </models>
28
+ <resources>
29
+ <getsquare_admin_order_log_setup>
30
+ <setup>
31
+ <module>Getsquare_AdminOrderLog</module>
32
+ </setup>
33
+ <connection>
34
+ <use>core_setup</use>
35
+ </connection>
36
+ </getsquare_admin_order_log_setup>
37
+ </resources>
38
+ </global>
39
+ <adminhtml>
40
+ <events>
41
+ <sales_order_place_after>
42
+ <observers>
43
+ <admin_order_log_after_order_save>
44
+ <type>model</type>
45
+ <class>Getsquare_AdminOrderLog_Model_Observer</class>
46
+ <method>addUserName</method>
47
+ </admin_order_log_after_order_save>
48
+ </observers>
49
+ </sales_order_place_after>
50
+ <sales_order_grid_collection_load_before>
51
+ <observers>
52
+ <add_admin_user_name_to_grid_collection>
53
+ <type>model</type>
54
+ <class>Getsquare_AdminOrderLog_Model_Observer</class>
55
+ <method>salesOrderGridCollectionLoadBefore</method>
56
+ </add_admin_user_name_to_grid_collection>
57
+ </observers>
58
+ </sales_order_grid_collection_load_before>
59
+ </events>
60
+ <layout>
61
+ <updates>
62
+ <getsquare_admin_order_log>
63
+ <file>getsquare_admin_order_log.xml</file>
64
+ </getsquare_admin_order_log>
65
+ </updates>
66
+ </layout>
67
+ </adminhtml>
68
+ </config>
app/code/community/Getsquare/AdminOrderLog/sql/getsquare_admin_order_log_setup/install-0.1.0.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $installer Mage_Core_Model_Resource_Setup */
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ /**
8
+ * Create table 'admin_order_log/entry'
9
+ */
10
+ $table = $installer->getConnection()
11
+ ->newTable($installer->getTable('admin_order_log/entry'))
12
+ ->addColumn('log_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
13
+ 'identity' => true,
14
+ 'nullable' => false,
15
+ 'primary' => true,
16
+ ), 'Admin Log ID')
17
+ ->addColumn('log_order_increment_id', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
18
+ 'nullable' => false,
19
+ ), 'Increment Id')
20
+ ->addColumn('placed_by_user', Varien_Db_Ddl_Table::TYPE_TEXT, 40, array(
21
+ 'nullable' => true,
22
+ ), 'User Name');
23
+
24
+ $installer->getConnection()->createTable($table);
25
+
26
+ $this->endSetup();
app/etc/modules/Getsquare_AdminOrderLog.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Getsquare_AdminOrderLog>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Getsquare_AdminOrderLog>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Getsquare_AdminOrderLog</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/OSL-3.0">OSL 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>A Magento extension which helps businesses identify which user processed a Backend (Admin) order.</summary>
10
+ <description>This small but handy extension logs the username against a Backend (Admin) processed order and displays this in the order grid.</description>
11
+ <notes>Initial Release</notes>
12
+ <authors><author><name>GetSquare</name><user>GetSquare</user><email>online@getsquare.co.uk</email></author></authors>
13
+ <date>2014-08-25</date>
14
+ <time>19:22:21</time>
15
+ <contents><target name="magecommunity"><dir name="Getsquare"><dir name="AdminOrderLog"><dir name="Helper"><file name="Data.php" hash="fe12a47ca911a02f051438aa29fd2d4b"/></dir><dir name="Model"><file name="Entry.php" hash="e48a119d02c3e2e51d6081723794b9f1"/><file name="Observer.php" hash="38936cc2add2b4a137aea66e961e35be"/><dir name="Resource"><dir name="Entry"><file name="Collection.php" hash="3debbf0b9c1fc780b676b738c39cf202"/></dir><file name="Entry.php" hash="f8716af596fecfdadbb12193e9e6053f"/></dir></dir><dir name="etc"><file name="config.xml" hash="38255cca8c63d01a3e88cf0a76cce2e0"/></dir><dir name="sql"><dir name="getsquare_admin_order_log_setup"><file name="install-0.1.0.php" hash="95e1ce9b74598e0bd7d5590c3c17a6c2"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Getsquare_AdminOrderLog.xml" hash="bc6bf29ec10d47f9a0d8cb2cff5e31d2"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>