WooCommerce Square - Version 2.1.5

Version Description

  • 2020.05.15 =
  • Fix - Fatal errors caused by incorrectly fetching locations before plugin init.
  • Fix - WordPress database error when creating the Square Customers table on servers using utf8mb4.
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Square
Version 2.1.5
Comparing to
See all releases

Code changes from version 2.1.4 to 2.1.5

i18n/languages/woocommerce-square.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 2.1.4\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/woocommerce/woocommerce-square/issues\n"
8
- "POT-Creation-Date: 2020-05-05 07:39:26+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -559,31 +559,31 @@ msgid_plural "Updated data for %d products."
559
  msgstr[0] ""
560
  msgstr[1] ""
561
 
562
- #: includes/Plugin.php:273
563
  msgid ""
564
  "Heads up! There may be a problem with your connection to Square. In order "
565
  "to continue accepting payments, please %1$sdisconnect and re-connect your "
566
  "site%2$s."
567
  msgstr ""
568
 
569
- #: includes/Plugin.php:285
570
  msgid "You are connected to Square!"
571
  msgstr ""
572
 
573
- #: includes/Plugin.php:292
574
  msgid "To get started, set your business location."
575
  msgstr ""
576
 
577
- #: includes/Plugin.php:298
578
  #. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
579
  msgid "Visit the %1$splugin settings%2$s to set your business location."
580
  msgstr ""
581
 
582
- #: includes/Plugin.php:307
583
  msgid "You are ready to sync products!"
584
  msgstr ""
585
 
586
- #: includes/Plugin.php:313
587
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - product count, %3$s -
588
  #. </strong> tag, %4$s - <a> tag, %5$s - </a> tag
589
  msgid ""
@@ -591,7 +591,7 @@ msgid ""
591
  "now &raquo;%5$s"
592
  msgstr ""
593
 
594
- #: includes/Plugin.php:322
595
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
596
  #. <a> tag, %4$s - </a> tag
597
  msgid ""
@@ -599,28 +599,28 @@ msgid ""
599
  "products to sync data &raquo;%4$s"
600
  msgstr ""
601
 
602
- #: includes/Plugin.php:335
603
  msgid ""
604
  "Heads up! Square is configured to sync product inventory, but WooCommerce "
605
  "stock management is disabled. Please %1$senable stock management%2$s to "
606
  "ensure product inventory counts are kept in sync."
607
  msgstr ""
608
 
609
- #: includes/Plugin.php:348
610
  msgid "To get started, connect with Square."
611
  msgstr ""
612
 
613
- #: includes/Plugin.php:354
614
  #. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
615
  msgid "To get started, %1$sconnect with Square &raquo;%2$s"
616
  msgstr ""
617
 
618
- #: includes/Plugin.php:361
619
  #. translators: Placeholders: %1$s - plugin name
620
  msgid "Thanks for installing %1$s!"
621
  msgstr ""
622
 
623
- #: includes/Plugin.php:385
624
  #. translators: Placeholders: %1$s - plugin name, %2$ - plugin version number,
625
  #. %3$s - opening <a> HTML link tag, %4$s - closing </a> HTML link tag, %5$s -
626
  #. opening <a> HTML link tag, %6$s - closing </a> HTML link tag
@@ -631,7 +631,7 @@ msgid ""
631
  "%5$supdated documentation%6$s."
632
  msgstr ""
633
 
634
- #: includes/Plugin.php:419
635
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
636
  #. 2-character country code, %4$s - comma separated list of 2-character country
637
  #. codes
@@ -640,7 +640,7 @@ msgid ""
640
  "accept transactions from merchants outside of %4$s."
641
  msgstr ""
642
 
643
- #: includes/Plugin.php:441
644
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
645
  #. <a> tag, %4$s - </a> tag
646
  msgid ""
@@ -649,7 +649,7 @@ msgid ""
649
  "successfully with Square. %3$sRead more here%4$s on how to resolve this."
650
  msgstr ""
651
 
652
- #: includes/Plugin.php:479
653
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
654
  #. <a> tag, %4$s - </a> tag
655
  msgid ""
@@ -657,14 +657,14 @@ msgid ""
657
  "Square is inactive. Please disconnect and reconnect to resolve."
658
  msgstr ""
659
 
660
- #: includes/Plugin.php:510
661
  msgid ""
662
  "%1$sWooCommerce Square:%2$s Product prices are entered inclusive of tax, "
663
  "but Square does not support syncing tax-inclusive prices. Please make sure "
664
  "your Square tax rates match your WooCommerce tax rates."
665
  msgstr ""
666
 
667
- #: includes/Plugin.php:536
668
  msgid ""
