diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md deleted file mode 100755 index b25b4ce..0000000 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: "Bug report" -about: Report a bug if something isn't working as expected in Subscriptions - ---- - -### Describe the bug - - -### To reproduce - -1. -1. -1. - -**Screenshots** - - -### Expected behavior - - -### Additional details - - -
System status - - ``` - - ``` -
diff --git a/.github/ISSUE_TEMPLATE/Enhancement.md b/.github/ISSUE_TEMPLATE/Enhancement.md deleted file mode 100755 index 9534e7d..0000000 --- a/.github/ISSUE_TEMPLATE/Enhancement.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: "New Enhancement" -about: "" - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Proposed approach** -Describe the proposed approach for the enhancement. diff --git a/.github/config.yml b/.github/config.yml deleted file mode 100755 index a80ba44..0000000 --- a/.github/config.yml +++ /dev/null @@ -1,3 +0,0 @@ -# helPR bot config. https://probot.github.io/apps/helpr/ -helpr: - opened: 'hasPR' diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100755 index 74151a7..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,28 +0,0 @@ - - -**Issue**: # - -**Ticket**: - -**Slack thread**: - ---- - -### Description - - -### Steps to test: - - - -1. -1. -1. - -### Documentation - - -- [ ] This PR needs documentation (has the "status:needs-docs" label). - - -Closes # . diff --git a/assets/css/admin.css b/assets/css/admin.css index 9e4ac60..7b9e806 100755 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -274,10 +274,10 @@ a.close-subscriptions-search { } .variable_subscription_pricing_2_3 .wc_input_subscription_payment_sync_day { max-width: 13%; + float: right; } .variable_subscription_pricing_2_3 .wc_input_subscription_payment_sync_month { max-width: 86%; - float: right; } @media screen and (max-width: 1190px) { .variable_subscription_pricing_2_3 p._subscription_price_field, @@ -290,10 +290,10 @@ a.close-subscriptions-search { } .variable_subscription_pricing_2_3 .wc_input_subscription_payment_sync_day { max-width: 20%; + float: right; } .variable_subscription_pricing_2_3 .wc_input_subscription_payment_sync_month { max-width: 78%; - float: right; } } ._subscription_limit_field .description { diff --git a/assets/js/admin/admin.js b/assets/js/admin/admin.js index a670a15..f79ceb0 100755 --- a/assets/js/admin/admin.js +++ b/assets/js/admin/admin.js @@ -12,6 +12,10 @@ jQuery(document).ready(function($){ return decodeURIComponent(results[1].replace(/\+/g, ' ')); } }, + daysInMonth: function( month ) { + // Intentionally choose a non-leap year because we want february to have only 28 days. + return new Date(Date.UTC(2001, month, 0)).getUTCDate(); + }, showHideSubscriptionMeta: function(){ if ($('select#product-type').val()==WCSubscriptions.productType) { $('.show_if_simple').show(); @@ -150,7 +154,7 @@ jQuery(document).ready(function($){ if ($('select#product-type').val()=='variable-subscription') { var $container = periodField.closest('.woocommerce_variable_attributes').find('.variable_subscription_sync'); } else { - $container = periodField.closest('#general_product_data').find('.subscription_sync') + $container = periodField.closest('#general_product_data').find('.subscription_sync'); } var $syncWeekMonthContainer = $container.find('.subscription_sync_week_month'), @@ -170,16 +174,17 @@ jQuery(document).ready(function($){ if('day'==billingPeriod) { $syncWeekMonthSelect.val(0); - $syncAnnualContainer.find('input[type="number"]').val(0); + $syncAnnualContainer.find('input[type="number"]').val(0).trigger('change'); } else { if('year'==billingPeriod) { // Make sure the year sync fields are reset - $syncAnnualContainer.find('input[type="number"]').val(0); + $syncAnnualContainer.find('input[type="number"]').val(0).trigger('change'); // And the week/month field has no option selected $syncWeekMonthSelect.val(0); } else { // Make sure the year sync value is 0 - $syncAnnualContainer.find('input[type="number"]').val(0); + $syncAnnualContainer.find('input[type="number"]').val(0).trigger('change'); + // And the week/month field has the appropriate options $syncWeekMonthSelect.empty(); $.each(WCSubscriptions.syncOptions[billingPeriod], function(key,description) { @@ -202,6 +207,7 @@ jQuery(document).ready(function($){ if ($varSubField.length > 0) { // Variation var matches = $varSubField.attr('name').match(/\[(.*?)\]/); $subscriptionPeriodElement = $('[name="variable_subscription_period['+matches[1]+']"]'); + if ($('select#product-type').val()=='variable-subscription') { $slideSwitch = true; } @@ -433,6 +439,22 @@ jQuery(document).ready(function($){ $.setTrialPeriods(); }); + // Handles changes to sync date select/input for yearly subscription products. + $('#woocommerce-product-data').on('change', '[name^="_subscription_payment_sync_date_day"], [name^="variable_subscription_payment_sync_date_day"]', function() { + if ( 0 == $(this).val() ) { + $(this).siblings('[name^="_subscription_payment_sync_date_month"], [name^="variable_subscription_payment_sync_date_month"]').val(0); + $(this).prop('disabled', true); + } + }).on('change', '[name^="_subscription_payment_sync_date_month"], [name^="variable_subscription_payment_sync_date_month"]', function() { + var $syncDayOfMonthInput = $(this).siblings('[name^="_subscription_payment_sync_date_day"], [name^="variable_subscription_payment_sync_date_day"]'); + + if ( 0 < $(this).val() ) { + $syncDayOfMonthInput.val(1).attr({step: "1", min: "1", max: $.daysInMonth($(this).val())}).prop('disabled', false); + } else { + $syncDayOfMonthInput.val(0).trigger('change'); + } + }); + $('body').bind('woocommerce-product-type-change',function(){ $.showHideSubscriptionMeta(); $.showHideVariableSubscriptionMeta(); diff --git a/changelog.txt b/changelog.txt index e777146..3cc3830 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,9 +1,57 @@ *** WooCommerce Subscriptions Changelog *** +2019.11.14 - version 2.6.5 +* Fix: Account for prorated switch sign up fees in multi-switches. PR#3519 +* Fix: Tooltip content displayed on WooCommerce > Subscriptions administration screen. +* Dev: Add additional hooks in My Account Subscription Details table template. PR#3523 + +2019.11.12 - version 2.6.4 +* Tweak: Update the My Account customer has no subscriptions notice to match WC core. PR#3516 +* Fix: Add hidden class to subscription_pricing and subscription_sync edit product fields. Fixes a bug when the subscription product types are removed from the edit product type drop-down. PR#3514 +* Fix: error on My Account > Payment Methods for non credit card tokens and allow deleting tokens with clear alternative. PR#3482 +* Fix: Allow only number of days in specific month for synchronize renewals. PR#3470 +* Fix: Save subscription meta box data via set_props(). Fixes fatal error when saving invalid data. PR#3524 +* Fix: Use update_option() rather than add_option() to record WC Subscriptions activation. Fixes infinitely running activation hook under some circumstances. PR#3525 +* Dev - Opt-in tracking data for Subscriptions PR#3504 + Data sent to WooCommerce: + Staging or live site + Live URL + WooCommerce Subscriptions Settings + Dates of the first and last created subscriptions + Number of subscriptions + Number of subscriptions with each status + Gross totals for switch, renewal, resubscribe, and initial totals + Order counts for for switch, renewal, resubscribe, and initial orders + To disable this tracking, opt out of WooCommerce tracking, see https://woocommerce.com/usage-tracking/ + +2019.10.29 - version 2.6.3 +* Fix: use dashicon over fa icon. PR#3497 +* Fix: remove button type from close modal link. PR#3497 +* Fix: Remove double filtering of the meta label through the woocommerce_attribute_label filter. PR#3476 +* Fix: Restore the subscription's end date after reactivation. PR#3399 +* Fix: Tooltip content displayed on WooCommerce > Subscriptions administration screen. +* Tweak: Allow modals to be displayed on admin screens. PR#3497 +* Tweak: Redirect the customer to checkout after failed early renewal attempt. PR#3494 +* Dev: Allow third parties to filter the switch cart item object properties. PR#3484 + +2019.10.10 - version 2.6.2 +* Tweak: Add the switch direction the switch data stored in _subscription_switch_data order meta. PR#3440 +* Tweak: Add an order note to manual renewal order to note the order is awaiting customer payment. PR#3456 +* Tweak: Add note on the renewal order when a manual payment retry is ran. PR#3477 +* Fix: Hide sync meta data on the edit order and subscription screen. PR#3454 +* Fix: Fix an issue that led to missing _switched_subscription_item_id line item meta which caused incorrect multi-switch upgrade costs among other issues. PR#3461 +* Fix: Store the full set of current subscription counts not just the last element. Fixes issues when exporting subscription report data. PR#3455 +* Fix: Add the manually admin requested renewal order notes in the correct order. PR#3462 +* Fix: Display the customer facing subscription dates in site time. Fixing display inconsistencies. PR#3469 +* Fix: Updated the link in the staging site admin notice. PR#3473 +* Fix: Only get return retries from the post store which are retry posts. Fixes an issue where it would return a retry object for other post types. PR#3481 +* Fix: Load renewal order fee items to manual renewal carts. PR#3480 +* Dev: Fixed WC_Subscription::get_date() returning dates in the site time if the site was using GMT offsets in their site settings. PR#3469 + 2019.09.04 - version 2.6.1 * Fix a bug that would lead to switch log entries not including all information. PR#3441 * Fix fatal errors that would occur on the admin edit order screen on staging sites. PR#3443 -* Performance: Sort subscription related order IDs on the application layer with rsort() instead of MySQL orderby clause. PR#3442 +* Performance: Sort using subscription related order IDs on the application layer with rsort() instead of MySQL orderby clause. PR#3442 2019.09.02 - version 2.6.0 * New: New option to allow customers with automatically renewing subscriptions to renew early via a modal rather than going through the checkout. PR#3293 diff --git a/includes/admin/class-wc-subscriptions-admin.php b/includes/admin/class-wc-subscriptions-admin.php index 693ba0c..bc56e83 100755 --- a/includes/admin/class-wc-subscriptions-admin.php +++ b/includes/admin/class-wc-subscriptions-admin.php @@ -110,9 +110,7 @@ class WC_Subscriptions_Admin { add_filter( 'posts_where', array( __CLASS__, 'filter_orders' ) ); - add_filter( 'posts_where', array( __CLASS__, 'filter_orders_from_list' ) ); - - add_filter( 'posts_where', array( __CLASS__, 'filter_subscriptions_from_list' ) ); + add_filter( 'posts_where', array( __CLASS__, 'filter_orders_and_subscriptions_from_list' ) ); add_filter( 'posts_where', array( __CLASS__, 'filter_paid_subscription_orders_for_user' ) ); @@ -288,7 +286,7 @@ class WC_Subscriptions_Admin { $chosen_period = 'month'; } - echo '
'; + echo ''; - echo '
'; + echo '