Merge remote-tracking branch 'woothemes/master'

This commit is contained in:
Shohei Tanaka 2015-09-22 14:35:23 +09:00
commit 523d01f73b
12 changed files with 120 additions and 122 deletions

View File

@ -42,11 +42,10 @@ jQuery(function( $ ) {
$( 'input[name="_stock"]', '.inline-edit-row' ).val( stock );
$( 'input[name="menu_order"]', '.inline-edit-row' ).val( menu_order );
$( 'select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option' ).removeAttr( 'selected' );
$( 'select[name="_tax_status"] option[value="' + tax_status + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' );
$( 'select[name="_tax_class"] option[value="' + tax_class + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' );
$( 'select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option' ).removeAttr( 'selected' );
$( 'select[name="_visibility"] option[value="' + visibility + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' );
$( 'select[name="_stock_status"] option[value="' + stock_status + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' );
$( 'select[name="_backorders"] option[value="' + backorders + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' );

View File

@ -1 +1 @@
jQuery(function(a){a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#woocommerce_inline_"+b),d=c.find(".sku").text(),e=c.find(".regular_price").text(),f=c.find(".sale_price ").text(),g=c.find(".weight").text(),h=c.find(".length").text(),i=c.find(".width").text(),j=c.find(".height").text(),k=c.find(".shipping_class").text(),l=c.find(".visibility").text(),m=c.find(".stock_status").text(),n=c.find(".stock").text(),o=c.find(".featured").text(),p=c.find(".manage_stock").text(),q=c.find(".menu_order").text(),r=c.find(".tax_status").text(),s=c.find(".tax_class").text(),t=c.find(".backorders").text();a('input[name="_sku"]',".inline-edit-row").val(d),a('input[name="_regular_price"]',".inline-edit-row").val(e),a('input[name="_sale_price"]',".inline-edit-row").val(f),a('input[name="_weight"]',".inline-edit-row").val(g),a('input[name="_length"]',".inline-edit-row").val(h),a('input[name="_width"]',".inline-edit-row").val(i),a('input[name="_height"]',".inline-edit-row").val(j),a('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),a('select[name="_shipping_class"] option[value="'+k+'"]').attr("selected","selected").change(),a('input[name="_stock"]',".inline-edit-row").val(n),a('input[name="menu_order"]',".inline-edit-row").val(q),a('select[name="_tax_status"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_tax_class"] option[value="'+s+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),a('select[name="_visibility"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_backorders"] option[value="'+t+'"]',".inline-edit-row").attr("selected","selected"),"yes"===o?a('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):a('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===p?(a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),a('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(a(".stock_qty_field",".inline-edit-row").hide(),a('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var u=c.find(".product_type").text(),v=c.find(".product_is_virtual").text();"simple"===u||"external"===u?a(".price_fields",".inline-edit-row").show().removeAttr("style"):a(".price_fields",".inline-edit-row").hide(),"yes"===v?a(".dimension_fields",".inline-edit-row").hide():a(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===u?a(".stock_fields",".inline-edit-row").hide():a(".stock_fields",".inline-edit-row").show().removeAttr("style")}),a("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){a(this).is(":checked")?a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):a(".stock_qty_field",".inline-edit-row").hide()}),a("#wpbody").on("click","#doaction, #doaction2",function(){a("input.text",".inline-edit-row").val(""),a("#woocommerce-fields").find("select").prop("selectedIndex",0),a("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide();var b="product_tag";a('tr.inline-editor textarea[name="tax_input['+b+']"]').suggest(ajaxurl+"?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),a("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<a(this).val()?a(this).closest("div").find(".change-input").show():a(this).closest("div").find(".change-input").hide()})});
jQuery(function(a){a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#woocommerce_inline_"+b),d=c.find(".sku").text(),e=c.find(".regular_price").text(),f=c.find(".sale_price ").text(),g=c.find(".weight").text(),h=c.find(".length").text(),i=c.find(".width").text(),j=c.find(".height").text(),k=c.find(".shipping_class").text(),l=c.find(".visibility").text(),m=c.find(".stock_status").text(),n=c.find(".stock").text(),o=c.find(".featured").text(),p=c.find(".manage_stock").text(),q=c.find(".menu_order").text(),r=c.find(".tax_status").text(),s=c.find(".tax_class").text(),t=c.find(".backorders").text();a('input[name="_sku"]',".inline-edit-row").val(d),a('input[name="_regular_price"]',".inline-edit-row").val(e),a('input[name="_sale_price"]',".inline-edit-row").val(f),a('input[name="_weight"]',".inline-edit-row").val(g),a('input[name="_length"]',".inline-edit-row").val(h),a('input[name="_width"]',".inline-edit-row").val(i),a('input[name="_height"]',".inline-edit-row").val(j),a('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),a('select[name="_shipping_class"] option[value="'+k+'"]').attr("selected","selected").change(),a('input[name="_stock"]',".inline-edit-row").val(n),a('input[name="menu_order"]',".inline-edit-row").val(q),a('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),a('select[name="_tax_status"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_tax_class"] option[value="'+s+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_visibility"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_backorders"] option[value="'+t+'"]',".inline-edit-row").attr("selected","selected"),"yes"===o?a('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):a('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===p?(a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),a('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(a(".stock_qty_field",".inline-edit-row").hide(),a('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var u=c.find(".product_type").text(),v=c.find(".product_is_virtual").text();"simple"===u||"external"===u?a(".price_fields",".inline-edit-row").show().removeAttr("style"):a(".price_fields",".inline-edit-row").hide(),"yes"===v?a(".dimension_fields",".inline-edit-row").hide():a(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===u?a(".stock_fields",".inline-edit-row").hide():a(".stock_fields",".inline-edit-row").show().removeAttr("style")}),a("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){a(this).is(":checked")?a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):a(".stock_qty_field",".inline-edit-row").hide()}),a("#wpbody").on("click","#doaction, #doaction2",function(){a("input.text",".inline-edit-row").val(""),a("#woocommerce-fields").find("select").prop("selectedIndex",0),a("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide();var b="product_tag";a('tr.inline-editor textarea[name="tax_input['+b+']"]').suggest(ajaxurl+"?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),a("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<a(this).val()?a(this).closest("div").find(".change-input").show():a(this).closest("div").find(".change-input").hide()})});

View File

@ -2131,7 +2131,7 @@ abstract class WC_Abstract_Order {
foreach ( $download_files as $download_id => $file ) {
$i++;
$prefix = count( $download_files ) > 1 ? sprintf( __( 'Download %d', 'woocommerce' ), $i ) : __( 'Download', 'woocommerce' );
$links[] = '<small>' . $prefix . ': <a href="' . esc_url( $file['download_url'] ) . '" target="_blank">' . esc_html( $file['name'] ) . '</a></small>' . "\n";
$links[] = '<small class="download-url">' . $prefix . ': <a href="' . esc_url( $file['download_url'] ) . '" target="_blank">' . esc_html( $file['name'] ) . '</a></small>' . "\n";
}
echo '<br/>' . implode( '<br/>', $links );

View File

@ -350,13 +350,13 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'title' => sprintf( __( '%s gross sales in this period', 'woocommerce' ), '<strong>' . wc_price( $data->total_sales ) . '</strong>' ),
'placeholder' => __( 'This is the sum of the order totals after any refunds and including shipping and taxes.', 'woocommerce' ),
'color' => $this->chart_colours['sales_amount'],
'highlight_series' => 6
'highlight_series' => 5
);
$legend[] = array(
'title' => sprintf( __( '%s net sales in this period', 'woocommerce' ), '<strong>' . wc_price( $data->net_sales ) . '</strong>' ),
'placeholder' => __( 'This is the sum of the order totals after any refunds and excluding shipping and taxes.', 'woocommerce' ),
'color' => $this->chart_colours['net_sales_amount'],
'highlight_series' => 7
'highlight_series' => 6
);
if ( $data->average_sales > 0 ) {
$legend[] = array(
@ -379,12 +379,12 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
$legend[] = array(
'title' => sprintf( _nx( '%s refunded %d order', '%s refunded %d orders', $this->report_data->total_refunded_orders, '%s = amount of the refunds, %d = number of refunded orders.', 'woocommerce' ), '<strong>' . wc_price( $data->total_refunds ) . '</strong>', $this->report_data->total_refunded_orders ) . ' (' . sprintf( _n( '%d item', '%d items', $this->report_data->refunded_order_items, 'woocommerce' ), $this->report_data->refunded_order_items ) . ')',
'color' => $this->chart_colours['refund_amount'],
'highlight_series' => 4
'highlight_series' => 7
);
$legend[] = array(
'title' => sprintf( __( '%s charged for shipping', 'woocommerce' ), '<strong>' . wc_price( $data->total_shipping ) . '</strong>' ),
'color' => $this->chart_colours['shipping_amount'],
'highlight_series' => 5
'highlight_series' => 4
);
$legend[] = array(
'title' => sprintf( __( '%s worth of coupons used', 'woocommerce' ), '<strong>' . wc_price( $data->total_coupons ) . '</strong>' ),

View File

@ -322,7 +322,8 @@ if ( ! defined( 'ABSPATH' ) ) {
$active_plugins = (array) get_option( 'active_plugins', array() );
if ( is_multisite() ) {
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
$network_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
$active_plugins = array_merge( $active_plugins, $network_activated_plugins );
}
foreach ( $active_plugins as $plugin ) {

View File

@ -65,6 +65,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</label>
</div>
<?php if ( wc_tax_enabled() ) : ?>
<label>
<span class="title"><?php _e( 'Tax Status', 'woocommerce' ); ?></span>
<span class="input-text-wrap">
@ -108,6 +109,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</select>
</span>
</label>
<?php endif; ?>
<?php if ( wc_product_weight_enabled() ) : ?>
<div class="inline-edit-group">

View File

@ -45,6 +45,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<br class="clear" />
</div>
<?php if ( wc_tax_enabled() ) : ?>
<label class="alignleft">
<span class="title"><?php _e( 'Tax Status', 'woocommerce' ); ?></span>
<span class="input-text-wrap">
@ -87,6 +88,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</span>
</label>
<br class="clear" />
<?php endif; ?>
<?php if ( wc_product_weight_enabled() || wc_product_dimensions_enabled() ) : ?>
<div class="dimension_fields">

View File

@ -461,37 +461,20 @@ class WC_API_Customers extends WC_API_Resource {
* @since 2.1
* @param int $id the customer ID
* @param string $fields fields to include in response
* @param array $filter filters
* @return array
*/
public function get_customer_orders( $id, $fields = null ) {
global $wpdb;
public function get_customer_orders( $id, $fields = null, $filter = array() ) {
$id = $this->validate_request( $id, 'customer', 'read' );
if ( is_wp_error( $id ) ) {
return $id;
}
$order_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id
FROM $wpdb->posts AS posts
LEFT JOIN {$wpdb->postmeta} AS meta on posts.ID = meta.post_id
WHERE meta.meta_key = '_customer_user'
AND meta.meta_value = '%s'
AND posts.post_type = 'shop_order'
AND posts.post_status IN ( '" . implode( "','", array_keys( wc_get_order_statuses() ) ) . "' )
", $id ) );
$filter['customer_id'] = $id;
$orders = WC()->api->WC_API_Orders->get_orders( $fields, $filter, null, -1 );
if ( empty( $order_ids ) ) {
return array( 'orders' => array() );
}
$orders = array();
foreach ( $order_ids as $order_id ) {
$orders[] = current( WC()->api->WC_API_Orders->get_order( $order_id, $fields ) );
}
return array( 'orders' => apply_filters( 'woocommerce_api_customer_orders_response', $orders, $id, $fields, $order_ids, $this->server ) );
return $orders;
}
/**

View File

@ -711,13 +711,21 @@ class WC_API_Orders extends WC_API_Resource {
// add status argument
if ( ! empty( $args['status'] ) ) {
$statuses = 'wc-' . str_replace( ',', ',wc-', $args['status'] );
$statuses = explode( ',', $statuses );
$query_args['post_status'] = $statuses;
unset( $args['status'] );
}
if ( ! empty( $args['customer_id'] ) ) {
$query_args['meta_query'] = array(
array(
'key' => '_customer_user',
'value' => absint( $args['customer_id'] ),
'compare' => '='
)
);
}
$query_args = $this->merge_query_args( $query_args, $args );

View File

@ -664,6 +664,6 @@ class WC_Product_Variation extends WC_Product {
* @return string
*/
public function get_variation_description() {
return wpautop( wp_kses_post( get_post_meta( $this->variation_id, '_variation_description', true ) ) );
return wpautop( do_shortcode( wp_kses_post( get_post_meta( $this->variation_id, '_variation_description', true ) ) ) );
}
}

View File

@ -103,6 +103,7 @@ class WC_Gateway_Paypal_Request {
protected function get_phone_number_args( $order ) {
if ( in_array( $order->billing_country, array( 'US','CA' ) ) ) {
$phone_number = str_replace( array( '(', '-', ' ', ')', '.' ), '', $order->billing_phone );
$phone_number = ltrim( $phone_number, '+1' );
$phone_args = array(
'night_phone_a' => substr( $phone_number, 0, 3 ),
'night_phone_b' => substr( $phone_number, 3, 3 ),

View File

@ -1133,15 +1133,17 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
* Output product up sells.
*
* @param int $posts_per_page (default: -1)
* @param int $columns (default: 2)
* @param int $columns (default: 4)
* @param string $orderby (default: 'rand')
*/
function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 4, $orderby = 'rand' ) {
wc_get_template( 'single-product/up-sells.php', array(
$args = apply_filters( 'woocommerce_upsell_display_args', array(
'posts_per_page' => $posts_per_page,
'orderby' => apply_filters( 'woocommerce_upsells_orderby', $orderby ),
'columns' => $columns
) );
wc_get_template( 'single-product/up-sells.php', $args );
}
}