diff --git a/changelog.txt b/changelog.txt index eeaf2f0..3452d34 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,14 @@ *** Woo Subscriptions Changelog *** +2023-12-21 - version 5.8.0 +* Fix: Incorrect switch calculation when upgrading a synchronised product before the first renewal is due where the initial payment was prorated. +* Fix: When updating a subscription via the REST API, don't update the start date to the current time if the start date is not set in the request. +* Fix: When using the checkout block to pay for renewal orders, ensure the order's cart hash is updated to make sure the existing order can be used. +* Fix: Prevents a PHP fatal error that occurs when the cart contains a renewal order item that no longer exists. +* Fix: When HPOS is enabled and data compatibility mode is turned on, make sure subscription date changes made to postmeta are synced to orders_meta table. +* Fix: Resolved an issue that would cause undefined $current_page, $max_num_pages, and $paginate variable errors when viewing a page with the subscriptions-shortcode. +* Dev: Update subscriptions-core to 6.6.0. + 2023-11-09 - version 5.7.0 * Add: Introduce a new REST API endpoint to create subscription(s) from a given order. This endpoint is available at POST `/wc/v3/orders/{order_id}/subscriptions` and accepts a single order ID. * Add: When a customer toggles automatic renewals on or off via their My Account page, add a note to the subscription to record that event. diff --git a/includes/api/class-wc-rest-subscriptions-controller.php b/includes/api/class-wc-rest-subscriptions-controller.php index e10ac83..97ca97c 100644 --- a/includes/api/class-wc-rest-subscriptions-controller.php +++ b/includes/api/class-wc-rest-subscriptions-controller.php @@ -241,11 +241,6 @@ class WC_REST_Subscriptions_Controller extends WC_REST_Orders_Controller { $payment_meta = array(); $dates = array(); - // If the start date is not set in the request, set its default to now. - if ( ! isset( $request['start_date'] ) ) { - $request['start_date'] = gmdate( 'Y-m-d H:i:s' ); - } - // Both setting (set_status()) and updating (update_status()) are valid ways for requests to set a subscription's status. $status_transition = 'set'; @@ -322,8 +317,8 @@ class WC_REST_Subscriptions_Controller extends WC_REST_Orders_Controller { } if ( ! empty( $dates ) ) { - // If the start date is not set in the request when a subscription is created with an active status, set its default to now. - if ( 'active' === $status && empty( $id ) && ! isset( $dates['start_date'] ) ) { + // If the start date is not set in the request when a subscription is being created, set its default to now. + if ( empty( $id ) && ! isset( $dates['start_date'] ) ) { $dates['start_date'] = gmdate( 'Y-m-d H:i:s' ); } diff --git a/includes/switching/class-wcs-switch-cart-item.php b/includes/switching/class-wcs-switch-cart-item.php index 99edafe..af3fee3 100644 --- a/includes/switching/class-wcs-switch-cart-item.php +++ b/includes/switching/class-wcs-switch-cart-item.php @@ -332,11 +332,11 @@ class WCS_Switch_Cart_Item { public function calculate_days_in_old_cycle() { $method_to_use = 'days_between_payments'; - // If the subscription contains a synced product and the next payment is actually the first payment, determine the days in the "old" cycle from the subscription object + // If the subscription contains a synced product with no proration on signup and the next payment is actually the first payment, determine the days in the "old" cycle from the subscription object if ( WC_Subscriptions_Synchroniser::subscription_contains_synced_product( $this->subscription ) ) { $first_synced_payment = WC_Subscriptions_Synchroniser::calculate_first_payment_date( wc_get_product( $this->canonical_product_id ), 'timestamp', $this->subscription->get_date( 'start' ) ); - if ( $first_synced_payment === $this->next_payment_timestamp ) { + if ( $first_synced_payment === $this->next_payment_timestamp && 0 === $this->get_total_paid_for_current_period() ) { $method_to_use = 'days_in_billing_cycle'; } } diff --git a/languages/woocommerce-subscriptions.pot b/languages/woocommerce-subscriptions.pot index 0c407d3..9ea0b45 100644 --- a/languages/woocommerce-subscriptions.pot +++ b/languages/woocommerce-subscriptions.pot @@ -2,14 +2,14 @@ # This file is distributed under the same license as the Woo Subscriptions plugin. msgid "" msgstr "" -"Project-Id-Version: Woo Subscriptions 5.7.0\n" +"Project-Id-Version: Woo Subscriptions 5.8.0\n" "Report-Msgid-Bugs-To: https://woocommerce.com/contact-us\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-11-09T05:16:09+00:00\n" +"POT-Creation-Date: 2023-12-21T00:30:53+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: woocommerce-subscriptions\n" @@ -57,7 +57,7 @@ msgstr "" #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:349 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:108 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:133 -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:287 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:289 #: vendor/woocommerce/subscriptions-core/includes/privacy/class-wcs-privacy-exporters.php:51 msgid "Subscriptions" msgstr "" @@ -96,14 +96,14 @@ msgid "Report Cache Enabled" msgstr "" #: includes/admin/reports/class-wcs-report-cache-manager.php:316 -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1608 -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1677 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1644 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1713 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-system-status.php:98 msgid "Yes" msgstr "" #: includes/admin/reports/class-wcs-report-cache-manager.php:316 -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1608 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1644 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-system-status.php:98 msgid "No" msgstr "" @@ -677,47 +677,47 @@ msgstr "" msgid "Failed to load subscription object with the ID %d." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:333 +#: includes/api/class-wc-rest-subscriptions-controller.php:328 msgid "Subscription dates could not be set. Error message: %s" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:369 +#: includes/api/class-wc-rest-subscriptions-controller.php:364 msgid "Subscription status." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:372 +#: includes/api/class-wc-rest-subscriptions-controller.php:367 msgid "Where the subscription was created." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:373 +#: includes/api/class-wc-rest-subscriptions-controller.php:368 msgid "Currency the subscription was created with, in ISO format." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:374 +#: includes/api/class-wc-rest-subscriptions-controller.php:369 msgid "The date the subscription was created, in the site's timezone." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:375 +#: includes/api/class-wc-rest-subscriptions-controller.php:370 msgid "The date the subscription was created, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:376 +#: includes/api/class-wc-rest-subscriptions-controller.php:371 msgid "The date the subscription was last modified, in the site's timezone." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:377 +#: includes/api/class-wc-rest-subscriptions-controller.php:372 msgid "The date the subscription was last modified, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:378 +#: includes/api/class-wc-rest-subscriptions-controller.php:373 msgid "User ID who owns the subscription." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:388 +#: includes/api/class-wc-rest-subscriptions-controller.php:383 msgid "The status to transition a subscription to." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:394 +#: includes/api/class-wc-rest-subscriptions-controller.php:389 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:350 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:506 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-extend-store-endpoint.php:179 @@ -725,7 +725,7 @@ msgstr "" msgid "The number of billing periods between subscription renewals." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:399 +#: includes/api/class-wc-rest-subscriptions-controller.php:394 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:355 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:511 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-extend-store-endpoint.php:172 @@ -733,69 +733,69 @@ msgstr "" msgid "Billing period for the subscription." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:405 +#: includes/api/class-wc-rest-subscriptions-controller.php:400 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:361 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:517 msgid "Subscription payment details." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:410 +#: includes/api/class-wc-rest-subscriptions-controller.php:405 msgid "Payment method meta and token in a post_meta_key: token format." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:415 +#: includes/api/class-wc-rest-subscriptions-controller.php:410 msgid "Payment method meta and token in a user_meta_key : token format." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:422 +#: includes/api/class-wc-rest-subscriptions-controller.php:417 msgid "The subscription's start date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:427 +#: includes/api/class-wc-rest-subscriptions-controller.php:422 msgid "The subscription's trial end date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:432 +#: includes/api/class-wc-rest-subscriptions-controller.php:427 msgid "The subscription's next payment date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:437 +#: includes/api/class-wc-rest-subscriptions-controller.php:432 msgid "The subscription's cancelled date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:442 +#: includes/api/class-wc-rest-subscriptions-controller.php:437 msgid "The subscription's end date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:461 +#: includes/api/class-wc-rest-subscriptions-controller.php:456 msgid "Limit result set to subscriptions which have specific statuses." msgstr "" #. translators: placeholder is the payment method ID. -#: includes/api/class-wc-rest-subscriptions-controller.php:505 +#: includes/api/class-wc-rest-subscriptions-controller.php:500 msgid "The %s payment gateway does not support admin changing the payment method." msgstr "" #. translators: 1$: gateway id, 2$: error message -#: includes/api/class-wc-rest-subscriptions-controller.php:522 +#: includes/api/class-wc-rest-subscriptions-controller.php:517 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:336 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:405 msgid "Subscription payment method could not be set to %1$s with error message: %2$s" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:536 +#: includes/api/class-wc-rest-subscriptions-controller.php:531 msgid "Invalid order ID." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:542 +#: includes/api/class-wc-rest-subscriptions-controller.php:537 msgid "Failed to load order object with the ID %d." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:546 +#: includes/api/class-wc-rest-subscriptions-controller.php:541 msgid "Order does not have a customer associated with it. Subscriptions require a customer." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:550 +#: includes/api/class-wc-rest-subscriptions-controller.php:545 msgid "Order already has subscriptions associated with it." msgstr "" @@ -1886,46 +1886,6 @@ msgstr "" msgid "Want to renew early via the checkout? Click %shere.%s" msgstr "" -#: tests/unit/scheduler/scheduler.php:65 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:291 -msgctxt "table heading" -msgid "Start Date" -msgstr "" - -#: tests/unit/scheduler/scheduler.php:66 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:292 -msgctxt "table heading" -msgid "Trial End" -msgstr "" - -#: tests/unit/scheduler/scheduler.php:67 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:40 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:293 -msgctxt "table heading" -msgid "Next Payment" -msgstr "" - -#: tests/unit/scheduler/scheduler.php:68 -#: vendor/woocommerce/subscriptions-core/templates/emails/cancelled-subscription.php:23 -#: vendor/woocommerce/subscriptions-core/templates/emails/expired-subscription.php:23 -#: vendor/woocommerce/subscriptions-core/templates/emails/on-hold-subscription.php:23 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:294 -msgctxt "table heading" -msgid "Last Order Date" -msgstr "" - -#: tests/unit/scheduler/scheduler.php:69 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:295 -msgctxt "table heading" -msgid "Cancelled Date" -msgstr "" - -#: tests/unit/scheduler/scheduler.php:70 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:296 -msgctxt "table heading" -msgid "End Date" -msgstr "" - #. translators: 1: relation type, 2: list of valid relation types. #: vendor/woocommerce/subscriptions-core/includes/abstracts/abstract-wcs-related-order-store.php:148 msgid "Invalid relation type: %1$s. Order relationship type must be one of: %2$s." @@ -2191,70 +2151,82 @@ msgstr "" msgid "The trial period can not exceed %s." msgstr "" +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1570 +msgid "Please log in to your account to view your subscriptions." +msgstr "" + #: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1607 +msgid "No subscriptions found for that customer." +msgstr "" + +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1609 +msgid "You do not have permission to view those subscriptions." +msgstr "" + +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1643 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-system-status.php:96 msgctxt "label that indicates whether debugging is turned on for the plugin" msgid "WCS_DEBUG" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1613 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1649 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-system-status.php:110 msgctxt "Live or Staging, Label on WooCommerce -> System Status page" msgid "Subscriptions Mode" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1614 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1650 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-system-status.php:112 msgctxt "refers to staging site" msgid "Staging" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1614 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1650 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-system-status.php:112 msgctxt "refers to live site" msgid "Live" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1644 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1680 msgid "Automatic Recurring Payments" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1677 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1713 msgid "Supports automatic renewal payments." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1775 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1811 msgid "Subscription items can no longer be edited." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1779 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1815 msgid "This subscription is no longer editable because the payment gateway does not allow modification of recurring amounts." msgstr "" #. translators: $1-2: opening and closing tags of a link that takes to Woo marketplace / Stripe product page -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1798 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1834 msgid "No payment gateways capable of processing automatic subscription payments are enabled. If you would like to process automatic payments, we recommend the %1$sfree Stripe extension%2$s." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1805 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1841 msgid "Recurring Payments" msgstr "" #. translators: placeholders are opening and closing link tags -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1813 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1849 msgid "Payment gateways which don't support automatic recurring payments can be used to process %1$smanual subscription renewal payments%2$s." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1933 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1969 msgid "Note that purchasing a subscription still requires an account." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1947 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1983 msgid "The product type can not be changed because this product is associated with subscriptions." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:2004 -#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:2005 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:2040 +#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:2041 msgid "Allow subscription customers to create an account during checkout" msgstr "" @@ -2519,7 +2491,7 @@ msgstr[1] "" #. translators: placeholder is the display name of a payment gateway a subscription was paid by #. translators: %s: payment method. #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:646 -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2052 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2126 msgid "Via %s" msgstr "" @@ -2587,7 +2559,7 @@ msgid "None" msgstr "" #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:1129 -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2034 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2108 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-change-payment-method-admin.php:170 msgid "Manual Renewal" msgstr "" @@ -2966,115 +2938,115 @@ msgid "Error during subscription status transition." msgstr "" #. translators: placeholder is human time diff (e.g. "3 weeks") -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1222 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1296 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-manager.php:2387 msgid "In %s" msgstr "" #. translators: placeholder is human time diff (e.g. "3 weeks") -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1225 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1299 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:246 msgid "%s ago" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1232 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1306 msgid "Not yet ended" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1235 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1309 msgid "Not cancelled" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1240 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1314 msgctxt "original denotes there is no date to display" msgid "-" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1348 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1422 msgid "The creation date of a subscription can not be deleted, only updated." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1351 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1425 msgid "The start date of a subscription can not be deleted, only updated." msgstr "" #. translators: %s: date type (e.g. "trial_end"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1356 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1430 msgid "The %s date of a subscription can not be deleted. You must delete the order." msgstr "" #. translators: %d: subscription ID. #. translators: %d: order ID. -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1365 -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2475 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1439 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2549 msgid "Subscription #%d: " msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1779 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1853 msgid "Payment status marked complete." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1812 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1886 msgid "Payment failed." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1817 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1891 msgid "Subscription Cancelled: maximum number of failed payments reached." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:1927 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2001 msgid "The \"all\" value for $order_type parameter is deprecated. It was a misnomer, as it did not return resubscribe orders. It was also inconsistent with order type values accepted by wcs_get_subscription_orders(). Use array( \"parent\", \"renewal\", \"switch\" ) to maintain previous behaviour, or \"any\" to receive all order types, including switch and resubscribe." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2131 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2205 #: vendor/woocommerce/subscriptions-core/wcs-functions.php:835 msgid "Payment method meta must be an array." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2367 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2441 msgid "Invalid format. First parameter needs to be an array." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2371 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2445 msgid "Invalid data. First parameter was empty when passed to update_dates()." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2378 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2452 msgid "Invalid data. First parameter has a date that is not in the registered date types." msgstr "" #. translators: placeholder is date type (e.g. "end", "next_payment"...) -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2405 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2479 msgctxt "appears in an error message if date is wrong format" msgid "Invalid %s date. The date must be of the format: \"Y-m-d H:i:s\"." msgstr "" #. translators: %s: date type (e.g. "end"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2443 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2517 msgid "The %s date must occur after the cancellation date." msgstr "" #. translators: %s: date type (e.g. "end"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2449 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2523 msgid "The %s date must occur after the last payment date." msgstr "" #. translators: %s: date type (e.g. "end"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2454 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2528 msgid "The %s date must occur after the next payment date." msgstr "" #. translators: %s: date type (e.g. "end"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2460 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2534 msgid "The %s date must occur after the trial end date." msgstr "" #. translators: %s: date type (e.g. "next_payment"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2465 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2539 msgid "The %s date must occur after the start date." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2495 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php:2569 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-checkout.php:348 msgid "Backordered" msgstr "" @@ -3245,7 +3217,7 @@ msgid "Invalid Subscription." msgstr "" #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:235 -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:243 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:245 msgid "The payment method can not be changed for that subscription." msgstr "" @@ -4171,16 +4143,16 @@ msgid_plural "We couldn't find the original renewal orders for items in your car msgstr[0] "" msgstr[1] "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php:681 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php:687 msgid "All linked subscription items have been removed from the cart." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php:710 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php:716 msgctxt "Used in WooCommerce by removed item notification: \"_All linked subscription items were_ removed. Undo?\" Filter for item title." msgid "All linked subscription items were" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php:1526 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php:1532 msgctxt "The place order button text while renewing a subscription" msgid "Renew subscription" msgstr "" @@ -4317,23 +4289,23 @@ msgstr "" msgid "My Subscription" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:288 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:290 msgid "Endpoint for the My Account → Subscriptions page" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:296 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:298 msgid "View subscription" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:297 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:299 msgid "Endpoint for the My Account → View Subscription page" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:305 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:307 msgid "Subscription payment method" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:306 +#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:308 msgid "Endpoint for the My Account → Change Subscription Payment Method page" msgstr "" @@ -6394,6 +6366,14 @@ msgctxt "table headings in notification email" msgid "Price" msgstr "" +#: vendor/woocommerce/subscriptions-core/templates/emails/cancelled-subscription.php:23 +#: vendor/woocommerce/subscriptions-core/templates/emails/expired-subscription.php:23 +#: vendor/woocommerce/subscriptions-core/templates/emails/on-hold-subscription.php:23 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:294 +msgctxt "table heading" +msgid "Last Order Date" +msgstr "" + #: vendor/woocommerce/subscriptions-core/templates/emails/cancelled-subscription.php:24 msgctxt "table headings in notification email" msgid "End of Prepaid Term" @@ -6676,6 +6656,12 @@ msgstr "" msgid "ID" msgstr "" +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:40 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:293 +msgctxt "table heading" +msgid "Next Payment" +msgstr "" + #: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:46 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:53 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:42 @@ -6855,6 +6841,26 @@ msgstr "" msgid "Can not get address type display name. Address type is not a string." msgstr "" +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:291 +msgctxt "table heading" +msgid "Start Date" +msgstr "" + +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:292 +msgctxt "table heading" +msgid "Trial End" +msgstr "" + +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:295 +msgctxt "table heading" +msgid "Cancelled Date" +msgstr "" + +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:296 +msgctxt "table heading" +msgid "End Date" +msgstr "" + #: vendor/woocommerce/subscriptions-core/wcs-functions.php:331 msgid "Date type is not a string." msgstr "" diff --git a/vendor/autoload.php b/vendor/autoload.php index 5d87e63..5ea7985 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -2,6 +2,24 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); +} + require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitfe47e554dced83cd1f1961109287683e::getLoader(); +return ComposerAutoloaderInita652888dbfcef5cfe9fff35250423322::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 6d0c3f2..a72151c 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -42,30 +42,79 @@ namespace Composer\Autoload; */ class ClassLoader { + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var ?string */ private $vendorDir; // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ private $fallbackDirsPsr4 = array(); // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ private $fallbackDirsPsr0 = array(); + /** @var bool */ private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ private $classMap = array(); + + /** @var bool */ private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ private $missingClasses = array(); + + /** @var ?string */ private $apcuPrefix; + /** + * @var self[] + */ private static $registeredLoaders = array(); + /** + * @param ?string $vendorDir + */ public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); } + /** + * @return string[] + */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { @@ -75,28 +124,47 @@ class ClassLoader return array(); } + /** + * @return array[] + * @psalm-return array> + */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } + /** + * @return array[] + * @psalm-return array + */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } + /** + * @return array[] + * @psalm-return array + */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } + /** + * @return string[] Array of classname => path + * @psalm-return array + */ public function getClassMap() { return $this->classMap; } /** - * @param array $classMap Class to filename map + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void */ public function addClassMap(array $classMap) { @@ -111,9 +179,11 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void */ public function add($prefix, $paths, $prepend = false) { @@ -156,11 +226,13 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException + * + * @return void */ public function addPsr4($prefix, $paths, $prepend = false) { @@ -204,8 +276,10 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void */ public function set($prefix, $paths) { @@ -220,10 +294,12 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException + * + * @return void */ public function setPsr4($prefix, $paths) { @@ -243,6 +319,8 @@ class ClassLoader * Turns on searching the include path for class files. * * @param bool $useIncludePath + * + * @return void */ public function setUseIncludePath($useIncludePath) { @@ -265,6 +343,8 @@ class ClassLoader * that have not been registered with the class map. * * @param bool $classMapAuthoritative + * + * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -285,6 +365,8 @@ class ClassLoader * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix + * + * @return void */ public function setApcuPrefix($apcuPrefix) { @@ -305,6 +387,8 @@ class ClassLoader * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void */ public function register($prepend = false) { @@ -324,6 +408,8 @@ class ClassLoader /** * Unregisters this instance as an autoloader. + * + * @return void */ public function unregister() { @@ -343,7 +429,8 @@ class ClassLoader public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -403,6 +490,11 @@ class ClassLoader return self::$registeredLoaders; } + /** + * @param string $class + * @param string $ext + * @return string|false + */ private function findFileWithExtension($class, $ext) { // PSR-4 lookup @@ -468,14 +560,26 @@ class ClassLoader return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index b3a4e16..51e734a 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -20,12 +20,27 @@ use Composer\Semver\VersionParser; * * See also https://getcomposer.org/doc/07-runtime.md#installed-versions * - * To require it's presence, you can require `composer-runtime-api ^2.0` + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final */ class InstalledVersions { + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ private static $installed; + + /** + * @var bool|null + */ private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ private static $installedByVendor = array(); /** @@ -83,7 +98,7 @@ class InstalledVersions { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; } } @@ -104,7 +119,7 @@ class InstalledVersions */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints($constraint); + $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -228,7 +243,7 @@ class InstalledVersions /** * @return array - * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string} + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} */ public static function getRootPackage() { @@ -242,7 +257,7 @@ class InstalledVersions * * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @return array[] - * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array} + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} */ public static function getRawData() { @@ -265,7 +280,7 @@ class InstalledVersions * Returns the raw data of all installed.php which are currently loaded for custom implementations * * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ public static function getAllRawData() { @@ -288,7 +303,7 @@ class InstalledVersions * @param array[] $data A vendor/composer/installed.php data set * @return void * - * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array} $data + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data */ public static function reload($data) { @@ -298,7 +313,7 @@ class InstalledVersions /** * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ private static function getInstalled() { @@ -313,7 +328,9 @@ class InstalledVersions if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -325,12 +342,17 @@ class InstalledVersions // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; } else { self::$installed = array(); } } - $installed[] = self::$installed; + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } return $installed; } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index db9b014..a27be98 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2,7 +2,7 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index b7fc012..15a2ff3 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 12ea9cc..e480e28 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 9ca2568..aad5c34 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitfe47e554dced83cd1f1961109287683e +class ComposerAutoloaderInita652888dbfcef5cfe9fff35250423322 { private static $loader; @@ -24,31 +24,12 @@ class ComposerAutoloaderInitfe47e554dced83cd1f1961109287683e require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitfe47e554dced83cd1f1961109287683e', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitfe47e554dced83cd1f1961109287683e', 'loadClassLoader')); + spl_autoload_register(array('ComposerAutoloaderInita652888dbfcef5cfe9fff35250423322', 'loadClassLoader'), true, true); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); + spl_autoload_unregister(array('ComposerAutoloaderInita652888dbfcef5cfe9fff35250423322', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInitfe47e554dced83cd1f1961109287683e::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInita652888dbfcef5cfe9fff35250423322::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 9972558..2658c19 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitfe47e554dced83cd1f1961109287683e +class ComposerStaticInita652888dbfcef5cfe9fff35250423322 { public static $prefixLengthsPsr4 = array ( 'C' => @@ -129,9 +129,9 @@ class ComposerStaticInitfe47e554dced83cd1f1961109287683e public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitfe47e554dced83cd1f1961109287683e::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitfe47e554dced83cd1f1961109287683e::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitfe47e554dced83cd1f1961109287683e::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInita652888dbfcef5cfe9fff35250423322::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInita652888dbfcef5cfe9fff35250423322::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInita652888dbfcef5cfe9fff35250423322::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b187f19..b9107bb 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -156,17 +156,17 @@ }, { "name": "woocommerce/subscriptions-core", - "version": "6.5.0", - "version_normalized": "6.5.0.0", + "version": "6.6.0", + "version_normalized": "6.6.0.0", "source": { "type": "git", "url": "https://github.com/Automattic/woocommerce-subscriptions-core.git", - "reference": "19ca9b7cf2b48cba4abd6ecf811475382b9d6673" + "reference": "5abcf9aac4e53ad9bdcf3752a34a04ae42261bac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/19ca9b7cf2b48cba4abd6ecf811475382b9d6673", - "reference": "19ca9b7cf2b48cba4abd6ecf811475382b9d6673", + "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/5abcf9aac4e53ad9bdcf3752a34a04ae42261bac", + "reference": "5abcf9aac4e53ad9bdcf3752a34a04ae42261bac", "shasum": "" }, "require": { @@ -179,7 +179,7 @@ "woocommerce/woocommerce-sniffs": "0.1.0", "yoast/phpunit-polyfills": "1.1.0" }, - "time": "2023-11-09T04:27:49+00:00", + "time": "2023-12-20T07:19:09+00:00", "type": "wordpress-plugin", "extra": { "phpcodesniffer-search-depth": 2 @@ -209,7 +209,7 @@ "description": "Sell products and services with recurring payments in your WooCommerce Store.", "homepage": "https://github.com/Automattic/woocommerce-subscriptions-core", "support": { - "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/6.5.0", + "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/6.6.0", "issues": "https://github.com/Automattic/woocommerce-subscriptions-core/issues" }, "install-path": "../woocommerce/subscriptions-core" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 8b2317c..ba3b91c 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,22 +1,22 @@ array( - 'pretty_version' => 'dev-release/5.7.0', - 'version' => 'dev-release/5.7.0', + 'name' => 'woocommerce/woocommerce-subscriptions', + 'pretty_version' => 'dev-release/5.8.0', + 'version' => 'dev-release/5.8.0', + 'reference' => '49bca69e2b17a445dc250b21c753175bdd9ed2c6', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '05388f52bd8a4479997a2672e130fb44de3548f4', - 'name' => 'woocommerce/woocommerce-subscriptions', 'dev' => false, ), 'versions' => array( 'composer/installers' => array( 'pretty_version' => 'v1.12.0', 'version' => '1.12.0.0', + 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/./installers', 'aliases' => array(), - 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', 'dev_requirement' => false, ), 'roundcube/plugin-installer' => array( @@ -32,21 +32,21 @@ ), ), 'woocommerce/subscriptions-core' => array( - 'pretty_version' => '6.5.0', - 'version' => '6.5.0.0', + 'pretty_version' => '6.6.0', + 'version' => '6.6.0.0', + 'reference' => '5abcf9aac4e53ad9bdcf3752a34a04ae42261bac', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../woocommerce/subscriptions-core', 'aliases' => array(), - 'reference' => '19ca9b7cf2b48cba4abd6ecf811475382b9d6673', 'dev_requirement' => false, ), 'woocommerce/woocommerce-subscriptions' => array( - 'pretty_version' => 'dev-release/5.7.0', - 'version' => 'dev-release/5.7.0', + 'pretty_version' => 'dev-release/5.8.0', + 'version' => 'dev-release/5.8.0', + 'reference' => '49bca69e2b17a445dc250b21c753175bdd9ed2c6', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '05388f52bd8a4479997a2672e130fb44de3548f4', 'dev_requirement' => false, ), ), diff --git a/vendor/woocommerce/subscriptions-core/changelog.txt b/vendor/woocommerce/subscriptions-core/changelog.txt index ae4cd03..6817b6e 100644 --- a/vendor/woocommerce/subscriptions-core/changelog.txt +++ b/vendor/woocommerce/subscriptions-core/changelog.txt @@ -1,5 +1,11 @@ *** WooCommerce Subscriptions Core Changelog *** += 6.6.0 - 2023-12-20 = +* Fix - When using the checkout block to pay for renewal orders, ensure the order's cart hash is updated to make sure the existing order can be used. +* Fix - Prevents a PHP fatal error that occurs when the cart contains a renewal order item that no longer exists. +* Fix - When HPOS is enabled and data compatibility mode is turned on, make sure subscription date changes made to postmeta are synced to orders_meta table. +* Fix - Resolved an issue that would cause undefined $current_page, $max_num_pages, and $paginate variable errors when viewing a page with the subscriptions-shortcode. + = 6.5.0 - 2023-11-09 = * Add - When a customer toggles automatic renewals on or off via their My Account page, add a note to the subscription to record that event. * Fix - When a subscription is flagged as requiring manual payments, allow admin users to turn on automatic payments for a subscription via the Edit Subscription page by selecting a new payment method. diff --git a/vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php b/vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php index d25f02f..a0a8579 100644 --- a/vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php +++ b/vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php @@ -1550,12 +1550,26 @@ class WC_Subscriptions_Admin { } /** - * Callback for the [subscriptions] shortcode that displays subscription names for a particular user. + * Displays the content for the [subscriptions] shortcode. * - * @param array $attributes Shortcode attributes. - * @return string + * The subscriptions shortcode can be used to display customer subscriptions similar to the my account list page. + * Shortcode args enable filtering by status and user ID. + * + * @param array $attributes shortcode attributes. + * @return string The shortcode content. */ public static function do_subscriptions_shortcode( $attributes ) { + + // Display a notice if the user isn't logged in. + if ( ! is_user_logged_in() ) { + // We cannot show notices on admin requests - eg page previews. + if ( is_admin() ) { + return; + } + + return wc_print_notice( esc_html__( 'Please log in to your account to view your subscriptions.', 'woocommerce-subscriptions' ), 'error', [], true ); + } + $attributes = shortcode_atts( array( 'user_id' => 0, @@ -1565,15 +1579,34 @@ class WC_Subscriptions_Admin { 'subscriptions' ); - $subscriptions = wcs_get_users_subscriptions( $attributes['user_id'] ); + $subscriptions = wcs_get_users_subscriptions( $attributes['user_id'] ); + $apply_status_filter = 'all' !== $attributes['status'] && 'any' !== $attributes['status']; - // Limit subscriptions to the appropriate status if it's not "any" or "all". - if ( 'all' !== $attributes['status'] && 'any' !== $attributes['status'] ) { - /** @var WC_Subscription $subscription */ - foreach ( $subscriptions as $index => $subscription ) { - if ( ! $subscription->has_status( $attributes['status'] ) ) { - unset( $subscriptions[ $index ] ); - } + // Determine if the current user has permission to view the subscriptions. + // By default, only the user themselves can view their subscriptions. + $display_permissions_notice = ! empty( $attributes['user_id'] ) && get_current_user_id() !== absint( $attributes['user_id'] ); + + foreach ( $subscriptions as $index => $subscription ) { + if ( $apply_status_filter && ! $subscription->has_status( $attributes['status'] ) ) { + unset( $subscriptions[ $index ] ); + } + + // Remove any subscriptions the current user cannot view. WooCommerce admins can view all subscriptions. + if ( ! current_user_can( 'manage_woocommerce' ) && ! current_user_can( 'view_order', $subscription->get_id() ) ) { + unset( $subscriptions[ $index ] ); + $display_permissions_notice = true; + } + } + + // If all the subscriptions were removed and the current user doesn't have permissions, display a notice. Note: We cannot show notices on admin requests - eg page previews. + if ( empty( $subscriptions ) && $display_permissions_notice ) { + // We cannot show notices on admin requests - eg page previews. + if ( is_admin() ) { + return; + } elseif ( current_user_can( 'manage_woocommerce' ) ) { + return wc_print_notice( esc_html__( 'No subscriptions found for that customer.', 'woocommerce-subscriptions' ), 'notice', [], true ); + } else { + return wc_print_notice( esc_html__( 'You do not have permission to view those subscriptions.', 'woocommerce-subscriptions' ), 'error', [], true ); } } @@ -1584,6 +1617,9 @@ class WC_Subscriptions_Admin { array( 'subscriptions' => $subscriptions, 'user_id' => $attributes['user_id'], + 'current_page' => 1, + 'max_num_pages' => 1, + 'paginate' => false, ), '', WC_Subscriptions_Core_Plugin::instance()->get_subscriptions_core_directory( 'templates/' ) diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php index 5c29a61..4c3604d 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php @@ -947,6 +947,80 @@ class WC_Subscription extends WC_Order { $this->set_prop( 'schedule_start', $schedule_start ); } + /** + * Set schedule trial end date. + * + * Note: This function is intended for internal use only and should not be accessed directly. + * It only exists to support setting the trial end date prop from the data store. + * Calling this function does not automatically schedule the trial end date as a Scheduled Action. + * + * Use WC_Subscription::update_dates() instead. + * + * @param string $schedule_trial_end + */ + public function set_trial_end_date( $schedule_trial_end ) { + $this->set_prop( 'schedule_trial_end', $schedule_trial_end ); + } + + /** + * Set schedule next payment date. + * + * Note: This function is intended for internal use only and should not be accessed directly. + * It only exists to support setting the next payment date prop from the data store. + * Calling this function does not automatically schedule the next payment date as a Scheduled Action. + * + * Use WC_Subscription::update_dates() instead. + * + * @param string $schedule_next_payment + */ + public function set_next_payment_date( $schedule_next_payment ) { + $this->set_prop( 'schedule_next_payment', $schedule_next_payment ); + } + + /** + * Set schedule cancelled date. + * + * Note: This function is intended for internal use only and should not be accessed directly. + * It only exists to support setting the cancelled date prop from the data store. + * + * Use WC_Subscription::update_dates() instead. + * + * @param string $schedule_cancelled + */ + public function set_cancelled_date( $schedule_cancelled ) { + $this->set_prop( 'schedule_cancelled', $schedule_cancelled ); + } + + /** + * Set schedule end date. + * + * Note: This function is intended for internal use only and should not be accessed directly. + * It only exists to support setting the end date prop from the data store. + * Calling this function does not automatically schedule the end date as a Scheduled Action. + * + * Use WC_Subscription::update_dates() instead. + * + * @param string $schedule_end + */ + public function set_end_date( $schedule_end ) { + $this->set_prop( 'schedule_end', $schedule_end ); + } + + /** + * Set schedule payment retry date. + * + * Note: This function is intended for internal use only and should not be accessed directly. + * It only exists to support setting the payment retry date prop from the data store. + * Calling this function does not automatically schedule the payment retry date as a Scheduled Action. + * + * Use WC_Subscription::update_dates() instead. + * + * @param string $schedule_payment_retry + */ + public function set_payment_retry_date( $schedule_payment_retry ) { + $this->set_prop( 'schedule_payment_retry', $schedule_payment_retry ); + } + /** * Set parent order ID. We don't use WC_Abstract_Order::set_parent_id() because we want to allow false * parent IDs, like 0. diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php index 3f2bb93..b81b159 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php @@ -16,7 +16,7 @@ class WC_Subscriptions_Core_Plugin { * The version of subscriptions-core library. * @var string */ - protected $library_version = '6.5.0'; // WRCS: DEFINED_VERSION. + protected $library_version = '6.6.0'; // WRCS: DEFINED_VERSION. /** * The subscription scheduler instance. diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php b/vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php index 7c4a2c7..5af1a33 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wcs-cart-renewal.php @@ -427,6 +427,7 @@ class WCS_Cart_Renewal { if ( $subscription ) { $subscription_items = $subscription->get_items(); + $item_to_renew = []; /** * Find the subscription or order line item that represents this cart item. @@ -445,6 +446,11 @@ class WCS_Cart_Renewal { } } + // If we can't find the item to renew, return the cart item session data as is. + if ( empty( $item_to_renew ) ) { + return $cart_item_session_data; + } + $price = $item_to_renew['line_subtotal']; if ( $_product->is_taxable() && $subscription->get_prices_include_tax() ) { @@ -1613,16 +1619,8 @@ class WCS_Cart_Renewal { return $has_status; } - /** - * This function is only concerned with updating the order cart hash during REST API requests - which is the request - * context where the Store API Checkout Block validates the order for payment resumption. - */ - if ( ! WC()->is_rest_api_request() ) { - return $has_status; - } - // If the order being validated is the order in the cart, then we need to update the cart hash so it can be resumed. - if ( $order && $order->get_id() === WC()->session->get( 'store_api_draft_order', 0 ) ) { + if ( $order && $order->get_id() === (int) WC()->session->get( 'store_api_draft_order', 0 ) ) { $cart_order = $this->get_order(); if ( $cart_order && $cart_order->get_id() === $order->get_id() ) { diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php b/vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php index 5e37dc3..85646f4 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php @@ -232,8 +232,10 @@ class WCS_Query extends WC_Query { return; } - $subscription = wcs_get_subscription( absint( $query->get( 'subscription-payment-method' ) ) ); - if ( ! $subscription ) { + $subscription_id = absint( $query->get( 'subscription-payment-method' ) ); + $subscription = wcs_get_subscription( $subscription_id ); + + if ( ! $subscription || ! current_user_can( 'edit_shop_subscription_payment_method', $subscription_id ) ) { return; } diff --git a/vendor/woocommerce/subscriptions-core/includes/data-stores/class-wcs-orders-table-subscription-data-store.php b/vendor/woocommerce/subscriptions-core/includes/data-stores/class-wcs-orders-table-subscription-data-store.php index 13ba0ff..76ac9a6 100644 --- a/vendor/woocommerce/subscriptions-core/includes/data-stores/class-wcs-orders-table-subscription-data-store.php +++ b/vendor/woocommerce/subscriptions-core/includes/data-stores/class-wcs-orders-table-subscription-data-store.php @@ -990,4 +990,70 @@ class WCS_Orders_Table_Subscription_Data_Store extends \Automattic\WooCommerce\I public function get_switch_order_ids_cache( $subscription ) { return $subscription->get_meta( '_subscription_switch_order_ids_cache' ); } + + /** + * Sets the subscription's start date prop. + * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. + * + * @param \WC_Subscription $subscription Subscription object. + * @param string $date The date to set. + */ + public function set_schedule_start( $subscription, $date ) { + $subscription->set_start_date( $date ); + } + + /** + * Sets the subscription's trial end date prop. + * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. + * + * @param \WC_Subscription $subscription Subscription object. + * @param string $date The date to set. + */ + public function set_schedule_trial_end( $subscription, $date ) { + $subscription->set_trial_end_date( $date ); + } + + /** + * Sets the subscription's next payment date prop. + * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. + * + * @param \WC_Subscription $subscription Subscription object. + * @param string $date The date to set. + */ + public function set_schedule_next_payment( $subscription, $date ) { + $subscription->set_next_payment_date( $date ); + } + + /** + * Sets the subscription's cancelled date prop. + * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. + * + * @param \WC_Subscription $subscription Subscription object. + * @param string $date The date to set. + */ + public function set_schedule_cancelled( $subscription, $date ) { + $subscription->set_cancelled_date( $date ); + } + + /** + * Sets the subscription's end date prop. + * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. + * + * @param \WC_Subscription $subscription Subscription object. + * @param string $date The date to set. + */ + public function set_schedule_end( $subscription, $date ) { + $subscription->set_end_date( $date ); + } + + /** + * Sets the subscription's payment retry date prop. + * Called by @see OrdersTableDataStore::set_order_prop() when syncing/migrating internal meta key data. + * + * @param \WC_Subscription $subscription Subscription object. + * @param string $date The date to set. + */ + public function set_schedule_payment_retry( $subscription, $date ) { + $subscription->set_payment_retry_date( $date ); + } } diff --git a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php index 34e276e..cdcb055 100644 --- a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php +++ b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php @@ -6,5 +6,5 @@ * Author: Automattic * Author URI: https://woocommerce.com/ * Requires WP: 5.6 - * Version: 6.5.0 + * Version: 6.6.0 */ diff --git a/woocommerce-subscriptions.php b/woocommerce-subscriptions.php index e62bd55..89d48b8 100644 --- 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: WooCommerce * Author URI: https://woocommerce.com/ - * Version: 5.7.0 + * Version: 5.8.0 * * WC requires at least: 7.7.0 * WC tested up to: 8.2.0 @@ -77,7 +77,7 @@ class WC_Subscriptions { public static $plugin_file = __FILE__; /** @var string */ - public static $version = '5.7.0'; // WRCS: DEFINED_VERSION. + public static $version = '5.8.0'; // WRCS: DEFINED_VERSION. /** @var string */ public static $wc_minimum_supported_version = '7.7';