Fooman_SameOrderInvoiceNumber - Version 1.0.2

Version Notes

added configurable prefixes

Download this release

Release Info

Developer Magento Core Team
Extension Fooman_SameOrderInvoiceNumber
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Fooman/SameOrderInvoiceNumber/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Fooman_SameOrderInvoiceNumber_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/community/Fooman/SameOrderInvoiceNumber/Model/Mysql4/Order/Creditmemo.php CHANGED
@@ -32,10 +32,11 @@ class Fooman_SameOrderInvoiceNumber_Model_Mysql4_Order_Creditmemo extends Mage_S
32
  return $this;
33
  }
34
 
 
35
  $incrementId = Mage::getModel('sales/order')->load($object->getOrderId())->getIncrementId();
36
 
37
  if (false!==$incrementId) {
38
- $object->setIncrementId($incrementId);
39
  }
40
 
41
  return $this;
32
  return $this;
33
  }
34
 
35
+ $prefix = Mage::getStoreConfig('sameorderinvoicenumber/settings/creditmemoprefix',$object->getStore()->getId());
36
  $incrementId = Mage::getModel('sales/order')->load($object->getOrderId())->getIncrementId();
37
 
38
  if (false!==$incrementId) {
39
+ $object->setIncrementId($prefix.$incrementId);
40
  }
41
 
42
  return $this;
app/code/community/Fooman/SameOrderInvoiceNumber/Model/Mysql4/Order/Invoice.php CHANGED
@@ -29,17 +29,23 @@ class Fooman_SameOrderInvoiceNumber_Model_Mysql4_Order_Invoice extends Mage_Sale
29
  if ($object->getIncrementId()) {
30
  return $this;
31
  }
 
 
 
 
 
 
32
 
33
  $incrementId = Mage::getModel('sales/order')->load($object->getOrderId())->getIncrementId();
34
  if (empty($incrementId)){
35
- $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId()+1;
36
  }
37
  if (empty($incrementId)){
38
  $incrementId = $this->getEntityType()->fetchNewIncrementId($object->getStoreId());
39
  }
40
 
41
  if (false!==$incrementId) {
42
- $object->setIncrementId($incrementId);
43
  }
44
 
45
  return $this;
29
  if ($object->getIncrementId()) {
30
  return $this;
31
  }
32
+ if(!empty($object)){
33
+ $storeId = $object->getStore()->getId();
34
+ }else{
35
+ $storeId = Mage::getSingleton('checkout/session')->getStore()->getId();
36
+ }
37
+ $prefix = Mage::getStoreConfig('sameorderinvoicenumber/settings/invoiceprefix',$storeId);
38
 
39
  $incrementId = Mage::getModel('sales/order')->load($object->getOrderId())->getIncrementId();
40
  if (empty($incrementId)){
41
+ $incrementId = (int)Mage::getSingleton('checkout/session')->getLastRealOrderId()+1;
42
  }
43
  if (empty($incrementId)){
44
  $incrementId = $this->getEntityType()->fetchNewIncrementId($object->getStoreId());
45
  }
46
 
47
  if (false!==$incrementId) {
48
+ $object->setIncrementId($prefix.$incrementId);
49
  }
50
 
51
  return $this;
app/code/community/Fooman/SameOrderInvoiceNumber/Model/Mysql4/Order/Shipment.php CHANGED
@@ -31,10 +31,11 @@ class Fooman_SameOrderInvoiceNumber_Model_Mysql4_Order_Shipment extends Mage_Sal
31
  return $this;
32
  }
33
 
 
34
  $incrementId = Mage::getModel('sales/order')->load($object->getOrderId())->getIncrementId();
35
 
36
  if (false!==$incrementId) {
37
- $object->setIncrementId($incrementId);
38
  }
39
 
40
  return $this;
31
  return $this;
32
  }
33
 
34
+ $prefix = Mage::getStoreConfig('sameorderinvoicenumber/settings/shipmentprefix',$object->getStore()->getId());
35
  $incrementId = Mage::getModel('sales/order')->load($object->getOrderId())->getIncrementId();
36
 
37
  if (false!==$incrementId) {
38
+ $object->setIncrementId($prefix.$incrementId);
39
  }
40
 
41
  return $this;
app/code/community/Fooman/SameOrderInvoiceNumber/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
  <config>
24
  <modules>
25
  <Fooman_SameOrderInvoiceNumber>
26
- <version>1.0.0</version>
27
  <depends>
28
  <Mage_Sales />
29
  </depends>
@@ -32,6 +32,9 @@
32
 
33
  <global>
34
  <models>
 
 
 
35
  <sales_mysql4>
36
  <rewrite>
37
  <order_invoice>Fooman_SameOrderInvoiceNumber_Model_Mysql4_Order_Invoice</order_invoice>
@@ -40,6 +43,42 @@
40
  </rewrite>
41
  </sales_mysql4>
42
  </models>
 
 
 
 
 
43
  </global>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  </config>
23
  <config>
24
  <modules>
25
  <Fooman_SameOrderInvoiceNumber>
26
+ <version>1.0.2</version>
27
  <depends>
28
  <Mage_Sales />
29
  </depends>
32
 
33
  <global>
34
  <models>
35
+ <sameorderinvoicenumber>
36
+ <class>Fooman_SameOrderInvoiceNumber_Model</class>
37
+ </sameorderinvoicenumber>
38
  <sales_mysql4>
39
  <rewrite>
40
  <order_invoice>Fooman_SameOrderInvoiceNumber_Model_Mysql4_Order_Invoice</order_invoice>
43
  </rewrite>
44
  </sales_mysql4>
45
  </models>
46
+ <helpers>
47
+ <sameorderinvoicenumber>
48
+ <class>Fooman_SameOrderInvoiceNumber_Helper</class>
49
+ </sameorderinvoicenumber>
50
+ </helpers>
51
  </global>
52
+ <adminhtml>
53
+ <acl>
54
+ <resources>
55
+ <admin>
56
+ <children>
57
+ <system>
58
+ <children>
59
+ <config>
60
+ <children>
61
+ <sameorderinvoicenumber>
62
+ <title>Order numbers by FOOMAN</title>
63
+ </sameorderinvoicenumber>
64
+ </children>
65
+ </config>
66
+ </children>
67
+ </system>
68
+ </children>
69
+ </admin>
70
+ </resources>
71
+ </acl>
72
+ </adminhtml>
73
+ <default>
74
+ <config_vars><!--config values --></config_vars>
75
+ <sameorderinvoicenumber>
76
+ <settings>
77
+ <invoiceprefix></invoiceprefix>
78
+ <shipmentprefix></shipmentprefix>
79
+ <creditmemoprefix></creditmemoprefix>
80
+ </settings>
81
+ </sameorderinvoicenumber>
82
+ </default>
83
 
84
  </config>
app/code/community/Fooman/SameOrderInvoiceNumber/etc/system.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <sections>
3
+ <sameorderinvoicenumber translate="label" module="sameorderinvoicenumber">
4
+ <label>Order Numbers</label>
5
+ <tab>sales</tab>
6
+ <frontend_type>text</frontend_type>
7
+ <sort_order>850</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <settings translate="label">
13
+ <label>Settings</label>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>10</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <fields>
20
+ <invoiceprefix translate="label">
21
+ <label>Invoice Prefix</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>20</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ </invoiceprefix>
28
+ <shipmentprefix translate="label">
29
+ <label>Shipment Prefix</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>30</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </shipmentprefix>
36
+ <creditmemoprefix translate="label">
37
+ <label>Creditmemo Prefix</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>40</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </creditmemoprefix>
44
+ </fields>
45
+ </settings>
46
+ </groups>
47
+ </sameorderinvoicenumber>
48
+ </sections>
49
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fooman_SameOrderInvoiceNumber</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -10,11 +10,11 @@
10
  <description>&lt;p&gt;Use the order number as invoice,shipment and creditmemo number.&lt;/p&gt;
11
 
12
  &lt;p&gt;By default Magento keeps separate counts for order and invoice numbers. This extension ensures that when an invoice is created it uses the related order number as invoice number.&lt;/p&gt;</description>
13
- <notes>fixed SQL constraint error</notes>
14
  <authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
15
- <date>2009-05-24</date>
16
- <time>03:04:27</time>
17
- <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fooman_SameOrderInvoiceNumber.xml" hash="9c647ab0671752cda14b95db99dd7805"/></dir></dir></dir></target><target name="magecommunity"><dir name="Fooman"><dir name="SameOrderInvoiceNumber"><dir name="etc"><file name="config.xml" hash="a94ea01056e65b6e1805dafae1c6e7a7"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Order"><file name="Creditmemo.php" hash="1e9cf781d3c08e9a2f0ad87a524bf05a"/><file name="Invoice.php" hash="fe9cc4a9941fa4bdbe134d8585d51fb1"/><file name="Shipment.php" hash="360f85d73fc4342cacf6a6049ff53315"/></dir></dir></dir><file name="LICENSE.txt" hash="59563e7be45096d0833dade102989042"/><file name="LICENSE_AFL.txt" hash="45a399f2095030865fb962263ccd7506"/></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fooman_SameOrderInvoiceNumber</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
10
  <description>&lt;p&gt;Use the order number as invoice,shipment and creditmemo number.&lt;/p&gt;
11
 
12
  &lt;p&gt;By default Magento keeps separate counts for order and invoice numbers. This extension ensures that when an invoice is created it uses the related order number as invoice number.&lt;/p&gt;</description>
13
+ <notes>added configurable prefixes</notes>
14
  <authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
15
+ <date>2009-05-27</date>
16
+ <time>06:49:39</time>
17
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fooman_SameOrderInvoiceNumber.xml" hash="9c647ab0671752cda14b95db99dd7805"/></dir></dir></dir></target><target name="magecommunity"><dir name="Fooman"><dir name="SameOrderInvoiceNumber"><dir name="etc"><file name="config.xml" hash="6c2cc4b6df439875f72d0a26b0616ca1"/><file name="system.xml" hash="e06ad358458427a53e063482679de916"/></dir><dir name="Helper"><file name="Data.php" hash="2902afb6f8362656b9e1212091d04550"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Order"><file name="Creditmemo.php" hash="5c72065a6d8209377e46b6d7ed44e3b4"/><file name="Invoice.php" hash="5e5eb6a947a281b8341920fd60aeeef3"/><file name="Shipment.php" hash="2b50d680179f9f90518f9016d266f4d4"/></dir></dir></dir><file name="LICENSE.txt" hash="59563e7be45096d0833dade102989042"/><file name="LICENSE_AFL.txt" hash="45a399f2095030865fb962263ccd7506"/></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>