Version Description
- 2017.08.22 =
- Fix - PHP deprecation warning when Subscriptions is used
- Misc - Removed support for WooCommerce Subscriptions older than v2.0
Download this release
Release Info
Developer | SkyVerge |
Plugin | WooCommerce Sequential Order Numbers |
Version | 1.8.2 |
Comparing to | |
See all releases |
Code changes from version 1.8.1 to 1.8.2
i18n/languages/woocommerce-sequential-order-numbers.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Sequential Order Numbers 1.8.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://github.com/skyverge/woocommerce-sequential-order-numbers/issues\n"
|
8 |
"POT-Creation-Date: 2014-09-05 22:27:38+00:00\n"
|
@@ -23,14 +23,22 @@ msgstr ""
|
|
23 |
msgid "You cannot unserialize instances of %s."
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: woocommerce-sequential-order-numbers.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
#. Translators: %s - error message(s)
|
28 |
msgid ""
|
29 |
"Error activating and installing <strong>WooCommerce Sequential Order "
|
30 |
"Numbers</strong>: %s"
|
31 |
msgstr ""
|
32 |
|
33 |
-
#: woocommerce-sequential-order-numbers.php:
|
34 |
msgid "« Go Back"
|
35 |
msgstr ""
|
36 |
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Sequential Order Numbers 1.8.2\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://github.com/skyverge/woocommerce-sequential-order-numbers/issues\n"
|
8 |
"POT-Creation-Date: 2014-09-05 22:27:38+00:00\n"
|
23 |
msgid "You cannot unserialize instances of %s."
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: woocommerce-sequential-order-numbers.php:487
|
27 |
+
#. translators: Placeholders: %1$s - plugin name; %2$s - WooCommerce version;
|
28 |
+
#. %3$s, %5$s - <a> tags; %4$s - </a> tag
|
29 |
+
msgid ""
|
30 |
+
"%1$s is inactive because it requires WooCommerce %2$s or newer. Please "
|
31 |
+
"%3$supdate WooCommerce%4$s or run the %5$sWooCommerce database upgrade%4$s."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: woocommerce-sequential-order-numbers.php:529
|
35 |
#. Translators: %s - error message(s)
|
36 |
msgid ""
|
37 |
"Error activating and installing <strong>WooCommerce Sequential Order "
|
38 |
"Numbers</strong>: %s"
|
39 |
msgstr ""
|
40 |
|
41 |
+
#: woocommerce-sequential-order-numbers.php:530
|
42 |
msgid "« Go Back"
|
43 |
msgstr ""
|
44 |
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: SkyVerge, maxrice, tamarazuk, chasewiseman, nekojira, beka.rice
|
3 |
Tags: woocommerce, order number, sequential order number, woocommerce orders
|
4 |
Requires at least: 4.1
|
5 |
-
Tested up to: 4.
|
6 |
-
|
7 |
-
|
8 |
-
Stable tag: 1.8.
|
9 |
|
10 |
This plugin extends WooCommerce by setting sequential order numbers for new orders.
|
11 |
|
@@ -103,6 +103,10 @@ $order_number = $order->get_order_number();
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
106 |
= 1.8.1 - 2017.03.28 =
|
107 |
* Fix - Removes errors on refund number display
|
108 |
|
2 |
Contributors: SkyVerge, maxrice, tamarazuk, chasewiseman, nekojira, beka.rice
|
3 |
Tags: woocommerce, order number, sequential order number, woocommerce orders
|
4 |
Requires at least: 4.1
|
5 |
+
Tested up to: 4.8.1
|
6 |
+
WC requires at least: 2.5.5
|
7 |
+
WC tested up to: 3.1.0
|
8 |
+
Stable tag: 1.8.2
|
9 |
|
10 |
This plugin extends WooCommerce by setting sequential order numbers for new orders.
|
11 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 1.8.2 - 2017.08.22 =
|
107 |
+
* Fix - PHP deprecation warning when Subscriptions is used
|
108 |
+
* Misc - Removed support for WooCommerce Subscriptions older than v2.0
|
109 |
+
|
110 |
= 1.8.1 - 2017.03.28 =
|
111 |
* Fix - Removes errors on refund number display
|
112 |
|
woocommerce-sequential-order-numbers.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Provides sequential order numbers for WooCommerce orders
|
6 |
* Author: SkyVerge
|
7 |
* Author URI: http://www.skyverge.com
|
8 |
-
* Version: 1.8.
|
9 |
* Text Domain: woocommerce-sequential-order-numbers
|
10 |
* Domain Path: /i18n/languages/
|
11 |
*
|
@@ -32,7 +32,7 @@ class WC_Seq_Order_Number {
|
|
32 |
|
33 |
|
34 |
/** version number */
|
35 |
-
const VERSION = '1.8.
|
36 |
|
37 |
/** @var \WC_Seq_Order_Number single instance of this plugin */
|
38 |
protected static $instance;
|
@@ -105,13 +105,8 @@ class WC_Seq_Order_Number {
|
|
105 |
add_filter( 'woocommerce_shortcode_order_tracking_order_id', array( $this, 'find_order_by_order_number' ) );
|
106 |
|
107 |
// WC Subscriptions support
|
108 |
-
|
109 |
-
|
110 |
-
add_filter( 'wcs_renewal_order_created', array( $this, 'subscriptions_set_sequential_order_number' ), 10, 2 );
|
111 |
-
} else {
|
112 |
-
add_filter( 'woocommerce_subscriptions_renewal_order_meta_query', array( $this, 'subscriptions_remove_renewal_order_meta' ) );
|
113 |
-
add_action( 'woocommerce_subscriptions_renewal_order_created', array( $this, 'subscriptions_set_sequential_order_number' ), 10, 2 );
|
114 |
-
}
|
115 |
|
116 |
if ( is_admin() ) {
|
117 |
add_filter( 'request', array( $this, 'woocommerce_custom_shop_order_orderby' ), 20 );
|
@@ -201,10 +196,10 @@ class WC_Seq_Order_Number {
|
|
201 |
|
202 |
// attempt the query up to 3 times for a much higher success rate if it fails (due to Deadlock)
|
203 |
$success = false;
|
|
|
204 |
for ( $i = 0; $i < 3 && ! $success; $i++ ) {
|
205 |
|
206 |
// this seems to me like the safest way to avoid order number clashes
|
207 |
-
// By the time this is outdated, it's likely no longer needed anyway {BR 2017-03-08}
|
208 |
$query = $wpdb->prepare( "
|
209 |
INSERT INTO {$wpdb->postmeta} (post_id, meta_key, meta_value)
|
210 |
SELECT %d, '_order_number', IF( MAX( CAST( meta_value as UNSIGNED ) ) IS NULL, 1, MAX( CAST( meta_value as UNSIGNED ) ) + 1 )
|
@@ -297,47 +292,26 @@ class WC_Seq_Order_Number {
|
|
297 |
/** 3rd Party Plugin Support ******************************************************/
|
298 |
|
299 |
|
300 |
-
/**
|
301 |
-
* Helper method to get the version of WooCommerce Subscriptions
|
302 |
-
*
|
303 |
-
* @since 1.5.1
|
304 |
-
* @return string|null WC_Subscriptions version number or null if not found
|
305 |
-
*/
|
306 |
-
protected static function get_wc_subscriptions_version() {
|
307 |
-
return class_exists( 'WC_Subscriptions' ) && ! empty( WC_Subscriptions::$version ) ? WC_Subscriptions::$version : null;
|
308 |
-
}
|
309 |
-
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Returns true if the installed version of WooCommerce Subscriptions is 2.0.0 or greater
|
313 |
-
*
|
314 |
-
* TODO: Drop Subs < 2.0 support with WC 3.1 compat {BR 2017-03-21}
|
315 |
-
*
|
316 |
-
* @since 1.5.1
|
317 |
-
* @return boolean
|
318 |
-
*/
|
319 |
-
protected static function is_wc_subscriptions_version_gte_2_0() {
|
320 |
-
return self::get_wc_subscriptions_version() && version_compare( self::get_wc_subscriptions_version(), '2.0-beta-1', '>=' );
|
321 |
-
}
|
322 |
-
|
323 |
-
|
324 |
/**
|
325 |
* Sets an order number on a subscriptions-created order
|
326 |
*
|
327 |
* @since 1.3
|
328 |
* @param \WC_Order $renewal_order the new renewal order object
|
329 |
-
* @param
|
330 |
-
* @return
|
331 |
*/
|
332 |
-
public function subscriptions_set_sequential_order_number( $renewal_order, $
|
333 |
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
// after 2.0 this callback needs to return the renewal order
|
338 |
-
if ( self::is_wc_subscriptions_version_gte_2_0() ) {
|
339 |
return $renewal_order;
|
340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
}
|
342 |
|
343 |
|
@@ -508,12 +482,17 @@ class WC_Seq_Order_Number {
|
|
508 |
*/
|
509 |
public function render_update_notices() {
|
510 |
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
|
|
|
|
|
|
|
|
516 |
|
|
|
517 |
}
|
518 |
|
519 |
|
@@ -573,6 +552,7 @@ class WC_Seq_Order_Number {
|
|
573 |
}
|
574 |
|
575 |
if ( $installed_version !== WC_Seq_Order_Number::VERSION ) {
|
|
|
576 |
$this->upgrade( $installed_version );
|
577 |
|
578 |
// new version number
|
5 |
* Description: Provides sequential order numbers for WooCommerce orders
|
6 |
* Author: SkyVerge
|
7 |
* Author URI: http://www.skyverge.com
|
8 |
+
* Version: 1.8.2
|
9 |
* Text Domain: woocommerce-sequential-order-numbers
|
10 |
* Domain Path: /i18n/languages/
|
11 |
*
|
32 |
|
33 |
|
34 |
/** version number */
|
35 |
+
const VERSION = '1.8.2';
|
36 |
|
37 |
/** @var \WC_Seq_Order_Number single instance of this plugin */
|
38 |
protected static $instance;
|
105 |
add_filter( 'woocommerce_shortcode_order_tracking_order_id', array( $this, 'find_order_by_order_number' ) );
|
106 |
|
107 |
// WC Subscriptions support
|
108 |
+
add_filter( 'wcs_renewal_order_meta_query', array( $this, 'subscriptions_remove_renewal_order_meta' ) );
|
109 |
+
add_filter( 'wcs_renewal_order_created', array( $this, 'subscriptions_set_sequential_order_number' ), 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
if ( is_admin() ) {
|
112 |
add_filter( 'request', array( $this, 'woocommerce_custom_shop_order_orderby' ), 20 );
|
196 |
|
197 |
// attempt the query up to 3 times for a much higher success rate if it fails (due to Deadlock)
|
198 |
$success = false;
|
199 |
+
|
200 |
for ( $i = 0; $i < 3 && ! $success; $i++ ) {
|
201 |
|
202 |
// this seems to me like the safest way to avoid order number clashes
|
|
|
203 |
$query = $wpdb->prepare( "
|
204 |
INSERT INTO {$wpdb->postmeta} (post_id, meta_key, meta_value)
|
205 |
SELECT %d, '_order_number', IF( MAX( CAST( meta_value as UNSIGNED ) ) IS NULL, 1, MAX( CAST( meta_value as UNSIGNED ) ) + 1 )
|
292 |
/** 3rd Party Plugin Support ******************************************************/
|
293 |
|
294 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
/**
|
296 |
* Sets an order number on a subscriptions-created order
|
297 |
*
|
298 |
* @since 1.3
|
299 |
* @param \WC_Order $renewal_order the new renewal order object
|
300 |
+
* @param \WC_Subscription $subscription Post ID of a 'shop_subscription' post, or instance of a WC_Subscription object
|
301 |
+
* @return \WC_Order renewal order instance
|
302 |
*/
|
303 |
+
public function subscriptions_set_sequential_order_number( $renewal_order, $subscription ) {
|
304 |
|
305 |
+
// sanity check
|
306 |
+
if ( ! $renewal_order instanceof WC_Order ) {
|
|
|
|
|
|
|
307 |
return $renewal_order;
|
308 |
}
|
309 |
+
|
310 |
+
$order_post = get_post( self::get_order_prop( $renewal_order, 'id' ) );
|
311 |
+
$this->set_sequential_order_number( $order_post->ID, $order_post );
|
312 |
+
|
313 |
+
// after Subs 2.0 this callback needs to return the renewal order
|
314 |
+
return $renewal_order;
|
315 |
}
|
316 |
|
317 |
|
482 |
*/
|
483 |
public function render_update_notices() {
|
484 |
|
485 |
+
$message = sprintf(
|
486 |
+
/* translators: Placeholders: %1$s - plugin name; %2$s - WooCommerce version; %3$s, %5$s - <a> tags; %4$s - </a> tag */
|
487 |
+
esc_html__( '%1$s is inactive because it requires WooCommerce %2$s or newer. Please %3$supdate WooCommerce%4$s or run the %5$sWooCommerce database upgrade%4$s.', 'woocommerce-sequential-order-numbers' ),
|
488 |
+
'Sequential Order Numbers',
|
489 |
+
self::MINIMUM_WC_VERSION,
|
490 |
+
'<a href="' . admin_url( 'update-core.php' ) . '">',
|
491 |
+
'</a>',
|
492 |
+
'<a href="' . admin_url( 'plugins.php?do_update_woocommerce=true' ) . '">'
|
493 |
+
);
|
494 |
|
495 |
+
printf( '<div class="error"><p>%s</p></div>', $message );
|
496 |
}
|
497 |
|
498 |
|
552 |
}
|
553 |
|
554 |
if ( $installed_version !== WC_Seq_Order_Number::VERSION ) {
|
555 |
+
|
556 |
$this->upgrade( $installed_version );
|
557 |
|
558 |
// new version number
|