Changeset 2972698
- Timestamp:
- 09/28/2023 03:35:18 PM (2 years ago)
- Location:
- taxjar-simplified-taxes-for-woocommerce/trunk
- Files:
-
- 6 edited
-
CHANGELOG.md (modified) (1 diff)
-
composer.json (modified) (2 diffs)
-
includes/class-wc-taxjar-integration.php (modified) (2 diffs)
-
includes/class-wc-taxjar-transaction-sync.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
taxjar-woocommerce.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
taxjar-simplified-taxes-for-woocommerce/trunk/CHANGELOG.md
r2797935 r2972698 1 # 4.2.0 (2023-09-27) 2 * WooCommerce tested up to 7.8.0 3 * Updates needed for HPOS compliance 4 * Flag as HPOS-enabled 5 1 6 # 4.1.5 (2022-10-11) 2 7 * WooCommerce tested up to 7.0.0 -
taxjar-simplified-taxes-for-woocommerce/trunk/composer.json
r2593377 r2972698 11 11 "squizlabs/php_codesniffer": "3.6.0", 12 12 "wp-coding-standards/wpcs": "2.3.0", 13 "phpunit/phpunit": "7.5.20" 13 "phpunit/phpunit": "^9", 14 "yoast/phpunit-polyfills": "^2.0" 14 15 }, 15 16 "scripts": { … … 20 21 "\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs" 21 22 ] 23 }, 24 "config": { 25 "allow-plugins": { 26 "composer/installers": true 27 } 22 28 } 23 29 } -
taxjar-simplified-taxes-for-woocommerce/trunk/includes/class-wc-taxjar-integration.php
r2702220 r2972698 7 7 * @author TaxJar 8 8 */ 9 10 use Automattic\WooCommerce\Utilities\OrderUtil; 9 11 10 12 if ( ! class_exists( 'WC_Taxjar_Integration' ) ) : … … 201 203 global $pagenow; 202 204 if ( 'post.php' === $pagenow ) { 203 $post = get_post( $_GET['post'] ); 204 if ( $this->is_order_post_type( $post->post_type ) ) { 205 if ( $this->is_order_post_type( OrderUtil::get_order_type($_GET['post']) ) ) { 205 206 return true; 206 207 } -
taxjar-simplified-taxes-for-woocommerce/trunk/includes/class-wc-taxjar-transaction-sync.php
r2679432 r2972698 10 10 } 11 11 12 use Automattic\WooCommerce\Utilities\OrderUtil; 13 12 14 class WC_Taxjar_Transaction_Sync { 13 15 … … 309 311 } 310 312 311 $ post_type = get_post_type( $id );312 if ( 'shop_order' != $ post_type ) {313 $order_type = OrderUtil::get_order_type( $id );; 314 if ( 'shop_order' != $order_type ) { 313 315 return; 314 316 } … … 345 347 */ 346 348 public function maybe_delete_transaction_from_taxjar( $post_id ) { 347 if ( 'shop_order' != get_post_type( $post_id ) ) {349 if ( 'shop_order' != OrderUtil::get_order_type( $post_id ) ) { 348 350 return; 349 351 } … … 390 392 */ 391 393 public function maybe_delete_refund_from_taxjar( $post_id ) { 392 if ( 'shop_order_refund' != get_post_type( $post_id ) ) {394 if ( 'shop_order_refund' != OrderUtil::get_order_type( $post_id ) ) { 393 395 return; 394 396 } … … 597 599 $should_validate_completed_date = WC_Taxjar_Transaction_Sync::should_validate_order_completed_date(); 598 600 599 if ( $force ) { 600 $query = "SELECT p.id FROM {$wpdb->posts} AS p "; 601 602 if ( $should_validate_completed_date ) { 603 $query .= "INNER JOIN {$wpdb->postmeta} AS order_meta_completed_date ON ( p.id = order_meta_completed_date.post_id ) AND ( order_meta_completed_date.meta_key = '_completed_date' ) "; 604 } 605 606 $query .= "WHERE p.post_type = 'shop_order' AND p.post_status IN {$post_status_string} AND p.post_date >= '{$start_date}' AND p.post_date < '{$end_date}' "; 607 608 if ( $should_validate_completed_date ) { 609 $query .= "AND order_meta_completed_date.meta_value IS NOT NULL AND order_meta_completed_date.meta_value != '' "; 610 } 611 612 $query .= "ORDER BY p.post_date ASC"; 601 if ( OrderUtil::custom_orders_table_usage_is_enabled() ) { 602 // HPOS usage is enabled. 603 if ( $force ) { 604 $query = "SELECT o.id FROM {$wpdb->wc_orders} AS o "; 605 606 if ( $should_validate_completed_date ) { 607 $query .= "INNER JOIN {$wpdb->wc_orders_meta} AS order_meta_completed_date ON ( o.id = order_meta_completed_date.order_id ) AND ( order_meta_completed_date.meta_key = '_completed_date' ) "; 608 } 609 610 $query .= "WHERE o.type = 'shop_order' AND o.status IN {$post_status_string} AND o.date_created_gmt >= '{$start_date}' AND o.date_created_gmt < '{$end_date}' "; 611 612 if ( $should_validate_completed_date ) { 613 $query .= "AND order_meta_completed_date.meta_value IS NOT NULL AND order_meta_completed_date.meta_value != '' "; 614 } 615 616 $query .= "ORDER BY o.date_created_gmt ASC"; 617 } else { 618 $query = "SELECT o.id FROM {$wpdb->wc_orders} AS o "; 619 620 if ( $should_validate_completed_date ) { 621 $query .= "INNER JOIN {$wpdb->wc_orders_meta} AS order_meta_completed_date ON ( o.id = order_meta_completed_date.order_id ) AND ( order_meta_completed_date.meta_key = '_completed_date' ) "; 622 } 623 624 $query .= "LEFT JOIN {$wpdb->wc_order_meta} AS order_meta_last_sync ON ( o.id = order_meta_last_sync.order_id ) AND ( order_meta_last_sync.meta_key = '_taxjar_last_sync' ) "; 625 $query .= "WHERE o.type = 'shop_order' AND o.status IN {$post_status_string} AND o.date_created_gmt >= '{$start_date}' AND o.date_created_gmt < '{$end_date}' "; 626 627 if ( $should_validate_completed_date ) { 628 $query .= "AND order_meta_completed_date.meta_value IS NOT NULL AND order_meta_completed_date.meta_value != '' "; 629 } 630 631 $query .= "AND ((order_meta_last_sync.meta_value IS NULL) OR (o.date_updated_gmt > order_meta_last_sync.meta_value)) ORDER BY o.date_created_gmt ASC"; 632 } 613 633 } else { 614 $query = "SELECT p.id FROM {$wpdb->posts} AS p "; 615 616 if ( $should_validate_completed_date ) { 617 $query .= "INNER JOIN {$wpdb->postmeta} AS order_meta_completed_date ON ( p.id = order_meta_completed_date.post_id ) AND ( order_meta_completed_date.meta_key = '_completed_date' ) "; 618 } 619 620 $query .= "LEFT JOIN {$wpdb->postmeta} AS order_meta_last_sync ON ( p.id = order_meta_last_sync.post_id ) AND ( order_meta_last_sync.meta_key = '_taxjar_last_sync' ) "; 621 $query .= "WHERE p.post_type = 'shop_order' AND p.post_status IN {$post_status_string} AND p.post_date >= '{$start_date}' AND p.post_date < '{$end_date}' "; 622 623 if ( $should_validate_completed_date ) { 624 $query .= "AND order_meta_completed_date.meta_value IS NOT NULL AND order_meta_completed_date.meta_value != '' "; 625 } 626 627 $query .= "AND ((order_meta_last_sync.meta_value IS NULL) OR (p.post_modified_gmt > order_meta_last_sync.meta_value)) ORDER BY p.post_date ASC"; 634 // Traditional CPT-based orders are in use. 635 if ( $force ) { 636 $query = "SELECT p.id FROM {$wpdb->posts} AS p "; 637 638 if ( $should_validate_completed_date ) { 639 $query .= "INNER JOIN {$wpdb->postmeta} AS order_meta_completed_date ON ( p.id = order_meta_completed_date.post_id ) AND ( order_meta_completed_date.meta_key = '_completed_date' ) "; 640 } 641 642 $query .= "WHERE p.post_type = 'shop_order' AND p.post_status IN {$post_status_string} AND p.post_date >= '{$start_date}' AND p.post_date < '{$end_date}' "; 643 644 if ( $should_validate_completed_date ) { 645 $query .= "AND order_meta_completed_date.meta_value IS NOT NULL AND order_meta_completed_date.meta_value != '' "; 646 } 647 648 $query .= "ORDER BY p.post_date ASC"; 649 } else { 650 $query = "SELECT p.id FROM {$wpdb->posts} AS p "; 651 652 if ( $should_validate_completed_date ) { 653 $query .= "INNER JOIN {$wpdb->postmeta} AS order_meta_completed_date ON ( p.id = order_meta_completed_date.post_id ) AND ( order_meta_completed_date.meta_key = '_completed_date' ) "; 654 } 655 656 $query .= "LEFT JOIN {$wpdb->postmeta} AS order_meta_last_sync ON ( p.id = order_meta_last_sync.post_id ) AND ( order_meta_last_sync.meta_key = '_taxjar_last_sync' ) "; 657 $query .= "WHERE p.post_type = 'shop_order' AND p.post_status IN {$post_status_string} AND p.post_date >= '{$start_date}' AND p.post_date < '{$end_date}' "; 658 659 if ( $should_validate_completed_date ) { 660 $query .= "AND order_meta_completed_date.meta_value IS NOT NULL AND order_meta_completed_date.meta_value != '' "; 661 } 662 663 $query .= "AND ((order_meta_last_sync.meta_value IS NULL) OR (p.post_modified_gmt > order_meta_last_sync.meta_value)) ORDER BY p.post_date ASC"; 664 } 628 665 } 629 666 … … 650 687 $order_ids_string = implode( ',', $order_ids ); 651 688 652 $posts = $wpdb->get_results( 653 " 689 if ( OrderUtil::custom_orders_table_usage_is_enabled() ) { 690 // HPOS usage is enabled. 691 $posts = $wpdb->get_results( 692 " 693 SELECT o.id 694 FROM {$wpdb->wc_orders} AS o 695 WHERE o.type = 'shop_order_refund' 696 AND o.status = 'wc-completed' 697 AND o.parent IN ( {$order_ids_string} ) 698 ORDER BY o.date_created_gmt ASC 699 ", ARRAY_N 700 ); 701 } else { 702 // Traditional CPT-based orders are in use. 703 $posts = $wpdb->get_results( 704 " 654 705 SELECT p.id 655 706 FROM {$wpdb->posts} AS p … … 659 710 ORDER BY p.post_date ASC 660 711 ", ARRAY_N 661 ); 712 ); 713 } 662 714 663 715 if ( empty( $posts ) ) { -
taxjar-simplified-taxes-for-woocommerce/trunk/readme.txt
r2797935 r2972698 4 4 Requires at least: 5.4 5 5 Tested up to: 6.0.2 6 Stable tag: 4. 1.56 Stable tag: 4.2.0 7 7 License: GPLv2 or later 8 8 URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 WC requires at least: 6.4.0 10 WC tested up to: 7. 0.010 WC tested up to: 7.8.0 11 11 12 12 Trusted by more than 20,000 businesses, TaxJar’s award-winning solution makes it easy to automate sales tax reporting and filing, and determine economic nexus with a single click. … … 95 95 96 96 == Changelog == 97 98 = 4.2.0 (2023-09-27) 99 * WooCommerce tested up to 7.8.0 100 * Updates needed for HPOS compliance 101 * Flag as HPOS-enabled 97 102 98 103 = 4.1.5 (2022-10-11) -
taxjar-simplified-taxes-for-woocommerce/trunk/taxjar-woocommerce.php
r2797935 r2972698 4 4 * Plugin URI: https://www.taxjar.com/woocommerce-sales-tax-plugin/ 5 5 * Description: Save hours every month by putting your sales tax on autopilot. Automated, multi-state sales tax calculation, collection, and filing. 6 * Version: 4. 1.56 * Version: 4.2.0 7 7 * Author: TaxJar 8 8 * Author URI: https://www.taxjar.com 9 9 * WC requires at least: 6.4.0 10 * WC tested up to: 7. 0.010 * WC tested up to: 7.8.0 11 11 * Requires PHP: 7.0 12 12 * … … 44 44 final class WC_Taxjar { 45 45 46 static $version = '4. 1.5';46 static $version = '4.2.0'; 47 47 public static $minimum_woocommerce_version = '6.4.0'; 48 48 … … 52 52 public function __construct() { 53 53 add_action( 'plugins_loaded', array( $this, 'init' ) ); 54 add_action( 'before_woocommerce_init', function() { 55 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 56 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 57 } 58 } ); 54 59 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_settings_link' ) ); 55 60 register_activation_hook( __FILE__, array( 'WC_Taxjar', 'plugin_registration_hook' ) );
Note: See TracChangeset
for help on using the changeset viewer.