Skip to content
Snippets Groups Projects
Commit 755234ac authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V3.5: Fix invoice creation (VM core changed...)

parent 5d6bafdf
Branches
Tags V3.5
No related merge requests found
BASE=ordernumber BASE=ordernumber
PLUGINTYPE=vmshopper PLUGINTYPE=vmshopper
VERSION=3.4 VERSION=3.5
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html $(BASE)/ PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html $(BASE)/
......
...@@ -484,11 +484,18 @@ class plgVmShopperOrdernumber extends vmShopperPlugin { ...@@ -484,11 +484,18 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
// Is order number customization enabled? // Is order number customization enabled?
if ($this->params->get('customize_invoice_number')) { if ($this->params->get('customize_invoice_number')) {
// check the default configuration // check the default configuration
$orderstatusForInvoice = VmConfig::get('inv_os',array()); $orderstatusForInvoice = VmConfig::get('inv_os',array('C'));
if(!is_array($orderstatusForInvoice)) $orderstatusForInvoice = array($orderstatusForInvoice); //for backward compatibility 2.0.8e if(!is_array($orderstatusForInvoice)) $orderstatusForInvoice = array($orderstatusForInvoice); //for backward compatibility 2.0.8e
$pdfInvoice = (int)VmConfig::get('pdf_invoice', 0); // backwards compatible $pdfInvoice = (int)VmConfig::get('pdf_invoice', 0); // backwards compatible
$force_create_invoice = JFactory::getApplication()->input->getInt('create_invoice', 0); // For VM<3.0.12, the URL parameter is an int, for VM>=3.0.12, the URL param is a string/cmd
$invoice_pass = isset($orderDetails['order_create_invoice_pass']) ? $orderDetails['order_create_invoice_pass'] : 1; $force_create_invoice = JFactory::getApplication()->input->getCmd('create_invoice', -1);
if (is_numeric($force_create_invoice)) {
// numeric means we have the old behavor pre-3.0.12 => No invoice_pass to check
$invoice_pass = 1;
} else {
$invoice_pass = isset($orderDetails['order_create_invoice_pass']) ? $orderDetails['order_create_invoice_pass'] : 'DO_NOT_CREATE_INVOICE';
}
if ( in_array($orderDetails['order_status'],$orderstatusForInvoice) or $pdfInvoice==1 or $force_create_invoice==$invoice_pass ){ if ( in_array($orderDetails['order_status'],$orderstatusForInvoice) or $pdfInvoice==1 or $force_create_invoice==$invoice_pass ){
$invoicenr = $this->assignNumber((object)$orderDetails, 'invoice_number', "#"); $invoicenr = $this->assignNumber((object)$orderDetails, 'invoice_number', "#");
if ($invoicenr !== false) { if ($invoicenr !== false) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<authorUrl>http://www.open-tools.net/</authorUrl> <authorUrl>http://www.open-tools.net/</authorUrl>
<copyright>Copyright (C) 2012-2015 Reinhold Kainhofer. All rights reserved.</copyright> <copyright>Copyright (C) 2012-2015 Reinhold Kainhofer. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license> <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license>
<version>3.4</version> <version>3.5</version>
<releaseDate>2015-05-23</releaseDate> <releaseDate>2015-05-23</releaseDate>
<releaseType>Minor update</releaseType> <releaseType>Minor update</releaseType>
<downloadUrl>http://open-tools.net/virtuemart/advanced-ordernumbers.html</downloadUrl> <downloadUrl>http://open-tools.net/virtuemart/advanced-ordernumbers.html</downloadUrl>
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment