Skip to content

Commit

Permalink
Merge branch 'master' into pr/11797
Browse files Browse the repository at this point in the history
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php
#	includes/api/class-wc-rest-coupons-controller.php
#	includes/class-wc-coupon.php
#	tests/unit-tests/api/coupons.php
#	tests/unit-tests/coupon/crud.php
  • Loading branch information
mikejolley committed Sep 1, 2016
2 parents d2d4143 + d30c54e commit 402d0ff
Show file tree
Hide file tree
Showing 25 changed files with 921 additions and 902 deletions.
17 changes: 13 additions & 4 deletions assets/js/frontend/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ jQuery( function( $ ) {
// Error message collection
var $error = $( '.woocommerce-error', $html );
var $message = $( '.woocommerce-message', $html );
var $info = $( '.woocommerce-info', $html );

// Remove errors
$( '.woocommerce-error, .woocommerce-message' ).remove();
$( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();

if ( $new_form.length === 0 ) {
// If the checkout is also displayed on this page, trigger reload instead.
Expand All @@ -88,9 +89,13 @@ jQuery( function( $ ) {
// Display errors
if ( $error.length > 0 ) {
show_notice( $error, $( '.cart-empty' ).closest( '.woocommerce' ) );
} else if ( $message.length > 0 ) {
}
if ( $message.length > 0 ) {
show_notice( $message, $( '.cart-empty' ).closest( '.woocommerce' ) );
}
if ( $info.length > 0 ) {
show_notice( $info, $( '.cart-empty' ).closest( '.woocommerce' ) );
}
} else {
// If the checkout is also displayed on this page, trigger update event.
if ( $( '.woocommerce-checkout' ).length ) {
Expand All @@ -102,9 +107,13 @@ jQuery( function( $ ) {

if ( $error.length > 0 ) {
show_notice( $error );
} else if ( $message.length > 0 ) {
}
if ( $message.length > 0 ) {
show_notice( $message );
}
if ( $info.length > 0 ) {
show_notice( $info );
}

update_cart_totals_div( $new_totals );
}
Expand All @@ -131,7 +140,7 @@ jQuery( function( $ ) {
if ( ! $target ) {
$target = $( '.shop_table.cart' ).closest( 'form' );
}
$( '.woocommerce-error, .woocommerce-message' ).remove();
$( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();
$target.before( html_element );
};

Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/cart.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions includes/abstracts/abstract-wc-rest-shipping-zones-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,23 @@ public function update_items_permissions_check( $request ) {

return true;
}

/**
* Check whether a given request has permission to delete Shipping Zones.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function delete_items_permissions_check( $request ) {
if ( ! wc_shipping_enabled() ) {
return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) );
}

if ( ! wc_rest_check_manager_permissions( 'settings', 'delete' ) ) {
return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}

return true;
}

}
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function preview_emails() {
* @return string
*/
public function admin_footer_text( $footer_text ) {
if ( ! current_user_can( 'manage_woocommerce' ) ) {
if ( ! current_user_can( 'manage_woocommerce' ) || ! function_exists( 'wc_get_screen_ids' ) ) {
return;
}
$current_screen = get_current_screen();
Expand Down
Loading

0 comments on commit 402d0ff

Please sign in to comment.