Skip to content

Commit

Permalink
Merge branch 'master' into order-crud-api
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Aug 16, 2016
2 parents 3f08d11 + 46b6ca0 commit bc75c60
Show file tree
Hide file tree
Showing 14 changed files with 214 additions and 265 deletions.
5 changes: 2 additions & 3 deletions includes/abstracts/abstract-wc-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ protected function read_meta_data() {
$raw_meta_data = $wpdb->get_results( $wpdb->prepare( "
SELECT " . $db_info['meta_id_field'] . ", meta_key, meta_value
FROM " . $db_info['table'] . "
WHERE " . $db_info['object_id_field'] . " = %d ORDER BY " . $db_info['meta_id_field'] . "
AND meta_key NOT LIKE 'wp\_%%'
WHERE " . $db_info['object_id_field'] . "=%d AND meta_key NOT LIKE 'wp\_%%' ORDER BY " . $db_info['meta_id_field'] . "
", $this->get_id() ) );

if ( $raw_meta_data ) {
Expand All @@ -264,7 +263,7 @@ protected function read_meta_data() {
}
$this->_meta_data[] = (object) array(
'key' => $meta->meta_key,
'value' => $meta->meta_value,
'value' => maybe_unserialize( $meta->meta_value ),
'meta_id' => $meta->{ $db_info['meta_id_field'] },
);
}
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -2203,7 +2203,7 @@ public function process_product_file_download_paths( $product_id, $variation_id,
foreach ( $existing_permissions as $existing_permission ) {
$order = wc_get_order( $existing_permission->order_id );

if ( ! empty( $order->get_id() ) ) {
if ( $order->get_id() ) {
// Remove permissions
if ( ! empty( $removed_download_ids ) ) {
foreach ( $removed_download_ids as $download_id ) {
Expand Down
6 changes: 3 additions & 3 deletions includes/admin/meta-boxes/class-wc-meta-box-order-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public static function output( $post ) {
$payment_gateways = array();
}

$payment_method = ! empty( $order->get_payment_method() ) ? $order->get_payment_method() : '';
$payment_method = $order->get_payment_method() ? $order->get_payment_method() : '';

$order_type_object = get_post_type_object( $post->post_type );
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
Expand Down Expand Up @@ -219,7 +219,7 @@ public static function output( $post ) {

<p class="form-field form-field-wide wc-customer-user">
<label for="customer_user"><?php _e( 'Customer:', 'woocommerce' ) ?> <?php
if ( ! empty( $order->get_user_id() ) ) {
if ( $order->get_user_id() ) {
$args = array( 'post_status' => 'all',
'post_type' => 'shop_order',
'_customer_user' => absint( $order->get_user_id() )
Expand All @@ -233,7 +233,7 @@ public static function output( $post ) {
<?php
$user_string = '';
$user_id = '';
if ( ! empty( $order->get_user_id() ) ) {
if ( $order->get_user_id() ) {
$user_id = absint( $order->get_user_id() );
$user = get_user_by( 'id', $user_id );
$user_string = esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' &ndash; ' . esc_html( $user->user_email ) . ')';
Expand Down
4 changes: 2 additions & 2 deletions includes/api/legacy/v1/class-wc-api-coupons.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function get_coupon( $id, $fields = null ) {
'individual_use' => $coupon->get_individual_use(),
'product_ids' => array_map( 'absint', (array) $coupon->get_product_ids() ),
'exclude_product_ids' => array_map( 'absint', (array) $coupon->get_excluded_product_ids() ),
'usage_limit' => ( ! empty( $coupon->get_usage_limit() ) ) ? $coupon->get_usage_limit() : null,
'usage_limit_per_user' => ( ! empty( $coupon->get_usage_limit_per_user() ) ) ? $coupon->get_usage_limit_per_user() : null,
'usage_limit' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : null,
'usage_limit_per_user' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : null,
'limit_usage_to_x_items' => (int) $coupon->get_limit_usage_to_x_items(),
'usage_count' => (int) $coupon->get_usage_count(),
'expiry_date' => $this->server->format_datetime( $coupon->get_expiry_date() ),
Expand Down
6 changes: 3 additions & 3 deletions includes/api/legacy/v2/class-wc-api-coupons.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ public function get_coupon( $id, $fields = null ) {
'individual_use' => $coupon->get_individual_use(),
'product_ids' => array_map( 'absint', (array) $coupon->get_product_ids() ),
'exclude_product_ids' => array_map( 'absint', (array) $coupon->get_excluded_product_ids() ),
'usage_limit' => ( ! empty( $coupon->get_usage_limit() ) ) ? $coupon->get_usage_limit() : null,
'usage_limit_per_user' => ( ! empty( $coupon->get_usage_limit_per_user() ) ) ? $coupon->get_usage_limit_per_user() : null,
'usage_limit' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : null,
'usage_limit_per_user' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : null,
'limit_usage_to_x_items' => (int) $coupon->get_limit_usage_to_x_items(),
'usage_count' => (int) $coupon->get_usage_count(),
'expiry_date' => ( ! empty( $coupon->get_expiry_date() ) ) ? $this->server->format_datetime( $coupon->get_expiry_date() ) : null,
'expiry_date' => $coupon->get_expiry_date() ? $this->server->format_datetime( $coupon->get_expiry_date() ) : null,
'enable_free_shipping' => $coupon->get_free_shipping(),
'product_category_ids' => array_map( 'absint', (array) $coupon->get_product_categories() ),
'exclude_product_category_ids' => array_map( 'absint', (array) $coupon->get_excluded_product_categories() ),
Expand Down
6 changes: 3 additions & 3 deletions includes/api/legacy/v3/class-wc-api-coupons.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ public function get_coupon( $id, $fields = null ) {
'individual_use' => $coupon->get_individual_use(),
'product_ids' => array_map( 'absint', (array) $coupon->get_product_ids() ),
'exclude_product_ids' => array_map( 'absint', (array) $coupon->get_excluded_product_ids() ),
'usage_limit' => ( ! empty( $coupon->get_usage_limit() ) ) ? $coupon->get_usage_limit() : null,
'usage_limit_per_user' => ( ! empty( $coupon->get_usage_limit_per_user() ) ) ? $coupon->get_usage_limit_per_user() : null,
'usage_limit' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : null,
'usage_limit_per_user' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : null,
'limit_usage_to_x_items' => (int) $coupon->get_limit_usage_to_x_items(),
'usage_count' => (int) $coupon->get_usage_count(),
'expiry_date' => ( ! empty( $coupon->get_expiry_date() ) ) ? $this->server->format_datetime( $coupon->get_expiry_date() ) : null,
'expiry_date' => $coupon->get_expiry_date() ? $this->server->format_datetime( $coupon->get_expiry_date() ) : null,
'enable_free_shipping' => $coupon->get_free_shipping(),
'product_category_ids' => array_map( 'absint', (array) $coupon->get_product_categories() ),
'exclude_product_category_ids' => array_map( 'absint', (array) $coupon->get_excluded_product_categories() ),
Expand Down

0 comments on commit bc75c60

Please sign in to comment.