From 2b8be95360e01f2cee0eab85077b13ae535cd05b Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 24 Oct 2014 14:53:40 +0100 Subject: [PATCH 1/2] Remove # (hash) from get_order_number and add to strings instead as needed. Most places use Order #X Some places use Order Number: X Both are now valid. Fixes #6518 --- includes/abstracts/abstract-wc-order.php | 2 +- includes/admin/class-wc-admin-post-types.php | 2 +- .../meta-boxes/class-wc-meta-box-order-data.php | 2 +- .../reports/class-wc-report-customer-list.php | 2 +- includes/class-wc-emails.php | 2 +- .../gateways/mijireh/class-wc-gateway-mijireh.php | 2 +- .../gateways/paypal/class-wc-gateway-paypal.php | 14 +++++++------- .../class-wc-addons-gateway-simplify-commerce.php | 4 ++-- .../class-wc-gateway-simplify-commerce.php | 2 +- .../shortcodes/class-wc-shortcode-checkout.php | 4 ++-- templates/checkout/thankyou.php | 4 ++-- templates/emails/admin-new-order.php | 2 +- templates/emails/customer-completed-order.php | 2 +- templates/emails/customer-invoice.php | 2 +- templates/emails/customer-note.php | 2 +- templates/emails/customer-processing-order.php | 2 +- templates/myaccount/my-orders.php | 4 ++-- templates/myaccount/view-order.php | 2 +- templates/order/tracking.php | 2 +- 19 files changed, 29 insertions(+), 29 deletions(-) diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php index 0b86b448f8b..26f1dfe0fa2 100644 --- a/includes/abstracts/abstract-wc-order.php +++ b/includes/abstracts/abstract-wc-order.php @@ -882,7 +882,7 @@ abstract class WC_Abstract_Order { * @return string */ public function get_order_number() { - return apply_filters( 'woocommerce_order_number', _x( '#', 'hash before order number', 'woocommerce' ) . $this->id, $this ); + return apply_filters( 'woocommerce_order_number', $this->id, $this ); } /** diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index b158bee1f03..62fa2156246 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -588,7 +588,7 @@ class WC_Admin_Post_Types { } } - printf( __( '%s by %s', 'woocommerce' ), '' . esc_attr( $the_order->get_order_number() ) . '', $username ); + printf( _x( '%s by %s', 'Order number by X', 'woocommerce' ), '#' . esc_attr( $the_order->get_order_number() ) . '', $username ); if ( $the_order->billing_email ) { echo '' . esc_html( $the_order->billing_email ) . ''; diff --git a/includes/admin/meta-boxes/class-wc-meta-box-order-data.php b/includes/admin/meta-boxes/class-wc-meta-box-order-data.php index d4d94fa450c..d1b57e31afe 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-order-data.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-order-data.php @@ -157,7 +157,7 @@ class WC_Meta_Box_Order_Data {
-

get_order_number() ) ); ?>

+

get_order_number() ) ); ?>

