Commit db43f3bf authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

V1.3.2: Fix issues with the pdf invoices and packaging slips plugin

parent e3059cd9
BASE=ordernumbers
PLATTFORM=woocommerce
VENDOR=opentools
VERSION=1.3.1
VERSION=1.3.2
DIR = $(shell pwd)
SVNDIR=wordpress-plugin-svn
......
......@@ -12,6 +12,31 @@ if ( ! defined( 'ABSPATH' ) ) {
if (!class_exists( 'OpenToolsOrdernumbersBasic' ))
require_once (dirname(__FILE__) . '/ordernumbers_woocommerce_basic.php');
/*
* RK: This debugging function is taken from the debug_backtrace documentation page of php.net:
* Send the output from a backtrace to the error_log
* @param string $message Optional message that will be sent the the error_log before the backtrace
*/
function log_trace($message = '') {
$trace = debug_backtrace();
if ($message) {
error_log($message);
}
$caller = array_shift($trace);
$function_name = $caller['function'];
error_log(sprintf('%s: Called from %s:%s', $function_name, $caller['file'], $caller['line']));
foreach ($trace as $entry_id => $entry) {
$entry['file'] = $entry['file'] ? : '-';
$entry['line'] = $entry['line'] ? : '-';
if (empty($entry['class'])) {
error_log(sprintf('%s %3s. %s() %s:%s', $function_name, $entry_id + 1, $entry['function'], $entry['file'], $entry['line']));
} else {
error_log(sprintf('%s %3s. %s->%s() %s:%s', $function_name, $entry_id + 1, $entry['class'], $entry['function'], $entry['file'], $entry['line']));
}
}
}
class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
/**
* Construct the plugin object
......@@ -373,8 +398,10 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
* Filter to return the invoice number => simply return the first argument unchanged (was already
* created in the correct format, no need to format it now again)
*/
function thirdparty_wpo_wcpdf_invoice_number($invoice_number, $order_number, $order_id, $order_data) {
$nr = $this->get_or_create_number($order_id, $order_data, 'invoice');
function thirdparty_wpo_wcpdf_invoice_number($invoice_number, $order_number, $order_id, $order_date) {
$_of = new WC_Order_Factory();
$order = $_of->get_order($order_id);
$nr = $this->get_or_create_number($order_id, $order, 'invoice');
if ($nr == $order_id) {
// No number was found, so the default is the order id => reset to invoice number
return $invoice_number;
......@@ -423,7 +450,6 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
if (!$this->invoicenumbers_activated()) {
$wp_settings_fields['wpo_wcpdf_template_settings']['invoice']['display_number']['args']['description'] = '<i>' . sprintf($this->helper->__( 'The Open Tools Ordernumbers plugin is installed, but not configured to create invoice numbers. Configure it <a href="%s">here</a> to create invoice numbers.'), $this->invoicenumbers_config_link()) . '</i>';
}
return $settings;
}
......
......@@ -4,7 +4,7 @@ Contributors: opentools
Tags: WooCommerce, Order numbers, orders
Requires at least: 4.0
Tested up to: 4.5
Stable tag: 1.3.1
Stable tag: 1.3.2
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl.html
......
......@@ -3,15 +3,15 @@
* Plugin Name: Woocommerce Advanced Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Lets the user freely configure the order numbers in WooCommerce.
* Version: 1.3.1
* Version: 1.3.2
* Author: Open Tools
* Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers
* Domain Path:
* License: GPL2+
* Network: true
WC requires at least: 2.2
WC tested up to: 2.5
* WC requires at least: 2.2
* WC tested up to: 2.5
*/
if ( ! defined( 'ABSPATH' ) ) {
......
......@@ -3,14 +3,14 @@
* Plugin Name: WooCommerce Basic Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Configure WooCommerce ordernumbers to have a running counter and arbitrary, fixed text (prefix / postfix).
* Version: 1.3.1
* Version: 1.3.2
* Author: Open Tools
* Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers
* License: GPL2+
* Network: true
WC requires at least: 2.2
WC tested up to: 2.5
* WC requires at least: 2.2
* WC tested up to: 2.5
*/
if ( ! defined( 'ABSPATH' ) ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment