Fooman_SameOrderInvoiceNumber - Version 1.0.1

Version Notes

fixed SQL constraint error

Download this release

Release Info

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


Code changes from version 1.0.0 to 1.0.1

app/code/community/Fooman/SameOrderInvoiceNumber/Model/Mysql4/Order/Invoice.php CHANGED
@@ -2,9 +2,9 @@
2
 
3
  /**
4
  * Fooman Order = Invoice Number
5
- *
6
  * Magento
7
- *
8
  * NOTICE OF LICENSE
9
  *
10
  * This source file is subject to the Open Software License (OSL 3.0)
@@ -26,17 +26,23 @@ class Fooman_SameOrderInvoiceNumber_Model_Mysql4_Order_Invoice extends Mage_Sale
26
  {
27
  public function setNewIncrementId(Varien_Object $object)
28
  {
29
-
30
  if ($object->getIncrementId()) {
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;
 
41
  }
42
  }
2
 
3
  /**
4
  * Fooman Order = Invoice Number
5
+ *
6
  * Magento
7
+ *
8
  * NOTICE OF LICENSE
9
  *
10
  * This source file is subject to the Open Software License (OSL 3.0)
26
  {
27
  public function setNewIncrementId(Varien_Object $object)
28
  {
 
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;
46
+
47
  }
48
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fooman_SameOrderInvoiceNumber</name>
4
- <version>1.0.0</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>Stable Release 1.0.0</notes>
14
  <authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
15
- <date>2009-03-16</date>
16
- <time>03:28:29</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="a33eeb022e1ea536eb62bf0182418467"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Order"><file name="Creditmemo.php" hash="1e9cf781d3c08e9a2f0ad87a524bf05a"/><file name="Invoice.php" hash="d22ad40409f9336610f3975821acbf53"/><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.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
  <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>