diff --git a/assets/css/about.css b/assets/css/about.css old mode 100644 new mode 100755 diff --git a/assets/css/admin.css b/assets/css/admin.css old mode 100644 new mode 100755 diff --git a/assets/css/checkout.css b/assets/css/checkout.css old mode 100644 new mode 100755 diff --git a/assets/css/dashboard.css b/assets/css/dashboard.css old mode 100644 new mode 100755 diff --git a/assets/css/view-subscription.css b/assets/css/view-subscription.css old mode 100644 new mode 100755 diff --git a/assets/css/wcs-upgrade.css b/assets/css/wcs-upgrade.css old mode 100644 new mode 100755 diff --git a/assets/images/add-edit-subscription-screen.png b/assets/images/add-edit-subscription-screen.png old mode 100644 new mode 100755 diff --git a/assets/images/admin-change-payment-method.jpg b/assets/images/admin-change-payment-method.jpg old mode 100644 new mode 100755 diff --git a/assets/images/ajax-loader.gif b/assets/images/ajax-loader.gif old mode 100644 new mode 100755 diff --git a/assets/images/ajax-loader@2x.gif b/assets/images/ajax-loader@2x.gif old mode 100644 new mode 100755 diff --git a/assets/images/billing-schedules-meta-box.png b/assets/images/billing-schedules-meta-box.png old mode 100644 new mode 100755 diff --git a/assets/images/checkout-recurring-totals.png b/assets/images/checkout-recurring-totals.png old mode 100644 new mode 100755 diff --git a/assets/images/drip-downloadable-content.jpg b/assets/images/drip-downloadable-content.jpg old mode 100644 new mode 100755 diff --git a/assets/images/gift-subscription.png b/assets/images/gift-subscription.png old mode 100644 new mode 100755 diff --git a/assets/images/renewal-retry-settings.png b/assets/images/renewal-retry-settings.png old mode 100644 new mode 100755 diff --git a/assets/images/subscribe-all-the-things.png b/assets/images/subscribe-all-the-things.png old mode 100644 new mode 100755 diff --git a/assets/images/subscription-reports.png b/assets/images/subscription-reports.png old mode 100644 new mode 100755 diff --git a/assets/images/subscription-suspended-email.jpg b/assets/images/subscription-suspended-email.jpg old mode 100644 new mode 100755 diff --git a/assets/images/subscriptions-importer-exporter.png b/assets/images/subscriptions-importer-exporter.png old mode 100644 new mode 100755 diff --git a/assets/images/view-subscription.png b/assets/images/view-subscription.png old mode 100644 new mode 100755 diff --git a/assets/images/woocommerce_subscriptions_logo.png b/assets/images/woocommerce_subscriptions_logo.png old mode 100644 new mode 100755 diff --git a/assets/js/admin/admin-pointers.js b/assets/js/admin/admin-pointers.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/admin.js b/assets/js/admin/admin.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/jquery.flot.axislabels.js b/assets/js/admin/jquery.flot.axislabels.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/jquery.flot.axislabels.min.js b/assets/js/admin/jquery.flot.axislabels.min.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/jquery.flot.orderBars.js b/assets/js/admin/jquery.flot.orderBars.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/jquery.flot.orderBars.min.js b/assets/js/admin/jquery.flot.orderBars.min.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/jstz.js b/assets/js/admin/jstz.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/jstz.min.js b/assets/js/admin/jstz.min.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/meta-boxes-coupon.js b/assets/js/admin/meta-boxes-coupon.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/meta-boxes-subscription.js b/assets/js/admin/meta-boxes-subscription.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/moment.js b/assets/js/admin/moment.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/moment.min.js b/assets/js/admin/moment.min.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/reports.js b/assets/js/admin/reports.js old mode 100644 new mode 100755 diff --git a/assets/js/admin/wcs-meta-boxes-order.js b/assets/js/admin/wcs-meta-boxes-order.js old mode 100644 new mode 100755 diff --git a/assets/js/wcs-upgrade.js b/assets/js/wcs-upgrade.js old mode 100644 new mode 100755 diff --git a/changelog.txt b/changelog.txt old mode 100644 new mode 100755 index f3431d4..ada15b8 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,15 @@ *** WooCommerce Subscriptions Changelog *** +2018.08.27 - version 2.3.5 +* Fix: Exclude customers with at least 1 subscription from the WC inactivity user cleanup query. PR#2830 +* Fix: Calculate PayPal trial args from the next payment date while resubscribing before the subscription's end date. PR#2828 +* Fix: Only display the 2.3 upgrade notice after plugin upgrade, not after install. PR#2869 +* Tweak: Add 'woocommerce_subscriptions_can_user_renew_early' filter to allow third-parties to filter renew early eligibility. PR#2859 +* Tweak: Include resubscribe data in the subscription REST API response. PR#2863 +* Tweak: Improve the performance of some queries by using cached customer subscriptions instead of meta queries. PR#2856 +* Tweak: Improve the performance of the query which generates the data for the Subscriptions by Date report. PR#2788 +* Tweak: Give customers the option to update their subscription tokens after changing their default method. PR#2819 + 2018.08.10 - version 2.3.4 * New: Add filter to bypass coupon removal for recurring carts. PR#2832 * Fix: Check if subscription is payable before populating the cart with a renewal order. PR#2838 diff --git a/composer.lock b/composer.lock old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-background-updater.php b/includes/abstracts/abstract-wcs-background-updater.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-background-upgrader.php b/includes/abstracts/abstract-wcs-background-upgrader.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-cache-manager.php b/includes/abstracts/abstract-wcs-cache-manager.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-customer-store.php b/includes/abstracts/abstract-wcs-customer-store.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-debug-tool-cache-updater.php b/includes/abstracts/abstract-wcs-debug-tool-cache-updater.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-debug-tool.php b/includes/abstracts/abstract-wcs-debug-tool.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-dynamic-hook-deprecator.php b/includes/abstracts/abstract-wcs-dynamic-hook-deprecator.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-hook-deprecator.php b/includes/abstracts/abstract-wcs-hook-deprecator.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-related-order-store.php b/includes/abstracts/abstract-wcs-related-order-store.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-retry-store.php b/includes/abstracts/abstract-wcs-retry-store.php old mode 100644 new mode 100755 diff --git a/includes/abstracts/abstract-wcs-scheduler.php b/includes/abstracts/abstract-wcs-scheduler.php old mode 100644 new mode 100755 diff --git a/includes/admin/class-wc-subscriptions-admin.php b/includes/admin/class-wc-subscriptions-admin.php old mode 100644 new mode 100755 diff --git a/includes/admin/class-wcs-admin-meta-boxes.php b/includes/admin/class-wcs-admin-meta-boxes.php old mode 100644 new mode 100755 diff --git a/includes/admin/class-wcs-admin-notice.php b/includes/admin/class-wcs-admin-notice.php old mode 100644 new mode 100755 diff --git a/includes/admin/class-wcs-admin-post-types.php b/includes/admin/class-wcs-admin-post-types.php old mode 100644 new mode 100755 index 5fc0eb4..712dc84 --- a/includes/admin/class-wcs-admin-post-types.php +++ b/includes/admin/class-wcs-admin-post-types.php @@ -23,6 +23,19 @@ if ( class_exists( 'WCS_Admin_Post_Types' ) ) { */ class WCS_Admin_Post_Types { + /** + * The value to use for the 'post__in' query param when no results should be returned. + * + * We can't use an empty array, because WP returns all posts when post__in is an empty + * array. Source: https://core.trac.wordpress.org/ticket/28099 + * + * This would ideally be a private CONST but visibility modifiers are only allowed for + * class constants in PHP >= 7.1. + * + * @var array + */ + private static $post__in_none = array( 0 ); + /** * Constructor */ @@ -732,24 +745,20 @@ class WCS_Admin_Post_Types { if ( 'shop_subscription' === $typenow ) { // Filter the orders by the posted customer. - if ( isset( $_GET['_customer_user'] ) && $_GET['_customer_user'] > 0 ) { - $vars['meta_query'][] = array( - 'key' => '_customer_user', - 'value' => (int) $_GET['_customer_user'], - 'compare' => '=', - ); + if ( isset( $_GET['_subscriber_id'] ) && $_GET['_subscriber_id'] > 0 ) { + $subscription_ids = WCS_Customer_Store::instance()->get_users_subscription_ids( absint( $_GET['_subscriber_id'] ) ); + $vars = self::set_post__in_query_var( $vars, $subscription_ids ); } if ( isset( $_GET['_wcs_product'] ) && $_GET['_wcs_product'] > 0 ) { - $subscription_ids = wcs_get_subscriptions_for_product( $_GET['_wcs_product'] ); + $subscription_ids = array_keys( $subscription_ids ); + $vars = self::set_post__in_query_var( $vars, $subscription_ids ); + } - if ( ! empty( $subscription_ids ) ) { - $vars['post__in'] = $subscription_ids; - } else { - // no subscriptions contain this product, but we need to pass post__in an ID that no post will have because WP returns all posts when post__in is an empty array: https://core.trac.wordpress.org/ticket/28099 - $vars['post__in'] = array( 0 ); - } + // If we've using the 'none' flag for the post__in query var, there's no need to apply other query filters, as we're going to return no subscriptions anyway + if ( isset( $vars['post__in'] ) && self::$post__in_none === $vars['post__in'] ) { + return $vars; } if ( ! empty( $_GET['_payment_method'] ) ) { @@ -779,7 +788,7 @@ class WCS_Admin_Post_Types { if ( ! empty( $subscription_ids ) ) { $vars['post__in'] = $subscription_ids; } else { - $vars['post__in'] = array( 0 ); + $vars['post__in'] = self::$post__in_none; } } @@ -816,6 +825,40 @@ class WCS_Admin_Post_Types { return $vars; } + /** + * Set the 'post__in' query var with a given set of post ids. + * + * There are a few special conditions for handling the post__in value. Namely: + * - if there are no matching post_ids, the value should be array( 0 ), not an empty array() + * - if there are existing IDs in post__in, we only want to retun posts with an ID in both + * the existing set and the new set + * + * While this method is public, it should not be used as it will eventually be deprecated and + * it's only made publicly available for other Subscriptions methods until Subscriptions + * requires WC 3.0, and can rely on using methods in the data store rather than a hack like + * pulling this for use outside of the admin context. + * + * @param array $query_vars + * @param array $post_ids + * @return array + */ + public static function set_post__in_query_var( $query_vars, $post_ids ) { + + if ( empty( $post_ids ) ) { + // No posts for this user + $query_vars['post__in'] = self::$post__in_none; + } elseif ( ! isset( $query_vars['post__in'] ) ) { + // No other posts limitations, include all of these posts + $query_vars['post__in'] = $post_ids; + } elseif ( self::$post__in_none !== $query_vars['post__in'] ) { + // Existing post limitation, we only want to include existing IDs that are also in this new set of IDs + $intersecting_post_ids = array_intersect( $query_vars['post__in'], $post_ids ); + $query_vars['post__in'] = empty( $intersecting_post_ids ) ? self::$post__in_none : $intersecting_post_ids; + } + + return $query_vars; + } + /** * Change messages when a post type is updated. * @@ -1062,8 +1105,8 @@ class WCS_Admin_Post_Types { $user_string = ''; $user_id = ''; - if ( ! empty( $_GET['_customer_user'] ) ) { - $user_id = absint( $_GET['_customer_user'] ); + if ( ! empty( $_GET['_subscriber_id'] ) ) { + $user_id = absint( $_GET['_subscriber_id'] ); $user = get_user_by( 'id', $user_id ); $user_string = sprintf( @@ -1075,7 +1118,7 @@ class WCS_Admin_Post_Types { ); } ?> - prepare( "SELECT searchdate.Date as date, COUNT( DISTINCT wcsubs.ID) as count FROM ( - SELECT DATE_FORMAT(a.Date,'%%Y-%%m-%%d') as Date, 0 as cnt + SELECT DATE_FORMAT(last_thousand_days.Date,'%%Y-%%m-%%d') as Date FROM ( - SELECT DATE(%s) - INTERVAL(a.a + (10 * b.a) + (100 * c.a)) DAY as Date + SELECT DATE(%s) - INTERVAL(units.digit + (10 * tens.digit) + (100 * hundreds.digit)) DAY as Date FROM ( - SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 + SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 - ) as a + ) as units CROSS JOIN ( - SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 + SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 - ) as b + ) as tens CROSS JOIN ( - SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 + SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 - ) AS c - ) a - WHERE a.Date >= %s AND a.Date <= %s - ) searchdate - LEFT JOIN ( - {$wpdb->posts} AS wcsubs - LEFT JOIN {$wpdb->postmeta} AS wcsmeta - ON wcsubs.ID = wcsmeta.post_id AND wcsmeta.meta_key = %s - ) ON DATE( wcsubs.post_date ) < searchdate.Date - AND wcsubs.post_type IN ( 'shop_subscription' ) - AND wcsubs.post_status NOT IN( 'trash', 'auto-draft' ) - AND ( - DATE( CONVERT_TZ( wcsmeta.meta_value , '+00:00', %s ) ) >= searchdate.Date - OR wcsmeta.meta_value = 0 - OR wcsmeta.meta_value IS NULL - ) - GROUP BY searchdate.Date - ORDER BY searchdate.Date ASC", + ) AS hundreds + ) last_thousand_days + WHERE last_thousand_days.Date >= %s AND last_thousand_days.Date <= %s + ) searchdate, + {$wpdb->posts} AS wcsubs, + {$wpdb->postmeta} AS wcsmeta + WHERE wcsubs.ID = wcsmeta.post_id AND wcsmeta.meta_key = '%s' + AND DATE( wcsubs.post_date ) <= searchdate.Date + AND wcsubs.post_type IN ( 'shop_subscription' ) + AND wcsubs.post_status NOT IN( 'auto-draft' ) + AND ( + DATE( CONVERT_TZ( wcsmeta.meta_value , '+00:00', %s ) ) >= searchdate.Date + OR wcsmeta.meta_value = 0 + OR wcsmeta.meta_value IS NULL + ) + ORDER BY searchdate.Date ASC", $query_end_date, date( 'Y-m-d', $this->start_date ), $query_end_date, diff --git a/includes/admin/reports/class-wcs-report-subscription-payment-retry.php b/includes/admin/reports/class-wcs-report-subscription-payment-retry.php old mode 100644 new mode 100755 diff --git a/includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php b/includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php old mode 100644 new mode 100755 diff --git a/includes/admin/views/html-report-by-period.php b/includes/admin/views/html-report-by-period.php old mode 100644 new mode 100755 diff --git a/includes/admin/wcs-admin-functions.php b/includes/admin/wcs-admin-functions.php old mode 100644 new mode 100755 diff --git a/includes/api/class-wc-rest-subscription-notes-controller.php b/includes/api/class-wc-rest-subscription-notes-controller.php old mode 100644 new mode 100755 diff --git a/includes/api/class-wc-rest-subscriptions-controller.php b/includes/api/class-wc-rest-subscriptions-controller.php old mode 100644 new mode 100755 index e25a3e4..d55d495 --- a/includes/api/class-wc-rest-subscriptions-controller.php +++ b/includes/api/class-wc-rest-subscriptions-controller.php @@ -81,8 +81,13 @@ class WC_REST_Subscriptions_Controller extends WC_REST_Orders_V1_Controller { if ( ! empty( $post->post_type ) && ! empty( $post->ID ) && 'shop_subscription' == $post->post_type ) { $subscription = wcs_get_subscription( $post->ID ); - $response->data['billing_period'] = $subscription->get_billing_period(); - $response->data['billing_interval'] = $subscription->get_billing_interval(); + $response->data['billing_period'] = $subscription->get_billing_period(); + $response->data['billing_interval'] = $subscription->get_billing_interval(); + + // Send resubscribe data + $resubscribed_subscriptions = array_filter( $subscription->get_related_orders( 'ids', 'resubscribe' ), 'wcs_is_subscription' ); + $response->data['resubscribed_from'] = strval( wcs_get_objects_property( $subscription, 'subscription_resubscribe' ) ); + $response->data['resubscribed_subscription'] = strval( reset( $resubscribed_subscriptions ) ); // Subscriptions can only be resubscribed to once so return the first and only element. foreach ( array( 'start', 'trial_end', 'next_payment', 'end' ) as $date_type ) { $date_type_key = ( 'start' === $date_type ) ? 'date_created' : $date_type; @@ -447,6 +452,18 @@ class WC_REST_Subscriptions_Controller extends WC_REST_Orders_V1_Controller { 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), + 'resubscribed_from' => array( + 'description' => __( "The subscription's original subscription ID if this is a resubscribed subscription.", 'woocommerce-subscriptions' ), + 'type' => 'string', + 'context' => array( 'view' ), + 'readonly' => true, + ), + 'resubscribed_subscription' => array( + 'description' => __( "The subscription's resubscribed subscription ID.", 'woocommerce-subscriptions' ), + 'type' => 'string', + 'context' => array( 'view' ), + 'readonly' => true, + ), ); $schema['properties'] += $subscriptions_schema; diff --git a/includes/api/legacy/class-wc-api-subscriptions-customers.php b/includes/api/legacy/class-wc-api-subscriptions-customers.php old mode 100644 new mode 100755 diff --git a/includes/api/legacy/class-wc-api-subscriptions.php b/includes/api/legacy/class-wc-api-subscriptions.php old mode 100644 new mode 100755 diff --git a/includes/api/legacy/class-wc-rest-subscription-notes-controller.php b/includes/api/legacy/class-wc-rest-subscription-notes-controller.php old mode 100644 new mode 100755 diff --git a/includes/api/legacy/class-wc-rest-subscriptions-controller.php b/includes/api/legacy/class-wc-rest-subscriptions-controller.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-order-item-pending-switch.php b/includes/class-wc-order-item-pending-switch.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-product-subscription-variation.php b/includes/class-wc-product-subscription-variation.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-product-subscription.php b/includes/class-wc-product-subscription.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-product-variable-subscription.php b/includes/class-wc-product-variable-subscription.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscription.php b/includes/class-wc-subscription.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-addresses.php b/includes/class-wc-subscriptions-addresses.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-cart.php b/includes/class-wc-subscriptions-cart.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-change-payment-gateway.php b/includes/class-wc-subscriptions-change-payment-gateway.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-checkout.php b/includes/class-wc-subscriptions-checkout.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-coupon.php b/includes/class-wc-subscriptions-coupon.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-email.php b/includes/class-wc-subscriptions-email.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-manager.php b/includes/class-wc-subscriptions-manager.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-order.php b/includes/class-wc-subscriptions-order.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-product.php b/includes/class-wc-subscriptions-product.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-renewal-order.php b/includes/class-wc-subscriptions-renewal-order.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-switcher.php b/includes/class-wc-subscriptions-switcher.php old mode 100644 new mode 100755 diff --git a/includes/class-wc-subscriptions-synchroniser.php b/includes/class-wc-subscriptions-synchroniser.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-action-scheduler.php b/includes/class-wcs-action-scheduler.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-api.php b/includes/class-wcs-api.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-auth.php b/includes/class-wcs-auth.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-cached-data-manager.php b/includes/class-wcs-cached-data-manager.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-cart-initial-payment.php b/includes/class-wcs-cart-initial-payment.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-cart-renewal.php b/includes/class-wcs-cart-renewal.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-cart-resubscribe.php b/includes/class-wcs-cart-resubscribe.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-cart-switch.php b/includes/class-wcs-cart-switch.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-change-payment-method-admin.php b/includes/class-wcs-change-payment-method-admin.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-download-handler.php b/includes/class-wcs-download-handler.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-failed-scheduled-action-manager.php b/includes/class-wcs-failed-scheduled-action-manager.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-limiter.php b/includes/class-wcs-limiter.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-my-account-payment-methods.php b/includes/class-wcs-my-account-payment-methods.php old mode 100644 new mode 100755 index 3b0a2d4..abf915b --- a/includes/class-wcs-my-account-payment-methods.php +++ b/includes/class-wcs-my-account-payment-methods.php @@ -18,12 +18,15 @@ class WCS_My_Account_Payment_Methods { * @since 2.2.7 */ public static function init() { - // Only hook class functions if the payment token object exists - if ( class_exists( 'WC_Payment_Token' ) ) { - add_filter( 'woocommerce_payment_methods_list_item', __CLASS__ . '::flag_subscription_payment_token_deletions', 10, 2 ); - add_action( 'woocommerce_payment_token_deleted', __CLASS__ . '::maybe_update_subscriptions_payment_meta', 10, 2 ); + if ( ! class_exists( 'WC_Payment_Token' ) ) { + return; } + + add_filter( 'woocommerce_payment_methods_list_item', array( __CLASS__, 'flag_subscription_payment_token_deletions' ), 10, 2 ); + add_action( 'woocommerce_payment_token_deleted',array( __CLASS__, 'maybe_update_subscriptions_payment_meta' ), 10, 2 ); + add_action( 'woocommerce_payment_token_set_default', array( __CLASS__, 'display_default_payment_token_change_notice' ), 10, 2 ); + add_action( 'wp', array( __CLASS__, 'update_subscription_tokens' ) ); } /** @@ -61,68 +64,86 @@ class WCS_My_Account_Payment_Methods { * old token value stored in post meta will be updated using the same meta key to use the * new token value. * - * @param int The deleted token id - * @param WC_Payment_Token The deleted token object + * @param int $deleted_token_id The deleted token id. + * @param WC_Payment_Token $deleted_token The deleted token object. * @since 2.2.7 */ public static function maybe_update_subscriptions_payment_meta( $deleted_token_id, $deleted_token ) { - if ( isset( $_GET['delete_subscription_token'] ) && ! empty( $_GET['wcs_nonce'] ) && wp_verify_nonce( $_GET['wcs_nonce'], 'delete_subscription_token_' . $_GET['delete_subscription_token'] ) ) { - // init payment gateways - WC()->payment_gateways(); + if ( ! isset( $_GET['delete_subscription_token'] ) || empty( $_GET['wcs_nonce'] ) || ! wp_verify_nonce( $_GET['wcs_nonce'], 'delete_subscription_token_' . $_GET['delete_subscription_token'] ) ) { + return; + } - $new_token = self::get_customers_alternative_token( $deleted_token ); + // init payment gateways + WC()->payment_gateways(); - if ( empty( $new_token ) ) { - $notice = esc_html__( 'The deleted payment method was used for automatic subscription payments, we couldn\'t find an alternative token payment method token to change your subscriptions to.', 'woocommerce-subscriptions' ); - wc_add_notice( $notice, 'error' ); - return; + $new_token = self::get_customers_alternative_token( $deleted_token ); + + if ( empty( $new_token ) ) { + $notice = esc_html__( 'The deleted payment method was used for automatic subscription payments, we couldn\'t find an alternative token payment method token to change your subscriptions to.', 'woocommerce-subscriptions' ); + wc_add_notice( $notice, 'error' ); + return; + } + + $subscriptions = self::get_subscriptions_by_token( $deleted_token ); + + if ( empty( $subscriptions ) ) { + return; + } + + foreach ( $subscriptions as $subscription ) { + $subscription = wcs_get_subscription( $subscription ); + + if ( empty( $subscription ) ) { + continue; } - $subscriptions = self::get_subscriptions_by_token( $deleted_token ); - $token_meta_key = ''; - $notice_displayed = false; + if ( self::update_subscription_token( $subscription, $new_token, $deleted_token ) ) { + $subscription->add_order_note( sprintf( _x( 'Payment method meta updated after customer deleted a token from their My Account page. Payment meta changed from %1$s to %2$s', 'used in subscription note', 'woocommerce-subscriptions' ), $deleted_token->get_token(), $new_token->get_token() ) ); + } + } - if ( ! empty( $subscriptions ) ) { - // translators: $1: the token/credit card label, 2$-3$: opening and closing strong and link tags - $notice = sprintf( esc_html__( 'The deleted payment method was used for automatic subscription payments. To avoid failed renewal payments in future the subscriptions using this payment method have been updated to use your %1$s. To change the payment method of individual subscriptions go to your %2$sMy Account > Subscriptions%3$s page.', 'woocommerce-subscriptions' ), - self::get_token_label( $new_token ), - '', - '' - ); + // translators: $1: the token/credit card label, 2$-3$: opening and closing strong and link tags + $notice = sprintf( esc_html__( 'The deleted payment method was used for automatic subscription payments. To avoid failed renewal payments in future the subscriptions using this payment method have been updated to use your %1$s. To change the payment method of individual subscriptions go to your %2$sMy Account > Subscriptions%3$s page.', 'woocommerce-subscriptions' ), + self::get_token_label( $new_token ), + '', + '' + ); - wc_add_notice( $notice , 'notice' ); - foreach ( $subscriptions as $subscription ) { - $subscription = wcs_get_subscription( $subscription ); + wc_add_notice( $notice , 'notice' ); + } - if ( empty( $subscription ) ) { - continue; - } + /** + * Update the subscription payment meta to change from an old payment token to a new one. + * + * @param WC_Subscription $subscription The subscription to update. + * @param WC_Payment_Token $new_token The new payment token. + * @param WC_Payment_Token $old_token The old payment token. + * @return bool Whether the subscription was updated or not. + */ + protected static function update_subscription_token( $subscription, $new_token, $old_token ) { + $payment_method_meta = apply_filters( 'woocommerce_subscription_payment_meta', array(), $subscription ); + $token_payment_gateway = $old_token->get_gateway_id(); + $token_meta_key = ''; - // Attempt to find the token meta key if we haven't already found it. - if ( empty( $token_meta_key ) ) { - $payment_method_meta = apply_filters( 'woocommerce_subscription_payment_meta', array(), $subscription ); - - if ( is_array( $payment_method_meta ) && isset( $payment_method_meta[ $deleted_token->get_gateway_id() ] ) && is_array( $payment_method_meta[ $deleted_token->get_gateway_id() ] ) ) { - foreach ( $payment_method_meta[ $deleted_token->get_gateway_id() ] as $meta_table => $meta ) { - foreach ( $meta as $meta_key => $meta_data ) { - if ( $deleted_token->get_token() === $meta_data['value'] ) { - $token_meta_key = $meta_key; - break 2; - } - } - } - } - } - - $updated = update_post_meta( $subscription->get_id(), $token_meta_key, $new_token->get_token(), $deleted_token->get_token() ); - - if ( $updated ) { - $subscription->add_order_note( sprintf( _x( 'Payment method meta updated after customer deleted a token from their My Account page. Payment meta changed from %1$s to %2$s', 'used in subscription note', 'woocommerce-subscriptions' ), $deleted_token->get_token(), $new_token->get_token() ) ); - do_action( 'woocommerce_subscription_token_changed', $subscription, $new_token, $deleted_token ); + // Attempt to find the token meta key from the subscription payment meta and the old token. + if ( is_array( $payment_method_meta ) && isset( $payment_method_meta[ $token_payment_gateway ] ) && is_array( $payment_method_meta[ $token_payment_gateway ] ) ) { + foreach ( $payment_method_meta[ $token_payment_gateway ] as $meta_table => $meta ) { + foreach ( $meta as $meta_key => $meta_data ) { + if ( $old_token->get_token() === $meta_data['value'] ) { + $token_meta_key = $meta_key; + break 2; } } } } + + $updated = update_post_meta( $subscription->get_id(), $token_meta_key, $new_token->get_token(), $old_token->get_token() ); + + if ( $updated ) { + do_action( 'woocommerce_subscription_token_changed', $subscription, $new_token, $old_token ); + } + + return $updated; } /** @@ -144,11 +165,6 @@ class WCS_My_Account_Payment_Methods { 'key' => '_requires_manual_renewal', 'value' => 'false', ), - array( - 'key' => '_customer_user', - 'value' => $payment_token->get_user_id(), - 'type' => 'numeric', - ), array( 'value' => $payment_token->get_token(), ), @@ -159,6 +175,7 @@ class WCS_My_Account_Payment_Methods { 'post_status' => array( 'wc-pending', 'wc-active', 'wc-on-hold' ), 'meta_query' => $meta_query, 'posts_per_page' => -1, + 'post__in' => WCS_Customer_Store::instance()->get_users_subscription_ids( $payment_token->get_user_id() ), ) ); return apply_filters( 'woocommerce_subscriptions_by_payment_token', $user_subscriptions, $payment_token ); @@ -205,20 +222,26 @@ class WCS_My_Account_Payment_Methods { /** * Get the customer's alternative token. * - * @param WC_Payment_Token the token to find an alternative for - * @return WC_Payment_Token the customer's alternative token + * @param WC_Payment_Token $token The token to find an alternative for + * @return WC_Payment_Token The customer's alternative token * @since 2.2.7 */ public static function get_customers_alternative_token( $token ) { - $payment_tokens = self::get_customer_tokens( $token->get_gateway_id(), $token->get_user_id() ); - $alternative_token = null; - $has_single_alternative = count( $payment_tokens ) === 2; // if there are 2 tokens in total there is only 1 other alternative + $payment_tokens = self::get_customer_tokens( $token->get_gateway_id(), $token->get_user_id() ); + $alternative_token = null; - foreach ( $payment_tokens as $payment_token ) { - // if there is a default token which is different we can use it as an alternative. - if ( $payment_token->get_id() !== $token->get_id() && ( $payment_token->is_default() || $has_single_alternative ) ) { - $alternative_token = $payment_token; - break; + // Remove the token we're trying to find an alternative for. + unset( $payment_tokens[ $token->get_id() ] ); + + if ( count( $payment_tokens ) === 1 ) { + $alternative_token = reset( $payment_tokens ); + } else { + foreach ( $payment_tokens as $payment_token ) { + // If there is a default token we can use it as an alternative. + if ( $payment_token->is_default() ) { + $alternative_token = $payment_token; + break; + } } } @@ -235,5 +258,80 @@ class WCS_My_Account_Payment_Methods { public static function customer_has_alternative_token( $token ) { return self::get_customers_alternative_token( $token ) !== null; } + + /** + * Display a notice when a customer sets a new default token notifying them of what this means for their subscriptions. + * + * @param int $default_token_id The default token id. + * @param WC_Payment_Token $default_token The default token object. + * @since 2.3.3 + */ + public static function display_default_payment_token_change_notice( $default_token_id, $default_token ) { + $display_notice = false; + $customer_tokens = self::get_customer_tokens( $default_token->get_gateway_id(), $default_token->get_user_id() ); + unset( $customer_tokens[ $default_token_id ] ); + + // Check if there are subscriptions for one of the customer's other tokens. + foreach ( $customer_tokens as $token ) { + if ( count( self::get_subscriptions_by_token( $token ) ) > 0 ) { + $display_notice = true; + break; + } + } + + if ( ! $display_notice ) { + return; + } + + $notice = sprintf( esc_html__( 'Would you like to update your subscriptions to use this new payment method - %1$s?%2$sYes%4$s | %3$sNo%4$s', 'woocommerce-subscriptions' ), + self::get_token_label( $default_token ), + '
', + '', + '' + ); + + wc_add_notice( $notice , 'notice' ); + } + + /** + * Update the customer's subscription tokens if they opted to from their My Account page. + * + * @since 2.3.3 + */ + public static function update_subscription_tokens() { + if ( ! isset( $_GET['update-subscription-tokens'], $_GET['token-id'], $_GET['_wcsnonce'] ) || ! wp_verify_nonce( $_GET['_wcsnonce'], 'wcs-update-subscription-tokens' ) ) { + return; + } + + // init payment gateways + WC()->payment_gateways(); + + $default_token_id = $_GET['token-id']; + $default_token = WC_Payment_Tokens::get( $default_token_id ); + + if ( ! $default_token ) { + return; + } + + $tokens = self::get_customer_tokens( $default_token->get_gateway_id(), $default_token->get_user_id() ); + unset( $tokens[ $default_token_id ] ); + + foreach ( $tokens as $old_token ) { + foreach ( self::get_subscriptions_by_token( $old_token ) as $subscription ) { + $subscription = wcs_get_subscription( $subscription ); + + if ( ! empty( $subscription ) && self::update_subscription_token( $subscription, $default_token, $old_token ) ) { + $subscription->add_order_note( sprintf( _x( 'Payment method meta updated after customer changed their default token and opted to update their subscriptions. Payment meta changed from %1$s to %2$s', 'used in subscription note', 'woocommerce-subscriptions' ), $old_token->get_token(), $default_token->get_token() ) ); + } + } + } + + wp_redirect( remove_query_arg( array( 'update-subscription-tokens', 'token-id', '_wcsnonce' ) ) ); + exit(); + } } WCS_My_Account_Payment_Methods::init(); diff --git a/includes/class-wcs-post-meta-cache-manager-many-to-one.php b/includes/class-wcs-post-meta-cache-manager-many-to-one.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-post-meta-cache-manager.php b/includes/class-wcs-post-meta-cache-manager.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-query.php b/includes/class-wcs-query.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-remove-item.php b/includes/class-wcs-remove-item.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-retry-manager.php b/includes/class-wcs-retry-manager.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-select2.php b/includes/class-wcs-select2.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-staging.php b/includes/class-wcs-staging.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-template-loader.php b/includes/class-wcs-template-loader.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-user-change-status-handler.php b/includes/class-wcs-user-change-status-handler.php old mode 100644 new mode 100755 diff --git a/includes/class-wcs-webhooks.php b/includes/class-wcs-webhooks.php old mode 100644 new mode 100755 diff --git a/includes/data-stores/class-wcs-customer-store-cached-cpt.php b/includes/data-stores/class-wcs-customer-store-cached-cpt.php old mode 100644 new mode 100755 diff --git a/includes/data-stores/class-wcs-customer-store-cpt.php b/includes/data-stores/class-wcs-customer-store-cpt.php old mode 100644 new mode 100755 diff --git a/includes/data-stores/class-wcs-product-variable-data-store-cpt.php b/includes/data-stores/class-wcs-product-variable-data-store-cpt.php old mode 100644 new mode 100755 diff --git a/includes/data-stores/class-wcs-related-order-store-cached-cpt.php b/includes/data-stores/class-wcs-related-order-store-cached-cpt.php old mode 100644 new mode 100755 diff --git a/includes/data-stores/class-wcs-related-order-store-cpt.php b/includes/data-stores/class-wcs-related-order-store-cpt.php old mode 100644 new mode 100755 diff --git a/includes/data-stores/class-wcs-subscription-data-store-cpt.php b/includes/data-stores/class-wcs-subscription-data-store-cpt.php old mode 100644 new mode 100755 index 6fd8252..52f6cde --- a/includes/data-stores/class-wcs-subscription-data-store-cpt.php +++ b/includes/data-stores/class-wcs-subscription-data-store-cpt.php @@ -441,4 +441,20 @@ class WCS_Subscription_Data_Store_CPT extends WC_Order_Data_Store_CPT implements return apply_filters( 'woocommerce_shop_subscription_search_results', $subscription_ids, $term, $search_fields ); } + + /** + * Get the user IDs for customers who have a subscription. + * + * @since 3.4.3 + * @return array The user IDs. + */ + public function get_subscription_customer_ids() { + global $wpdb; + + return $wpdb->get_col( + "SELECT DISTINCT meta_value + FROM {$wpdb->postmeta} AS subscription_meta INNER JOIN {$wpdb->posts} AS posts ON subscription_meta.post_id = posts.ID + WHERE subscription_meta.meta_key = '_customer_user' AND posts.post_type = 'shop_subscription'" + ); + } } diff --git a/includes/deprecated/class-wcs-action-deprecator.php b/includes/deprecated/class-wcs-action-deprecator.php old mode 100644 new mode 100755 diff --git a/includes/deprecated/class-wcs-deprecated-filter-hooks.php b/includes/deprecated/class-wcs-deprecated-filter-hooks.php old mode 100644 new mode 100755 diff --git a/includes/deprecated/class-wcs-dynamic-action-deprecator.php b/includes/deprecated/class-wcs-dynamic-action-deprecator.php old mode 100644 new mode 100755 diff --git a/includes/deprecated/class-wcs-dynamic-filter-deprecator.php b/includes/deprecated/class-wcs-dynamic-filter-deprecator.php old mode 100644 new mode 100755 diff --git a/includes/deprecated/class-wcs-filter-deprecator.php b/includes/deprecated/class-wcs-filter-deprecator.php old mode 100644 new mode 100755 diff --git a/includes/early-renewal/class-wcs-cart-early-renewal.php b/includes/early-renewal/class-wcs-cart-early-renewal.php old mode 100644 new mode 100755 diff --git a/includes/early-renewal/class-wcs-early-renewal-manager.php b/includes/early-renewal/class-wcs-early-renewal-manager.php old mode 100644 new mode 100755 diff --git a/includes/early-renewal/wcs-early-renewal-functions.php b/includes/early-renewal/wcs-early-renewal-functions.php old mode 100644 new mode 100755 index 536f775..0c97733 --- a/includes/early-renewal/wcs-early-renewal-functions.php +++ b/includes/early-renewal/wcs-early-renewal-functions.php @@ -38,54 +38,61 @@ function wcs_cart_contains_early_renewal() { * @return bool Whether the user can renew a subscription early. */ function wcs_can_user_renew_early( $subscription, $user_id = 0 ) { + $subscription = wcs_get_subscription( $subscription ); + $user_id = ! empty( $user_id ) ? $user_id : get_current_user_id(); + $reason = ''; - if ( ! is_object( $subscription ) ) { - $subscription = wcs_get_subscription( $subscription ); - } - - if ( empty( $user_id ) ) { - $user_id = get_current_user_id(); - } - + // Check for all the normal reasons a subscription can't be renewed early. if ( ! $subscription ) { - $can_renew_early = false; + $reason = 'not_a_subscription'; } elseif ( ! $subscription->has_status( array( 'active' ) ) ) { - $can_renew_early = false; - } elseif ( 0 === $subscription->get_total() ) { - $can_renew_early = false; + $reason = 'subscription_not_active'; + } elseif ( 0.0 === $subscription->get_total() ) { + $reason = 'subscription_zero_total'; } elseif ( $subscription->get_time( 'trial_end' ) > gmdate( 'U' ) ) { - $can_renew_early = false; + $reason = 'subscription_still_in_free_trial'; } elseif ( ! $subscription->get_time( 'next_payment' ) ) { - $can_renew_early = false; - } elseif ( WC_Subscriptions_Synchroniser::subscription_contains_synced_product( $subscription ) ) { - $can_renew_early = false; + $reason = 'subscription_no_next_payment'; } elseif ( ! $subscription->payment_method_supports( 'subscription_date_changes' ) ) { - $can_renew_early = false; - } else { - // Make sure all line items still exist. - $all_line_items_exist = true; - - foreach ( $subscription->get_items() as $line_item ) { - $product = wc_get_product( wcs_get_canonical_product_id( $line_item ) ); - - if ( false === $product ) { - $all_line_items_exist = false; - break; - } - } - - $can_renew_early = $all_line_items_exist; + $reason = 'payment_method_not_supported'; + } elseif ( + WC_Subscriptions_Synchroniser::subscription_contains_synced_product( $subscription ) && + /** + * Determine whether a subscription with Synchronized products can be renewed early. + * + * @param bool $can_renew_early Whether the subscription can be renewed early. + * @param WC_Subscription $subscription The subscription to be renewed early. + */ + ! boolval( apply_filters( 'wcs_allow_synced_product_early_renewal', false, $subscription ) ) + ) { + $reason = 'subscription_contains_synced_product'; } + // Make sure all line items still exist. + foreach ( $subscription->get_items() as $line_item ) { + $product = wc_get_product( wcs_get_canonical_product_id( $line_item ) ); + + if ( false === $product ) { + $reason = 'line_item_no_longer_exists'; + break; + } + } + + // Non-empty $reason means we can't renew early. + $can_renew_early = empty( $reason ); + /** * Allow third-parties to filter whether the customer can renew a subscription early. * * @since 2.3.0 + * * @param bool $can_renew_early Whether early renewal is permitted. - * @param WC_Subscription $subscription The subscription being renewed early. - * @param int $user_id The user's ID. + * @param WC_Subscription $subscription The subscription being renewed early. + * @param int $user_id The user's ID. + * @param string $reason The reason why the subscription cannot be renewed early. Empty + * string if the subscription can be renewed early. */ - return apply_filters( 'woocommerce_subscriptions_can_user_renew_early', $can_renew_early, $subscription, $user_id ); + return apply_filters( 'woocommerce_subscriptions_can_user_renew_early', $can_renew_early, $subscription, $user_id, $reason ); } /** diff --git a/includes/emails/class-wcs-email-cancelled-subscription.php b/includes/emails/class-wcs-email-cancelled-subscription.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-customer-completed-renewal-order.php b/includes/emails/class-wcs-email-customer-completed-renewal-order.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-customer-completed-switch-order.php b/includes/emails/class-wcs-email-customer-completed-switch-order.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-customer-payment-retry.php b/includes/emails/class-wcs-email-customer-payment-retry.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-customer-processing-renewal-order.php b/includes/emails/class-wcs-email-customer-processing-renewal-order.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-customer-renewal-invoice.php b/includes/emails/class-wcs-email-customer-renewal-invoice.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-expired-subscription.php b/includes/emails/class-wcs-email-expired-subscription.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-new-renewal-order.php b/includes/emails/class-wcs-email-new-renewal-order.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-new-switch-order.php b/includes/emails/class-wcs-email-new-switch-order.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-on-hold-subscription.php b/includes/emails/class-wcs-email-on-hold-subscription.php old mode 100644 new mode 100755 diff --git a/includes/emails/class-wcs-email-payment-retry.php b/includes/emails/class-wcs-email-payment-retry.php old mode 100644 new mode 100755 diff --git a/includes/gateways/class-wc-subscriptions-payment-gateways.php b/includes/gateways/class-wc-subscriptions-payment-gateways.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/class-wcs-paypal.php b/includes/gateways/paypal/class-wcs-paypal.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/abstracts/abstract-wcs-sv-api-base.php b/includes/gateways/paypal/includes/abstracts/abstract-wcs-sv-api-base.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php b/includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/admin/class-wcs-paypal-change-payment-method-admin.php b/includes/gateways/paypal/includes/admin/class-wcs-paypal-change-payment-method-admin.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-billing-agreement.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-billing-agreement.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-checkout.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-checkout.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-payment.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-payment.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-recurring-payment.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response-recurring-payment.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-response.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-ipn-handler.php b/includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-ipn-handler.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-standard-change-payment-method.php b/includes/gateways/paypal/includes/class-wcs-paypal-standard-change-payment-method.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-standard-ipn-failure-handler.php b/includes/gateways/paypal/includes/class-wcs-paypal-standard-ipn-failure-handler.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-standard-ipn-handler.php b/includes/gateways/paypal/includes/class-wcs-paypal-standard-ipn-handler.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php b/includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php old mode 100644 new mode 100755 index 754f208..2cef5b3 --- a/includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php +++ b/includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php @@ -111,6 +111,12 @@ class WCS_PayPal_Standard_Request { $next_payment_timestamp = $subscription->get_time( 'next_payment' ); $is_synced_subscription = WC_Subscriptions_Synchroniser::subscription_contains_synced_product( $subscription->get_id() ); + $is_early_resubscribe = false; + + if ( $resubscribe_cart_item = wcs_cart_contains_resubscribe() ) { + $resubscribed_subscription = wcs_get_subscription( $resubscribe_cart_item['subscription_resubscribe']['subscription_id'] ); + $is_early_resubscribe = wcs_is_subscription( $resubscribed_subscription ) && $resubscribed_subscription->has_status( 'pending-cancel' ); + } if ( $is_synced_subscription ) { $length_from_timestamp = $next_payment_timestamp; @@ -164,7 +170,7 @@ class WCS_PayPal_Standard_Request { $subscription_installments = max( $subscription_installments - $subscription->get_completed_payment_count(), 0 ); // If we're changing the payment date or switching subs, we need to set the trial period to the next payment date & installments to be the number of installments left - } elseif ( $is_payment_change || $is_synced_subscription ) { + } elseif ( $is_payment_change || $is_synced_subscription || $is_early_resubscribe ) { $next_payment_timestamp = $subscription->get_time( 'next_payment' ); diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-standard-switcher.php b/includes/gateways/paypal/includes/class-wcs-paypal-standard-switcher.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-status-manager.php b/includes/gateways/paypal/includes/class-wcs-paypal-status-manager.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/class-wcs-paypal-supports.php b/includes/gateways/paypal/includes/class-wcs-paypal-supports.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/deprecated/class-wc-paypal-standard-subscriptions.php b/includes/gateways/paypal/includes/deprecated/class-wc-paypal-standard-subscriptions.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/templates/admin-notices.php b/includes/gateways/paypal/includes/templates/admin-notices.php old mode 100644 new mode 100755 diff --git a/includes/gateways/paypal/includes/wcs-paypal-functions.php b/includes/gateways/paypal/includes/wcs-paypal-functions.php old mode 100644 new mode 100755 diff --git a/includes/interfaces/interface-wcs-cache-updater.php b/includes/interfaces/interface-wcs-cache-updater.php old mode 100644 new mode 100755 diff --git a/includes/legacy/class-wc-product-subscription-legacy.php b/includes/legacy/class-wc-product-subscription-legacy.php old mode 100644 new mode 100755 diff --git a/includes/legacy/class-wc-product-subscription-variation-legacy.php b/includes/legacy/class-wc-product-subscription-variation-legacy.php old mode 100644 new mode 100755 diff --git a/includes/legacy/class-wc-product-variable-subscription-legacy.php b/includes/legacy/class-wc-product-variable-subscription-legacy.php old mode 100644 new mode 100755 diff --git a/includes/legacy/class-wc-subscription-legacy.php b/includes/legacy/class-wc-subscription-legacy.php old mode 100644 new mode 100755 diff --git a/includes/legacy/class-wcs-array-property-post-meta-black-magic.php b/includes/legacy/class-wcs-array-property-post-meta-black-magic.php old mode 100644 new mode 100755 diff --git a/includes/legacy/class-wcs-product-legacy.php b/includes/legacy/class-wcs-product-legacy.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/action-scheduler.php b/includes/libraries/action-scheduler/action-scheduler.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler.php b/includes/libraries/action-scheduler/classes/ActionScheduler.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_ListTable.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_ListTable.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_QueueRunner.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_QueueRunner.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Action.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Action.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_ActionClaim.php b/includes/libraries/action-scheduler/classes/ActionScheduler_ActionClaim.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_ActionFactory.php b/includes/libraries/action-scheduler/classes/ActionScheduler_ActionFactory.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_AdminView.php b/includes/libraries/action-scheduler/classes/ActionScheduler_AdminView.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_AdminView_Deprecated.php b/includes/libraries/action-scheduler/classes/ActionScheduler_AdminView_Deprecated.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_CanceledAction.php b/includes/libraries/action-scheduler/classes/ActionScheduler_CanceledAction.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_CronSchedule.php b/includes/libraries/action-scheduler/classes/ActionScheduler_CronSchedule.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_DateTime.php b/includes/libraries/action-scheduler/classes/ActionScheduler_DateTime.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php b/includes/libraries/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_FinishedAction.php b/includes/libraries/action-scheduler/classes/ActionScheduler_FinishedAction.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_IntervalSchedule.php b/includes/libraries/action-scheduler/classes/ActionScheduler_IntervalSchedule.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_ListTable.php b/includes/libraries/action-scheduler/classes/ActionScheduler_ListTable.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_LogEntry.php b/includes/libraries/action-scheduler/classes/ActionScheduler_LogEntry.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Logger.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Logger.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_NullAction.php b/includes/libraries/action-scheduler/classes/ActionScheduler_NullAction.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_NullLogEntry.php b/includes/libraries/action-scheduler/classes/ActionScheduler_NullLogEntry.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_NullSchedule.php b/includes/libraries/action-scheduler/classes/ActionScheduler_NullSchedule.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_QueueCleaner.php b/includes/libraries/action-scheduler/classes/ActionScheduler_QueueCleaner.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_QueueRunner.php b/includes/libraries/action-scheduler/classes/ActionScheduler_QueueRunner.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Schedule.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Schedule.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_SimpleSchedule.php b/includes/libraries/action-scheduler/classes/ActionScheduler_SimpleSchedule.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Store.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Store.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_TimezoneHelper.php b/includes/libraries/action-scheduler/classes/ActionScheduler_TimezoneHelper.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Versions.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Versions.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_QueueRunner.php b/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_QueueRunner.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_Scheduler_command.php b/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_Scheduler_command.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpCommentLogger.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpCommentLogger.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/composer.json b/includes/libraries/action-scheduler/composer.json old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/composer.lock b/includes/libraries/action-scheduler/composer.lock old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/functions.php b/includes/libraries/action-scheduler/functions.php old mode 100644 new mode 100755 diff --git a/includes/libraries/action-scheduler/license.txt b/includes/libraries/action-scheduler/license.txt old mode 100644 new mode 100755 diff --git a/includes/libraries/class-wc-datetime.php b/includes/libraries/class-wc-datetime.php old mode 100644 new mode 100755 diff --git a/includes/payment-retry/class-wcs-retry-admin.php b/includes/payment-retry/class-wcs-retry-admin.php old mode 100644 new mode 100755 diff --git a/includes/payment-retry/class-wcs-retry-email.php b/includes/payment-retry/class-wcs-retry-email.php old mode 100644 new mode 100755 diff --git a/includes/payment-retry/class-wcs-retry-post-store.php b/includes/payment-retry/class-wcs-retry-post-store.php old mode 100644 new mode 100755 diff --git a/includes/payment-retry/class-wcs-retry-rule.php b/includes/payment-retry/class-wcs-retry-rule.php old mode 100644 new mode 100755 diff --git a/includes/payment-retry/class-wcs-retry-rules.php b/includes/payment-retry/class-wcs-retry-rules.php old mode 100644 new mode 100755 diff --git a/includes/payment-retry/class-wcs-retry.php b/includes/payment-retry/class-wcs-retry.php old mode 100644 new mode 100755 diff --git a/includes/privacy/class-wcs-privacy-background-updater.php b/includes/privacy/class-wcs-privacy-background-updater.php old mode 100644 new mode 100755 diff --git a/includes/privacy/class-wcs-privacy-erasers.php b/includes/privacy/class-wcs-privacy-erasers.php old mode 100644 new mode 100755 diff --git a/includes/privacy/class-wcs-privacy-exporters.php b/includes/privacy/class-wcs-privacy-exporters.php old mode 100644 new mode 100755 diff --git a/includes/privacy/class-wcs-privacy.php b/includes/privacy/class-wcs-privacy.php old mode 100644 new mode 100755 index d145010..462e80f --- a/includes/privacy/class-wcs-privacy.php +++ b/includes/privacy/class-wcs-privacy.php @@ -21,6 +21,14 @@ class WCS_Privacy extends WC_Abstract_Privacy { */ protected static $background_process; + /** + * A flag which is set when WC is doing a user inactivity cleanup. + * Used to exclude subscription customers from the inactive user query. + * + * @var bool + */ + protected static $doing_user_inactivity_query = false; + /** * WCS_Privacy constructor. */ @@ -61,6 +69,11 @@ class WCS_Privacy extends WC_Abstract_Privacy { add_filter( 'woocommerce_anonymize_completed_orders_query_args', array( __CLASS__, 'remove_subscription_orders_from_anonymization_query' ), 10, 2 ); add_action( 'woocommerce_cleanup_personal_data', array( $this, 'queue_cleanup_personal_data' ) ); + + // Hook in late so there is less opportunity for our flag to affect other user queries called on this hook. + add_filter( 'woocommerce_delete_inactive_account_roles', array( __CLASS__, 'flag_subscription_user_exclusion_from_query' ), 1000 ); + add_action( 'pre_get_users', array( __CLASS__, 'maybe_exclude_subscription_customers' ) ); + add_filter( 'woocommerce_account_settings', array( __CLASS__, 'add_inactive_user_retention_note' ) ); } /** @@ -247,4 +260,53 @@ class WCS_Privacy extends WC_Abstract_Privacy { return $query_args; } + + /** + * Add a note to the inactive user data retention setting noting that users with a subscription are excluded. + * + * @since 2.3.4 + * @param array $settings WooCommerce Account and Privacy settings. + * @return array Account and Privacy settings. + */ + public static function add_inactive_user_retention_note( $settings ) { + foreach ( $settings as &$setting ) { + if ( isset( $setting['id'], $setting['desc_tip'] ) && 'woocommerce_delete_inactive_accounts' === $setting['id'] ) { + $setting['desc_tip'] .= ' ' . __( 'Customers with a subscription are excluded from this setting.', 'woocommerce-subscriptions' ); + break; + } + } + + return $settings; + } + + /** + * Set a flag to record inactive user account deletion. + * + * @since 2.3.4 + * @param array $user_roles The user roles included in the inactive user query. + * @return array + */ + public static function flag_subscription_user_exclusion_from_query( $user_roles ) { + self::$doing_user_inactivity_query = true; + return $user_roles; + } + + /** + * Exclude customers who have subscriptions from the inactive user cleanup query. + * + * @since 2.3.4 + * @param WP_User_Query $user_query + */ + public static function maybe_exclude_subscription_customers( $user_query ) { + if ( ! self::$doing_user_inactivity_query ) { + return; + } + + $user_query->set( 'exclude', array_merge( + (array) $user_query->get( 'exclude' ), + WC_Data_Store::load( 'subscription' )->get_subscription_customer_ids() + ) ); + + self::$doing_user_inactivity_query = false; + } } diff --git a/includes/upgrades/class-wc-subscriptions-upgrader.php b/includes/upgrades/class-wc-subscriptions-upgrader.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-repair-2-0-2.php b/includes/upgrades/class-wcs-repair-2-0-2.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-repair-2-0.php b/includes/upgrades/class-wcs-repair-2-0.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-repair-subscription-address-indexes.php b/includes/upgrades/class-wcs-repair-subscription-address-indexes.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-repair-suspended-paypal-subscriptions.php b/includes/upgrades/class-wcs-repair-suspended-paypal-subscriptions.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-1-2.php b/includes/upgrades/class-wcs-upgrade-1-2.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-1-3.php b/includes/upgrades/class-wcs-upgrade-1-3.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-1-4.php b/includes/upgrades/class-wcs-upgrade-1-4.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-1-5.php b/includes/upgrades/class-wcs-upgrade-1-5.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-2-0.php b/includes/upgrades/class-wcs-upgrade-2-0.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-2-1.php b/includes/upgrades/class-wcs-upgrade-2-1.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-2-2-7.php b/includes/upgrades/class-wcs-upgrade-2-2-7.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-2-2-9.php b/includes/upgrades/class-wcs-upgrade-2-2-9.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-logger.php b/includes/upgrades/class-wcs-upgrade-logger.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/class-wcs-upgrade-notice-manager.php b/includes/upgrades/class-wcs-upgrade-notice-manager.php old mode 100644 new mode 100755 index cdcd5b5..c143f54 --- a/includes/upgrades/class-wcs-upgrade-notice-manager.php +++ b/includes/upgrades/class-wcs-upgrade-notice-manager.php @@ -53,7 +53,7 @@ class WCS_Upgrade_Notice_Manager { * @since 2.3.0 */ public static function maybe_record_upgrade( $current_version, $previously_active_version ) { - if ( version_compare( $previously_active_version, self::$version, '<' ) && version_compare( $current_version, self::$version, '>=' ) ) { + if ( '0' !== $previously_active_version && version_compare( $previously_active_version, self::$version, '<' ) && version_compare( $current_version, self::$version, '>=' ) ) { update_option( self::$option_name, array( 'version' => self::$version, 'display_count' => 0, diff --git a/includes/upgrades/templates/update-welcome-notice.php b/includes/upgrades/templates/update-welcome-notice.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/templates/wcs-about-2-0.php b/includes/upgrades/templates/wcs-about-2-0.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/templates/wcs-about.php b/includes/upgrades/templates/wcs-about.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/templates/wcs-upgrade-in-progress.php b/includes/upgrades/templates/wcs-upgrade-in-progress.php old mode 100644 new mode 100755 diff --git a/includes/upgrades/templates/wcs-upgrade.php b/includes/upgrades/templates/wcs-upgrade.php old mode 100644 new mode 100755 diff --git a/includes/wcs-cart-functions.php b/includes/wcs-cart-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-compatibility-functions.php b/includes/wcs-compatibility-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-conditional-functions.php b/includes/wcs-conditional-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-deprecated-functions.php b/includes/wcs-deprecated-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-formatting-functions.php b/includes/wcs-formatting-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-helper-functions.php b/includes/wcs-helper-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-limit-functions.php b/includes/wcs-limit-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-order-functions.php b/includes/wcs-order-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-product-functions.php b/includes/wcs-product-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-renewal-functions.php b/includes/wcs-renewal-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-resubscribe-functions.php b/includes/wcs-resubscribe-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-switch-functions.php b/includes/wcs-switch-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-time-functions.php b/includes/wcs-time-functions.php old mode 100644 new mode 100755 diff --git a/includes/wcs-user-functions.php b/includes/wcs-user-functions.php old mode 100644 new mode 100755 diff --git a/languages/woocommerce-subscriptions.pot b/languages/woocommerce-subscriptions.pot old mode 100644 new mode 100755 index 8ea1434..163ad98 --- a/languages/woocommerce-subscriptions.pot +++ b/languages/woocommerce-subscriptions.pot @@ -2,10 +2,10 @@ # This file is distributed under the same license as the WooCommerce Subscriptions package. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Subscriptions 2.3.4\n" +"Project-Id-Version: WooCommerce Subscriptions 2.3.5\n" "Report-Msgid-Bugs-To: " "https://github.com/Prospress/woocommerce-subscriptions/issues\n" -"POT-Creation-Date: 2018-08-10 04:58:51+00:00\n" +"POT-Creation-Date: 2018-08-27 07:15:08+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -196,7 +196,7 @@ msgstr "" #: includes/admin/class-wc-subscriptions-admin.php:992 #: includes/admin/class-wcs-admin-reports.php:51 #: includes/admin/class-wcs-admin-system-status.php:55 -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:689 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:687 #: includes/class-wcs-query.php:108 includes/class-wcs-query.php:129 #: includes/class-wcs-query.php:248 #: includes/privacy/class-wcs-privacy-exporters.php:51 @@ -529,18 +529,18 @@ msgstr "" msgid "Create pending parent order requested by admin action." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:201 +#: includes/admin/class-wcs-admin-post-types.php:214 msgid "Search for a product…" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:378 +#: includes/admin/class-wcs-admin-post-types.php:391 #. translators: placeholder is the number of subscriptions updated msgid "%s subscription status changed." msgid_plural "%s subscription statuses changed." msgstr[0] "" msgstr[1] "" -#: includes/admin/class-wcs-admin-post-types.php:385 +#: includes/admin/class-wcs-admin-post-types.php:398 #. translators: 1$: is the number of subscriptions not updated, 2$: is the #. error message msgid "%1$s subscription could not be updated: %2$s" @@ -548,7 +548,7 @@ msgid_plural "%1$s subscriptions could not be updated: %2$s" msgstr[0] "" msgstr[1] "" -#: includes/admin/class-wcs-admin-post-types.php:409 +#: includes/admin/class-wcs-admin-post-types.php:422 #: includes/admin/meta-boxes/views/html-related-orders-table.php:20 #: templates/myaccount/my-subscriptions.php:26 #: templates/myaccount/my-subscriptions.php:41 @@ -560,7 +560,7 @@ msgstr[1] "" msgid "Status" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:410 +#: includes/admin/class-wcs-admin-post-types.php:423 #: includes/admin/meta-boxes/class-wcs-meta-box-related-orders.php:63 #: templates/emails/cancelled-subscription.php:26 #: templates/emails/expired-subscription.php:26 @@ -572,158 +572,158 @@ msgstr "" msgid "Subscription" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:411 +#: includes/admin/class-wcs-admin-post-types.php:424 msgid "Items" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:412 +#: includes/admin/class-wcs-admin-post-types.php:425 msgid "Total" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:413 +#: includes/admin/class-wcs-admin-post-types.php:426 msgid "Start Date" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:414 +#: includes/admin/class-wcs-admin-post-types.php:427 msgid "Trial End" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:415 +#: includes/admin/class-wcs-admin-post-types.php:428 msgid "Next Payment" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:416 +#: includes/admin/class-wcs-admin-post-types.php:429 msgid "Last Order Date" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:417 +#: includes/admin/class-wcs-admin-post-types.php:430 msgid "End Date" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:458 +#: includes/admin/class-wcs-admin-post-types.php:471 #: includes/wcs-user-functions.php:333 msgid "Reactivate" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:459 +#: includes/admin/class-wcs-admin-post-types.php:472 #: includes/wcs-user-functions.php:328 msgid "Suspend" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:461 -#: includes/admin/class-wcs-admin-post-types.php:476 +#: includes/admin/class-wcs-admin-post-types.php:474 +#: includes/admin/class-wcs-admin-post-types.php:489 msgid "Trash" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:462 -#: includes/admin/class-wcs-admin-post-types.php:480 +#: includes/admin/class-wcs-admin-post-types.php:475 +#: includes/admin/class-wcs-admin-post-types.php:493 msgid "Delete Permanently" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:474 +#: includes/admin/class-wcs-admin-post-types.php:487 #: includes/class-wc-subscriptions-product.php:746 msgid "Restore this item from the Trash" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:474 +#: includes/admin/class-wcs-admin-post-types.php:487 #: includes/class-wc-subscriptions-product.php:747 msgid "Restore" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:476 +#: includes/admin/class-wcs-admin-post-types.php:489 msgid "Move this item to the Trash" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:480 +#: includes/admin/class-wcs-admin-post-types.php:493 msgid "Delete this item permanently" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:486 +#: includes/admin/class-wcs-admin-post-types.php:499 msgid "Cancel Now" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:519 +#: includes/admin/class-wcs-admin-post-types.php:532 #. translators: placeholder is customer's billing email msgid "Email: %s" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:524 +#: includes/admin/class-wcs-admin-post-types.php:537 #. translators: placeholder is customer's billing phone number msgid "Tel: %s" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:556 +#: includes/admin/class-wcs-admin-post-types.php:569 msgid "Show more details" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:572 +#: includes/admin/class-wcs-admin-post-types.php:585 msgid "%d item" msgid_plural "%d items" msgstr[0] "" msgstr[1] "" -#: includes/admin/class-wcs-admin-post-types.php:588 +#: includes/admin/class-wcs-admin-post-types.php:601 #: templates/myaccount/my-subscriptions.php:49 #. translators: placeholder is the display name of a payment gateway a #. subscription was paid by msgid "Via %s" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:624 +#: includes/admin/class-wcs-admin-post-types.php:637 msgid "Y/m/d g:i:s A" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:627 +#: includes/admin/class-wcs-admin-post-types.php:640 msgid "" "This date should be treated as an estimate only. The payment gateway for " "this subscription controls when payments are processed." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:830 -#: includes/admin/class-wcs-admin-post-types.php:833 -#: includes/admin/class-wcs-admin-post-types.php:836 +#: includes/admin/class-wcs-admin-post-types.php:873 +#: includes/admin/class-wcs-admin-post-types.php:876 +#: includes/admin/class-wcs-admin-post-types.php:879 msgid "Subscription updated." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:831 +#: includes/admin/class-wcs-admin-post-types.php:874 msgid "Custom field updated." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:832 +#: includes/admin/class-wcs-admin-post-types.php:875 msgid "Custom field deleted." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:837 +#: includes/admin/class-wcs-admin-post-types.php:880 msgid "Subscription saved." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:838 +#: includes/admin/class-wcs-admin-post-types.php:881 msgid "Subscription submitted." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:840 +#: includes/admin/class-wcs-admin-post-types.php:883 #. translators: php date string msgid "Subscription scheduled for: %1$s." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:841 +#: includes/admin/class-wcs-admin-post-types.php:884 msgid "Subscription draft updated." msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:877 +#: includes/admin/class-wcs-admin-post-types.php:920 msgid "Any Payment Method" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:878 +#: includes/admin/class-wcs-admin-post-types.php:921 msgid "None" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:1071 +#: includes/admin/class-wcs-admin-post-types.php:1114 #. translators: 1: user display name 2: user ID 3: user email msgid "%1$s (#%2$s – %3$s)" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:1078 +#: includes/admin/class-wcs-admin-post-types.php:1121 #: includes/admin/meta-boxes/class-wcs-meta-box-subscription-data.php:79 msgid "Search for a customer…" msgstr "" @@ -899,7 +899,7 @@ msgid "Relationship" msgstr "" #: includes/admin/meta-boxes/views/html-related-orders-table.php:19 -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:550 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:548 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:173 #: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:205 #: templates/myaccount/related-orders.php:23 @@ -1131,185 +1131,185 @@ msgstr "" msgid "subscriptions" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:399 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:397 msgid "%s signup revenue in this period" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:400 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:398 msgid "" "The sum of all subscription parent orders, including other items, fees, tax " "and shipping." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:406 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:404 msgid "%s renewal revenue in this period" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:407 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:405 msgid "The sum of all renewal orders including tax and shipping." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:413 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:411 msgid "%s resubscribe revenue in this period" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:414 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:412 msgid "The sum of all resubscribe orders including tax and shipping." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:420 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:418 msgid "%s new subscriptions" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:421 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:419 msgid "" "The number of subscriptions created during this period, either by being " "manually created, imported or a customer placing an order." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:427 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:425 msgid "%s subscription signups" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:428 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:426 msgid "" "The number of subscription parent orders created during this period. This " "represents the new subscriptions created by customers placing an order via " "checkout." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:434 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:432 msgid "%s subscription resubscribes" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:435 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:433 msgid "The number of resubscribe orders processed during this period." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:441 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:439 msgid "%s subscription renewals" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:442 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:440 msgid "The number of renewal orders processed during this period." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:448 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:446 msgid "%s subscription switches" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:449 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:447 msgid "" "The number of subscriptions upgraded, downgraded or cross-graded during " "this period." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:455 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:453 msgid "%s subscription cancellations" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:456 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:454 msgid "" "The number of subscriptions cancelled by the customer or store manager " "during this period. The pre-paid term may not yet have ended during this " "period." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:462 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:460 msgid "%s subscriptions ended" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:463 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:461 msgid "" "The number of subscriptions which have either expired or reached the end of " "the prepaid term if it was previously cancelled." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:469 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:467 msgid "%s current subscriptions" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:470 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:468 msgid "" "The number of subscriptions during this period with an end date in the " "future and a status other than pending." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:486 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:484 msgid "%s net subscription gain" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:488 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:486 msgid "%s net subscription loss" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:493 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:491 msgid "Change in subscriptions between the start and end of the period." msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:507 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:505 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:137 msgid "Year" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:508 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:506 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:138 msgid "Last Month" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:509 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:507 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:139 msgid "This Month" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:510 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:508 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:140 msgid "Last 7 Days" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:554 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:552 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:177 #: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:209 msgid "Export CSV" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:611 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:609 msgid "Switched subscriptions" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:627 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:625 msgid "New Subscriptions" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:643 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:641 msgid "Subscriptions signups" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:658 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:656 msgid "Number of resubscribes" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:673 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:671 msgid "Number of renewals" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:705 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:703 msgid "Subscriptions Ended" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:721 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:719 msgid "Cancellations" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:736 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:734 msgid "Signup Totals" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:756 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:754 msgid "Resubscribe Totals" msgstr "" -#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:776 +#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:774 msgid "Renewal Totals" msgstr "" @@ -1410,16 +1410,16 @@ msgstr "" msgid "Renewals amount" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:109 +#: includes/api/class-wc-rest-subscriptions-controller.php:114 msgid "Customer ID is invalid." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:214 +#: includes/api/class-wc-rest-subscriptions-controller.php:219 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:171 msgid "Invalid subscription id." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:285 +#: includes/api/class-wc-rest-subscriptions-controller.php:290 #: includes/api/legacy/class-wc-api-subscriptions.php:307 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:303 msgid "" @@ -1427,7 +1427,7 @@ msgid "" "Subscription." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:316 +#: includes/api/class-wc-rest-subscriptions-controller.php:321 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:333 #. translators: 1$: gateway id, 2$: error message msgid "" @@ -1435,52 +1435,62 @@ msgid "" "%2$s" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:383 -#: includes/api/class-wc-rest-subscriptions-controller.php:525 +#: includes/api/class-wc-rest-subscriptions-controller.php:388 +#: includes/api/class-wc-rest-subscriptions-controller.php:542 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:284 msgid "Updating subscription dates errored with message: %s" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:408 +#: includes/api/class-wc-rest-subscriptions-controller.php:413 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:347 msgid "The number of billing periods between subscription renewals." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:413 +#: includes/api/class-wc-rest-subscriptions-controller.php:418 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:352 msgid "Billing period for the subscription." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:419 +#: includes/api/class-wc-rest-subscriptions-controller.php:424 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:358 msgid "Subscription payment details." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:424 +#: includes/api/class-wc-rest-subscriptions-controller.php:429 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:363 msgid "Payment gateway ID." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:431 +#: includes/api/class-wc-rest-subscriptions-controller.php:436 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:370 msgid "The subscription's start date." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:436 +#: includes/api/class-wc-rest-subscriptions-controller.php:441 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:375 msgid "The subscription's trial date" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:441 +#: includes/api/class-wc-rest-subscriptions-controller.php:446 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:380 msgid "The subscription's next payment date." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:446 +#: includes/api/class-wc-rest-subscriptions-controller.php:451 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:385 msgid "The subscription's end date." msgstr "" +#: includes/api/class-wc-rest-subscriptions-controller.php:456 +msgid "" +"The subscription's original subscription ID if this is a resubscribed " +"subscription." +msgstr "" + +#: includes/api/class-wc-rest-subscriptions-controller.php:462 +msgid "The subscription's resubscribed subscription ID." +msgstr "" + #: includes/api/legacy/class-wc-api-subscriptions.php:102 wcs-functions.php:172 msgid "Invalid subscription status given." msgstr "" @@ -2503,14 +2513,14 @@ msgstr "" msgid "Limit to one of any status" msgstr "" -#: includes/class-wcs-my-account-payment-methods.php:76 +#: includes/class-wcs-my-account-payment-methods.php:82 msgid "" "The deleted payment method was used for automatic subscription payments, we " "couldn't find an alternative token payment method token to change your " "subscriptions to." msgstr "" -#: includes/class-wcs-my-account-payment-methods.php:87 +#: includes/class-wcs-my-account-payment-methods.php:106 #. translators: $1: the token/credit card label, 2$-3$: opening and closing #. strong and link tags msgid "" @@ -2521,10 +2531,16 @@ msgid "" "Subscriptions%3$s page." msgstr "" -#: includes/class-wcs-my-account-payment-methods.php:177 +#: includes/class-wcs-my-account-payment-methods.php:194 msgid "%s ending in %s" msgstr "" +#: includes/class-wcs-my-account-payment-methods.php:286 +msgid "" +"Would you like to update your subscriptions to use this new payment method " +"- %1$s?%2$sYes%4$s | %3$sNo%4$s" +msgstr "" + #: includes/class-wcs-post-meta-cache-manager.php:198 msgid "" "Invalid update type: %s. Post update types supported are \"add\" or " @@ -3288,12 +3304,12 @@ msgstr "" msgid "WooCommerce Subscriptions" msgstr "" -#: includes/privacy/class-wcs-privacy.php:38 -#: includes/privacy/class-wcs-privacy.php:39 +#: includes/privacy/class-wcs-privacy.php:46 +#: includes/privacy/class-wcs-privacy.php:47 msgid "Subscriptions Data" msgstr "" -#: includes/privacy/class-wcs-privacy.php:82 +#: includes/privacy/class-wcs-privacy.php:95 msgid "" "By using WooCommerce Subscriptions, you may be storing personal data and " "depending on which third-party payment processors you’re using to take " @@ -3301,24 +3317,24 @@ msgid "" "sources." msgstr "" -#: includes/privacy/class-wcs-privacy.php:84 +#: includes/privacy/class-wcs-privacy.php:97 #. translators: placeholders are opening and closing link tags, linking to #. additional privacy policy documentation. msgid "What we collect and store" msgstr "" -#: includes/privacy/class-wcs-privacy.php:85 +#: includes/privacy/class-wcs-privacy.php:98 msgid "" "For the purposes of processing recurring subscription payments, we store " "the customer's name, billing address, shipping address, email address, " "phone number and credit card/payment details." msgstr "" -#: includes/privacy/class-wcs-privacy.php:86 +#: includes/privacy/class-wcs-privacy.php:99 msgid "What we share with others" msgstr "" -#: includes/privacy/class-wcs-privacy.php:87 +#: includes/privacy/class-wcs-privacy.php:100 msgid "" "What personal information your store shares with external sources depends " "on which third-party payment processor plugins you are using to collect " @@ -3326,7 +3342,7 @@ msgid "" "policies to inform this section of your privacy policy." msgstr "" -#: includes/privacy/class-wcs-privacy.php:89 +#: includes/privacy/class-wcs-privacy.php:102 #. translators: placeholders are opening and closing link tags, linking to #. additional privacy policy documentation. msgid "" @@ -3334,28 +3350,28 @@ msgid "" "see the %sPayPal Privacy Policy%s for more details." msgstr "" -#: includes/privacy/class-wcs-privacy.php:99 +#: includes/privacy/class-wcs-privacy.php:112 msgid "Cancel and remove personal data" msgstr "" -#: includes/privacy/class-wcs-privacy.php:165 +#: includes/privacy/class-wcs-privacy.php:178 msgid "Removed personal data from %d subscription." msgid_plural "Removed personal data from %d subscriptions." msgstr[0] "" msgstr[1] "" -#: includes/privacy/class-wcs-privacy.php:184 +#: includes/privacy/class-wcs-privacy.php:197 #. translators: placeholders are opening and closing tags. msgid "" "%sNote:%s Orders which are related to subscriptions will not be included in " "the orders affected by these settings." msgstr "" -#: includes/privacy/class-wcs-privacy.php:205 +#: includes/privacy/class-wcs-privacy.php:218 msgid "Remove personal data from subscriptions" msgstr "" -#: includes/privacy/class-wcs-privacy.php:207 +#: includes/privacy/class-wcs-privacy.php:220 #. Translators: placeholders are opening and closing link tags linking to the #. erasure request screen. msgid "" @@ -3363,20 +3379,24 @@ msgid "" "subscriptions be retained or removed?" msgstr "" -#: includes/privacy/class-wcs-privacy.php:216 +#: includes/privacy/class-wcs-privacy.php:229 msgid "Retain ended subscriptions" msgstr "" -#: includes/privacy/class-wcs-privacy.php:217 +#: includes/privacy/class-wcs-privacy.php:230 msgid "" "Retain ended subscriptions and their related orders for a specified " "duration before anonymizing the personal data within them." msgstr "" -#: includes/privacy/class-wcs-privacy.php:220 +#: includes/privacy/class-wcs-privacy.php:233 msgid "N/A" msgstr "" +#: includes/privacy/class-wcs-privacy.php:274 +msgid "Customers with a subscription are excluded from this setting." +msgstr "" + #: includes/upgrades/class-wc-subscriptions-upgrader.php:323 #. translators: placeholder is a list of version numbers (e.g. "1.3 & 1.4 & #. 1.5") @@ -4888,18 +4908,18 @@ msgctxt "meta box title" msgid "Schedule" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:245 +#: includes/admin/class-wcs-admin-post-types.php:258 msgctxt "an action on a subscription" msgid "Activate" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:246 +#: includes/admin/class-wcs-admin-post-types.php:259 msgctxt "an action on a subscription" msgid "Put on-hold" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:247 -#: includes/admin/class-wcs-admin-post-types.php:460 +#: includes/admin/class-wcs-admin-post-types.php:260 +#: includes/admin/class-wcs-admin-post-types.php:473 #: includes/class-wc-subscriptions-manager.php:1829 #: includes/wcs-user-functions.php:349 #: templates/myaccount/related-orders.php:73 @@ -4907,35 +4927,35 @@ msgctxt "an action on a subscription" msgid "Cancel" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:322 +#: includes/admin/class-wcs-admin-post-types.php:335 msgctxt "Used in order note. Reason why status changed." msgid "Subscription status changed by bulk edit:" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:418 +#: includes/admin/class-wcs-admin-post-types.php:431 msgctxt "number of orders linked to a subscription" msgid "Orders" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:514 +#: includes/admin/class-wcs-admin-post-types.php:527 msgctxt "meaning billing address" msgid "Billing:" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:552 +#: includes/admin/class-wcs-admin-post-types.php:565 #. translators: $1: is opening link, $2: is subscription order number, $3: is #. closing link tag, $4: is user's name msgctxt "Subscription title on admin table. (e.g.: #211 for John Doe)" msgid "%1$s#%2$s%3$s for %4$s" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:835 +#: includes/admin/class-wcs-admin-post-types.php:878 #. translators: placeholder is previous post title msgctxt "used in post updated messages" msgid "Subscription restored to revision from %s" msgstr "" -#: includes/admin/class-wcs-admin-post-types.php:840 +#: includes/admin/class-wcs-admin-post-types.php:883 msgctxt "used in \"Subscription scheduled for \"" msgid "M j, Y @ G:i" msgstr "" @@ -5417,13 +5437,20 @@ msgctxt "" msgid "All linked subscription items were" msgstr "" -#: includes/class-wcs-my-account-payment-methods.php:120 +#: includes/class-wcs-my-account-payment-methods.php:101 msgctxt "used in subscription note" msgid "" "Payment method meta updated after customer deleted a token from their My " "Account page. Payment meta changed from %1$s to %2$s" msgstr "" +#: includes/class-wcs-my-account-payment-methods.php:328 +msgctxt "used in subscription note" +msgid "" +"Payment method meta updated after customer changed their default token and " +"opted to update their subscriptions. Payment meta changed from %1$s to %2$s" +msgstr "" + #: includes/class-wcs-remove-item.php:68 msgctxt "hash before subscription ID" msgid "Subscription #%d does not exist." @@ -5606,8 +5633,8 @@ msgstr "" #: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php:326 #: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php:349 #: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php:361 -#: includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php:144 -#: includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php:147 +#: includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php:150 +#: includes/gateways/paypal/includes/class-wcs-paypal-standard-request.php:153 #. translators: placeholder is for blog name msgctxt "" "hash before the order number. Used as a character to remove from the actual " diff --git a/readme.txt b/readme.txt old mode 100644 new mode 100755 diff --git a/templates/admin/deprecated/html-variation-price.php b/templates/admin/deprecated/html-variation-price.php old mode 100644 new mode 100755 diff --git a/templates/admin/deprecated/html-variation-synchronisation.php b/templates/admin/deprecated/html-variation-synchronisation.php old mode 100644 new mode 100755 diff --git a/templates/admin/deprecated/order-shipping-html.php b/templates/admin/deprecated/order-shipping-html.php old mode 100644 new mode 100755 diff --git a/templates/admin/deprecated/order-tax-html.php b/templates/admin/deprecated/order-tax-html.php old mode 100644 new mode 100755 diff --git a/templates/admin/html-admin-notice.php b/templates/admin/html-admin-notice.php old mode 100644 new mode 100755 diff --git a/templates/admin/html-variation-price.php b/templates/admin/html-variation-price.php old mode 100644 new mode 100755 diff --git a/templates/admin/html-variation-synchronisation.php b/templates/admin/html-variation-synchronisation.php old mode 100644 new mode 100755 diff --git a/templates/admin/status.php b/templates/admin/status.php old mode 100644 new mode 100755 diff --git a/templates/cart/cart-recurring-shipping.php b/templates/cart/cart-recurring-shipping.php old mode 100644 new mode 100755 diff --git a/templates/checkout/form-change-payment-method.php b/templates/checkout/form-change-payment-method.php old mode 100644 new mode 100755 diff --git a/templates/checkout/recurring-totals.php b/templates/checkout/recurring-totals.php old mode 100644 new mode 100755 diff --git a/templates/emails/admin-new-renewal-order.php b/templates/emails/admin-new-renewal-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/admin-new-switch-order.php b/templates/emails/admin-new-switch-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/admin-payment-retry.php b/templates/emails/admin-payment-retry.php old mode 100644 new mode 100755 diff --git a/templates/emails/cancelled-subscription.php b/templates/emails/cancelled-subscription.php old mode 100644 new mode 100755 diff --git a/templates/emails/customer-completed-renewal-order.php b/templates/emails/customer-completed-renewal-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/customer-completed-switch-order.php b/templates/emails/customer-completed-switch-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/customer-payment-retry.php b/templates/emails/customer-payment-retry.php old mode 100644 new mode 100755 diff --git a/templates/emails/customer-processing-renewal-order.php b/templates/emails/customer-processing-renewal-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/customer-renewal-invoice.php b/templates/emails/customer-renewal-invoice.php old mode 100644 new mode 100755 diff --git a/templates/emails/email-order-details.php b/templates/emails/email-order-details.php old mode 100644 new mode 100755 diff --git a/templates/emails/expired-subscription.php b/templates/emails/expired-subscription.php old mode 100644 new mode 100755 diff --git a/templates/emails/on-hold-subscription.php b/templates/emails/on-hold-subscription.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/admin-new-renewal-order.php b/templates/emails/plain/admin-new-renewal-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/admin-new-switch-order.php b/templates/emails/plain/admin-new-switch-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/admin-payment-retry.php b/templates/emails/plain/admin-payment-retry.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/cancelled-subscription.php b/templates/emails/plain/cancelled-subscription.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/customer-completed-renewal-order.php b/templates/emails/plain/customer-completed-renewal-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/customer-completed-switch-order.php b/templates/emails/plain/customer-completed-switch-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/customer-payment-retry.php b/templates/emails/plain/customer-payment-retry.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/customer-processing-renewal-order.php b/templates/emails/plain/customer-processing-renewal-order.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/customer-renewal-invoice.php b/templates/emails/plain/customer-renewal-invoice.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/email-order-details.php b/templates/emails/plain/email-order-details.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/expired-subscription.php b/templates/emails/plain/expired-subscription.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/on-hold-subscription.php b/templates/emails/plain/on-hold-subscription.php old mode 100644 new mode 100755 diff --git a/templates/emails/plain/subscription-info.php b/templates/emails/plain/subscription-info.php old mode 100644 new mode 100755 diff --git a/templates/emails/subscription-info.php b/templates/emails/subscription-info.php old mode 100644 new mode 100755 diff --git a/templates/myaccount/my-subscriptions.php b/templates/myaccount/my-subscriptions.php old mode 100644 new mode 100755 diff --git a/templates/myaccount/related-orders.php b/templates/myaccount/related-orders.php old mode 100644 new mode 100755 diff --git a/templates/myaccount/related-subscriptions.php b/templates/myaccount/related-subscriptions.php old mode 100644 new mode 100755 diff --git a/templates/myaccount/subscription-details.php b/templates/myaccount/subscription-details.php old mode 100644 new mode 100755 diff --git a/templates/myaccount/subscription-totals.php b/templates/myaccount/subscription-totals.php old mode 100644 new mode 100755 diff --git a/templates/myaccount/subscriptions.php b/templates/myaccount/subscriptions.php old mode 100644 new mode 100755 diff --git a/templates/myaccount/view-subscription.php b/templates/myaccount/view-subscription.php old mode 100644 new mode 100755 diff --git a/templates/single-product/add-to-cart/subscription.php b/templates/single-product/add-to-cart/subscription.php old mode 100644 new mode 100755 diff --git a/templates/single-product/add-to-cart/variable-subscription.php b/templates/single-product/add-to-cart/variable-subscription.php old mode 100644 new mode 100755 diff --git a/wcs-functions.php b/wcs-functions.php old mode 100644 new mode 100755 index 7cae7f2..94fc125 --- a/wcs-functions.php +++ b/wcs-functions.php @@ -501,17 +501,14 @@ function wcs_get_subscriptions( $args ) { // Maybe filter to a specific user if ( 0 != $args['customer_id'] && is_numeric( $args['customer_id'] ) ) { - $query_args['meta_query'][] = array( - 'key' => '_customer_user', - 'value' => $args['customer_id'], - 'type' => 'numeric', - 'compare' => ( is_array( $args['customer_id'] ) ) ? 'IN' : '=', - ); + $users_subscription_ids = WCS_Customer_Store::instance()->get_users_subscription_ids( $args['customer_id'] ); + $query_args = WCS_Admin_Post_Types::set_post__in_query_var( $query_args, $users_subscription_ids ); }; // We need to restrict subscriptions to those which contain a certain product/variation if ( ( 0 != $args['product_id'] && is_numeric( $args['product_id'] ) ) || ( 0 != $args['variation_id'] && is_numeric( $args['variation_id'] ) ) ) { - $query_args['post__in'] = wcs_get_subscriptions_for_product( array( $args['product_id'], $args['variation_id'] ) ); + $subscriptions_for_product = wcs_get_subscriptions_for_product( array( $args['product_id'], $args['variation_id'] ) ); + $query_args = WCS_Admin_Post_Types::set_post__in_query_var( $query_args, $subscriptions_for_product ); } if ( ! empty( $query_args['meta_query'] ) ) { diff --git a/woo-includes/class-wc-dependencies.php b/woo-includes/class-wc-dependencies.php old mode 100644 new mode 100755 diff --git a/woo-includes/woo-functions.php b/woo-includes/woo-functions.php old mode 100644 new mode 100755 diff --git a/woocommerce-subscriptions.php b/woocommerce-subscriptions.php old mode 100644 new mode 100755 index 40ee52b..d6415ac --- a/woocommerce-subscriptions.php +++ b/woocommerce-subscriptions.php @@ -5,7 +5,7 @@ * Description: Sell products and services with recurring payments in your WooCommerce Store. * Author: Prospress Inc. * Author URI: http://prospress.com/ - * Version: 2.3.4 + * Version: 2.3.5 * * WC requires at least: 2.6 * WC tested up to: 3.4 @@ -170,7 +170,7 @@ class WC_Subscriptions { public static $plugin_file = __FILE__; - public static $version = '2.3.4'; + public static $version = '2.3.5'; private static $total_subscription_count = null;