Plumrocket_Auto_Invoice - Version 1.0.2

Version Notes

Plumrocket Auto Invoice

Download this release

Release Info

Developer Plumrocket Team
Extension Plumrocket_Auto_Invoice
Version 1.0.2
Comparing to
See all releases


Version 1.0.2

app/code/community/Plumrocket/AutoInvoice/Block/System/Config/Version.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plumrocket Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the End-user License Agreement
8
+ * that is available through the world-wide-web at this URL:
9
+ * http://wiki.plumrocket.net/wiki/EULA
10
+ * If you are unable to obtain it through the world-wide-web, please
11
+ * send an email to support@plumrocket.com so we can send you a copy immediately.
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file
16
+ *
17
+ * @package Plumrocket_Auto_Invoice
18
+ * @copyright Copyright (c) 2013 Plumrocket Inc. (http://www.plumrocket.com)
19
+ * @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
20
+ */
21
+ ?>
22
+ <?php
23
+
24
+ class Plumrocket_Autoinvoice_Block_System_Config_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
25
+ {
26
+
27
+ public function render(Varien_Data_Form_Element_Abstract $element)
28
+ {
29
+ $version = Mage::getConfig()->getNode('modules/Plumrocket_AutoInvoice')->version;
30
+ $wiki_url = Mage::getConfig()->getNode('modules/Plumrocket_AutoInvoice')->wiki;
31
+
32
+ return $this->includeJs() . '<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
33
+ Plumrocket Auto Invoice v' . $version . ' was developed by <a href="http://www.plumrocket.com" target="_blank">Plumrocket Inc</a>.
34
+ For manual & video tutorials please refer to <a href="' . $wiki_url . '" target="_blank">our online documentation<a/>.
35
+ </div>';
36
+ }
37
+
38
+ private function includeJs()
39
+ {
40
+ $baseJsUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
41
+
42
+ return '<script src="' . $baseJsUrl . 'tiny_mce/tiny_mce.js" type="text/javascript"></script>
43
+ <script src="' . $baseJsUrl . 'mage/adminhtml/wysiwyg/tiny_mce/setup.js" type="text/javascript"></script>
44
+ <script src="' . $baseJsUrl . 'mage/adminhtml/variables.js" type="text/javascript"></script>
45
+ <script src="' . $baseJsUrl . 'mage/adminhtml/wysiwyg/widget.js" type="text/javascript"></script>
46
+ <script type="text/javascript">
47
+ var basePopupPath = "' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '";
48
+ var basePopupSkinPath = "' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . '";
49
+ </script>
50
+
51
+ <link href="' . $baseJsUrl . 'prototype/windows/themes/default.css" type="text/css" rel="stylesheet" />
52
+ <link href="' . $baseJsUrl . 'prototype/windows/themes/magento.css" type="text/css" rel="stylesheet" />';
53
+ }
54
+ }
app/code/community/Plumrocket/AutoInvoice/Helper/Data.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plumrocket Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the End-user License Agreement
8
+ * that is available through the world-wide-web at this URL:
9
+ * http://wiki.plumrocket.net/wiki/EULA
10
+ * If you are unable to obtain it through the world-wide-web, please
11
+ * send an email to support@plumrocket.com so we can send you a copy immediately.
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file
16
+ *
17
+ * @package Plumrocket_Auto_Invoice
18
+ * @copyright Copyright (c) 2013 Plumrocket Inc. (http://www.plumrocket.com)
19
+ * @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
20
+ */
21
+ ?>
22
+ <?php
23
+
24
+ class Plumrocket_AutoInvoice_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+ private $_configPrefix = 'autoinvoice/';
27
+
28
+ public function moduleEnabled(){
29
+ return Mage::getStoreConfig($this->_configPrefix.'general/enabled');
30
+ }
31
+ }
32
+
app/code/community/Plumrocket/AutoInvoice/Model/Observer.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plumrocket Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the End-user License Agreement
8
+ * that is available through the world-wide-web at this URL:
9
+ * http://wiki.plumrocket.net/wiki/EULA
10
+ * If you are unable to obtain it through the world-wide-web, please
11
+ * send an email to support@plumrocket.com so we can send you a copy immediately.
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file
16
+ *
17
+ * @package Plumrocket_Auto_Invoice
18
+ * @copyright Copyright (c) 2013 Plumrocket Inc. (http://www.plumrocket.com)
19
+ * @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
20
+ */
21
+ ?>
22
+ <?php
23
+
24
+ class Plumrocket_AutoInvoice_Model_Observer
25
+ {
26
+
27
+ public function salesOrderSaveCommitAfter(Varien_Event_Observer $observer)
28
+ {
29
+
30
+ if (!Mage::helper('autoinvoice')->moduleEnabled()){
31
+ return $this;
32
+ }
33
+
34
+ $order = $observer->getEvent()->getOrder();
35
+ if ( ($order->getState() == Mage_Sales_Model_Order::STATE_NEW || $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) && !$order->getIsProcessedByMCornerOrdersObserver() )
36
+ {
37
+ $orders = Mage::getModel('sales/order_invoice')->getCollection()->addAttributeToFilter('order_id', array('eq'=>$order->getId()));
38
+ $orders->getSelect()->limit(1);
39
+ if ((int)$orders->count() !== 0) {
40
+ return $this;
41
+ }
42
+
43
+ try {
44
+ if(!$order->canInvoice()) {
45
+ $order->addStatusHistoryComment('Auto Invoice: Order cannot be invoiced.', false);
46
+ $order->save();
47
+ }
48
+
49
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
50
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
51
+
52
+ $incrementId = Mage::getModel('sales/order_invoice')->getCollection()
53
+ ->addFieldToFilter('store_id', Mage::app()->getStore()->getId())
54
+ ->setOrder('increment_id','DESC')
55
+ ->setPageSize(1)
56
+ ->setCurPage(1)
57
+ ->getFirstItem()
58
+ ->getIncrementId();
59
+
60
+ $invoice->setIncrementId($incrementId + 1);
61
+ $invoice->sendEmail('true','');
62
+ $invoice->setIncrementId(null);
63
+
64
+
65
+
66
+ $invoice->register();
67
+ $invoice->getOrder()->setCustomerNoteNotify(false);
68
+ $invoice->getOrder()->setIsInProcess(true);
69
+
70
+ $order->addStatusHistoryComment('Auto Invoice: Order invoiced.', false);
71
+ $transaction = Mage::getModel('core/resource_transaction')
72
+ ->addObject($invoice)
73
+ ->addObject($invoice->getOrder());
74
+ $transaction->save();
75
+
76
+ } catch (Exception $e) {
77
+ $order->addStatusHistoryComment('Auto Invoice: Unexpected error: '.$e->getMessage(), false);
78
+ $order->save();
79
+ }
80
+ }
81
+ return $this;
82
+ }
83
+
84
+
85
+
86
+ }
app/code/community/Plumrocket/AutoInvoice/etc/adminhtml.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <autoinvoice translate="title" module="autoinvoice">
12
+ <title>Plumrocket Auto Invoice Section</title>
13
+ <sort_order>1600</sort_order>
14
+ </autoinvoice>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ <plumrocket>
20
+ <title>Plumrocket</title>
21
+ <sort_order>80</sort_order>
22
+ <children>
23
+ <autoinvoice>
24
+ <title>Auto Invoice</title>
25
+ <sort_order>270</sort_order>
26
+ </autoinvoice>
27
+ </children>
28
+ </plumrocket>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ <menu>
34
+ <plumrocket>
35
+ <title>Plumrocket</title>
36
+ <sort_order>80</sort_order>
37
+ <children>
38
+ <autoinvoice>
39
+ <title>Auto Invoice</title>
40
+ <sort_order>270</sort_order>
41
+ <action>adminhtml/system_config/edit/section/autoinvoice</action>
42
+ </autoinvoice>
43
+ </children>
44
+ </plumrocket>
45
+ </menu>
46
+ </config>
app/code/community/Plumrocket/AutoInvoice/etc/config.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Plumrocket_AutoInvoice>
5
+ <version>1.0.2</version>
6
+ </Plumrocket_AutoInvoice>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <autoinvoice>
11
+ <class>Plumrocket_AutoInvoice_Helper</class>
12
+ </autoinvoice>
13
+ </helpers>
14
+ <blocks>
15
+ <autoinvoice>
16
+ <class>Plumrocket_AutoInvoice_Block</class>
17
+ </autoinvoice>
18
+ </blocks>
19
+ <models>
20
+ <autoinvoice>
21
+ <class>Plumrocket_AutoInvoice_Model</class>
22
+ <resourceModel>autoinvoice_mysql4</resourceModel>
23
+ </autoinvoice>
24
+ </models>
25
+ <events>
26
+ <sales_order_save_commit_after>
27
+ <observers>
28
+ <sales_order_save_commit_after_handler>
29
+ <type>model</type>
30
+ <class>autoinvoice/observer</class>
31
+ <method>salesOrderSaveCommitAfter</method>
32
+ <args></args>
33
+ </sales_order_save_commit_after_handler>
34
+ </observers>
35
+ </sales_order_save_commit_after>
36
+ </events>
37
+ </global>
38
+ </config>
app/code/community/Plumrocket/AutoInvoice/etc/system.xml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <plumrocket>
5
+ <label>
6
+ <![CDATA[
7
+ <div style="padding-left:22px; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZ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d7s0TeSigTFWYOKJX2w2vKYrk8urq7P/6m/gVfV6ZRl2alKzznws4fnUnKpQcms0zf+9GKtKvdWik/flz6uP9ze3QQdwTBJBqouBnpmZL5qH+S7y232XiIOTguzemc5PJ+p5963VCjAGP6fJWlCZXkLeDR6MYPR2c13jO3tpZZmniE2M04IRcKAPCKYiQrKFtGtRc4YjIApkkmBJGqCR9lG48B1s0JR0dMaAc3posaBPIM8daMsVBpmMLiwHPhI/k+AAQDYqY0eXeLHAgAAAABJRU5ErkJggg==) left 50% no-repeat;">Plumrocket Inc.</div> ]]>
8
+ </label>
9
+ <class>plumrocket_section</class>
10
+ <sort_order>101</sort_order>
11
+ </plumrocket>
12
+ </tabs>
13
+ <sections>
14
+ <autoinvoice translate="label" module="autoinvoice">
15
+ <label>Auto Invoice</label>
16
+ <tab>plumrocket</tab>
17
+ <frontend_type>text</frontend_type>
18
+ <sort_order>1600</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ <groups>
23
+ <general translate="label">
24
+ <label>General</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>0</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <fields>
31
+ <version translate="label">
32
+ <frontend_type>text</frontend_type>
33
+ <frontend_model>autoinvoice/system_config_version</frontend_model>
34
+ <sort_order>10</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </version>
39
+ <enabled translate="label">
40
+ <label>Enable Plumrocket Auto Invoice</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>adminhtml/system_config_source_yesno</source_model>
43
+ <sort_order>0</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <comment></comment>
48
+ </enabled>
49
+ </fields>
50
+ </general>
51
+ </groups>
52
+ </autoinvoice>
53
+ </sections>
54
+ </config>
app/etc/modules/Plumrocket_AutoInvoice.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Plumrocket_AutoInvoice>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>1.0.2</version>
8
+ <wiki>http://wiki.plumrocket.com/wiki/Magento_Auto_Invoice_v1.x_Extension</wiki>
9
+ </Plumrocket_AutoInvoice>
10
+ </modules>
11
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Plumrocket_Auto_Invoice</name>
4
+ <version>1.0.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://wiki.plumrocket.net/wiki/EULA">End-user License Agreement</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Plumrocket Auto Invoice is a convenient Magento payment processing module that was designed to generate invoice automatically.</summary>
10
+ <description>Plumrocket Auto Invoice is a convenient Magento payment processing module that was designed to generate invoice automatically. After a client confirms his order the system will send the invoice automatically thus allowing website admin to avoid manual processing of payment transactions.</description>
11
+ <notes>Plumrocket Auto Invoice</notes>
12
+ <authors><author><name>Plumrocket Team</name><user>plumrocket</user><email>support@plumrocket.com</email></author></authors>
13
+ <date>2013-09-18</date>
14
+ <time>07:56:53</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Plumrocket_AutoInvoice.xml" hash="e5f828c16dc2563ea55373d83e93b837"/></dir></target><target name="magecommunity"><dir name="Plumrocket"><dir name="AutoInvoice"><dir name="Block"><dir name="System"><dir name="Config"><file name="Version.php" hash="3adcf7698f60ef53547cb6259797668c"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ab7a87f35fd20b8dfeb90b20f3ce6020"/></dir><dir name="Model"><file name="Observer.php" hash="f1d22b9ee93019aa674e6c6bb6ee03a5"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e45a29110a7ea4ed9e26535cca2f47a4"/><file name="config.xml" hash="1cb5afa9b2997aeef7b3bcdee185c7b6"/><file name="system.xml" hash="327ed7120fca05dbb062d59479deddc9"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>