Merge branch 'master' into update/erasure-requests

# Conflicts:
#	includes/class-wc-privacy.php
This commit is contained in:
Mike Jolley 2018-04-20 16:49:17 +01:00
commit 2cc1504f7e
6 changed files with 16 additions and 11 deletions

View File

@ -93,7 +93,7 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V1_Controller {
/**
* Update customer meta fields.
*
* @param WC_Customer $customer Cusotmer data.
* @param WC_Customer $customer Customer data.
* @param WP_REST_Request $request Request data.
*/
protected function update_customer_meta_fields( $customer, $request ) {

View File

@ -317,13 +317,14 @@ class WC_API_Reports extends WC_API_Resource {
*/
protected function validate_request( $id = null, $type = null, $context = null ) {
if ( ! current_user_can( 'view_woocommerce_reports' ) ) {
return new WP_Error( 'woocommerce_api_user_cannot_read_report', __( 'You do not have permission to read this report', 'woocommerce' ), array( 'status' => 401 ) );
} else {
if ( current_user_can( 'view_woocommerce_reports' ) ) {
return true;
}
return new WP_Error(
'woocommerce_api_user_cannot_read_report',
__( 'You do not have permission to read this report', 'woocommerce' ),
array( 'status' => 401 )
);
}
}

View File

@ -1017,6 +1017,10 @@ class WC_Checkout {
throw new Exception( $order_id->get_error_message() );
}
if ( ! $order ) {
throw new Exception( __( 'Unable to create order.', 'woocommerce' ) );
}
do_action( 'woocommerce_checkout_order_processed', $order_id, $posted_data, $order );
if ( WC()->cart->needs_payment() ) {

View File

@ -63,7 +63,7 @@ class WC_Privacy_Exporters {
}
/**
* Finds and exports data which could be used to identify a person from WooCommerce data assocated with an email address.
* Finds and exports data which could be used to identify a person from WooCommerce data associated with an email address.
*
* Orders are exported in blocks of 10 to avoid timeouts.
*

View File

@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit;
*
* @since 2.6.0
* @param array $args Array of args (above).
* @return array|stdClass Number of pages and an array of order objects if
* @return WC_Order[]|stdClass Number of pages and an array of order objects if
* paginate is true, or just an array of values.
*/
function wc_get_orders( $args ) {

View File

@ -792,7 +792,7 @@ function wc_terms_and_conditions_page_content() {
/**
* Output privacy policy text. This is custom text which can be added via the customizer/privacy settings section.
*
* Loads the relevent policy for the current page unless a specfic policy text is required.
* Loads the relevant policy for the current page unless a specific policy text is required.
*
* @since 3.4.0
* @param string $type Type of policy to load. Valid values include registration and checkout.
@ -823,7 +823,7 @@ function wc_privacy_policy_text( $type = '' ) {
* @return string
*/
function wc_replace_policy_page_link_placeholders( $text ) {
$privacy_page_id = wc_privacy_policy_page_id( $text );
$privacy_page_id = wc_privacy_policy_page_id();
$terms_page_id = wc_terms_and_conditions_page_id();
$privacy_link = $privacy_page_id ? '<a href="' . esc_url( get_permalink( $privacy_page_id ) ) . '" class="woocommerce-privacy-policy-link" target="_blank">' . __( 'privacy policy', 'woocommerce' ) . '</a>' : __( 'privacy policy', 'woocommerce' );
$terms_link = $terms_page_id ? '<a href="' . esc_url( get_permalink( $terms_page_id ) ) . '" class="woocommerce-terms-and-conditions-link" target="_blank">' . __( 'terms and conditions', 'woocommerce' ) . '</a>' : __( 'terms and conditions', 'woocommerce' );