phpcs sniff fixes for class-wc-report-orders-by-date.php
This commit is contained in:
parent
b774968c81
commit
aa9961695f
|
@ -1,16 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* WC_Report_Sales_By_Date
|
||||||
|
*
|
||||||
|
* @package WooCommerce/Admin/Reports
|
||||||
|
* @version 2.1.0
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit; // Exit if accessed directly
|
exit; // Exit if accessed directly.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WC_Report_Sales_By_Date
|
* WC_Report_Sales_By_Date
|
||||||
*
|
|
||||||
* @author WooThemes
|
|
||||||
* @category Admin
|
|
||||||
* @package WooCommerce/Admin/Reports
|
|
||||||
* @version 2.1.0
|
|
||||||
*/
|
*/
|
||||||
class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// All items from orders - even those refunded
|
// All items from orders - even those refunded.
|
||||||
$this->report_data->order_items = (array) $this->get_order_report_data(
|
$this->report_data->order_items = (array) $this->get_order_report_data(
|
||||||
array(
|
array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
|
@ -412,11 +413,11 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
$this->report_data->total_sales = wc_format_decimal( array_sum( wp_list_pluck( $this->report_data->orders, 'total_sales' ) ) - $this->report_data->total_refunds, 2 );
|
$this->report_data->total_sales = wc_format_decimal( array_sum( wp_list_pluck( $this->report_data->orders, 'total_sales' ) ) - $this->report_data->total_refunds, 2 );
|
||||||
$this->report_data->net_sales = wc_format_decimal( $this->report_data->total_sales - $this->report_data->total_shipping - max( 0, $this->report_data->total_tax ) - max( 0, $this->report_data->total_shipping_tax ), 2 );
|
$this->report_data->net_sales = wc_format_decimal( $this->report_data->total_sales - $this->report_data->total_shipping - max( 0, $this->report_data->total_tax ) - max( 0, $this->report_data->total_shipping_tax ), 2 );
|
||||||
|
|
||||||
// Calculate average based on net
|
// Calculate average based on net.
|
||||||
$this->report_data->average_sales = wc_format_decimal( $this->report_data->net_sales / ( $this->chart_interval + 1 ), 2 );
|
$this->report_data->average_sales = wc_format_decimal( $this->report_data->net_sales / ( $this->chart_interval + 1 ), 2 );
|
||||||
$this->report_data->average_total_sales = wc_format_decimal( $this->report_data->total_sales / ( $this->chart_interval + 1 ), 2 );
|
$this->report_data->average_total_sales = wc_format_decimal( $this->report_data->total_sales / ( $this->chart_interval + 1 ), 2 );
|
||||||
|
|
||||||
// Total orders and discounts also includes those which have been refunded at some point
|
// Total orders and discounts also includes those which have been refunded at some point.
|
||||||
$this->report_data->total_coupons = number_format( array_sum( wp_list_pluck( $this->report_data->coupons, 'discount_amount' ) ), 2, '.', '' );
|
$this->report_data->total_coupons = number_format( array_sum( wp_list_pluck( $this->report_data->coupons, 'discount_amount' ) ), 2, '.', '' );
|
||||||
$this->report_data->total_refunded_orders = absint( count( $this->report_data->full_refunds ) );
|
$this->report_data->total_refunded_orders = absint( count( $this->report_data->full_refunds ) );
|
||||||
|
|
||||||
|
@ -441,26 +442,26 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
|
|
||||||
switch ( $this->chart_groupby ) {
|
switch ( $this->chart_groupby ) {
|
||||||
case 'day':
|
case 'day':
|
||||||
/* translators: %s: average total sales */
|
|
||||||
$average_total_sales_title = sprintf(
|
$average_total_sales_title = sprintf(
|
||||||
|
/* translators: %s: average total sales */
|
||||||
__( '%s average gross daily sales', 'woocommerce' ),
|
__( '%s average gross daily sales', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->average_total_sales ) . '</strong>'
|
'<strong>' . wc_price( $data->average_total_sales ) . '</strong>'
|
||||||
);
|
);
|
||||||
/* translators: %s: average sales */
|
|
||||||
$average_sales_title = sprintf(
|
$average_sales_title = sprintf(
|
||||||
|
/* translators: %s: average sales */
|
||||||
__( '%s average net daily sales', 'woocommerce' ),
|
__( '%s average net daily sales', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->average_sales ) . '</strong>'
|
'<strong>' . wc_price( $data->average_sales ) . '</strong>'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
default:
|
default:
|
||||||
/* translators: %s: average total sales */
|
|
||||||
$average_total_sales_title = sprintf(
|
$average_total_sales_title = sprintf(
|
||||||
|
/* translators: %s: average total sales */
|
||||||
__( '%s average gross monthly sales', 'woocommerce' ),
|
__( '%s average gross monthly sales', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->average_total_sales ) . '</strong>'
|
'<strong>' . wc_price( $data->average_total_sales ) . '</strong>'
|
||||||
);
|
);
|
||||||
/* translators: %s: average sales */
|
|
||||||
$average_sales_title = sprintf(
|
$average_sales_title = sprintf(
|
||||||
|
/* translators: %s: average sales */
|
||||||
__( '%s average net monthly sales', 'woocommerce' ),
|
__( '%s average net monthly sales', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->average_sales ) . '</strong>'
|
'<strong>' . wc_price( $data->average_sales ) . '</strong>'
|
||||||
);
|
);
|
||||||
|
@ -468,8 +469,8 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
/* translators: %s: total sales */
|
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
|
/* translators: %s: total sales */
|
||||||
__( '%s gross sales in this period', 'woocommerce' ),
|
__( '%s gross sales in this period', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->total_sales ) . '</strong>'
|
'<strong>' . wc_price( $data->total_sales ) . '</strong>'
|
||||||
),
|
),
|
||||||
|
@ -486,8 +487,8 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
/* translators: %s: net sales */
|
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
|
/* translators: %s: net sales */
|
||||||
__( '%s net sales in this period', 'woocommerce' ),
|
__( '%s net sales in this period', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->net_sales ) . '</strong>'
|
'<strong>' . wc_price( $data->net_sales ) . '</strong>'
|
||||||
),
|
),
|
||||||
|
@ -504,8 +505,8 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
/* translators: %s: total orders */
|
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
|
/* translators: %s: total orders */
|
||||||
__( '%s orders placed', 'woocommerce' ),
|
__( '%s orders placed', 'woocommerce' ),
|
||||||
'<strong>' . $data->total_orders . '</strong>'
|
'<strong>' . $data->total_orders . '</strong>'
|
||||||
),
|
),
|
||||||
|
@ -514,8 +515,8 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
);
|
);
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
/* translators: %s: total items */
|
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
|
/* translators: %s: total items */
|
||||||
__( '%s items purchased', 'woocommerce' ),
|
__( '%s items purchased', 'woocommerce' ),
|
||||||
'<strong>' . $data->total_items . '</strong>'
|
'<strong>' . $data->total_items . '</strong>'
|
||||||
),
|
),
|
||||||
|
@ -523,8 +524,8 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
'highlight_series' => 0,
|
'highlight_series' => 0,
|
||||||
);
|
);
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
/* translators: 1: total refunds 2: total refunded orders 3: refunded items */
|
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
|
/* translators: 1: total refunds 2: total refunded orders 3: refunded items */
|
||||||
_n( '%1$s refunded %2$d order (%3$d item)', '%1$s refunded %2$d orders (%3$d items)', $this->report_data->total_refunded_orders, 'woocommerce' ),
|
_n( '%1$s refunded %2$d order (%3$d item)', '%1$s refunded %2$d orders (%3$d items)', $this->report_data->total_refunded_orders, 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->total_refunds ) . '</strong>',
|
'<strong>' . wc_price( $data->total_refunds ) . '</strong>',
|
||||||
$this->report_data->total_refunded_orders,
|
$this->report_data->total_refunded_orders,
|
||||||
|
@ -534,8 +535,8 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
'highlight_series' => 8,
|
'highlight_series' => 8,
|
||||||
);
|
);
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
/* translators: %s: total shipping */
|
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
|
/* translators: %s: total shipping */
|
||||||
__( '%s charged for shipping', 'woocommerce' ),
|
__( '%s charged for shipping', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->total_shipping ) . '</strong>'
|
'<strong>' . wc_price( $data->total_shipping ) . '</strong>'
|
||||||
),
|
),
|
||||||
|
@ -543,8 +544,8 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
'highlight_series' => 5,
|
'highlight_series' => 5,
|
||||||
);
|
);
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
/* translators: %s: total coupons */
|
|
||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
|
/* translators: %s: total coupons */
|
||||||
__( '%s worth of coupons used', 'woocommerce' ),
|
__( '%s worth of coupons used', 'woocommerce' ),
|
||||||
'<strong>' . wc_price( $data->total_coupons ) . '</strong>'
|
'<strong>' . wc_price( $data->total_coupons ) . '</strong>'
|
||||||
),
|
),
|
||||||
|
@ -578,9 +579,9 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
'refund_amount' => '#e74c3c',
|
'refund_amount' => '#e74c3c',
|
||||||
);
|
);
|
||||||
|
|
||||||
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
|
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day'; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.NoNonceVerification
|
||||||
|
|
||||||
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
|
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ), true ) ) {
|
||||||
$current_range = '7day';
|
$current_range = '7day';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,18 +595,18 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
* Output an export link.
|
* Output an export link.
|
||||||
*/
|
*/
|
||||||
public function get_export_button() {
|
public function get_export_button() {
|
||||||
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
|
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day'; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.NoNonceVerification
|
||||||
?>
|
?>
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); ?>.csv"
|
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo esc_attr( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) ); ?>.csv"
|
||||||
class="export_csv"
|
class="export_csv"
|
||||||
data-export="chart"
|
data-export="chart"
|
||||||
data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>"
|
data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>"
|
||||||
data-exclude_series="2"
|
data-exclude_series="2"
|
||||||
data-groupby="<?php echo $this->chart_groupby; ?>"
|
data-groupby="<?php echo esc_attr( $this->chart_groupby ); ?>"
|
||||||
>
|
>
|
||||||
<?php _e( 'Export CSV', 'woocommerce' ); ?>
|
<?php esc_html_e( 'Export CSV', 'woocommerce' ); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -613,7 +614,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
/**
|
/**
|
||||||
* Round our totals correctly.
|
* Round our totals correctly.
|
||||||
*
|
*
|
||||||
* @param array|string $amount
|
* @param array|string $amount Chart total.
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
|
@ -631,7 +632,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
public function get_main_chart() {
|
public function get_main_chart() {
|
||||||
global $wp_locale;
|
global $wp_locale;
|
||||||
|
|
||||||
// Prepare data for report
|
// Prepare data for report.
|
||||||
$data = array(
|
$data = array(
|
||||||
'order_counts' => $this->prepare_chart_data( $this->report_data->order_counts, 'post_date', 'count', $this->chart_interval, $this->start_date, $this->chart_groupby ),
|
'order_counts' => $this->prepare_chart_data( $this->report_data->order_counts, 'post_date', 'count', $this->chart_interval, $this->start_date, $this->chart_groupby ),
|
||||||
'order_item_counts' => $this->prepare_chart_data( $this->report_data->order_items, 'post_date', 'order_item_count', $this->chart_interval, $this->start_date, $this->chart_groupby ),
|
'order_item_counts' => $this->prepare_chart_data( $this->report_data->order_items, 'post_date', 'order_item_count', $this->chart_interval, $this->start_date, $this->chart_groupby ),
|
||||||
|
@ -650,7 +651,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
$data['gross_order_amounts'][ $order_amount_key ][1] -= $data['refund_amounts'][ $order_amount_key ][1];
|
$data['gross_order_amounts'][ $order_amount_key ][1] -= $data['refund_amounts'][ $order_amount_key ][1];
|
||||||
|
|
||||||
$data['net_order_amounts'][ $order_amount_key ] = $order_amount_value;
|
$data['net_order_amounts'][ $order_amount_key ] = $order_amount_value;
|
||||||
// subtract the sum of the values from net order amounts
|
// Subtract the sum of the values from net order amounts.
|
||||||
$data['net_order_amounts'][ $order_amount_key ][1] -=
|
$data['net_order_amounts'][ $order_amount_key ][1] -=
|
||||||
$data['refund_amounts'][ $order_amount_key ][1] +
|
$data['refund_amounts'][ $order_amount_key ][1] +
|
||||||
$data['shipping_amounts'][ $order_amount_key ][1] +
|
$data['shipping_amounts'][ $order_amount_key ][1] +
|
||||||
|
@ -658,11 +659,11 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
$data['tax_amounts'][ $order_amount_key ][1];
|
$data['tax_amounts'][ $order_amount_key ][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3rd party filtering of report data
|
// 3rd party filtering of report data.
|
||||||
$data = apply_filters( 'woocommerce_admin_report_chart_data', $data );
|
$data = apply_filters( 'woocommerce_admin_report_chart_data', $data );
|
||||||
|
|
||||||
// Encode in json format
|
// Encode in json format.
|
||||||
$chart_data = json_encode(
|
$chart_data = wp_json_encode(
|
||||||
array(
|
array(
|
||||||
'order_counts' => array_values( $data['order_counts'] ),
|
'order_counts' => array_values( $data['order_counts'] ),
|
||||||
'order_item_counts' => array_values( $data['order_item_counts'] ),
|
'order_item_counts' => array_values( $data['order_item_counts'] ),
|
||||||
|
@ -683,30 +684,30 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
var main_chart;
|
var main_chart;
|
||||||
|
|
||||||
jQuery(function(){
|
jQuery(function(){
|
||||||
var order_data = jQuery.parseJSON( '<?php echo $chart_data; ?>' );
|
var order_data = jQuery.parseJSON( '<?php echo $chart_data; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>' );
|
||||||
var drawGraph = function( highlight ) {
|
var drawGraph = function( highlight ) {
|
||||||
var series = [
|
var series = [
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Number of items sold', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Number of items sold', 'woocommerce' ) ); ?>",
|
||||||
data: order_data.order_item_counts,
|
data: order_data.order_item_counts,
|
||||||
color: '<?php echo $this->chart_colours['item_count']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['item_count'] ); ?>',
|
||||||
bars: { fillColor: '<?php echo $this->chart_colours['item_count']; ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo $this->barwidth; ?> * 0.5, align: 'center' },
|
bars: { fillColor: '<?php echo esc_js( $this->chart_colours['item_count'] ); ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo esc_js( $this->barwidth ); ?> * 0.5, align: 'center' },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
hoverable: false
|
hoverable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Number of orders', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Number of orders', 'woocommerce' ) ); ?>",
|
||||||
data: order_data.order_counts,
|
data: order_data.order_counts,
|
||||||
color: '<?php echo $this->chart_colours['order_count']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['order_count'] ); ?>',
|
||||||
bars: { fillColor: '<?php echo $this->chart_colours['order_count']; ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo $this->barwidth; ?> * 0.5, align: 'center' },
|
bars: { fillColor: '<?php echo esc_js( $this->chart_colours['order_count'] ); ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo esc_js( $this->barwidth ); ?> * 0.5, align: 'center' },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
hoverable: false
|
hoverable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Average gross sales amount', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Average gross sales amount', 'woocommerce' ) ); ?>",
|
||||||
data: [ [ <?php echo min( array_keys( $data['order_amounts'] ) ); ?>, <?php echo $this->report_data->average_total_sales; ?> ], [ <?php echo max( array_keys( $data['order_amounts'] ) ); ?>, <?php echo $this->report_data->average_total_sales; ?> ] ],
|
data: [ [ <?php echo esc_js( min( array_keys( $data['order_amounts'] ) ) ); ?>, <?php echo esc_js( $this->report_data->average_total_sales ); ?> ], [ <?php echo esc_js( max( array_keys( $data['order_amounts'] ) ) ); ?>, <?php echo esc_js( $this->report_data->average_total_sales ); ?> ] ],
|
||||||
yaxis: 2,
|
yaxis: 2,
|
||||||
color: '<?php echo $this->chart_colours['average']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['average'] ); ?>',
|
||||||
points: { show: false },
|
points: { show: false },
|
||||||
lines: { show: true, lineWidth: 2, fill: false },
|
lines: { show: true, lineWidth: 2, fill: false },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
|
@ -714,9 +715,9 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Average net sales amount', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Average net sales amount', 'woocommerce' ) ); ?>",
|
||||||
data: [ [ <?php echo min( array_keys( $data['order_amounts'] ) ); ?>, <?php echo $this->report_data->average_sales; ?> ], [ <?php echo max( array_keys( $data['order_amounts'] ) ); ?>, <?php echo $this->report_data->average_sales; ?> ] ],
|
data: [ [ <?php echo esc_js( min( array_keys( $data['order_amounts'] ) ) ); ?>, <?php echo esc_js( $this->report_data->average_sales ); ?> ], [ <?php echo esc_js( max( array_keys( $data['order_amounts'] ) ) ); ?>, <?php echo esc_js( $this->report_data->average_sales ); ?> ] ],
|
||||||
yaxis: 2,
|
yaxis: 2,
|
||||||
color: '<?php echo $this->chart_colours['net_average']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['net_average'] ); ?>',
|
||||||
points: { show: false },
|
points: { show: false },
|
||||||
lines: { show: true, lineWidth: 2, fill: false },
|
lines: { show: true, lineWidth: 2, fill: false },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
|
@ -726,51 +727,51 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
label: "<?php echo esc_js( __( 'Coupon amount', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Coupon amount', 'woocommerce' ) ); ?>",
|
||||||
data: order_data.coupon_amounts,
|
data: order_data.coupon_amounts,
|
||||||
yaxis: 2,
|
yaxis: 2,
|
||||||
color: '<?php echo $this->chart_colours['coupon_amount']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['coupon_amount'] ); ?>',
|
||||||
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
||||||
lines: { show: true, lineWidth: 2, fill: false },
|
lines: { show: true, lineWidth: 2, fill: false },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
<?php echo $this->get_currency_tooltip(); ?>
|
<?php echo $this->get_currency_tooltip(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Shipping amount', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Shipping amount', 'woocommerce' ) ); ?>",
|
||||||
data: order_data.shipping_amounts,
|
data: order_data.shipping_amounts,
|
||||||
yaxis: 2,
|
yaxis: 2,
|
||||||
color: '<?php echo $this->chart_colours['shipping_amount']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['shipping_amount'] ); ?>',
|
||||||
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
||||||
lines: { show: true, lineWidth: 2, fill: false },
|
lines: { show: true, lineWidth: 2, fill: false },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); ?>"
|
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Gross sales amount', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Gross sales amount', 'woocommerce' ) ); ?>",
|
||||||
data: order_data.gross_order_amounts,
|
data: order_data.gross_order_amounts,
|
||||||
yaxis: 2,
|
yaxis: 2,
|
||||||
color: '<?php echo $this->chart_colours['sales_amount']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['sales_amount'] ); ?>',
|
||||||
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
||||||
lines: { show: true, lineWidth: 2, fill: false },
|
lines: { show: true, lineWidth: 2, fill: false },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
<?php echo $this->get_currency_tooltip(); ?>
|
<?php echo $this->get_currency_tooltip(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Net sales amount', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Net sales amount', 'woocommerce' ) ); ?>",
|
||||||
data: order_data.net_order_amounts,
|
data: order_data.net_order_amounts,
|
||||||
yaxis: 2,
|
yaxis: 2,
|
||||||
color: '<?php echo $this->chart_colours['net_sales_amount']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['net_sales_amount'] ); ?>',
|
||||||
points: { show: true, radius: 6, lineWidth: 4, fillColor: '#fff', fill: true },
|
points: { show: true, radius: 6, lineWidth: 4, fillColor: '#fff', fill: true },
|
||||||
lines: { show: true, lineWidth: 5, fill: false },
|
lines: { show: true, lineWidth: 5, fill: false },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
<?php echo $this->get_currency_tooltip(); ?>
|
<?php echo $this->get_currency_tooltip(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "<?php echo esc_js( __( 'Refund amount', 'woocommerce' ) ); ?>",
|
label: "<?php echo esc_js( __( 'Refund amount', 'woocommerce' ) ); ?>",
|
||||||
data: order_data.refund_amounts,
|
data: order_data.refund_amounts,
|
||||||
yaxis: 2,
|
yaxis: 2,
|
||||||
color: '<?php echo $this->chart_colours['refund_amount']; ?>',
|
color: '<?php echo esc_js( $this->chart_colours['refund_amount'] ); ?>',
|
||||||
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
||||||
lines: { show: true, lineWidth: 2, fill: false },
|
lines: { show: true, lineWidth: 2, fill: false },
|
||||||
shadowSize: 0,
|
shadowSize: 0,
|
||||||
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); ?>"
|
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>"
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -807,9 +808,9 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
tickColor: 'transparent',
|
tickColor: 'transparent',
|
||||||
mode: "time",
|
mode: "time",
|
||||||
timeformat: "<?php echo ( 'day' === $this->chart_groupby ) ? '%d %b' : '%b'; ?>",
|
timeformat: "<?php echo ( 'day' === $this->chart_groupby ) ? '%d %b' : '%b'; ?>",
|
||||||
monthNames: <?php echo json_encode( array_values( $wp_locale->month_abbrev ) ); ?>,
|
monthNames: <?php echo wp_json_encode( array_values( $wp_locale->month_abbrev ) ); ?>,
|
||||||
tickLength: 1,
|
tickLength: 1,
|
||||||
minTickSize: [1, "<?php echo $this->chart_groupby; ?>"],
|
minTickSize: [1, "<?php echo esc_js( $this->chart_groupby ); ?>"],
|
||||||
font: {
|
font: {
|
||||||
color: "#aaa"
|
color: "#aaa"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue