Version Notes
Fixed some minor bugs.
Download this release
Release Info
Developer | Prakash Vaniya |
Extension | Phxsolution_Autoinvoiceshipment |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Phxsolution/Autoinvoiceshipment/Helper/Data.php +34 -0
- app/code/community/Phxsolution/Autoinvoiceshipment/Model/Observer.php +100 -0
- app/code/community/Phxsolution/Autoinvoiceshipment/etc/config.xml +79 -0
- app/code/community/Phxsolution/Autoinvoiceshipment/etc/system.xml +65 -0
- app/etc/modules/Phxsolution_Autoinvoiceshipment.xml +35 -0
- package.xml +18 -0
app/code/community/Phxsolution/Autoinvoiceshipment/Helper/Data.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
/**
|
4 |
+
* PHXSolution Autoinvoice and shipment
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category Autoinvoiceshipment Helper
|
19 |
+
* @package Phxsolution_Autoinvoiceshipment
|
20 |
+
* @author Prakash Vaniya
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 PHXSolution
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
class Phxsolution_Autoinvoiceshipment_Helper_Data extends Mage_Core_Helper_Abstract
|
29 |
+
{
|
30 |
+
public function getIsEnabled()
|
31 |
+
{
|
32 |
+
return Mage::getStoreConfig('autoinvoiceshipment_section/settings/enabled');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Phxsolution/Autoinvoiceshipment/Model/Observer.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
/**
|
4 |
+
* PHXSolution Autoinvoice and shipment
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category Autoinvoiceshipment Model
|
19 |
+
* @package Phxsolution_Autoinvoiceshipment
|
20 |
+
* @author Prakash Vaniya
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 PHXSolution
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
class Phxsolution_Autoinvoiceshipment_Model_Observer
|
29 |
+
{
|
30 |
+
public function automaticallyInvoiceShipCompleteOrder(Varien_Event_Observer $observer)
|
31 |
+
{
|
32 |
+
if(Mage::helper('autoinvoiceshipment')->getIsEnabled())
|
33 |
+
{
|
34 |
+
//Mage::dispatchEvent('admin_session_user_login_success', array('user'=>$user));
|
35 |
+
//$user = $observer->getEvent()->getUser();
|
36 |
+
//$user->doSomething();
|
37 |
+
|
38 |
+
$order = $observer->getEvent()->getOrder();
|
39 |
+
|
40 |
+
$_totalData = Mage::getModel('sales/order')->load($order->getId());
|
41 |
+
$shipping_address = $_totalData->getShippingAddress();
|
42 |
+
//$order->getWeight()/2.2046."<br/>";
|
43 |
+
//date('Y-m-d',strtotime($order->getCreatedAt()));
|
44 |
+
//echo "<pre>"; print_r($shipping_address->getData());
|
45 |
+
//echo "<pre>"; print_r($_totalData->getData()); die;
|
46 |
+
|
47 |
+
$orders = Mage::getModel('sales/order_invoice')->getCollection()
|
48 |
+
->addAttributeToFilter('order_id', array('eq'=>$order->getId()));
|
49 |
+
$orders->getSelect()->limit(1);
|
50 |
+
if ((int)$orders->count() !== 0) {
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
|
54 |
+
try {
|
55 |
+
if(!$order->canInvoice()) {
|
56 |
+
$order->addStatusHistoryComment('Phxsolution_Autoinvoiceshipment: Order cannot be invoiced.', false);
|
57 |
+
$order->save();
|
58 |
+
}
|
59 |
+
//START Handle Invoice
|
60 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
61 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
62 |
+
$invoice->register();
|
63 |
+
$invoice->getOrder()->setCustomerNoteNotify(false);
|
64 |
+
$invoice->getOrder()->setIsInProcess(true);
|
65 |
+
$order->addStatusHistoryComment('Automatically INVOICED by Phxsolution_Autoinvoiceshipment.', false);
|
66 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
67 |
+
->addObject($invoice)
|
68 |
+
->addObject($invoice->getOrder());
|
69 |
+
$transactionSave->save();
|
70 |
+
//END Handle Invoice
|
71 |
+
|
72 |
+
/*//START Handle Shipment
|
73 |
+
$shipment = $order->prepareShipment();
|
74 |
+
$shipment->register();
|
75 |
+
$order->setIsInProcess(true);
|
76 |
+
$order->addStatusHistoryComment('Automatically SHIPPED by Phxsolution_Autoinvoiceshipment.', false);
|
77 |
+
|
78 |
+
if(isset($AirwayBillNumber) && $AirwayBillNumber != '')
|
79 |
+
{
|
80 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
81 |
+
->setNumber($AirwayBillNumber) //tracking number / awb number
|
82 |
+
->setCarrierCode('DHL') //carrier code
|
83 |
+
->setTitle('DHL'); //carrier title
|
84 |
+
$shipment->addTrack($track);
|
85 |
+
}
|
86 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
87 |
+
->addObject($shipment)
|
88 |
+
->addObject($shipment->getOrder())
|
89 |
+
->save();
|
90 |
+
//END Handle Shipment*/
|
91 |
+
|
92 |
+
} catch (Exception $e) {
|
93 |
+
$order->addStatusHistoryComment('Phxsolution_Autoinvoiceshipment: Exception occurred during automaticallyInvoiceShipCompleteOrder action. Exception message: '.$e->getMessage(), false);
|
94 |
+
$order->save();
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
return $this;
|
99 |
+
}
|
100 |
+
}
|
app/code/community/Phxsolution/Autoinvoiceshipment/etc/config.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* PHXSolution Autoinvoice and shipment
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category Module Configuration
|
19 |
+
* @package Phxsolution_Autoinvoiceshipment
|
20 |
+
* @author Prakash Vaniya
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 PHXSolution
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
-->
|
27 |
+
<config>
|
28 |
+
<modules>
|
29 |
+
<Phxsolution_Autoinvoiceshipment>
|
30 |
+
<version>0.1.0</version>
|
31 |
+
</Phxsolution_Autoinvoiceshipment>
|
32 |
+
</modules>
|
33 |
+
<adminhtml>
|
34 |
+
<acl>
|
35 |
+
<resources>
|
36 |
+
<admin>
|
37 |
+
<children>
|
38 |
+
<system>
|
39 |
+
<children>
|
40 |
+
<config>
|
41 |
+
<children>
|
42 |
+
<autoinvoiceshipment_section translate="title" module="autoinvoiceshipment">
|
43 |
+
<title>Autoinvoice and shipment</title>
|
44 |
+
</autoinvoiceshipment_section>
|
45 |
+
</children>
|
46 |
+
</config>
|
47 |
+
</children>
|
48 |
+
</system>
|
49 |
+
</children>
|
50 |
+
</admin>
|
51 |
+
</resources>
|
52 |
+
</acl>
|
53 |
+
</adminhtml>
|
54 |
+
<global>
|
55 |
+
<helpers>
|
56 |
+
<autoinvoiceshipment>
|
57 |
+
<class>Phxsolution_Autoinvoiceshipment_Helper</class>
|
58 |
+
</autoinvoiceshipment>
|
59 |
+
</helpers>
|
60 |
+
<models>
|
61 |
+
<autoinvoiceshipment>
|
62 |
+
<class>Phxsolution_Autoinvoiceshipment_Model</class>
|
63 |
+
<resourceModel>autoinvoiceshipment_mysql4</resourceModel>
|
64 |
+
</autoinvoiceshipment>
|
65 |
+
</models>
|
66 |
+
<events>
|
67 |
+
<sales_order_save_after>
|
68 |
+
<observers>
|
69 |
+
<sales_order_save_after_handler>
|
70 |
+
<type>model</type>
|
71 |
+
<class>autoinvoiceshipment/observer</class>
|
72 |
+
<method>automaticallyInvoiceShipCompleteOrder</method>
|
73 |
+
<args></args>
|
74 |
+
</sales_order_save_after_handler>
|
75 |
+
</observers>
|
76 |
+
</sales_order_save_after>
|
77 |
+
</events>
|
78 |
+
</global>
|
79 |
+
</config>
|
app/code/community/Phxsolution/Autoinvoiceshipment/etc/system.xml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* PHXSolution Autoinvoice and shipment
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category System Configuration
|
19 |
+
* @package Phxsolution_Autoinvoiceshipment
|
20 |
+
* @author Prakash Vaniya
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 PHXSolution
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
-->
|
27 |
+
<config>
|
28 |
+
<tabs>
|
29 |
+
<autoinvoiceshipment_tab translate="label" module="autoinvoiceshipment">
|
30 |
+
<label>Phxsolution Extensions</label>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
</autoinvoiceshipment_tab>
|
33 |
+
</tabs>
|
34 |
+
<sections>
|
35 |
+
<autoinvoiceshipment_section translate="label" module="autoinvoiceshipment">
|
36 |
+
<label>Autoinvoice and shipment</label>
|
37 |
+
<tab>autoinvoiceshipment_tab</tab>
|
38 |
+
<sort_order>1</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
<groups>
|
43 |
+
<settings translate="label">
|
44 |
+
<label>Settings</label>
|
45 |
+
<sort_order>1</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
<expanded>1</expanded>
|
50 |
+
<fields>
|
51 |
+
<enabled translate="label">
|
52 |
+
<label>Enable</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
55 |
+
<sort_order>1</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</enabled>
|
60 |
+
</fields>
|
61 |
+
</settings>
|
62 |
+
</groups>
|
63 |
+
</autoinvoiceshipment_section>
|
64 |
+
</sections>
|
65 |
+
</config>
|
app/etc/modules/Phxsolution_Autoinvoiceshipment.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* PHXSolution Autoinvoice and shipment
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category Module Global Configuration
|
19 |
+
* @package Phxsolution_Autoinvoiceshipment
|
20 |
+
* @author Prakash Vaniya
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 PHXSolution
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
-->
|
27 |
+
<config>
|
28 |
+
<modules>
|
29 |
+
<Phxsolution_Autoinvoiceshipment>
|
30 |
+
<active>true</active>
|
31 |
+
<codePool>community</codePool>
|
32 |
+
<version>0.1.0</version>
|
33 |
+
</Phxsolution_Autoinvoiceshipment>
|
34 |
+
</modules>
|
35 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Phxsolution_Autoinvoiceshipment</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Payment processing module designed to generate invoice/shipment automatically after order is placed.</summary>
|
10 |
+
<description>Payment processing module designed to generate invoice/shipment automatically after order is placed.</description>
|
11 |
+
<notes>Fixed some minor bugs.</notes>
|
12 |
+
<authors><author><name>Prakash Vaniya</name><user>phxsolution</user><email>contact@phxsolution.com</email></author></authors>
|
13 |
+
<date>2014-12-25</date>
|
14 |
+
<time>07:04:49</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Phxsolution_Autoinvoiceshipment.xml" hash="68843fb76191a45f99c0bfb5c39bf261"/></dir></target><target name="magecommunity"><dir name="Phxsolution"><dir name="Autoinvoiceshipment"><dir name="Helper"><file name="Data.php" hash="4766e6531d4ffd4a5a285b56387bd561"/></dir><dir name="Model"><file name="Observer.php" hash="fb8723bf74dac595a1be146eef068075"/></dir><dir name="etc"><file name="config.xml" hash="36dc67655f76cac525c78f776a577575"/><file name="system.xml" hash="7a564ec6d3c5fd230cce8ca0c3f3fa8f"/></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>
|