Plugin Directory

Changeset 2972698


Ignore:
Timestamp:
09/28/2023 03:35:18 PM (2 years ago)
Author:
taxjar
Message:

Preparing for 4.2.0 release

Location:
taxjar-simplified-taxes-for-woocommerce/trunk
Files:
6 edited

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
    16# 4.1.5 (2022-10-11)
    27* WooCommerce tested up to 7.0.0
  • taxjar-simplified-taxes-for-woocommerce/trunk/composer.json

    r2593377 r2972698  
    1111    "squizlabs/php_codesniffer": "3.6.0",
    1212    "wp-coding-standards/wpcs": "2.3.0",
    13     "phpunit/phpunit": "7.5.20"
     13    "phpunit/phpunit": "^9",
     14        "yoast/phpunit-polyfills": "^2.0"
    1415  },
    1516  "scripts": {
     
    2021      "\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
    2122    ]
     23  },
     24  "config": {
     25    "allow-plugins": {
     26      "composer/installers": true
     27    }
    2228  }
    2329}
  • taxjar-simplified-taxes-for-woocommerce/trunk/includes/class-wc-taxjar-integration.php

    r2702220 r2972698  
    77 * @author   TaxJar
    88 */
     9
     10use Automattic\WooCommerce\Utilities\OrderUtil;
    911
    1012if ( ! class_exists( 'WC_Taxjar_Integration' ) ) :
     
    201203            global $pagenow;
    202204            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']) ) ) {
    205206                    return true;
    206207                }
  • taxjar-simplified-taxes-for-woocommerce/trunk/includes/class-wc-taxjar-transaction-sync.php

    r2679432 r2972698  
    1010}
    1111
     12use Automattic\WooCommerce\Utilities\OrderUtil;
     13
    1214class WC_Taxjar_Transaction_Sync {
    1315
     
    309311        }
    310312
    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 ) {
    313315            return;
    314316        }
     
    345347     */
    346348    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 ) ) {
    348350            return;
    349351        }
     
    390392     */
    391393    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 ) ) {
    393395            return;
    394396        }
     
    597599        $should_validate_completed_date = WC_Taxjar_Transaction_Sync::should_validate_order_completed_date();
    598600
    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            }
    613633        } 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            }
    628665        }
    629666
     
    650687        $order_ids_string = implode( ',', $order_ids );
    651688
    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                "
    654705            SELECT p.id
    655706            FROM {$wpdb->posts} AS p
     
    659710            ORDER BY p.post_date ASC
    660711            ", ARRAY_N
    661         );
     712            );
     713        }
    662714
    663715        if ( empty( $posts ) ) {
  • taxjar-simplified-taxes-for-woocommerce/trunk/readme.txt

    r2797935 r2972698  
    44Requires at least: 5.4
    55Tested up to: 6.0.2
    6 Stable tag: 4.1.5
     6Stable tag: 4.2.0
    77License: GPLv2 or later
    88URI: http://www.gnu.org/licenses/gpl-2.0.html
    99WC requires at least: 6.4.0
    10 WC tested up to: 7.0.0
     10WC tested up to: 7.8.0
    1111
    1212Trusted 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.
     
    9595
    9696== 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
    97102
    98103= 4.1.5 (2022-10-11)
  • taxjar-simplified-taxes-for-woocommerce/trunk/taxjar-woocommerce.php

    r2797935 r2972698  
    44 * Plugin URI: https://www.taxjar.com/woocommerce-sales-tax-plugin/
    55 * 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.5
     6 * Version: 4.2.0
    77 * Author: TaxJar
    88 * Author URI: https://www.taxjar.com
    99 * WC requires at least: 6.4.0
    10  * WC tested up to: 7.0.0
     10 * WC tested up to: 7.8.0
    1111 * Requires PHP: 7.0
    1212 *
     
    4444final class WC_Taxjar {
    4545
    46     static $version = '4.1.5';
     46    static $version = '4.2.0';
    4747    public static $minimum_woocommerce_version = '6.4.0';
    4848
     
    5252    public function __construct() {
    5353        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        } );
    5459        add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_settings_link' ) );
    5560        register_activation_hook( __FILE__, array( 'WC_Taxjar', 'plugin_registration_hook' ) );
Note: See TracChangeset for help on using the changeset viewer.