Plugin Directory

Changeset 3339144


Ignore:
Timestamp:
08/04/2025 04:34:49 PM (5 months ago)
Author:
DavidAnderson
Message:

1.35.5

Location:
woocommerce-eu-vat-compliance
Files:
4 added
2 deleted
12 edited
49 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-eu-vat-compliance/tags/1.35.5/bootstrap.php

    r3277213 r3339144  
    101101
    102102        // Update customer vat location on updating address on block checkout.
    103         add_action('woocommerce_store_api_cart_update_customer_from_request', array($this, 'update_customer_vat_location'), 10, 2);
     103        add_action('woocommerce_store_api_cart_update_customer_from_request', array($this, 'update_customer_vat_location'));
    104104    }
    105105   
     
    243243
    244244    /**
    245      * Update customer vat location for update tax
     245     * Update customer VAT location for update tax
    246246     *
    247247     * @param WC_Customer     $customer Customer object.
    248      * @param WP_REST_Request $request Request object.
    249      */
    250     public function update_customer_vat_location(\WC_Customer $customer, \WP_REST_Request $request) {
     248     */
     249    public function update_customer_vat_location(\WC_Customer $customer) {
     250       
    251251        $validation_util = new Automattic\WooCommerce\StoreApi\Utilities\ValidationUtils();
    252252        $vat_controller = WooCommerce_EU_VAT_Compliance('WC_EU_VAT_Compliance_VAT_Number');
     
    261261         * This resets the state to an empty string if it doesn't match the country.
    262262         */
    263         if ( !$validation_util->validate_state( $billing_state, $billing_country ) ) {
     263        if (!$validation_util->validate_state($billing_state, $billing_country)) {
    264264            $billing_state = '';
    265265        }
     
    310310        if (!empty($vat_number) && $vat_controller) {
    311311            $check_result = $vat_controller->check_vat_number_validity($country, $vat_number, false, true);
    312 
    313             if (empty($check_result['vat_number_accepted'])) {
    314                 $vat_number = null;
    315 
    316                 // Remove vat number if it's not valid vat number.
    317                 $this->wc->session->set('vat_number', null);
    318             }
     312        }
     313        if (!isset($check_result) || empty($check_result['vat_number_accepted'])) {
     314            $vat_number = null;
     315            // Do not store invalid VAT numbers in the session
     316            $this->wc->session->set('vat_number', null);
    319317        }
    320318
     
    16441642   
    16451643    /**
     1644     * See if the designated checkout page uses the checkout shortcode.
     1645     * N.B. Theoretically the designated checkout page might not actually be the one the site uses; a custom checkout may be in use, etc.
     1646     *
     1647     * @return Boolean
     1648     */
     1649    public function checkout_page_uses_shortcode() {
     1650       
     1651        $checkout_id = wc_get_page_id('checkout');
     1652       
     1653        // No checkout page found
     1654        if ($checkout_id <= 0) return false;
     1655       
     1656        $content = get_post_field('post_content', $checkout_id);
     1657       
     1658        return has_shortcode($content, 'woocommerce_checkout');
     1659    }
     1660   
     1661    /**
     1662     * See if the designated cart page uses the cart shortcode.
     1663     * N.B. Theoretically the designated cart page might not actually be the one the site uses; a custom cart may be in use, etc.
     1664     *
     1665     * @return Boolean
     1666     */
     1667    public function cart_page_uses_shortcode() {
     1668       
     1669        $cart_id = wc_get_page_id('cart');
     1670       
     1671        // No cart page found
     1672        if ($cart_id <= 0) return false;
     1673       
     1674        $content = get_post_field('post_content', $cart_id);
     1675       
     1676        return has_shortcode($content, 'woocommerce_cart');
     1677    }
     1678   
     1679    /**
    16461680     * Rename the "Valid EU VAT Number" field to "Valid VAT Number"
    16471681     */
  • woocommerce-eu-vat-compliance/tags/1.35.5/control-centre.php

    r3188577 r3339144  
    165165            if (empty($_POST['settings']) || !is_string($_POST['settings'])) die;
    166166
    167             parse_str($_POST['settings'], $posted_settings);
     167            parse_str(stripslashes($_POST['settings']), $posted_settings);
    168168           
    169169            $posted_settings = stripslashes_deep($posted_settings);
     
    318318                'content' => $contents
    319319            ));
     320        } elseif ('load_readiness_tab' === $_POST['subaction']) {
     321            ob_start();
     322            $this->render_tab_readiness_table();
     323            $contents = @ob_get_contents();
     324            @ob_end_clean();
     325           
     326            echo json_encode(array(
     327                'result' => 'ok',
     328                'content' => $contents
     329            ));
     330           
    320331        } elseif ('export_settings' == $_POST['subaction']) {
    321332       
    322             $plugin_version = WooCommerce_EU_VAT_Compliance()->get_version();
     333            $compliance = WooCommerce_EU_VAT_Compliance();
     334           
     335            $plugin_version = $compliance->get_version();
    323336
    324337            include(ABSPATH.WPINC.'/version.php');
     
    333346            }
    334347           
    335             $options['woocommerce_default_country'] = WC()->countries->get_base_country();
     348            $options['woocommerce_base_country'] = WC()->countries->get_base_country();
    336349           
    337350            $results = array(
     
    339352                'versions' => array(
    340353                    'wc' => defined('WOOCOMMERCE_VERSION') ? WOOCOMMERCE_VERSION : '?',
    341                     'wc_eu_vat_compliance' => '?',
     354                    'wc_vat_compliance' => '?',
    342355                    'wp' => $wp_version
     356                ),
     357                'features' => array(
     358                    'hpos_enabled' => $compliance->woocommerce_custom_order_tables_enabled(),
     359                    'checkout_page_using_shortcode' => $compliance->checkout_page_uses_shortcode(),
     360                    'cart_page_using_shortcode' => $compliance->cart_page_uses_shortcode(),
    343361                ),
    344362            );
     
    483501        ));
    484502
    485         $active_tab = !empty($_REQUEST['tab']) ? $_REQUEST['tab'] : 'settings';
     503        $active_tab = empty($_REQUEST['tab']) ? 'settings' : stripslashes($_REQUEST['tab']);
    486504        if ('taxes' == $active_tab || !empty($_GET['range'])) $active_tab = 'reports';
    487505
     
    525543        foreach ($tabs as $slug => $title) {
    526544            ?>
    527                 <a class="nav-tab <?php if($slug == $active_tab) echo 'nav-tab-active'; ?>" href="#wceuvat-navtab-<?php echo $slug;?>-content" id="wceuvat-navtab-<?php echo $slug;?>"><?php echo $title;?></a>
     545                <a class="nav-tab <?php if ($slug == $active_tab) echo 'nav-tab-active'; ?>" href="#wceuvat-navtab-<?php echo esc_attr($slug);?>-content" id="wceuvat-navtab-<?php echo esc_attr($slug);?>"><?php echo esc_html($title);?></a>
    528546            <?php
    529547        }
     
    532550
    533551        foreach ($tabs as $slug => $title) {
    534             echo "<div class=\"wceuvat-navtab-content\" id=\"wceuvat-navtab-".$slug."-content\"";
     552            echo "<div class=\"wceuvat-navtab-content\" id=\"wceuvat-navtab-".esc_attr($slug)."-content\"";
    535553            if ($slug != $active_tab) echo ' style="display:none;"';
    536554            echo ">";
     
    14501468        echo '<p>'.esc_html__("N.B. If you are not selling goods for which the \"place of supply\" is deemed to be the customer's location (rather than the seller's; e.g. electronically supplied goods), then the tests for the presence of up-to-date VAT per-country rates are not relevant and you should not use them.", 'woocommerce-eu-vat-compliance').'</p>';
    14511469
     1470        // This is populated via AJAX so that the tests don't have to be done upon each settings page load
     1471        echo '<div id="wcvat_readiness_results_table_container"></div>';
     1472   
     1473        // N.B. This is duplicated in render_tab_readiness(); keep them in sync.
     1474        $opts = get_option('wceuvat_background_tests');
     1475        $email = empty($opts['email']) ? '' : (string) $opts['email'];
     1476       
     1477        $default_bottom_blurb = '<p><a href="https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/">'.esc_html__('To automatically run these tests daily, and notify yourself of any failed tests by email, use our Premium version.', 'woocommerce-eu-vat-compliance').'</a></p>';
     1478        $bottom_blurb = apply_filters('wceuvat_readinesstests_bottom_section', $default_bottom_blurb, $email);
     1479       
     1480        echo $bottom_blurb;
     1481
     1482        echo '</div>';
     1483
     1484    }
     1485
     1486    /**
     1487     * Output the readiness test result table
     1488     */
     1489    private function render_tab_readiness_table() {
    14521490        if (!class_exists('WC_EU_VAT_Compliance_Readiness_Tests')) require_once(WC_VAT_COMPLIANCE_DIR.'/readiness-tests.php');
    14531491        $test = new WC_EU_VAT_Compliance_Readiness_Tests();
    14541492        $results = $test->get_results();
    1455 
     1493       
    14561494        $result_descriptions = $test->result_descriptions();
    1457 
     1495       
    14581496        ?>
    14591497        <table>
    14601498        <thead>
    1461             <tr>
    1462                 <th></th>
    1463                 <th style="text-align:left; min-width: 140px;"><?php _e('Test', 'woocommerce-eu-vat-compliance');?></th>
    1464                 <th style="text-align:left; min-width:60px;"><?php _e('Result', 'woocommerce-eu-vat-compliance');?></th>
    1465                 <th style="text-align:left;"><?php _e('Futher information', 'woocommerce-eu-vat-compliance');?></th>
    1466             </tr>
     1499        <tr>
     1500        <th></th>
     1501        <th style="text-align:left; min-width: 140px;"><?php _e('Test', 'woocommerce-eu-vat-compliance');?></th>
     1502        <th style="text-align:left; min-width:60px;"><?php _e('Result', 'woocommerce-eu-vat-compliance');?></th>
     1503        <th style="text-align:left;"><?php _e('Futher information', 'woocommerce-eu-vat-compliance');?></th>
     1504        </tr>
    14671505        </thead>
    14681506        <tbody>
    14691507        <?php
    1470 
     1508       
     1509        // N.B. This is duplicated in render_tab_readiness(); keep them in sync.
    14711510        $opts = get_option('wceuvat_background_tests');
    1472         $email = empty($opts['email']) ? '' : (string)$opts['email'];
    1473 
     1511        $email = empty($opts['email']) ? '' : (string) $opts['email'];
    14741512        $default_bottom_blurb = '<p><a href="https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/">'.esc_html__('To automatically run these tests daily, and notify yourself of any failed tests by email, use our Premium version.', 'woocommerce-eu-vat-compliance').'</a></p>';
    14751513        $bottom_blurb = apply_filters('wceuvat_readinesstests_bottom_section', $default_bottom_blurb, $email);
    14761514        $premium_present = ($bottom_blurb == $default_bottom_blurb) ? false : true;
    1477 
     1515       
    14781516        foreach ($results as $id => $res) {
    14791517            if (!is_array($res)) continue;
     
    14941532            }
    14951533            $row_bg = 'color:'.$col;
    1496 
     1534           
    14971535            $checked = (is_array($opts) && empty($opts['tests'][$id])) ? false : true;
    1498 
     1536           
    14991537            ?>
    1500 
    1501             <tr style="<?php echo $row_bg;?>">
    1502                 <td style="vertical-align:top;"><?php
    1503                 if ($premium_present) { ?>
    1504                     <input type="checkbox" id="wceuvat_test_<?php echo esc_attr($id);?>" name="wceuvat_test_<?php echo esc_attr($id);?>" value="1" <?php if ($checked) echo 'checked="checked"'; ?>>
     1538           
     1539            <tr style="<?php echo esc_attr($row_bg);?>">
     1540            <td style="vertical-align:top;"><?php
     1541            if ($premium_present) { ?>
     1542                <input type="checkbox" id="wceuvat_test_<?php echo esc_attr($id);?>" name="wceuvat_test_<?php echo esc_attr($id);?>" value="1" <?php if ($checked) echo 'checked="checked"'; ?>>
    15051543                <?php } ?>
    15061544                </td>
     
    15081546                <td style="vertical-align:top;"><?php echo $result_descriptions[$res['result']];?></td>
    15091547                <td style="vertical-align:top;"><?php echo $res['info'];?></td>
    1510             </tr>
    1511             <?php
    1512         }
    1513 
     1548                </tr>
     1549                <?php
     1550        }
     1551       
    15141552        ?>
    15151553        </tbody>
    15161554        </table>
     1555       
    15171556        <?php
    1518 
    1519         echo $bottom_blurb;
    1520 
    1521         echo '</div>';
    1522 
    1523     }
    1524 
     1557    }
     1558   
    15251559    /**
    15261560     * Called by the WP action admin_footer when on our settings page
     
    15321566        $nonce = wp_create_nonce("wc_eu_vat_nonce");
    15331567        $response = esc_js(__('Response:', 'woocommerce-eu-vat-compliance'));
    1534         $loading = esc_js(__('Loading...', 'woocommerce-eu-vat-compliance'));
     1568        $loading = esc_js(__('Running readiness tests...', 'woocommerce-eu-vat-compliance'));
    15351569        $error = esc_js(__('Error', 'woocommerce-eu-vat-compliance'));
    15361570
     
    16691703                        $('#wceuvat-navtab-'+id.substring(15)+'-content').show();
    16701704                        // This is not yet ready
    1671 //                      $('#wceuvat_tabs').trigger('show_'+id.substring(15));
     1705                        $('#wceuvat_tabs').trigger('show_'+id.substring(15));
    16721706                    }
    16731707                    return false;
    16741708                });
    16751709               
    1676                 var content_loaded = false;
    1677                 $('#wceuvat_tabs').on('show_reports', function() {
    1678                     if (content_loaded) return;
    1679                     content_loaded = true;
    1680                     $('#wceuvat-navtab-reports-content').html('$loading');
     1710                var readiness_content_loaded = false;
     1711               
     1712                $('#wceuvat_tabs').on('show_readiness', function() {
     1713               
     1714                    if (readiness_content_loaded) return;
     1715                   
     1716                    readiness_content_loaded = true;
     1717       
     1718                    jQuery.blockUI({ message: "<h1>$loading</h1>" });
     1719       
     1720                    $('#wcvat_readiness_results_table_container').html('$loading');
     1721                   
    16811722                    $.post(ajaxurl, {
    16821723                        action: "wc_eu_vat_cc",
    1683                         subaction: 'load_reports_tab',
     1724                        subaction: 'load_readiness_tab',
    16841725                        _wpnonce: '$nonce'
    16851726                    }, function(response) {
    16861727                        resp = JSON.parse(response);
    16871728                        if (resp.result == 'ok') {
    1688                             $('#wceuvat-navtab-reports-content').html(resp.content);
     1729                            $('#wcvat_readiness_results_table_container').html(resp.content);
    16891730                        } else {
    1690                             $('#wceuvat-navtab-reports-content').html('$error');
     1731                            $('#wcvat_readiness_results_table_container').html('$error');
    16911732                            console.log(resp);
    16921733                        }
     1734                        jQuery.unblockUI();
    16931735                    });
    16941736                });
  • woocommerce-eu-vat-compliance/tags/1.35.5/data/rates.json

    r3277213 r3339144  
    11{
    2     "last_updated": "2025-03-06T21:00:00Z",
     2    "last_updated": "2025-08-04T12:00:00Z",
    33    "disclaimer": "This data is compiled from official European Commission sources to be as accurate as possible, however no guarantee of accuracy is provided. Use at your own risk. Don't trust random people on the internet without doing your own research.",
    44    "rates": {
     
    6262        "EE": {
    6363            "country": "Estonia",
    64             "standard_rate": 22.00,
    65             "standard_rate_by_time": { "0": 20.00, "1704063600": 22.00 },
     64            "standard_rate": 24.00,
     65            "standard_rate_by_time": { "0": 20.00, "1704063600": 22.00, "1751324400": 24.00 },
    6666            "reduced_rate": 9.00,
    6767            "reduced_rate_alt": false,
     
    206206        "RO": {
    207207            "country": "Romania",
    208             "standard_rate": 19.00,
    209             "reduced_rate": 9.00,
    210             "reduced_rate_alt": 5.00,
     208            "standard_rate": 21.00,
     209            "standard_rate_by_time": { "0": 19.00, "1754002800": 21.00 },
     210            "reduced_rate": 11.00,
     211            "reduced_rate_by_time": { "0": 9.00, "1754002800": 11.00 },
     212            "reduced_rate_alt": false,
    211213            "super_reduced_rate": false,
    212214            "parking_rate": false
  • woocommerce-eu-vat-compliance/tags/1.35.5/eu-vat-compliance.php

    r3277213 r3339144  
    44Plugin URI: https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/
    55Description: Provides features to assist WooCommerce with European VAT compliance
    6 Version: 1.34.0
     6Version: 1.35.5
    77Text Domain: woocommerce-eu-vat-compliance
    88Domain Path: /languages
     
    1111License: GNU General Public License v3.0
    1212License URI: https://www.gnu.org/licenses/gpl-3.0.html
    13 WC requires at least: 4.5.0
    14 WC tested up to: 9.8.0
     13WC requires at least: 4.8.0
     14WC tested up to: 10.0.0
    1515// N.B. WooCommerce doesn't check the minor version. So, '3.9.0' means 'the entire 3.9 series'
    1616Copyright: 2014- David Anderson
  • woocommerce-eu-vat-compliance/tags/1.35.5/nusoap/class.soap_parser.php

    r2988486 r3339144  
    101101            xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    102102            xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
    103             // Set the object for the parser.
    104             xml_set_object($this->parser, $this);
    105103            // Set the element handlers for the parser.
    106             xml_set_element_handler($this->parser, 'start_element','end_element');
    107             xml_set_character_data_handler($this->parser,'character_data');
     104            xml_set_element_handler($this->parser, array($this, 'start_element'), array($this, 'end_element'));
     105            xml_set_character_data_handler($this->parser, array($this, 'character_data'));
    108106
    109107            // Parse the XML file.
  • woocommerce-eu-vat-compliance/tags/1.35.5/nusoap/class.wsdl.php

    r2988486 r3339144  
    7575     * @access public
    7676     */
    77     function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
     77    public function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
    7878        parent::__construct();
    7979        $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
     
    274274        // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    275275        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    276         // Set the object for the parser.
    277         xml_set_object($this->parser, $this);
    278276        // Set the element handlers for the parser.
    279         xml_set_element_handler($this->parser, 'start_element', 'end_element');
    280         xml_set_character_data_handler($this->parser, 'character_data');
     277        xml_set_element_handler($this->parser, array($this, 'start_element'), array($this, 'end_element'));
     278        xml_set_character_data_handler($this->parser, array($this, 'character_data'));
    281279        // Parse the XML file.
    282280        if (!xml_parse($this->parser, $wsdl_string, true)) {
     
    307305     * start-element handler
    308306     *
    309      * @param string $parser XML parser object
     307     * @param object $parser XML parser object
    310308     * @param string $name element name
    311309     * @param string $attrs associative array of attributes
     
    521519    * end-element handler
    522520    *
    523     * @param string $parser XML parser object
     521    * @param object $parser XML parser object
    524522    * @param string $name element name
    525523    * @access private
     
    555553     * @access private
    556554     */
    557     function character_data($parser, $data)
     555    public function character_data($parser, $data)
    558556    {
    559557        $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
  • woocommerce-eu-vat-compliance/tags/1.35.5/nusoap/class.xmlschema.php

    r1607044 r3339144  
    120120            xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    121121
    122             // Set the object for the parser.
    123             xml_set_object($this->parser, $this);
    124 
    125122            // Set the element handlers for the parser.
    126123            if($type == "schema"){
    127                 xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
    128                 xml_set_character_data_handler($this->parser,'schemaCharacterData');
     124                xml_set_element_handler($this->parser, array($this, 'schemaStartElement'), array($this, 'schemaEndElement'));
     125                xml_set_character_data_handler($this->parser, array($this, 'schemaCharacterData'));
    129126            } elseif($type == "xml"){
    130                 xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
    131                 xml_set_character_data_handler($this->parser,'xmlCharacterData');
     127                xml_set_element_handler($this->parser, array($this, 'xmlStartElement'), array($this, 'xmlEndElement'));
     128                xml_set_character_data_handler($this->parser, array($this, 'xmlCharacterData'));
    132129            }
    133130
  • woocommerce-eu-vat-compliance/tags/1.35.5/preselect-country.php

    r3277213 r3339144  
    246246        $is_checkout_rest = $is_rest_request && in_array($this->current_rest_route, array('/wc/store/v1/cart/update-customer', '/wc/store/v1/checkout'));
    247247       
     248        // wc-ajax=ppc-create-order : call made by https://wordpress.org/plugins/woocommerce-paypal-payments/ ; on the back-end it uses the PayPal API to create an order, and returns the ID back to the front-end, which can then access a PayPal pop-up for that order. Thus it has to be treated as a checkout-context.
     249        $is_checkout_request = $is_checkout_rest || (isset($_REQUEST['wc-ajax']) && in_array($_REQUEST['wc-ajax'], array('ppc-create-order')));
     250       
    248251        // $state = $address[1]; $postcode = $address[2]; $city = $address[3];
    249252        $country = isset($address[0]) ? $address[0] : '';
     
    261264
    262265        // Checkout or cart context?
    263         if ($is_checkout_rest || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart()) || defined('WOOCOMMERCE_CHECKOUT') || defined('WOOCOMMERCE_CART')) {
     266        if ($is_checkout_request || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart()) || defined('WOOCOMMERCE_CHECKOUT') || defined('WOOCOMMERCE_CART')) {
    264267
    265268            // Processing of checkout form activity - get from session only
    266269            $allow_from_widget_or_request = (!defined('WOOCOMMERCE_CHECKOUT') || !WOOCOMMERCE_CHECKOUT) && (!function_exists('is_checkout') || !is_checkout()) ? true : false;
    267             if ($is_checkout_rest) $allow_from_widget_or_request = false;
     270            if ($is_checkout_request) $allow_from_widget_or_request = false;
    268271           
    269272            // This excludes the final checkout processing case - i.e. includes only the pages
    270             $allow_default = ($is_checkout_rest || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart())) && (!defined('WOOCOMMERCE_CHECKOUT') || !WOOCOMMERCE_CHECKOUT);
     273            $allow_default = ($is_checkout_request || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart())) && (!defined('WOOCOMMERCE_CHECKOUT') || !WOOCOMMERCE_CHECKOUT);
    271274
    272275            // On the cart or checkout, don't use a GeoIP lookup; don't allow use of the widget on the checkout
     
    276279                return array($vat_country, $vat_state, '', '');
    277280            }
     281           
    278282            return $address;
    279283        }
     
    285289            return array($vat_country, $vat_state, '', '');
    286290        }
    287 
     291       
    288292        return $address;
    289293
  • woocommerce-eu-vat-compliance/tags/1.35.5/readiness-tests.php

    r3277213 r3339144  
    9292    protected function res($result, $info) {
    9393        if (is_bool($result)) {
    94             if ($result) {
    95                 $rescode = 'pass';
    96             } else {
    97                 $rescode = 'fail';
    98             }
     94            $rescode = $result ? 'pass' : 'fail';
    9995        } else {
    10096            $rescode = 'unknown';
     
    115111        $minimum_supported_wc_version = '3.8';
    116112       
    117         $result = (defined('WOOCOMMERCE_VERSION') && version_compare(WOOCOMMERCE_VERSION, $minimum_supported_wc_version, '>='));
     113        $result = defined('WOOCOMMERCE_VERSION') && version_compare(WOOCOMMERCE_VERSION, $minimum_supported_wc_version, '>=');
    118114        if ($result) {
    119115            // translators: a version number
  • woocommerce-eu-vat-compliance/tags/1.35.5/readme.txt

    r3277213 r3339144  
    33Requires at least: 5.3
    44Tested up to: 6.8
    5 Stable tag: 1.34.0
     5Stable tag: 1.35.5
    66Requires PHP: 7.1
    77Tags: woocommerce, eu vat, vat compliance, iva, moss
     
    131131== Changelog ==
    132132
     133= 1.35.5 - 2025-08-04 =
     134
     135* TWEAK: Update VAT rates for Romania
     136
     137= 1.35.4 - 2025-08-01 =
     138
     139* TWEAK: When pre-filling the checkout page, if the VAT number was stored with a double-prefix, then fix it
     140* TWEAK: Update VAT rate for Estonia
     141
     142= 1.35.3 - 2025-07-09 =
     143
     144* TWEAK: Use WC_Order::save_meta_data() instead of WC_Order::save() in WC_EU_VAT_Compliance_Record_Order_Details to avoid unnecessary database updates
     145
     146= 1.35.2 - 2025-06-25 =
     147
     148* FIX: Invalidate the cart total calcuation cache if the cart hash has changed, fixing the issue of "exemption based upon value" calculations on the shortcode-based 'cart' page being based upon the pre-updated cart during an update operation
     149* TWEAK: Run readiness tests upon loading of the 'Readiness Report' tab instead of upon page loading, for quicker page loading and avoidance of unnecessary network calls.
     150* TWEAK: In the order and settings exports, include information on whether the designated cart page uses the cart shortcode
     151
     152= 1.35.1 - 2025-06-17 =
     153
     154* FIX: Fix incorrect reference to customer object during PayPal official extension off-site checkout
     155* TWEAK: In the order and settings exports, include information on whether the designated checkout page uses the checkout shortcode
     156* TWEAK: In the settings export, rename woocommerce_default_country to woocommerce_base_country and wc_eu_vat_compliance to wc_vat_compliance
     157
     158= 1.35.0 - 2025-06-11 =
     159
     160* FIX: Fix regression on the block checkout by which changes to the VAT number field were not feeding back to the "Order Review" section
     161* TWEAK: Provide more information in some cases of WSDL layer setup failure
     162* TWEAK: Replace use of xml_set_object() in nusoap code to resolve PHP 8.4 deprecations
     163* TWEAK: Mark as supporting WooCommerce 4.8+ (nothing has been changed to stop supporting previous versions; but this is now the official support requirement)
     164
     165= 1.34.3 - 2025-04-30 =
     166
     167* FIX: A further fix for the official WooCommerce PayPal extension; customer VAT exemptions were not applied on the non-standard AJAX call
     168
     169= 1.34.2 - 2025-04-26 =
     170
     171* FIX: The official WooCommerce PayPal extension uses a non-standard AJAX call when calculating order totals, resulting in possible incorrect context-dependent identification of taxation country
     172
     173= 1.34.1 - 2025-04-22 =
     174
     175* TWEAK: In the "VAT compliance information" meta-box, the status had regressed to being shown where the VAT number should have been displaying
     176
    133177= 1.34.0 - 2025-04-19 =
    134178
    135 * FEATURE: When performing VAT number validations upon subscription renewal, exempt from taxes (requires Subscriptio 0.12.11 or later) if the user is still VAT exempt based upon a fresh look-up
     179* FEATURE: When performing VAT number validations upon subscription renewal, exempt from taxes (requires Subscriben 0.12.11 or later) if the user is still VAT exempt based upon a fresh look-up
    136180* TWEAK: When performing VAT number validations upon subscription renewal, prefer the most recent VAT number, trust the previous order's look-up less, record unsuccessful results with more detail, and do not retain information from previous lookups
    137181* TWEAK: Prevent a PHP notice upon order placement if using the block checkout with no shipping required
     
    17371781
    17381782== Upgrade Notice ==
    1739 * 1.34.0 Various improvements and fixes relating to the block checkout and handling of tax changes between a subscription renewal order and prior order. Also - since 1.32.1, the Premium version now uses version 2.0 of the HMRC (UK) VAT number lookup service, which is the only version available from January - if you are using it, you must go into the plugin settings and go through the authentication procedure. Other minor tweaks and improvements. A recommended update for all.
     1783* 1.35.5 - Update VAT rates. N.B. Since 1.32.1, the Premium version now uses version 2.0 of the HMRC (UK) VAT number lookup service, which is the only version available from January - if you are using it, you must go into the plugin settings and go through the authentication procedure. Other minor tweaks and improvements. A recommended update for all.
  • woocommerce-eu-vat-compliance/tags/1.35.5/record-order-details.php

    r3277213 r3339144  
    276276        $order->update_meta_data('wceuvat_conversion_rates', $conversion_rates);
    277277       
    278         $order->save();
     278        $order->save_meta_data();
    279279       
    280280        return $conversion_rates;
     
    337337        if ($save_in_order) {
    338338            $order->update_meta_data('vat_compliance_vat_paid', $vat_paid);
    339             $order->save();
     339            $order->save_meta_data();
    340340        }
    341341           
     
    398398                   
    399399                    $order->update_meta_data('vat_compliance_country_info', apply_filters('wc_eu_vat_compliance_meta_country_info', $country_info, $order));
    400                     $order->save();
     400                    $order->save_meta_data();
    401401                   
    402402                    echo ' '.__("The following information is based upon looking up the customer's IP address now.", 'woocommerce-eu-vat-compliance');
     
    616616                $status = __('entered, but invalid', 'woocommerce-eu-vat-compliance');
    617617                // translators: a status message and a VAT number
    618                 echo '<p><strong>'.sprintf(esc_html__('VAT number (%1$s): %1$s', 'woocommerce-eu-vat-compliance'), $status, '</strong>'.$vat_number)."</p>\n";
     618                echo '<p><strong>'.sprintf(esc_html__('VAT number (%1$s): %2$s', 'woocommerce-eu-vat-compliance'), $status, '</strong>'.$vat_number)."</p>\n";
    619619            }
    620620
  • woocommerce-eu-vat-compliance/trunk/bootstrap.php

    r3277213 r3339144  
    101101
    102102        // Update customer vat location on updating address on block checkout.
    103         add_action('woocommerce_store_api_cart_update_customer_from_request', array($this, 'update_customer_vat_location'), 10, 2);
     103        add_action('woocommerce_store_api_cart_update_customer_from_request', array($this, 'update_customer_vat_location'));
    104104    }
    105105   
     
    243243
    244244    /**
    245      * Update customer vat location for update tax
     245     * Update customer VAT location for update tax
    246246     *
    247247     * @param WC_Customer     $customer Customer object.
    248      * @param WP_REST_Request $request Request object.
    249      */
    250     public function update_customer_vat_location(\WC_Customer $customer, \WP_REST_Request $request) {
     248     */
     249    public function update_customer_vat_location(\WC_Customer $customer) {
     250       
    251251        $validation_util = new Automattic\WooCommerce\StoreApi\Utilities\ValidationUtils();
    252252        $vat_controller = WooCommerce_EU_VAT_Compliance('WC_EU_VAT_Compliance_VAT_Number');
     
    261261         * This resets the state to an empty string if it doesn't match the country.
    262262         */
    263         if ( !$validation_util->validate_state( $billing_state, $billing_country ) ) {
     263        if (!$validation_util->validate_state($billing_state, $billing_country)) {
    264264            $billing_state = '';
    265265        }
     
    310310        if (!empty($vat_number) && $vat_controller) {
    311311            $check_result = $vat_controller->check_vat_number_validity($country, $vat_number, false, true);
    312 
    313             if (empty($check_result['vat_number_accepted'])) {
    314                 $vat_number = null;
    315 
    316                 // Remove vat number if it's not valid vat number.
    317                 $this->wc->session->set('vat_number', null);
    318             }
     312        }
     313        if (!isset($check_result) || empty($check_result['vat_number_accepted'])) {
     314            $vat_number = null;
     315            // Do not store invalid VAT numbers in the session
     316            $this->wc->session->set('vat_number', null);
    319317        }
    320318
     
    16441642   
    16451643    /**
     1644     * See if the designated checkout page uses the checkout shortcode.
     1645     * N.B. Theoretically the designated checkout page might not actually be the one the site uses; a custom checkout may be in use, etc.
     1646     *
     1647     * @return Boolean
     1648     */
     1649    public function checkout_page_uses_shortcode() {
     1650       
     1651        $checkout_id = wc_get_page_id('checkout');
     1652       
     1653        // No checkout page found
     1654        if ($checkout_id <= 0) return false;
     1655       
     1656        $content = get_post_field('post_content', $checkout_id);
     1657       
     1658        return has_shortcode($content, 'woocommerce_checkout');
     1659    }
     1660   
     1661    /**
     1662     * See if the designated cart page uses the cart shortcode.
     1663     * N.B. Theoretically the designated cart page might not actually be the one the site uses; a custom cart may be in use, etc.
     1664     *
     1665     * @return Boolean
     1666     */
     1667    public function cart_page_uses_shortcode() {
     1668       
     1669        $cart_id = wc_get_page_id('cart');
     1670       
     1671        // No cart page found
     1672        if ($cart_id <= 0) return false;
     1673       
     1674        $content = get_post_field('post_content', $cart_id);
     1675       
     1676        return has_shortcode($content, 'woocommerce_cart');
     1677    }
     1678   
     1679    /**
    16461680     * Rename the "Valid EU VAT Number" field to "Valid VAT Number"
    16471681     */
  • woocommerce-eu-vat-compliance/trunk/control-centre.php

    r3188577 r3339144  
    165165            if (empty($_POST['settings']) || !is_string($_POST['settings'])) die;
    166166
    167             parse_str($_POST['settings'], $posted_settings);
     167            parse_str(stripslashes($_POST['settings']), $posted_settings);
    168168           
    169169            $posted_settings = stripslashes_deep($posted_settings);
     
    318318                'content' => $contents
    319319            ));
     320        } elseif ('load_readiness_tab' === $_POST['subaction']) {
     321            ob_start();
     322            $this->render_tab_readiness_table();
     323            $contents = @ob_get_contents();
     324            @ob_end_clean();
     325           
     326            echo json_encode(array(
     327                'result' => 'ok',
     328                'content' => $contents
     329            ));
     330           
    320331        } elseif ('export_settings' == $_POST['subaction']) {
    321332       
    322             $plugin_version = WooCommerce_EU_VAT_Compliance()->get_version();
     333            $compliance = WooCommerce_EU_VAT_Compliance();
     334           
     335            $plugin_version = $compliance->get_version();
    323336
    324337            include(ABSPATH.WPINC.'/version.php');
     
    333346            }
    334347           
    335             $options['woocommerce_default_country'] = WC()->countries->get_base_country();
     348            $options['woocommerce_base_country'] = WC()->countries->get_base_country();
    336349           
    337350            $results = array(
     
    339352                'versions' => array(
    340353                    'wc' => defined('WOOCOMMERCE_VERSION') ? WOOCOMMERCE_VERSION : '?',
    341                     'wc_eu_vat_compliance' => '?',
     354                    'wc_vat_compliance' => '?',
    342355                    'wp' => $wp_version
     356                ),
     357                'features' => array(
     358                    'hpos_enabled' => $compliance->woocommerce_custom_order_tables_enabled(),
     359                    'checkout_page_using_shortcode' => $compliance->checkout_page_uses_shortcode(),
     360                    'cart_page_using_shortcode' => $compliance->cart_page_uses_shortcode(),
    343361                ),
    344362            );
     
    483501        ));
    484502
    485         $active_tab = !empty($_REQUEST['tab']) ? $_REQUEST['tab'] : 'settings';
     503        $active_tab = empty($_REQUEST['tab']) ? 'settings' : stripslashes($_REQUEST['tab']);
    486504        if ('taxes' == $active_tab || !empty($_GET['range'])) $active_tab = 'reports';
    487505
     
    525543        foreach ($tabs as $slug => $title) {
    526544            ?>
    527                 <a class="nav-tab <?php if($slug == $active_tab) echo 'nav-tab-active'; ?>" href="#wceuvat-navtab-<?php echo $slug;?>-content" id="wceuvat-navtab-<?php echo $slug;?>"><?php echo $title;?></a>
     545                <a class="nav-tab <?php if ($slug == $active_tab) echo 'nav-tab-active'; ?>" href="#wceuvat-navtab-<?php echo esc_attr($slug);?>-content" id="wceuvat-navtab-<?php echo esc_attr($slug);?>"><?php echo esc_html($title);?></a>
    528546            <?php
    529547        }
     
    532550
    533551        foreach ($tabs as $slug => $title) {
    534             echo "<div class=\"wceuvat-navtab-content\" id=\"wceuvat-navtab-".$slug."-content\"";
     552            echo "<div class=\"wceuvat-navtab-content\" id=\"wceuvat-navtab-".esc_attr($slug)."-content\"";
    535553            if ($slug != $active_tab) echo ' style="display:none;"';
    536554            echo ">";
     
    14501468        echo '<p>'.esc_html__("N.B. If you are not selling goods for which the \"place of supply\" is deemed to be the customer's location (rather than the seller's; e.g. electronically supplied goods), then the tests for the presence of up-to-date VAT per-country rates are not relevant and you should not use them.", 'woocommerce-eu-vat-compliance').'</p>';
    14511469
     1470        // This is populated via AJAX so that the tests don't have to be done upon each settings page load
     1471        echo '<div id="wcvat_readiness_results_table_container"></div>';
     1472   
     1473        // N.B. This is duplicated in render_tab_readiness(); keep them in sync.
     1474        $opts = get_option('wceuvat_background_tests');
     1475        $email = empty($opts['email']) ? '' : (string) $opts['email'];
     1476       
     1477        $default_bottom_blurb = '<p><a href="https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/">'.esc_html__('To automatically run these tests daily, and notify yourself of any failed tests by email, use our Premium version.', 'woocommerce-eu-vat-compliance').'</a></p>';
     1478        $bottom_blurb = apply_filters('wceuvat_readinesstests_bottom_section', $default_bottom_blurb, $email);
     1479       
     1480        echo $bottom_blurb;
     1481
     1482        echo '</div>';
     1483
     1484    }
     1485
     1486    /**
     1487     * Output the readiness test result table
     1488     */
     1489    private function render_tab_readiness_table() {
    14521490        if (!class_exists('WC_EU_VAT_Compliance_Readiness_Tests')) require_once(WC_VAT_COMPLIANCE_DIR.'/readiness-tests.php');
    14531491        $test = new WC_EU_VAT_Compliance_Readiness_Tests();
    14541492        $results = $test->get_results();
    1455 
     1493       
    14561494        $result_descriptions = $test->result_descriptions();
    1457 
     1495       
    14581496        ?>
    14591497        <table>
    14601498        <thead>
    1461             <tr>
    1462                 <th></th>
    1463                 <th style="text-align:left; min-width: 140px;"><?php _e('Test', 'woocommerce-eu-vat-compliance');?></th>
    1464                 <th style="text-align:left; min-width:60px;"><?php _e('Result', 'woocommerce-eu-vat-compliance');?></th>
    1465                 <th style="text-align:left;"><?php _e('Futher information', 'woocommerce-eu-vat-compliance');?></th>
    1466             </tr>
     1499        <tr>
     1500        <th></th>
     1501        <th style="text-align:left; min-width: 140px;"><?php _e('Test', 'woocommerce-eu-vat-compliance');?></th>
     1502        <th style="text-align:left; min-width:60px;"><?php _e('Result', 'woocommerce-eu-vat-compliance');?></th>
     1503        <th style="text-align:left;"><?php _e('Futher information', 'woocommerce-eu-vat-compliance');?></th>
     1504        </tr>
    14671505        </thead>
    14681506        <tbody>
    14691507        <?php
    1470 
     1508       
     1509        // N.B. This is duplicated in render_tab_readiness(); keep them in sync.
    14711510        $opts = get_option('wceuvat_background_tests');
    1472         $email = empty($opts['email']) ? '' : (string)$opts['email'];
    1473 
     1511        $email = empty($opts['email']) ? '' : (string) $opts['email'];
    14741512        $default_bottom_blurb = '<p><a href="https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/">'.esc_html__('To automatically run these tests daily, and notify yourself of any failed tests by email, use our Premium version.', 'woocommerce-eu-vat-compliance').'</a></p>';
    14751513        $bottom_blurb = apply_filters('wceuvat_readinesstests_bottom_section', $default_bottom_blurb, $email);
    14761514        $premium_present = ($bottom_blurb == $default_bottom_blurb) ? false : true;
    1477 
     1515       
    14781516        foreach ($results as $id => $res) {
    14791517            if (!is_array($res)) continue;
     
    14941532            }
    14951533            $row_bg = 'color:'.$col;
    1496 
     1534           
    14971535            $checked = (is_array($opts) && empty($opts['tests'][$id])) ? false : true;
    1498 
     1536           
    14991537            ?>
    1500 
    1501             <tr style="<?php echo $row_bg;?>">
    1502                 <td style="vertical-align:top;"><?php
    1503                 if ($premium_present) { ?>
    1504                     <input type="checkbox" id="wceuvat_test_<?php echo esc_attr($id);?>" name="wceuvat_test_<?php echo esc_attr($id);?>" value="1" <?php if ($checked) echo 'checked="checked"'; ?>>
     1538           
     1539            <tr style="<?php echo esc_attr($row_bg);?>">
     1540            <td style="vertical-align:top;"><?php
     1541            if ($premium_present) { ?>
     1542                <input type="checkbox" id="wceuvat_test_<?php echo esc_attr($id);?>" name="wceuvat_test_<?php echo esc_attr($id);?>" value="1" <?php if ($checked) echo 'checked="checked"'; ?>>
    15051543                <?php } ?>
    15061544                </td>
     
    15081546                <td style="vertical-align:top;"><?php echo $result_descriptions[$res['result']];?></td>
    15091547                <td style="vertical-align:top;"><?php echo $res['info'];?></td>
    1510             </tr>
    1511             <?php
    1512         }
    1513 
     1548                </tr>
     1549                <?php
     1550        }
     1551       
    15141552        ?>
    15151553        </tbody>
    15161554        </table>
     1555       
    15171556        <?php
    1518 
    1519         echo $bottom_blurb;
    1520 
    1521         echo '</div>';
    1522 
    1523     }
    1524 
     1557    }
     1558   
    15251559    /**
    15261560     * Called by the WP action admin_footer when on our settings page
     
    15321566        $nonce = wp_create_nonce("wc_eu_vat_nonce");
    15331567        $response = esc_js(__('Response:', 'woocommerce-eu-vat-compliance'));
    1534         $loading = esc_js(__('Loading...', 'woocommerce-eu-vat-compliance'));
     1568        $loading = esc_js(__('Running readiness tests...', 'woocommerce-eu-vat-compliance'));
    15351569        $error = esc_js(__('Error', 'woocommerce-eu-vat-compliance'));
    15361570
     
    16691703                        $('#wceuvat-navtab-'+id.substring(15)+'-content').show();
    16701704                        // This is not yet ready
    1671 //                      $('#wceuvat_tabs').trigger('show_'+id.substring(15));
     1705                        $('#wceuvat_tabs').trigger('show_'+id.substring(15));
    16721706                    }
    16731707                    return false;
    16741708                });
    16751709               
    1676                 var content_loaded = false;
    1677                 $('#wceuvat_tabs').on('show_reports', function() {
    1678                     if (content_loaded) return;
    1679                     content_loaded = true;
    1680                     $('#wceuvat-navtab-reports-content').html('$loading');
     1710                var readiness_content_loaded = false;
     1711               
     1712                $('#wceuvat_tabs').on('show_readiness', function() {
     1713               
     1714                    if (readiness_content_loaded) return;
     1715                   
     1716                    readiness_content_loaded = true;
     1717       
     1718                    jQuery.blockUI({ message: "<h1>$loading</h1>" });
     1719       
     1720                    $('#wcvat_readiness_results_table_container').html('$loading');
     1721                   
    16811722                    $.post(ajaxurl, {
    16821723                        action: "wc_eu_vat_cc",
    1683                         subaction: 'load_reports_tab',
     1724                        subaction: 'load_readiness_tab',
    16841725                        _wpnonce: '$nonce'
    16851726                    }, function(response) {
    16861727                        resp = JSON.parse(response);
    16871728                        if (resp.result == 'ok') {
    1688                             $('#wceuvat-navtab-reports-content').html(resp.content);
     1729                            $('#wcvat_readiness_results_table_container').html(resp.content);
    16891730                        } else {
    1690                             $('#wceuvat-navtab-reports-content').html('$error');
     1731                            $('#wcvat_readiness_results_table_container').html('$error');
    16911732                            console.log(resp);
    16921733                        }
     1734                        jQuery.unblockUI();
    16931735                    });
    16941736                });
  • woocommerce-eu-vat-compliance/trunk/data/rates.json

    r3277213 r3339144  
    11{
    2     "last_updated": "2025-03-06T21:00:00Z",
     2    "last_updated": "2025-08-04T12:00:00Z",
    33    "disclaimer": "This data is compiled from official European Commission sources to be as accurate as possible, however no guarantee of accuracy is provided. Use at your own risk. Don't trust random people on the internet without doing your own research.",
    44    "rates": {
     
    6262        "EE": {
    6363            "country": "Estonia",
    64             "standard_rate": 22.00,
    65             "standard_rate_by_time": { "0": 20.00, "1704063600": 22.00 },
     64            "standard_rate": 24.00,
     65            "standard_rate_by_time": { "0": 20.00, "1704063600": 22.00, "1751324400": 24.00 },
    6666            "reduced_rate": 9.00,
    6767            "reduced_rate_alt": false,
     
    206206        "RO": {
    207207            "country": "Romania",
    208             "standard_rate": 19.00,
    209             "reduced_rate": 9.00,
    210             "reduced_rate_alt": 5.00,
     208            "standard_rate": 21.00,
     209            "standard_rate_by_time": { "0": 19.00, "1754002800": 21.00 },
     210            "reduced_rate": 11.00,
     211            "reduced_rate_by_time": { "0": 9.00, "1754002800": 11.00 },
     212            "reduced_rate_alt": false,
    211213            "super_reduced_rate": false,
    212214            "parking_rate": false
  • woocommerce-eu-vat-compliance/trunk/eu-vat-compliance.php

    r3277213 r3339144  
    44Plugin URI: https://www.simbahosting.co.uk/s3/product/woocommerce-eu-vat-compliance/
    55Description: Provides features to assist WooCommerce with European VAT compliance
    6 Version: 1.34.0
     6Version: 1.35.5
    77Text Domain: woocommerce-eu-vat-compliance
    88Domain Path: /languages
     
    1111License: GNU General Public License v3.0
    1212License URI: https://www.gnu.org/licenses/gpl-3.0.html
    13 WC requires at least: 4.5.0
    14 WC tested up to: 9.8.0
     13WC requires at least: 4.8.0
     14WC tested up to: 10.0.0
    1515// N.B. WooCommerce doesn't check the minor version. So, '3.9.0' means 'the entire 3.9 series'
    1616Copyright: 2014- David Anderson
  • woocommerce-eu-vat-compliance/trunk/nusoap/class.soap_parser.php

    r2988486 r3339144  
    101101            xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    102102            xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
    103             // Set the object for the parser.
    104             xml_set_object($this->parser, $this);
    105103            // Set the element handlers for the parser.
    106             xml_set_element_handler($this->parser, 'start_element','end_element');
    107             xml_set_character_data_handler($this->parser,'character_data');
     104            xml_set_element_handler($this->parser, array($this, 'start_element'), array($this, 'end_element'));
     105            xml_set_character_data_handler($this->parser, array($this, 'character_data'));
    108106
    109107            // Parse the XML file.
  • woocommerce-eu-vat-compliance/trunk/nusoap/class.wsdl.php

    r2988486 r3339144  
    7575     * @access public
    7676     */
    77     function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
     77    public function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
    7878        parent::__construct();
    7979        $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
     
    274274        // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    275275        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    276         // Set the object for the parser.
    277         xml_set_object($this->parser, $this);
    278276        // Set the element handlers for the parser.
    279         xml_set_element_handler($this->parser, 'start_element', 'end_element');
    280         xml_set_character_data_handler($this->parser, 'character_data');
     277        xml_set_element_handler($this->parser, array($this, 'start_element'), array($this, 'end_element'));
     278        xml_set_character_data_handler($this->parser, array($this, 'character_data'));
    281279        // Parse the XML file.
    282280        if (!xml_parse($this->parser, $wsdl_string, true)) {
     
    307305     * start-element handler
    308306     *
    309      * @param string $parser XML parser object
     307     * @param object $parser XML parser object
    310308     * @param string $name element name
    311309     * @param string $attrs associative array of attributes
     
    521519    * end-element handler
    522520    *
    523     * @param string $parser XML parser object
     521    * @param object $parser XML parser object
    524522    * @param string $name element name
    525523    * @access private
     
    555553     * @access private
    556554     */
    557     function character_data($parser, $data)
     555    public function character_data($parser, $data)
    558556    {
    559557        $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
  • woocommerce-eu-vat-compliance/trunk/nusoap/class.xmlschema.php

    r1607044 r3339144  
    120120            xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    121121
    122             // Set the object for the parser.
    123             xml_set_object($this->parser, $this);
    124 
    125122            // Set the element handlers for the parser.
    126123            if($type == "schema"){
    127                 xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
    128                 xml_set_character_data_handler($this->parser,'schemaCharacterData');
     124                xml_set_element_handler($this->parser, array($this, 'schemaStartElement'), array($this, 'schemaEndElement'));
     125                xml_set_character_data_handler($this->parser, array($this, 'schemaCharacterData'));
    129126            } elseif($type == "xml"){
    130                 xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
    131                 xml_set_character_data_handler($this->parser,'xmlCharacterData');
     127                xml_set_element_handler($this->parser, array($this, 'xmlStartElement'), array($this, 'xmlEndElement'));
     128                xml_set_character_data_handler($this->parser, array($this, 'xmlCharacterData'));
    132129            }
    133130
  • woocommerce-eu-vat-compliance/trunk/preselect-country.php

    r3277213 r3339144  
    246246        $is_checkout_rest = $is_rest_request && in_array($this->current_rest_route, array('/wc/store/v1/cart/update-customer', '/wc/store/v1/checkout'));
    247247       
     248        // wc-ajax=ppc-create-order : call made by https://wordpress.org/plugins/woocommerce-paypal-payments/ ; on the back-end it uses the PayPal API to create an order, and returns the ID back to the front-end, which can then access a PayPal pop-up for that order. Thus it has to be treated as a checkout-context.
     249        $is_checkout_request = $is_checkout_rest || (isset($_REQUEST['wc-ajax']) && in_array($_REQUEST['wc-ajax'], array('ppc-create-order')));
     250       
    248251        // $state = $address[1]; $postcode = $address[2]; $city = $address[3];
    249252        $country = isset($address[0]) ? $address[0] : '';
     
    261264
    262265        // Checkout or cart context?
    263         if ($is_checkout_rest || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart()) || defined('WOOCOMMERCE_CHECKOUT') || defined('WOOCOMMERCE_CART')) {
     266        if ($is_checkout_request || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart()) || defined('WOOCOMMERCE_CHECKOUT') || defined('WOOCOMMERCE_CART')) {
    264267
    265268            // Processing of checkout form activity - get from session only
    266269            $allow_from_widget_or_request = (!defined('WOOCOMMERCE_CHECKOUT') || !WOOCOMMERCE_CHECKOUT) && (!function_exists('is_checkout') || !is_checkout()) ? true : false;
    267             if ($is_checkout_rest) $allow_from_widget_or_request = false;
     270            if ($is_checkout_request) $allow_from_widget_or_request = false;
    268271           
    269272            // This excludes the final checkout processing case - i.e. includes only the pages
    270             $allow_default = ($is_checkout_rest || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart())) && (!defined('WOOCOMMERCE_CHECKOUT') || !WOOCOMMERCE_CHECKOUT);
     273            $allow_default = ($is_checkout_request || (function_exists('is_checkout') && is_checkout()) || (function_exists('is_cart') && is_cart())) && (!defined('WOOCOMMERCE_CHECKOUT') || !WOOCOMMERCE_CHECKOUT);
    271274
    272275            // On the cart or checkout, don't use a GeoIP lookup; don't allow use of the widget on the checkout
     
    276279                return array($vat_country, $vat_state, '', '');
    277280            }
     281           
    278282            return $address;
    279283        }
     
    285289            return array($vat_country, $vat_state, '', '');
    286290        }
    287 
     291       
    288292        return $address;
    289293
  • woocommerce-eu-vat-compliance/trunk/readiness-tests.php

    r3277213 r3339144  
    9292    protected function res($result, $info) {
    9393        if (is_bool($result)) {
    94             if ($result) {
    95                 $rescode = 'pass';
    96             } else {
    97                 $rescode = 'fail';
    98             }
     94            $rescode = $result ? 'pass' : 'fail';
    9995        } else {
    10096            $rescode = 'unknown';
     
    115111        $minimum_supported_wc_version = '3.8';
    116112       
    117         $result = (defined('WOOCOMMERCE_VERSION') && version_compare(WOOCOMMERCE_VERSION, $minimum_supported_wc_version, '>='));
     113        $result = defined('WOOCOMMERCE_VERSION') && version_compare(WOOCOMMERCE_VERSION, $minimum_supported_wc_version, '>=');
    118114        if ($result) {
    119115            // translators: a version number
  • woocommerce-eu-vat-compliance/trunk/readme.txt

    r3277213 r3339144  
    33Requires at least: 5.3
    44Tested up to: 6.8
    5 Stable tag: 1.34.0
     5Stable tag: 1.35.5
    66Requires PHP: 7.1
    77Tags: woocommerce, eu vat, vat compliance, iva, moss
     
    131131== Changelog ==
    132132
     133= 1.35.5 - 2025-08-04 =
     134
     135* TWEAK: Update VAT rates for Romania
     136
     137= 1.35.4 - 2025-08-01 =
     138
     139* TWEAK: When pre-filling the checkout page, if the VAT number was stored with a double-prefix, then fix it
     140* TWEAK: Update VAT rate for Estonia
     141
     142= 1.35.3 - 2025-07-09 =
     143
     144* TWEAK: Use WC_Order::save_meta_data() instead of WC_Order::save() in WC_EU_VAT_Compliance_Record_Order_Details to avoid unnecessary database updates
     145
     146= 1.35.2 - 2025-06-25 =
     147
     148* FIX: Invalidate the cart total calcuation cache if the cart hash has changed, fixing the issue of "exemption based upon value" calculations on the shortcode-based 'cart' page being based upon the pre-updated cart during an update operation
     149* TWEAK: Run readiness tests upon loading of the 'Readiness Report' tab instead of upon page loading, for quicker page loading and avoidance of unnecessary network calls.
     150* TWEAK: In the order and settings exports, include information on whether the designated cart page uses the cart shortcode
     151
     152= 1.35.1 - 2025-06-17 =
     153
     154* FIX: Fix incorrect reference to customer object during PayPal official extension off-site checkout
     155* TWEAK: In the order and settings exports, include information on whether the designated checkout page uses the checkout shortcode
     156* TWEAK: In the settings export, rename woocommerce_default_country to woocommerce_base_country and wc_eu_vat_compliance to wc_vat_compliance
     157
     158= 1.35.0 - 2025-06-11 =
     159
     160* FIX: Fix regression on the block checkout by which changes to the VAT number field were not feeding back to the "Order Review" section
     161* TWEAK: Provide more information in some cases of WSDL layer setup failure
     162* TWEAK: Replace use of xml_set_object() in nusoap code to resolve PHP 8.4 deprecations
     163* TWEAK: Mark as supporting WooCommerce 4.8+ (nothing has been changed to stop supporting previous versions; but this is now the official support requirement)
     164
     165= 1.34.3 - 2025-04-30 =
     166
     167* FIX: A further fix for the official WooCommerce PayPal extension; customer VAT exemptions were not applied on the non-standard AJAX call
     168
     169= 1.34.2 - 2025-04-26 =
     170
     171* FIX: The official WooCommerce PayPal extension uses a non-standard AJAX call when calculating order totals, resulting in possible incorrect context-dependent identification of taxation country
     172
     173= 1.34.1 - 2025-04-22 =
     174
     175* TWEAK: In the "VAT compliance information" meta-box, the status had regressed to being shown where the VAT number should have been displaying
     176
    133177= 1.34.0 - 2025-04-19 =
    134178
    135 * FEATURE: When performing VAT number validations upon subscription renewal, exempt from taxes (requires Subscriptio 0.12.11 or later) if the user is still VAT exempt based upon a fresh look-up
     179* FEATURE: When performing VAT number validations upon subscription renewal, exempt from taxes (requires Subscriben 0.12.11 or later) if the user is still VAT exempt based upon a fresh look-up
    136180* TWEAK: When performing VAT number validations upon subscription renewal, prefer the most recent VAT number, trust the previous order's look-up less, record unsuccessful results with more detail, and do not retain information from previous lookups
    137181* TWEAK: Prevent a PHP notice upon order placement if using the block checkout with no shipping required
     
    17371781
    17381782== Upgrade Notice ==
    1739 * 1.34.0 Various improvements and fixes relating to the block checkout and handling of tax changes between a subscription renewal order and prior order. Also - since 1.32.1, the Premium version now uses version 2.0 of the HMRC (UK) VAT number lookup service, which is the only version available from January - if you are using it, you must go into the plugin settings and go through the authentication procedure. Other minor tweaks and improvements. A recommended update for all.
     1783* 1.35.5 - Update VAT rates. N.B. Since 1.32.1, the Premium version now uses version 2.0 of the HMRC (UK) VAT number lookup service, which is the only version available from January - if you are using it, you must go into the plugin settings and go through the authentication procedure. Other minor tweaks and improvements. A recommended update for all.
  • woocommerce-eu-vat-compliance/trunk/record-order-details.php

    r3277213 r3339144  
    276276        $order->update_meta_data('wceuvat_conversion_rates', $conversion_rates);
    277277       
    278         $order->save();
     278        $order->save_meta_data();
    279279       
    280280        return $conversion_rates;
     
    337337        if ($save_in_order) {
    338338            $order->update_meta_data('vat_compliance_vat_paid', $vat_paid);
    339             $order->save();
     339            $order->save_meta_data();
    340340        }
    341341           
     
    398398                   
    399399                    $order->update_meta_data('vat_compliance_country_info', apply_filters('wc_eu_vat_compliance_meta_country_info', $country_info, $order));
    400                     $order->save();
     400                    $order->save_meta_data();
    401401                   
    402402                    echo ' '.__("The following information is based upon looking up the customer's IP address now.", 'woocommerce-eu-vat-compliance');
     
    616616                $status = __('entered, but invalid', 'woocommerce-eu-vat-compliance');
    617617                // translators: a status message and a VAT number
    618                 echo '<p><strong>'.sprintf(esc_html__('VAT number (%1$s): %1$s', 'woocommerce-eu-vat-compliance'), $status, '</strong>'.$vat_number)."</p>\n";
     618                echo '<p><strong>'.sprintf(esc_html__('VAT number (%1$s): %2$s', 'woocommerce-eu-vat-compliance'), $status, '</strong>'.$vat_number)."</p>\n";
    619619            }
    620620
Note: See TracChangeset for help on using the changeset viewer.