id . '&action=edit' ) . '">' . $order->get_order_number() . ' – ' . date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); + echo '#' . $order->get_order_number() . ' – ' . date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); } else echo '-'; break; diff --git a/includes/class-wc-emails.php b/includes/class-wc-emails.php index 7305892d32b..4ed4e837c9c 100644 --- a/includes/class-wc-emails.php +++ b/includes/class-wc-emails.php @@ -357,7 +357,7 @@ class WC_Emails { } $subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product Backorder', 'woocommerce' ) ); - $message = sprintf( __( '%s units of %s have been backordered in order %s.', 'woocommerce' ), $quantity, html_entity_decode( strip_tags( $product->get_formatted_name() ) ), $order->get_order_number() ); + $message = sprintf( __( '%s units of %s have been backordered in order #%s.', 'woocommerce' ), $quantity, html_entity_decode( strip_tags( $product->get_formatted_name() ) ), $order->get_order_number() ); wp_mail( apply_filters( 'woocommerce_email_recipient_backorder', get_option( 'woocommerce_stock_email_recipient' ), $args ), diff --git a/includes/gateways/mijireh/class-wc-gateway-mijireh.php b/includes/gateways/mijireh/class-wc-gateway-mijireh.php index c843d33de64..bc130f9f376 100644 --- a/includes/gateways/mijireh/class-wc-gateway-mijireh.php +++ b/includes/gateways/mijireh/class-wc-gateway-mijireh.php @@ -180,7 +180,7 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway { } } - $mj_order->add_item( sprintf( __( 'Order %s' , 'woocommerce'), $wc_order->get_order_number() ) . " - " . implode( ', ', $item_names ), number_format( $wc_order->get_total() - round( $wc_order->get_total_shipping() + $wc_order->get_shipping_tax(), 2 ) + $wc_order->get_order_discount(), 2, '.', '' ), 1 ); + $mj_order->add_item( sprintf( __( 'Order #%s' , 'woocommerce'), $wc_order->get_order_number() ) . " - " . implode( ', ', $item_names ), number_format( $wc_order->get_total() - round( $wc_order->get_total_shipping() + $wc_order->get_shipping_tax(), 2 ) + $wc_order->get_order_discount(), 2, '.', '' ), 1 ); if ( ( $wc_order->get_total_shipping() + $wc_order->get_shipping_tax() ) > 0 ) { $mj_order->shipping = number_format( $wc_order->get_total_shipping() + $wc_order->get_shipping_tax(), 2, '.', '' ); diff --git a/includes/gateways/paypal/class-wc-gateway-paypal.php b/includes/gateways/paypal/class-wc-gateway-paypal.php index 77b8d9ea3c3..5e9088e4107 100644 --- a/includes/gateways/paypal/class-wc-gateway-paypal.php +++ b/includes/gateways/paypal/class-wc-gateway-paypal.php @@ -358,7 +358,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway { $order_id = $order->id; if ( 'yes' == $this->debug ) { - $this->log->add( 'paypal', 'Generating payment form for order ' . $order->get_order_number() . '. Notify URL: ' . $this->notify_url ); + $this->log->add( 'paypal', 'Generating payment form for order #' . $order->get_order_number() . '. Notify URL: ' . $this->notify_url ); } if ( in_array( $order->billing_country, array( 'US','CA' ) ) ) { @@ -395,7 +395,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway { 'bn' => 'WooThemes_Cart', // Order key + ID - 'invoice' => $this->invoice_prefix . ltrim( $order->get_order_number(), '#' ), + 'invoice' => $this->invoice_prefix . $order->get_order_number(), 'custom' => serialize( array( $order_id, $order->order_key ) ), // IPN @@ -451,7 +451,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway { } } - $paypal_args['item_name_1'] = $this->paypal_item_name( sprintf( __( 'Order %s' , 'woocommerce'), $order->get_order_number() ) . " - " . implode( ', ', $item_names ) ); + $paypal_args['item_name_1'] = $this->paypal_item_name( sprintf( __( 'Order #%s' , 'woocommerce'), $order->get_order_number() ) . " - " . implode( ', ', $item_names ) ); $paypal_args['quantity_1'] = '1'; $paypal_args['amount_1'] = number_format( $order->get_total() - round( $order->get_total_shipping() + $order->get_shipping_tax(), 2 ) + $order->get_order_discount(), 2, '.', '' ); @@ -861,7 +861,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway { $order->update_status( 'refunded', sprintf( __( 'Payment %s via IPN.', 'woocommerce' ), strtolower( $posted['payment_status'] ) ) ); $this->send_ipn_email_notification( - sprintf( __( 'Payment for order %s refunded/reversed', 'woocommerce' ), $order->get_order_number() ), + sprintf( __( 'Payment for order #%s refunded/reversed', 'woocommerce' ), $order->get_order_number() ), sprintf( __( 'Order %s has been marked as refunded - PayPal reason code: %s', 'woocommerce' ), $order->get_order_number(), $posted['reason_code'] ) ); } @@ -873,15 +873,15 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway { $order->update_status( 'on-hold', sprintf( __( 'Payment %s via IPN.', 'woocommerce' ), strtolower( $posted['payment_status'] ) ) ); $this->send_ipn_email_notification( - sprintf( __( 'Payment for order %s reversed', 'woocommerce' ), $order->get_order_number() ), + sprintf( __( 'Payment for order #%s reversed', 'woocommerce' ), $order->get_order_number() ), sprintf(__( 'Order %s has been marked on-hold due to a reversal - PayPal reason code: %s', 'woocommerce' ), $order->get_order_number(), $posted['reason_code'] ) ); break; case 'canceled_reversal' : $this->send_ipn_email_notification( - sprintf( __( 'Reversal cancelled for order %s', 'woocommerce' ), $order->get_order_number() ), - sprintf( __( 'Order %s has had a reversal cancelled. Please check the status of payment and update the order status accordingly.', 'woocommerce' ), $order->get_order_number() ) + sprintf( __( 'Reversal cancelled for order #%s', 'woocommerce' ), $order->get_order_number() ), + sprintf( __( 'Order #%s has had a reversal cancelled. Please check the status of payment and update the order status accordingly.', 'woocommerce' ), $order->get_order_number() ) ); break; default : diff --git a/includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php b/includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php index 08ca846f789..4016daa6672 100644 --- a/includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php +++ b/includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php @@ -223,7 +223,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce { public function process_subscription_payment( $order = '', $amount = 0 ) { $order_items = $order->get_items(); $order_item = array_shift( $order_items ); - $subscription_name = sprintf( __( '%s - Subscription for "%s"', 'woocommerce' ), esc_html( get_bloginfo( 'name' ) ), $order_item['name'] ) . ' ' . sprintf( __( '(Order %s)', 'woocommerce' ), $order->get_order_number() ); + $subscription_name = sprintf( __( '%s - Subscription for "%s"', 'woocommerce' ), esc_html( get_bloginfo( 'name' ) ), $order_item['name'] ) . ' ' . sprintf( __( '(Order #%s)', 'woocommerce' ), $order->get_order_number() ); if ( $amount * 100 < 50 ) { return new WP_Error( 'simplify_error', __( 'Sorry, the minimum allowed order total is 0.50 to use this payment method.', 'woocommerce' ) ); @@ -326,7 +326,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce { try { $order_items = $order->get_items(); $order_item = array_shift( $order_items ); - $pre_order_name = sprintf( __( '%s - Pre-order for "%s"', 'woocommerce' ), esc_html( get_bloginfo( 'name' ) ), $order_item['name'] ) . ' ' . sprintf( __( '(Order %s)', 'woocommerce' ), $order->get_order_number() ); + $pre_order_name = sprintf( __( '%s - Pre-order for "%s"', 'woocommerce' ), esc_html( get_bloginfo( 'name' ) ), $order_item['name'] ) . ' ' . sprintf( __( '(Order #%s)', 'woocommerce' ), $order->get_order_number() ); $customer_id = get_post_meta( $order->id, '_simplify_customer_id', true ); diff --git a/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php b/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php index 0c184548688..4cf49ce8565 100644 --- a/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php +++ b/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php @@ -287,7 +287,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway { $payment = Simplify_Payment::createPayment( array( 'amount' => $order->order_total * 100, // In cents 'token' => $token, - 'description' => sprintf( __( '%s - Order %s', 'woocommerce' ), esc_html( get_bloginfo( 'name' ) ), $order->get_order_number() ), + 'description' => sprintf( __( '%s - Order #%s', 'woocommerce' ), esc_html( get_bloginfo( 'name' ) ), $order->get_order_number() ), 'currency' => strtoupper( get_woocommerce_currency() ), 'reference' => $order->id, 'card.addressCity' => $order->billing_city, diff --git a/includes/shortcodes/class-wc-shortcode-checkout.php b/includes/shortcodes/class-wc-shortcode-checkout.php index 9ddf090ded0..948cb646778 100644 --- a/includes/shortcodes/class-wc-shortcode-checkout.php +++ b/includes/shortcodes/class-wc-shortcode-checkout.php @@ -128,7 +128,7 @@ class WC_Shortcode_Checkout { ?>