phpcs
This commit is contained in:
parent
2ff7c022f8
commit
0f3be9fce4
|
@ -2,9 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* Shows an order item
|
* Shows an order item
|
||||||
*
|
*
|
||||||
|
* @package WooCommerce/Admin
|
||||||
* @var object $item The item being displayed
|
* @var object $item The item being displayed
|
||||||
* @var int $item_id The id of the item being displayed
|
* @var int $item_id The id of the item being displayed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +33,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
||||||
echo esc_html( $item->get_variation_id() );
|
echo esc_html( $item->get_variation_id() );
|
||||||
} else {
|
} else {
|
||||||
/* translators: %s: variation id */
|
/* translators: %s: variation id */
|
||||||
printf( esc_html__( '%s (No longer exists)', 'woocommerce' ), $item->get_variation_id() );
|
printf( esc_html__( '%s (No longer exists)', 'woocommerce' ), esc_html( $item->get_variation_id() ) );
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
@ -49,7 +51,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
||||||
<td class="item_cost" width="1%" data-sort-value="<?php echo esc_attr( $order->get_item_subtotal( $item, false, true ) ); ?>">
|
<td class="item_cost" width="1%" data-sort-value="<?php echo esc_attr( $order->get_item_subtotal( $item, false, true ) ); ?>">
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<?php
|
<?php
|
||||||
echo wc_price( $order->get_item_total( $item, false, true ), array( 'currency' => $order->get_currency() ) );
|
echo wc_price( $order->get_item_total( $item, false, true ), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
|
||||||
if ( $item->get_subtotal() !== $item->get_total() ) {
|
if ( $item->get_subtotal() !== $item->get_total() ) {
|
||||||
echo '<span class="wc-order-item-discount">-' . wc_price( wc_format_decimal( $order->get_item_subtotal( $item, false, false ) - $order->get_item_total( $item, false, false ), '' ), array( 'currency' => $order->get_currency() ) ) . '</span>';
|
echo '<span class="wc-order-item-discount">-' . wc_price( wc_format_decimal( $order->get_item_subtotal( $item, false, false ) - $order->get_item_total( $item, false, false ), '' ), array( 'currency' => $order->get_currency() ) ) . '</span>';
|
||||||
|
@ -62,8 +64,10 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
||||||
<?php
|
<?php
|
||||||
echo '<small class="times">×</small> ' . esc_html( $item->get_quantity() );
|
echo '<small class="times">×</small> ' . esc_html( $item->get_quantity() );
|
||||||
|
|
||||||
if ( $refunded_qty = $order->get_qty_refunded_for_item( $item_id ) ) {
|
$refunded_qty = $order->get_qty_refunded_for_item( $item_id );
|
||||||
echo '<small class="refunded">-' . ( $refunded_qty * -1 ) . '</small>';
|
|
||||||
|
if ( $refunded_qty ) {
|
||||||
|
echo '<small class="refunded">-' . esc_html( $refunded_qty * -1 ) . '</small>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -77,7 +81,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
||||||
<td class="line_cost" width="1%" data-sort-value="<?php echo esc_attr( $item->get_total() ); ?>">
|
<td class="line_cost" width="1%" data-sort-value="<?php echo esc_attr( $item->get_total() ); ?>">
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<?php
|
<?php
|
||||||
echo wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) );
|
echo wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
|
||||||
if ( $item->get_subtotal() !== $item->get_total() ) {
|
if ( $item->get_subtotal() !== $item->get_total() ) {
|
||||||
echo '<span class="wc-order-item-discount">-' . wc_price( wc_format_decimal( $item->get_subtotal() - $item->get_total(), '' ), array( 'currency' => $order->get_currency() ) ) . '</span>';
|
echo '<span class="wc-order-item-discount">-' . wc_price( wc_format_decimal( $item->get_subtotal() - $item->get_total(), '' ), array( 'currency' => $order->get_currency() ) ) . '</span>';
|
||||||
|
@ -106,7 +110,9 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( ( $tax_data = $item->get_taxes() ) && wc_tax_enabled() ) {
|
$tax_data = wc_tax_enabled() ? $item->get_taxes() : false;
|
||||||
|
|
||||||
|
if ( $tax_data ) {
|
||||||
foreach ( $order_taxes as $tax_item ) {
|
foreach ( $order_taxes as $tax_item ) {
|
||||||
$tax_item_id = $tax_item->get_rate_id();
|
$tax_item_id = $tax_item->get_rate_id();
|
||||||
$tax_item_total = isset( $tax_data['total'][ $tax_item_id ] ) ? $tax_data['total'][ $tax_item_id ] : '';
|
$tax_item_total = isset( $tax_data['total'][ $tax_item_id ] ) ? $tax_data['total'][ $tax_item_id ] : '';
|
||||||
|
@ -116,7 +122,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<?php
|
<?php
|
||||||
if ( '' !== $tax_item_total ) {
|
if ( '' !== $tax_item_total ) {
|
||||||
echo wc_price( wc_round_tax_total( $tax_item_total ), array( 'currency' => $order->get_currency() ) );
|
echo wc_price( wc_round_tax_total( $tax_item_total ), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
} else {
|
} else {
|
||||||
echo '–';
|
echo '–';
|
||||||
}
|
}
|
||||||
|
@ -125,12 +131,14 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
||||||
if ( '' === $tax_item_total ) {
|
if ( '' === $tax_item_total ) {
|
||||||
echo '<span class="wc-order-item-discount">–</span>';
|
echo '<span class="wc-order-item-discount">–</span>';
|
||||||
} else {
|
} else {
|
||||||
echo '<span class="wc-order-item-discount">-' . wc_price( wc_round_tax_total( $tax_item_subtotal - $tax_item_total ), array( 'currency' => $order->get_currency() ) ) . '</span>';
|
echo '<span class="wc-order-item-discount">-' . wc_price( wc_round_tax_total( $tax_item_subtotal - $tax_item_total ), array( 'currency' => $order->get_currency() ) ) . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id ) ) {
|
$refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id );
|
||||||
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
|
||||||
|
if ( $refunded ) {
|
||||||
|
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue