Some minor improvements in the custom orders table implmentation.

This commit is contained in:
Nestor Soriano 2022-03-16 11:00:41 +01:00
parent 746d6a99b1
commit 71cc725bb5
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
3 changed files with 17 additions and 19 deletions

View File

@ -275,7 +275,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
break; break;
case 'info': case 'info':
echo '<tr><th scope="row" class="titledesc"/><td style="' . esc_html( $value['css'] ) . '">'; echo '<tr><th scope="row" class="titledesc"/><td style="' . esc_attr( $value['css'] ) . '">';
echo wp_kses_post( wpautop( wptexturize( $value['text'] ) ) ); echo wp_kses_post( wpautop( wptexturize( $value['text'] ) ) );
echo '</td></tr>'; echo '</td></tr>';
break; break;
@ -443,7 +443,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
name="<?php echo esc_attr( $value['id'] ); ?>" name="<?php echo esc_attr( $value['id'] ); ?>"
value="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $key ); ?>"
type="radio" type="radio"
<?php if(in_array($key, $disabled_values)) { echo 'disabled'; } ?> <?php if( in_array( $key, $disabled_values ) ) { echo 'disabled'; } ?>
style="<?php echo esc_attr( $value['css'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>" class="<?php echo esc_attr( $value['class'] ); ?>"
<?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?> <?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?>

View File

@ -322,19 +322,19 @@ class CustomOrdersTableController {
if ( $sync_is_pending ) { if ( $sync_is_pending ) {
$initial_pending_count = $sync_status['initial_pending_count']; $initial_pending_count = $sync_status['initial_pending_count'];
$current_pending_count = $sync_status['current_pending_count'];
if ( $initial_pending_count ) { if ( $initial_pending_count ) {
$text = sprintf( $text =
sprintf(
/* translators: %1$s=current number of orders pending sync, %2$s=initial number of orders pending sync */ /* translators: %1$s=current number of orders pending sync, %2$s=initial number of orders pending sync */
__( 'There are %1$s orders (out of a total of %2$s) pending sync!', 'woocommerce' ), _n( 'There\'s %1$s order (out of a total of %2$s) pending sync!', 'There are %1$s orders (out of a total of %2$s) pending sync!', $current_pending_count, 'woocommerce' ),
$sync_status['current_pending_count'], $current_pending_count,
$initial_pending_count $initial_pending_count
); );
} else { } else {
$text = sprintf( $text =
/* translators: %1$s=current number of orders pending sync */ /* translators: %s=initial number of orders pending sync */
__( 'There are %1$s orders pending sync!', 'woocommerce' ), sprintf( _n( 'There\'s %s order pending sync!', 'There are %s orders pending sync!', $current_pending_count, 'woocommerce' ), $current_pending_count, 'woocommerce' );
$sync_status['current_pending_count']
);
} }
if ( $this->data_synchronizer->pending_data_sync_is_in_progress() ) { if ( $this->data_synchronizer->pending_data_sync_is_in_progress() ) {

View File

@ -159,12 +159,10 @@ class DataSynchronizer {
$missing_orders_count_sql = "SELECT COUNT(1) FROM $orders_table WHERE post_id IS NULL"; $missing_orders_count_sql = "SELECT COUNT(1) FROM $orders_table WHERE post_id IS NULL";
} else { } else {
$missing_orders_count_sql = " $missing_orders_count_sql = "
SELECT COUNT(1) FROM ( SELECT COUNT( posts.ID ) FROM $wpdb->posts posts
SELECT posts.ID,orders.post_id FROM $wpdb->posts posts LEFT JOIN $orders_table orders ON posts.ID = orders.post_id
LEFT JOIN $orders_table orders ON posts.ID = orders.post_id WHERE posts.post_type='shop_order' AND orders.post_id IS NULL
WHERE posts.post_type='shop_order' AND orders.post_id IS NULL AND posts.post_status != 'auto-draft'";
AND posts.post_status != 'auto-draft'
) x";
} }
$sql = " $sql = "