669
  "Heads up! Your store currency is %1$s but your configured Square business "
670
  "location currency is %2$s, so payments cannot be processed. Please "
@@ -806,7 +806,7 @@ msgstr ""
806
  msgid "Log debug messages to the %1$sWooCommerce status log%2$s"
807
  msgstr ""
808
 
809
- #: includes/Settings.php:267
810
  msgid "Please choose a location"
811
  msgstr ""
812
 
@@ -2979,37 +2979,37 @@ msgstr ""
2979
  msgid "Unknown Error"
2980
  msgstr ""
2981
 
2982
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:644
2983
  msgid "Job data key \"%s\" not set"
2984
  msgstr ""
2985
 
2986
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:648
2987
  msgid "Job data key \"%s\" is not an array"
2988
  msgstr ""
2989
 
2990
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:884
2991
  msgid "Every %d Minutes"
2992
  msgstr ""
2993
 
2994
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1048
2995
  msgid "Background Processing Test"
2996
  msgstr ""
2997
 
2998
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1049
2999
  msgid "Run Test"
3000
  msgstr ""
3001
 
3002
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1050
3003
  msgid ""
3004
  "This tool will test whether your server is capable of processing background "
3005
  "jobs."
3006
  msgstr ""
3007
 
3008
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1068
3009
  msgid "Success! You should be able to process background jobs."
3010
  msgstr ""
3011
 
3012
- #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1071
3013
  msgid ""
3014
  "Could not connect. Please ask your hosting company to ensure your server "
3015
  "has loopback connections enabled."
@@ -3264,4 +3264,4 @@ msgstr ""
3264
  #. translators: https:www.skyverge.com/for-translators-environments/
3265
  msgctxt "software environment"
3266
  msgid "Production"
3267
- msgstr ""
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 2.1.5\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/woocommerce/woocommerce-square/issues\n"
8
+ "POT-Creation-Date: 2020-05-15 06:52:57+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
559
  msgstr[0] ""
560
  msgstr[1] ""
561
 
562
+ #: includes/Plugin.php:275
563
  msgid ""
564
  "Heads up! There may be a problem with your connection to Square. In order "
565
  "to continue accepting payments, please %1$sdisconnect and re-connect your "
566
  "site%2$s."
567
  msgstr ""
568
 
569
+ #: includes/Plugin.php:287
570
  msgid "You are connected to Square!"
571
  msgstr ""
572
 
573
+ #: includes/Plugin.php:294
574
  msgid "To get started, set your business location."
575
  msgstr ""
576
 
577
+ #: includes/Plugin.php:300
578
  #. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
579
  msgid "Visit the %1$splugin settings%2$s to set your business location."
580
  msgstr ""
581
 
582
+ #: includes/Plugin.php:309
583
  msgid "You are ready to sync products!"
584
  msgstr ""
585
 
586
+ #: includes/Plugin.php:315
587
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - product count, %3$s -
588
  #. </strong> tag, %4$s - <a> tag, %5$s - </a> tag
589
  msgid ""
591
  "now &raquo;%5$s"
592
  msgstr ""
593
 
594
+ #: includes/Plugin.php:324
595
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
596
  #. <a> tag, %4$s - </a> tag
597
  msgid ""
599
  "products to sync data &raquo;%4$s"
600
  msgstr ""
601
 
602
+ #: includes/Plugin.php:337
603
  msgid ""
604
  "Heads up! Square is configured to sync product inventory, but WooCommerce "
605
  "stock management is disabled. Please %1$senable stock management%2$s to "
606
  "ensure product inventory counts are kept in sync."
607
  msgstr ""
608
 
609
+ #: includes/Plugin.php:350
610
  msgid "To get started, connect with Square."
611
  msgstr ""
612
 
613
+ #: includes/Plugin.php:356
614
  #. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
615
  msgid "To get started, %1$sconnect with Square &raquo;%2$s"
616
  msgstr ""
617
 
618
+ #: includes/Plugin.php:363
619
  #. translators: Placeholders: %1$s - plugin name
620
  msgid "Thanks for installing %1$s!"
621
  msgstr ""
622
 
623
+ #: includes/Plugin.php:387
624
  #. translators: Placeholders: %1$s - plugin name, %2$ - plugin version number,
625
  #. %3$s - opening <a> HTML link tag, %4$s - closing </a> HTML link tag, %5$s -
626
  #. opening <a> HTML link tag, %6$s - closing </a> HTML link tag
631
  "%5$supdated documentation%6$s."
632
  msgstr ""
633
 
634
+ #: includes/Plugin.php:421
635
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
636
  #. 2-character country code, %4$s - comma separated list of 2-character country
