diff --git a/includes/Admin/Orders/HPOS_List_Orders.php b/includes/Admin/Orders/HPOS_List_Orders.php index 84a97fb..2daba30 100644 --- a/includes/Admin/Orders/HPOS_List_Orders.php +++ b/includes/Admin/Orders/HPOS_List_Orders.php @@ -52,22 +52,22 @@ public function orders_custom_column_content( string $column_name, $order ): voi } } - public function query_args($args) { + public function query_args( $args ) { $pos_order_filter = $_GET['pos_order'] ?? ''; - if ($pos_order_filter) { - if ( ! isset($args['field_query'])) { + if ( $pos_order_filter ) { + if ( ! isset( $args['field_query'] ) ) { $args['field_query'] = array(); } - if ('yes' === $pos_order_filter) { + if ( 'yes' === $pos_order_filter ) { $args['field_query'][] = array( 'field' => 'created_via', 'value' => 'woocommerce-pos', ); } - if ('no' === $pos_order_filter) { + if ( 'no' === $pos_order_filter ) { $args['field_query'][] = array( 'field' => 'created_via', 'value' => 'woocommerce-pos', diff --git a/includes/Admin/Orders/Single_Order.php b/includes/Admin/Orders/Single_Order.php index 90f1053..6efa900 100644 --- a/includes/Admin/Orders/Single_Order.php +++ b/includes/Admin/Orders/Single_Order.php @@ -7,8 +7,8 @@ class Single_Order { public function __construct() { add_filter( 'wc_order_is_editable', array( $this, 'wc_order_is_editable' ), 10, 2 ); - add_action('woocommerce_admin_order_data_after_order_details', array( $this, 'add_cashier_select' ) ); - add_action('woocommerce_process_shop_order_meta', array( $this, 'save_cashier_select' ) ); + add_action( 'woocommerce_admin_order_data_after_order_details', array( $this, 'add_cashier_select' ) ); + add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_cashier_select' ) ); } /** @@ -32,22 +32,22 @@ public function wc_order_is_editable( bool $is_editable, WC_Order $order ): bool */ public function add_cashier_select( WC_Order $order ): void { // only show if order created by POS - if ( 'woocommerce-pos' !== $order->get_created_via()) { + if ( 'woocommerce-pos' !== $order->get_created_via() ) { return; } - - $cashier_id = $order->get_meta('_pos_user'); + + $cashier_id = $order->get_meta( '_pos_user' ); // Create nonce for security - wp_nonce_field('pos_cashier_select_action', 'pos_cashier_select_nonce'); + wp_nonce_field( 'pos_cashier_select_action', 'pos_cashier_select_nonce' ); echo '

'; echo ''; - echo ''; + if ( $cashier_id ) { + $user = get_user_by( 'id', $cashier_id ); + if ( $user ) { + echo ''; } } echo ''; @@ -61,19 +61,19 @@ public function add_cashier_select( WC_Order $order ): void { */ public function save_cashier_select( $post_id ): void { // Security checks - if ( ! isset($_POST['pos_cashier_select_nonce']) || ! wp_verify_nonce($_POST['pos_cashier_select_nonce'], 'pos_cashier_select_action')) { + if ( ! isset( $_POST['pos_cashier_select_nonce'] ) || ! wp_verify_nonce( $_POST['pos_cashier_select_nonce'], 'pos_cashier_select_action' ) ) { return; } /** * NOTE: HPOS adds a second arg for WC_Order, but we will make it backwards compatible. */ - $order = wc_get_order($post_id); + $order = wc_get_order( $post_id ); // Check if $order is instance of WC_Order and $_POST['_pos_user'] is set - if ( $order instanceof WC_Order && isset($_POST['_pos_user']) ) { - $new_pos_cashier = (int) sanitize_text_field($_POST['_pos_user']); - $current_pos_cashier = (int) $order->get_meta('_pos_user'); + if ( $order instanceof WC_Order && isset( $_POST['_pos_user'] ) ) { + $new_pos_cashier = (int) sanitize_text_field( $_POST['_pos_user'] ); + $current_pos_cashier = (int) $order->get_meta( '_pos_user' ); // Update meta only if _pos_user has changed if ( $current_pos_cashier !== $new_pos_cashier ) { @@ -85,9 +85,9 @@ public function save_cashier_select( $post_id ): void { $new_cashier = get_userdata( $new_pos_cashier ); $note = sprintf( // translators: 1: old POS cashier, 2: new POS cashier - __('POS cashier changed from %1$s to %2$s.', 'woocommerce-pos'), - $current_cashier ? $current_cashier->display_name : __('Unknown', 'woocommerce-pos'), - $new_cashier ? $new_cashier->display_name : __('Unknown', 'woocommerce-pos') + __( 'POS cashier changed from %1$s to %2$s.', 'woocommerce-pos' ), + $current_cashier ? $current_cashier->display_name : __( 'Unknown', 'woocommerce-pos' ), + $new_cashier ? $new_cashier->display_name : __( 'Unknown', 'woocommerce-pos' ) ); $order->add_order_note( $note ); } diff --git a/includes/Templates/Frontend.php b/includes/Templates/Frontend.php index 952c8d7..785c84c 100644 --- a/includes/Templates/Frontend.php +++ b/includes/Templates/Frontend.php @@ -86,7 +86,7 @@ public function head(): void { public function footer(): void { $development = isset( $_ENV['DEVELOPMENT'] ) && $_ENV['DEVELOPMENT']; $user = wp_get_current_user(); - $github_url = 'https://cdn.jsdelivr.net/gh/wcpos/web-bundle@1.4/'; + $github_url = 'https://cdn.jsdelivr.net/gh/wcpos/web-bundle@latest/'; $auth_service = Auth::instance(); $stores = array_map( function ( $store ) { @@ -181,7 +181,7 @@ function getScript(source, callback) { .then((response) => response.json()) .then((data) => { var bundle = data.fileMetadata.web.bundle; - var bundleUrl = '{$github_url}' + '/' + bundle; + var bundleUrl = '{$github_url}' + bundle; getScript(bundleUrl, () => { console.log('done') }); }); " . "\n"; diff --git a/package.json b/package.json index 98d44cc..d0ea916 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wcpos/woocommerce-pos", - "version": "1.4.6", + "version": "1.4.7", "description": "A simple front-end for taking WooCommerce orders at the Point of Sale.", "main": "index.js", "workspaces": { diff --git a/readme.txt b/readme.txt index 19c3e8a..21a162e 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: kilbot Tags: cart, e-commerce, ecommerce, inventory, point-of-sale, pos, sales, sell, shop, shopify, store, vend, woocommerce, wordpress-ecommerce Requires at least: 5.6 & WooCommerce 5.3 Tested up to: 6.4 -Stable tag: 1.4.6 +Stable tag: 1.4.7 License: GPL-3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -63,6 +63,11 @@ There is more information on our website at [https://wcpos.com](https://wcpos.co == Changelog == += 1.4.7 - 2024/01/18 = +* Bump: web application to version 1.4.1 +* Fix: scroll-to-top issue when scrolling data tables +* Fix: variations not loading after first 10 + = 1.4.6 - 2024/01/16 = * Fix: decimal quantity for orders * Fix: load translation files diff --git a/woocommerce-pos.php b/woocommerce-pos.php index 0a1daca..c78cfa4 100644 --- a/woocommerce-pos.php +++ b/woocommerce-pos.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce POS * Plugin URI: https://wordpress.org/plugins/woocommerce-pos/ * Description: A simple front-end for taking WooCommerce orders at the Point of Sale. Requires WooCommerce. - * Version: 1.4.6 + * Version: 1.4.7 * Author: kilbot * Author URI: http://wcpos.com * Text Domain: woocommerce-pos @@ -22,7 +22,7 @@ namespace WCPOS\WooCommercePOS; // Define plugin constants. -const VERSION = '1.4.6'; +const VERSION = '1.4.7'; const PLUGIN_NAME = 'woocommerce-pos'; const SHORT_NAME = 'wcpos'; \define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php'