Plugin Directory

Changeset 2981538


Ignore:
Timestamp:
10/20/2023 07:52:09 AM (2 years ago)
Author:
shipdepot
Message:

Update version 1.1.2
Fix bug time zone
Notify incompatible with HPOS

Location:
ship-depot/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ship-depot/trunk/Ship_Depot_init.php

    r2963463 r2981538  
    55 * Plugin URI:        https://shipdepot.vn/
    66 * Description:       Ship Depot support shipping couriers in Vietnam like GHN, GHTK, AhaMove.
    7  * Version:           1.1.1
     7 * Version:           1.1.2
    88 * Author:            ShipDepot.vn
    99 * Text Domain:       ship-depot-translate
     
    124124    add_action('plugins_loaded', 'ship_depot_plugins_loaded');
    125125}
     126
     127add_action('before_woocommerce_init', function () {
     128    if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
     129        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, false);
     130    }
     131});
  • ship-depot/trunk/assets/js/admin-address.js

    r2922618 r2981538  
    2929                let allProvinces = JSON.parse(sd_admin_address_params.all_provinces);
    3030                parent.find('.__sd_ward').html('<option></option>').attr('disabled', 'disabled');
    31                 html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     31                html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    3232                allProvinces.forEach(pro => {
    3333                    if (pro.Code == province_code) {
     
    6868                let allProvinces = JSON.parse(sd_admin_address_params.all_provinces);
    6969                parent.find('.__sd_ward').html('<option></option>').removeAttr('disabled');
    70                 html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     70                html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    7171                allProvinces.forEach(pro => {
    7272                    if (pro.Code == province_code) {
     
    111111            //Load and update district
    112112            jQuery('[name="shipping_district"]').html('<option></option>')
    113             html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     113            html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    114114            allProvinces.forEach(pro => {
    115115                if (pro.Code == province_code) {
     
    123123            //Load and update ward
    124124            jQuery('[name="shipping_ward"]').html('<option></option>').removeAttr('disabled');
    125             html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     125            html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    126126            allProvinces.forEach(pro => {
    127127                if (pro.Code == province_code) {
     
    147147                //Load and update district
    148148                jQuery('[name="shipping_district"]').html('<option></option>')
    149                 html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     149                html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    150150                allProvinces.forEach(pro => {
    151151                    if (pro.Code == province_code) {
     
    165165                //Load and update ward
    166166                jQuery('[name="shipping_ward"]').html('<option></option>').removeAttr('disabled');
    167                 html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     167                html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    168168                allProvinces.forEach(pro => {
    169169                    if (pro.Code == province_code) {
     
    198198    //         //Load and update district
    199199    //         jQuery('[name="_shipping_district"]').html('<option></option>')
    200     //         html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     200    //         html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    201201    //         allProvinces.forEach(pro => {
    202202    //             if (pro.Code == province_code) {
     
    216216    //         //Load and update ward
    217217    //         jQuery('[name="_shipping_ward"]').html('<option></option>').removeAttr('disabled');
    218     //         html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     218    //         html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    219219    //         allProvinces.forEach(pro => {
    220220    //             if (pro.Code == province_code) {
     
    272272                        //Load and update district
    273273                        jQuery(':input#_billing_district').html('<option></option>')
    274                         html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     274                        html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    275275                        allProvinces.some(pro => {
    276276                            if (pro.Code == province_code) {
     
    285285                        //Load and update ward
    286286                        jQuery(':input#_billing_ward').html('<option></option>').removeAttr('disabled');
    287                         html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     287                        html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    288288                        allProvinces.some(pro => {
    289289                            if (pro.Code == province_code) {
     
    349349                        //Load and update district
    350350                        jQuery(':input#_shipping_district').html('<option></option>')
    351                         html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     351                        html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    352352                        allProvinces.some(pro => {
    353353                            if (pro.Code == province_code) {
     
    362362                        //Load and update ward
    363363                        jQuery(':input#_shipping_ward').html('<option></option>').removeAttr('disabled');
    364                         html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     364                        html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    365365                        allProvinces.some(pro => {
    366366                            if (pro.Code == province_code) {
     
    423423                            //Load and update district
    424424                            jQuery(':input#_billing_district').html('<option></option>')
    425                             html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     425                            html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    426426                            allProvinces.some(pro => {
    427427                                if (pro.Code == province_code) {
     
    436436                            //Load and update ward
    437437                            jQuery(':input#_billing_ward').html('<option></option>').removeAttr('disabled');
    438                             html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     438                            html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    439439                            allProvinces.some(pro => {
    440440                                if (pro.Code == province_code) {
     
    482482                            //Load and update district
    483483                            jQuery(':input#_shipping_district').html('<option></option>')
    484                             html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     484                            html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    485485                            allProvinces.some(pro => {
    486486                                if (pro.Code == province_code) {
     
    495495                            //Load and update ward
    496496                            jQuery(':input#_shipping_ward').html('<option></option>').removeAttr('disabled');
    497                             html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     497                            html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    498498                            allProvinces.some(pro => {
    499499                                if (pro.Code == province_code) {
  • ship-depot/trunk/assets/js/admin-order-detail.js

    r2963463 r2981538  
    344344    });
    345345
     346    jQuery('#receiver_info').find('select').each(function () {
     347        if (jQuery(this).hasClass('error-class')) {
     348            jQuery(this).removeClass('error-class');
     349        }
     350    });
     351
    346352    if (jQuery('#rd_receiver_type_other').is(':checked')) {
    347353        jQuery('#receiver_info').find('input[type=text]').each(function () {
    348             if (jQuery(this).val() == '') {
     354            if (!jQuery(this).val()) {
    349355                if (!(jQuery(this).hasClass('error-class'))) {
    350356                    if (highlightError) {
     
    355361            }
    356362        });
     363
     364        jQuery('#receiver_info').find('select').each(function () {
     365            if (!jQuery(this).val()) {
     366                if (!(jQuery(this).hasClass('error-class'))) {
     367                    if (highlightError) {
     368                        jQuery(this).addClass('error-class');
     369                    }
     370                }
     371                hasError = true;
     372            }
     373        });
    357374    } else {
    358         if (jQuery('#_shipping_last_name').val() == '' || jQuery('#_shipping_first_name').val() == '' || jQuery('#_shipping_country').val() == '' || jQuery('#_shipping_phone').val() == '' || jQuery('#_shipping_address_1').val() == '' || jQuery('#_shipping_ward').val() == '' || jQuery('#_shipping_district').val() == '' || jQuery('#_shipping_city').val() == '') {
     375        if (!jQuery('#_shipping_last_name').val() || !jQuery('#_shipping_first_name').val() || !jQuery('#_shipping_country').val() || !jQuery('#_shipping_phone').val() || !jQuery('#_shipping_address_1').val() || !jQuery('#_shipping_ward').val() || !jQuery('#_shipping_district').val() || !jQuery('#_shipping_city').val()) {
    359376            if (highlightError) {
    360377                jQuery('.load_customer_shipping').parents('.order_data_column').children('h3').css('color', 'red');
     
    457474        list_package_sizes: packageSizes,
    458475        sender_storage: jQuery('#sl_storage').val(),
    459         sender_info:  jQuery('#sender_info').val(),
     476        sender_info: jQuery('#sender_info').val(),
    460477        receiver: receiver,
    461478        cod: cod,
     
    705722            let allProvinces = JSON.parse(sd_admin_address_params.all_provinces);
    706723            $('#sl_receiver_ward').html('<option></option>').attr('disabled', 'disabled');
    707             html = '<option>' + sd_admin_address_params.l10n.select_district + '</option>';
     724            html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>';
    708725            allProvinces.forEach(pro => {
    709726                if (pro.Code == province_code) {
     
    714731            });
    715732            $('#sl_receiver_district').html(html);
     733            checkAndCalFee();
    716734        });
    717735    }
     
    723741            let allProvinces = JSON.parse(sd_admin_address_params.all_provinces);
    724742            $('#sl_receiver_ward').html('<option></option>').removeAttr('disabled');
    725             html = '<option>' + sd_admin_address_params.l10n.select_ward + '</option>';
     743            html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>';
    726744            allProvinces.forEach(pro => {
    727745                if (pro.Code == province_code) {
     
    738756            });
    739757            $('#sl_receiver_ward').html(html);
     758            checkAndCalFee();
    740759        });
    741760    }
     
    754773
    755774    if ($('#_shipping_city').length > 0) {
    756         $("#_shipping_city").blur(function () {
     775        $("#_shipping_city").change(function () {
    757776            checkAndCalFee();
    758777        });
     
    760779
    761780    if ($('#_shipping_district').length > 0) {
    762         $("#_shipping_district").blur(function () {
     781        $("#_shipping_district").change(function () {
    763782            checkAndCalFee();
    764783        });
  • ship-depot/trunk/assets/js/fe-checkout.js

    r2922618 r2981538  
    5454                    //Reset ward
    5555                    $('#billing_ward').html('<option></option>').removeAttr('disabled');
    56                     html = '<option>' + sd_fe_checkout_params.l10n.select_ward + '</option>';
     56                    html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>';
    5757                    allProvinces.forEach(pro => {
    5858                        if (pro.Code == province_code) {
     
    125125                    //Reset ward
    126126                    $('#shipping_ward').html('<option></option>').removeAttr('disabled');
    127                     html = '<option>' + sd_fe_checkout_params.l10n.select_ward + '</option>';
     127                    html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>';
    128128                    allProvinces.forEach(pro => {
    129129                        if (pro.Code == province_code) {
     
    153153        let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces);
    154154        $('#billing_ward').html('<option></option>').attr('disabled', 'disabled');
    155         html = '<option>' + sd_fe_checkout_params.l10n.select_district + '</option>';
     155        html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>';
    156156        allProvinces.forEach(pro => {
    157157            if (pro.Code == province_code) {
     
    175175        let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces);
    176176        $('#shipping_ward').html('<option></option>').attr('disabled', 'disabled');
    177         html = '<option>' + sd_fe_checkout_params.l10n.select_district + '</option>';
     177        html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>';
    178178        allProvinces.forEach(pro => {
    179179            if (pro.Code == province_code) {
     
    199199            let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces);
    200200            $('#billing_ward').html('<option></option>').attr('disabled', 'disabled');
    201             html = '<option>' + sd_fe_checkout_params.l10n.select_district + '</option>';
     201            html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>';
    202202            allProvinces.forEach(pro => {
    203203                if (pro.Code == province_code) {
     
    208208            });
    209209            $('#billing_district').html(html);
    210 
    211             if ($('#ship-to-different-address-checkbox').is(':checked') == false
    212                 && !checkNullorEmpty($('#billing_district').val())
    213                 && !checkNullorEmpty($('#billing_ward').val())
    214                 && !checkNullorEmpty($('#billing_address_1').val())) {
    215                 $(document.body).trigger('update_checkout');
    216             }
     210            $(document.body).trigger('update_checkout');
     211            // if ($('#ship-to-different-address-checkbox').is(':checked') == false
     212            //     && !checkNullorEmpty($('#billing_district').val())
     213            //     && !checkNullorEmpty($('#billing_ward').val())
     214            //     && !checkNullorEmpty($('#billing_address_1').val())) {
     215               
     216            // }
    217217        });
    218218    }
     
    226226            let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces);
    227227            $('#billing_ward').html('<option></option>').removeAttr('disabled');
    228             html = '<option>' + sd_fe_checkout_params.l10n.select_ward + '</option>';
     228            html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>';
    229229            allProvinces.forEach(pro => {
    230230                if (pro.Code == province_code) {
     
    239239            });
    240240            $('#billing_ward').html(html).val('');
    241 
    242             if ($('#ship-to-different-address-checkbox').is(':checked') == false
    243                 && !checkNullorEmpty($('#billing_ward').val())
    244                 && !checkNullorEmpty($('#billing_address_1').val())) {
    245                 $(document.body).trigger('update_checkout');
    246             }
     241            $(document.body).trigger('update_checkout');
     242            // if ($('#ship-to-different-address-checkbox').is(':checked') == false
     243            //     && !checkNullorEmpty($('#billing_ward').val())
     244            //     && !checkNullorEmpty($('#billing_address_1').val())) {
     245               
     246            // }
    247247        });
    248248    }
     
    251251        $('#billing_ward').change(function () {
    252252            console.log('billing_ward change');
    253             if ($('#ship-to-different-address-checkbox').is(':checked') == false
    254                 && !checkNullorEmpty($('#billing_address_1').val())) {
    255                 $(document.body).trigger('update_checkout');
    256             }
     253            $(document.body).trigger('update_checkout');
     254            // if ($('#ship-to-different-address-checkbox').is(':checked') == false
     255            //     && !checkNullorEmpty($('#billing_address_1').val())) {
     256               
     257            // }
    257258        });
    258259    }
     
    264265            let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces);
    265266            $('#shipping_ward').html('<option></option>').attr('disabled', 'disabled');
    266             html = '<option>' + sd_fe_checkout_params.l10n.select_district + '</option>';
     267            html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>';
    267268            allProvinces.forEach(pro => {
    268269                if (pro.Code == province_code) {
     
    273274            });
    274275            $('#shipping_district').html(html);
    275 
    276             if ($('#ship-to-different-address-checkbox').is(':checked') == true
    277                 && !checkNullorEmpty($('#shipping_district').val())
    278                 && !checkNullorEmpty($('#shipping_ward').val())
    279                 && !checkNullorEmpty($('#shipping_address_1').val())) {
    280                 $(document.body).trigger('update_checkout');
    281             }
     276            $(document.body).trigger('update_checkout');
     277            // if ($('#ship-to-different-address-checkbox').is(':checked') == true
     278            //     && !checkNullorEmpty($('#shipping_district').val())
     279            //     && !checkNullorEmpty($('#shipping_ward').val())
     280            //     && !checkNullorEmpty($('#shipping_address_1').val())) {
     281               
     282            // }
    282283        });
    283284    }
     
    291292            let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces);
    292293            $('#shipping_ward').html('<option></option>').removeAttr('disabled');
    293             html = '<option>' + sd_fe_checkout_params.l10n.select_ward + '</option>';
     294            html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>';
    294295            allProvinces.forEach(pro => {
    295296                if (pro.Code == province_code) {
     
    304305            });
    305306            $('#shipping_ward').html(html).val('');
    306             if ($('#ship-to-different-address-checkbox').is(':checked') == true
    307                 && !checkNullorEmpty($('#shipping_ward').val())
    308                 && !checkNullorEmpty($('#shipping_address_1').val())) {
    309                 $(document.body).trigger('update_checkout');
    310             }
     307            $(document.body).trigger('update_checkout');
     308            // if ($('#ship-to-different-address-checkbox').is(':checked') == true
     309            //     && !checkNullorEmpty($('#shipping_ward').val())
     310            //     && !checkNullorEmpty($('#shipping_address_1').val())) {
     311               
     312            // }
    311313        });
    312314    }
     
    315317        $('#shipping_ward').change(function () {
    316318            console.log('shipping_ward change');
    317             if ($('#ship-to-different-address-checkbox').is(':checked') == true
    318                 && !checkNullorEmpty($('#shipping_address_1').val())) {
    319                 $(document.body).trigger('update_checkout');
    320             }
     319            $(document.body).trigger('update_checkout');
     320            // if ($('#ship-to-different-address-checkbox').is(':checked') == true
     321            //     && !checkNullorEmpty($('#shipping_address_1').val())) {
     322               
     323            // }
    321324        });
    322325    }
  • ship-depot/trunk/page/admin/orders/sd-order-detail.php

    r2963463 r2981538  
    263263        if (!$is_edit || $need_call_update) {
    264264            Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] Call API');
     265            $order_created_date = $order->get_date_created();
     266            Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] order_created_date: ' . print_r($order_created_date, true));
     267            Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] order_created_date string: ' . print_r($order_created_date->__toString(), true));
     268
    265269            $data_input = array(
    266270                "order_id" => $order_id,
    267                 "order_created_date" => Ship_Depot_Helper::ParseObjectToArray($order->get_date_created()), //Order date need parse to array because WC_DateTime object cannot send to API
     271                "order_created_date" => $order_created_date->__toString(),
    268272                "item_total" => $order->get_subtotal(),
    269273                "order_total" => $order->get_total(),
  • ship-depot/trunk/readme.txt

    r2963463 r2981538  
    55Tested up to: 6.3.1
    66Requires PHP: 7.4.3
    7 Stable tag: 1.1.1
     7Stable tag: 1.1.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6565
    6666== Changelog ==
     67
     68= 1.1.2 =
     69* Sửa 1 số lỗi nhỏ
     70
    6771= 1.1.1 =
    6872* Thêm chức năng "Gửi hàng tại điểm giao nhận của Giao hàng nhanh"
Note: See TracChangeset for help on using the changeset viewer.