637
  #. codes
640
  "accept transactions from merchants outside of %4$s."
641
  msgstr ""
642
 
643
+ #: includes/Plugin.php:443
644
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
645
  #. <a> tag, %4$s - </a> tag
646
  msgid ""
649
  "successfully with Square. %3$sRead more here%4$s on how to resolve this."
650
  msgstr ""
651
 
652
+ #: includes/Plugin.php:481
653
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
654
  #. <a> tag, %4$s - </a> tag
655
  msgid ""
657
  "Square is inactive. Please disconnect and reconnect to resolve."
658
  msgstr ""
659
 
660
+ #: includes/Plugin.php:512
661
  msgid ""
662
  "%1$sWooCommerce Square:%2$s Product prices are entered inclusive of tax, "
663
  "but Square does not support syncing tax-inclusive prices. Please make sure "
664
  "your Square tax rates match your WooCommerce tax rates."
665
  msgstr ""
666
 
667
+ #: includes/Plugin.php:538
668
  msgid ""
669
  "Heads up! Your store currency is %1$s but your configured Square business "
670
  "location currency is %2$s, so payments cannot be processed. Please "
806
  msgid "Log debug messages to the %1$sWooCommerce status log%2$s"
807
  msgstr ""
808
 
809
+ #: includes/Settings.php:266
810
  msgid "Please choose a location"
811
  msgstr ""
812
 
2979
  msgid "Unknown Error"
2980
  msgstr ""
2981
 
2982
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:643
2983
  msgid "Job data key \"%s\" not set"
2984
  msgstr ""
2985
 
2986
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:647
2987
  msgid "Job data key \"%s\" is not an array"
2988
  msgstr ""
2989
 
2990
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:883
2991
  msgid "Every %d Minutes"
2992
  msgstr ""
2993
 
2994
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1047
2995
  msgid "Background Processing Test"
2996
  msgstr ""
2997
 
2998
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1048
2999
  msgid "Run Test"
3000
  msgstr ""
3001
 
3002
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1049
3003
  msgid ""
3004
  "This tool will test whether your server is capable of processing background "
3005
  "jobs."
3006
  msgstr ""
3007
 
3008
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1067
3009
  msgid "Success! You should be able to process background jobs."
3010
  msgstr ""
3011
 
3012
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/utilities/class-sv-wp-background-job-handler.php:1070
3013
  msgid ""
3014
  "Could not connect. Please ask your hosting company to ensure your server "
3015
  "has loopback connections enabled."
3264
  #. translators: https:www.skyverge.com/for-translators-environments/
3265
  msgctxt "software environment"
3266
  msgid "Production"
3267
+ msgstr ""
includes/Gateway/Customer_Helper.php CHANGED
@@ -176,7 +176,7 @@ class Customer_Helper {
176
 
177
  $schema = "
178
  CREATE TABLE IF NOT EXISTS {$wpdb->prefix}woocommerce_square_customers (
179
- square_id varchar(200) NOT NULL,
180
  email_address varchar(200) NOT NULL,
181
  user_id BIGINT UNSIGNED NOT NULL,
182
  PRIMARY KEY (square_id)
176
 
177
  $schema = "
178
  CREATE TABLE IF NOT EXISTS {$wpdb->prefix}woocommerce_square_customers (
179
+ square_id varchar(191) NOT NULL,
180
  email_address varchar(200) NOT NULL,
181
  user_id BIGINT UNSIGNED NOT NULL,
182
  PRIMARY KEY (square_id)
includes/Lifecycle.php CHANGED
@@ -53,6 +53,7 @@ class Lifecycle extends Framework\Plugin\Lifecycle {
53
  $this->upgrade_versions = [
54
  '2.0.0',
55
  '2.0.4',
 
56
  ];
57
  }
58
 
@@ -157,6 +158,17 @@ class Lifecycle extends Framework\Plugin\Lifecycle {
157
  update_option( 'wc_square_settings', $v2_settings );
158
  }
159
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
  /**
162
  * Migrates plugin settings from v1 to v2.
53
  $this->upgrade_versions = [
54
  '2.0.0',
55
  '2.0.4',
56
+ '2.1.5',
57
  ];
58
  }
59
 
158
  update_option( 'wc_square_settings', $v2_settings );
159
  }
160
 
161
+ /**
162
+ * Upgrades to version 2.1.5
163
+ *
164
+ * 2.1.5 updated the woocommerce_square_customers database schema.
165
+ *
166
+ * @see https://github.com/woocommerce/woocommerce-square/issues/359
167
+ * @since 2.1.5
168
+ */
169
+ protected function upgrade_to_2_1_5() {
170
+ Gateway\Customer_Helper::create_table();
171
+ }
172
 
173
  /**
174
  * Migrates plugin settings from v1 to v2.
includes/Plugin.php CHANGED
@@ -42,7 +42,7 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
42
 
43
 
44
  /** plugin version number */
45
- const VERSION = '2.1.4';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
@@ -217,6 +217,8 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
217
  if ( ! $this->admin_handler && is_admin() ) {
218
  $this->admin_handler = new Admin( $this );
219
  }
 
 
220
  }
221
 
222
 
42
 
43
 
44
  /** plugin version number */
45
+ const VERSION = '2.1.5';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
217
  if ( ! $this->admin_handler && is_admin() ) {
218
  $this->admin_handler = new Admin( $this );
219
  }
220
+
221
+ do_action( 'wc_square_initialized' );
222
  }
223
 
224
 
includes/Settings.php CHANGED
@@ -261,8 +261,7 @@ class Settings extends \WC_Settings_API {
261
 
262
  $fields = parent::get_form_fields();
263
 
264
- if ( ! empty( $fields['location_id'] ) ) {
265
-
266
  $locations = [
267
  '' => __( 'Please choose a location', 'woocommerce-square' ),
268
  ];
@@ -278,6 +277,7 @@ class Settings extends \WC_Settings_API {
278
  }
279
 
280
  $fields['location_id']['options'] = $locations;
 
281
  }
282
 
283
  return $fields;
@@ -616,12 +616,12 @@ class Settings extends \WC_Settings_API {
616
  }
617
 
618
  // don't always need to refetch when not on Settings screen
619
- if ( ! ( isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && Plugin::PLUGIN_ID === $_GET['tab'] ) ) {
620
 
621
  $this->locations = get_transient( 'wc_square_locations' );
622
  }
623
 
624
- if ( ! is_array( $this->locations ) ) {
625
 
626
  $this->locations = [];
627
 
@@ -865,5 +865,13 @@ class Settings extends \WC_Settings_API {
865
  return $this->plugin;
866
  }
867
 
868
-
 
 
 
 
 
 
 
 
869
  }
261
 
262
  $fields = parent::get_form_fields();
263
 
264
+ if ( ! empty( $fields['location_id'] ) && did_action( 'wc_square_initialized' ) && $this->is_admin_settings_screen() ) {
 
265
  $locations = [
266
  '' => __( 'Please choose a location', 'woocommerce-square' ),
267
  ];
277
  }
278
 
279
  $fields['location_id']['options'] = $locations;
280
+
281
  }
282
 
283
  return $fields;
616
  }
617
 
618
  // don't always need to refetch when not on Settings screen
619
+ if ( ! $this->is_admin_settings_screen() ) {
620
 
621
  $this->locations = get_transient( 'wc_square_locations' );
622
  }
623
 
624
+ if ( ! is_array( $this->locations ) && did_action( 'wc_square_initialized' ) ) {
625
 
626
  $this->locations = [];
627
 
865
  return $this->plugin;
866
  }
867
 
868
+ /**
869
+ * Determines if the current request is for the Square admin settings screen.
870
+ *
871
+ * @since 2.1.5
872
+ * @return bool True if the current request is for the Square admin settings, otherwise false.
873
+ */
874
+ public function is_admin_settings_screen() {
875
+ return isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && Plugin::PLUGIN_ID === $_GET['tab'];
876
+ }
877
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
  Tested up to: 5.4
6
  Requires PHP: 5.6
7
- Stable tag: 2.1.4
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -72,6 +72,10 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
72
 
73
  == Changelog ==
74
 
 
 
 
 
75
  = 2.1.4 - 2020.05.05 =
76
  * Fix - Make sure that Square credit card fields are editable after checkout form refresh.
77
 
4
  Requires at least: 4.6
5
  Tested up to: 5.4
6
  Requires PHP: 5.6
7
+ Stable tag: 2.1.5
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.1.5 - 2020.05.15 =
76
+ * Fix - Fatal errors caused by incorrectly fetching locations before plugin init.
77
+ * Fix - WordPress database error when creating the Square Customers table on servers using utf8mb4.
78
+
79
  = 2.1.4 - 2020.05.05 =
80
  * Fix - Make sure that Square credit card fields are editable after checkout form refresh.
81
 
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 2.1.4
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
@@ -19,7 +19,7 @@
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
- * WC tested up to: 4.0
23
  */
24
 
25
  defined( 'ABSPATH' ) or exit;
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 2.1.5
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
+ * WC tested up to: 4.1
23
  */
24
 
25
  defined( 'ABSPATH' ) or exit;