WooCommerce Sequential Order Numbers - Version 1.3.4

Version Description

  • 2014.09.23 =
  • Fix - Compatibility fix with WooCommerce 2.1
  • Fix - Fix a deprecated notice in WooCommerce 2.2
Download this release

Release Info

Developer SkyVerge
Plugin Icon WooCommerce Sequential Order Numbers
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

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.3.3\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"
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.3.4\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"
readme.txt CHANGED
@@ -1,17 +1,19 @@
1
  === WooCommerce Sequential Order Numbers ===
2
- Contributors: SkyVerge
3
  Tags: woocommerce, order number
4
  Requires at least: 3.8
5
  Tested up to: 4.0
6
  Requires WooCommerce at least: 2.0
7
  Tested WooCommerce up to: 2.2
8
- Stable tag: 1.3.3
9
 
10
- This plugin extends the WooCommerce e-commerce plugin by setting sequential order numbers for new orders.
11
 
12
  == Description ==
13
 
14
- This plugin extends the WooCommerce e-commerce plugin by setting sequential order numbers for new orders. If there are existing orders at the time of installation, the sequential order numbers will start with the highest current order number.
 
 
15
 
16
  If you like this plugin, but are looking for the ability to set the starting number, or to add a custom prefix/suffix to your order numbers (ie, you'd prefer something like WT101UK, WT102UK, etc) please consider our premium WooCommerce Sequential Order Numbers Pro plugin, available from the [WooThemes Store](http://www.woothemes.com/products/sequential-order-numbers-pro/)
17
 
@@ -33,6 +35,10 @@ This plugin requires WooCommerce 2.1 or greater.
33
 
34
  == Frequently Asked Questions ==
35
 
 
 
 
 
36
  = Can I start the order numbers at a particular number? =
37
 
38
  This free version does not have that functionality, but now you can with the premium [WooCommerce Sequential Order Numbers Pro](http://www.woothemes.com/products/sequential-order-numbers-pro/)
@@ -43,6 +49,10 @@ This free version does not have that functionality, but now you can with the pre
43
 
44
  == Changelog ==
45
 
 
 
 
 
46
  = 1.3.3 - 2014.09.05 =
47
  * Localization - Included a .pot file for localization
48
 
1
  === WooCommerce Sequential Order Numbers ===
2
+ Contributors: maxrice, justinstern, tamarazuk, SkyVerge
3
  Tags: woocommerce, order number
4
  Requires at least: 3.8
5
  Tested up to: 4.0
6
  Requires WooCommerce at least: 2.0
7
  Tested WooCommerce up to: 2.2
8
+ Stable tag: 1.3.4
9
 
10
+ This plugin extends WooCommerce by setting sequential order numbers for new orders.
11
 
12
  == Description ==
13
 
14
+ This plugin extends WooCommerce by automatically setting sequential order numbers for new orders. If there are existing orders at the time of installation, the sequential order numbers will start with the highest current order number.
15
+
16
+ > No configuration needed! The plugin is so easy to use, there aren't even any settings. Activate it, and orders will automatically become sequential.
17
 
18
  If you like this plugin, but are looking for the ability to set the starting number, or to add a custom prefix/suffix to your order numbers (ie, you'd prefer something like WT101UK, WT102UK, etc) please consider our premium WooCommerce Sequential Order Numbers Pro plugin, available from the [WooThemes Store](http://www.woothemes.com/products/sequential-order-numbers-pro/)
19
 
35
 
36
  == Frequently Asked Questions ==
37
 
38
+ = Where are the settings? =
39
+
40
+ The plugin doesn't require any :). When you activate it, it gets to work right away! Orders will automatically become sequential, starting from the most recent order number.
41
+
42
  = Can I start the order numbers at a particular number? =
43
 
44
  This free version does not have that functionality, but now you can with the premium [WooCommerce Sequential Order Numbers Pro](http://www.woothemes.com/products/sequential-order-numbers-pro/)
49
 
50
  == Changelog ==
51
 
52
+ = 1.3.4 - 2014.09.23 =
53
+ * Fix - Compatibility fix with WooCommerce 2.1
54
+ * Fix - Fix a deprecated notice in WooCommerce 2.2
55
+
56
  = 1.3.3 - 2014.09.05 =
57
  * Localization - Included a .pot file for localization
58
 
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.3.3
9
  *
10
  * Copyright: (c) 2012-2013 SkyVerge, Inc. (info@skyverge.com)
11
  *
@@ -36,7 +36,7 @@ $GLOBALS['wc_seq_order_number'] = new WC_Seq_Order_Number();
36
  class WC_Seq_Order_Number {
37
 
38
  /** version number */
39
- const VERSION = "1.3.3";
40
 
41
  /** version option name */
42
  const VERSION_OPTION_NAME = "woocommerce_seq_order_number_db_version";
@@ -128,13 +128,12 @@ class WC_Seq_Order_Number {
128
  'meta_key' => '_order_number',
129
  'meta_value' => $order_number,
130
  'post_type' => 'shop_order',
131
- 'post_status' => 'publish',
132
  'fields' => 'ids',
133
  );
134
 
135
- $query_args = self::backport_order_status_query_args( $query_args );
136
-
137
- list( $order_id ) = get_posts( $query_args );
138
 
139
  // order was found
140
  if ( $order_id !== null ) {
@@ -404,6 +403,42 @@ class WC_Seq_Order_Number {
404
  }
405
 
406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  /**
408
  * Helper method to get the version of the currently installed WooCommerce
409
  *
@@ -474,7 +509,7 @@ class WC_Seq_Order_Number {
474
 
475
  if ( ! $installed_version ) {
476
  // initial install, set the order number for all existing orders to the post id
477
- $orders = get_posts( array( 'numberposts' => '', 'post_type' => 'shop_order', 'nopaging' => true ) );
478
  if ( is_array( $orders ) ) {
479
  foreach( $orders as $order ) {
480
  if ( '' == get_post_meta( $order->ID, '_order_number', true ) ) {
5
  * Description: Provides sequential order numbers for WooCommerce orders
6
  * Author: SkyVerge
7
  * Author URI: http://www.skyverge.com
8
+ * Version: 1.3.4
9
  *
10
  * Copyright: (c) 2012-2013 SkyVerge, Inc. (info@skyverge.com)
11
  *
36
  class WC_Seq_Order_Number {
37
 
38
  /** version number */
39
+ const VERSION = "1.3.4";
40
 
41
  /** version option name */
42
  const VERSION_OPTION_NAME = "woocommerce_seq_order_number_db_version";
128
  'meta_key' => '_order_number',
129
  'meta_value' => $order_number,
130
  'post_type' => 'shop_order',
131
+ 'post_status' => self::is_wc_version_gte_2_2() ? 'any' : 'publish',
132
  'fields' => 'ids',
133
  );
134
 
135
+ $posts = get_posts( $query_args );
136
+ list( $order_id ) = ! empty( $posts ) ? $posts : null;
 
137
 
138
  // order was found
139
  if ( $order_id !== null ) {
403
  }
404
 
405
 
406
+ /**
407
+ * Get all order statuses
408
+ *
409
+ * Introduced in WC 2.2
410
+ *
411
+ * @since 1.3.4
412
+ * @return array
413
+ */
414
+ public static function wc_get_order_statuses() {
415
+
416
+ if ( self::is_wc_version_gte_2_2() ) {
417
+
418
+ return wc_get_order_statuses();
419
+
420
+ } else {
421
+
422
+ // get available order statuses
423
+ $order_status_terms = get_terms( 'shop_order_status', array( 'hide_empty' => false ) );
424
+
425
+ if ( is_wp_error( $order_status_terms ) ) {
426
+
427
+ $order_status_terms = array();
428
+ }
429
+
430
+ $order_statuses = array();
431
+
432
+ foreach ( $order_status_terms as $term ) {
433
+
434
+ $order_statuses[ $term->slug ] = $term->name;
435
+ }
436
+
437
+ return $order_statuses;
438
+ }
439
+ }
440
+
441
+
442
  /**
443
  * Helper method to get the version of the currently installed WooCommerce
444
  *
509
 
510
  if ( ! $installed_version ) {
511
  // initial install, set the order number for all existing orders to the post id
512
+ $orders = get_posts( array( 'numberposts' => '', 'post_type' => 'shop_order', 'nopaging' => true, 'post_status' => self::is_wc_version_gte_2_2() ? 'any' : 'publish' ) );
513
  if ( is_array( $orders ) ) {
514
  foreach( $orders as $order ) {
515
  if ( '' == get_post_meta( $order->ID, '_order_number', true ) ) {