Plugin Directory

Changeset 2702735


Ignore:
Timestamp:
03/31/2022 02:04:46 PM (4 years ago)
Author:
shindhl
Message:

Release 2.0.4

  • Updated tracking url for Belgium
  • Updated product-based automatic mailbox selection to work with areas where mailbox delivery is not available when used with bulk actions
  • Fixed an issue where product-based automatic mailbox selection is being applied to sequential orders when used in a bulk action
Location:
dhlpwc
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • dhlpwc/tags/2.0.4/README.md

    r2698318 r2702735  
    11# DHL Parcel for WooCommerce
     2 
     3v2.0.4
     4## Changes
     5- Updated tracking url for Belgium
     6- Updated product-based automatic mailbox selection to work with areas where mailbox delivery is not available when used with bulk actions
     7- Fixed an issue where product-based automatic mailbox selection is being applied to sequential orders when used in a bulk action
    28 
    39v2.0.3
  • dhlpwc/tags/2.0.4/dhlpwoocommerce.php

    r2698318 r2702735  
    55 * Description:          This is the official DHL Parcel for WooCommerce plugin.
    66 * Author:               DHL Parcel
    7  * Version:              2.0.3
     7 * Version:              2.0.4
    88 * Requires at least:    4.7.16
    99 * Tested up to:         5.9
  • dhlpwc/tags/2.0.4/includes/controller/class-dhlpwc-controller-mail.php

    r2688414 r2702735  
    7676        $postcode = $service->get_postcode_from_order($order->get_id());
    7777
     78        $service = DHLPWC_Model_Service_Order_Meta::instance();
     79        $country_code = $service->get_country_code($order->get_id());
     80
    7881        $service = DHLPWC_Model_Service_Track_Trace::instance();
    7982        $tracking_codes = $service->get_track_trace_from_order($order->get_id());
     
    8386        foreach($tracking_codes as $tracking_code) {
    8487            $tracking_codeset = array();
    85             $tracking_codeset['url'] = $service->get_url($tracking_code, $postcode, $locale);
     88            $tracking_codeset['url'] = $service->get_url($tracking_code, $postcode, $locale, $country_code);
    8689            $tracking_codeset['code'] = $tracking_code;
    8790            $tracking_codesets[] = $tracking_codeset;
  • dhlpwc/tags/2.0.4/includes/model/service/class-dhlpwc-model-service-label-metabox.php

    r2688414 r2702735  
    294294        $postcode = $service->get_postcode_from_order($post_id);
    295295
     296        $service = DHLPWC_Model_Service_Order_Meta::instance();
     297        $country_code = $service->get_country_code($post_id);
     298
    296299        $service = DHLPWC_Model_Service_Track_Trace::instance();
    297         $tracking_url = $service->get_url($label['tracker_code'], $postcode, $locale);
     300        $tracking_url = $service->get_url($label['tracker_code'], $postcode, $locale, $country_code);
    298301
    299302        $service = DHLPWC_Model_Service_Access_Control::instance();
  • dhlpwc/tags/2.0.4/includes/model/service/class-dhlpwc-model-service-order-meta.php

    r2688414 r2702735  
    4646    }
    4747
     48    public function get_country_code($order_id)
     49    {
     50        $order = wc_get_order($order_id);
     51        $address = $order->get_address('shipping') ?: $order->get_address();
     52        return strtoupper($address['country']);
     53    }
    4854}
    4955
  • dhlpwc/tags/2.0.4/includes/model/service/class-dhlpwc-model-service-shipment.php

    r2688414 r2702735  
    211211
    212212        foreach ($order_ids as $order_id) {
     213            $selected_size = $bulk_size;
    213214
    214215            // Generate to business option
     
    227228            if ($option_service->send_with_bp($order_id)) {
    228229                // Simulate bp_only print when eligible for BP
    229                 $bulk_size = 'bp_only';
     230                $service = DHLPWC_Model_Service_Access_Control::instance();
     231                $sizes = $service->check(DHLPWC_Model_Service_Access_Control::ACCESS_CAPABILITY_PARCELTYPE, array(
     232                    'order_id' => $order_id,
     233                    'options' => [DHLPWC_Model_Meta_Order_Option_Preference::OPTION_BP],
     234                    'to_business' => $to_business,
     235                ));
     236
     237                if (!empty($sizes)) {
     238                    $selected_size = 'bp_only';
     239                }
    230240            }
    231241
     
    233243            if (!in_array(DHLPWC_Model_Meta_Order_Option_Preference::OPTION_PS, $preset_options)) {
    234244                // BP preference
    235                 if ($bulk_size === 'bp_only') {
     245                if ($selected_size === 'bp_only') {
    236246                    if ( in_array(DHLPWC_Model_Meta_Order_Option_Preference::OPTION_DOOR, $preset_options)) {
    237247                        // Remove DOOR
     
    314324            } else {
    315325                $label_size = null;
    316                 switch($bulk_size) {
     326                switch($selected_size) {
    317327                    case 'bp_only':
    318328                    case 'smallest':
  • dhlpwc/tags/2.0.4/includes/model/service/class-dhlpwc-model-service-track-trace.php

    r2688414 r2702735  
    1212    const QUERY_LANDCODE = 'lc';
    1313
     14    protected $url_be = 'https://www.dhlparcel.be/nl/particulieren/volg-je-zending';
    1415    protected $url = 'https://www.dhlparcel.nl/nl/volg-uw-zending-0';
    1516
    16     public function get_url($tracking_code = null, $postcode = null, $locale = null)
     17    public function get_url($tracking_code = null, $postcode = null, $locale = null, $country_code = null)
    1718    {
    1819        $query_args = array();
     
    2930        }
    3031
    31         return add_query_arg($query_args, $this->url);
     32        $tracking_url = $this->url;
     33        if ($country_code === 'BE') {
     34            $tracking_url = $this->url_be;
     35        }
     36
     37        return add_query_arg($query_args, $tracking_url);
    3238    }
    3339
  • dhlpwc/tags/2.0.4/readme.txt

    r2698318 r2702735  
    55Requires PHP:         5.6
    66Tested up to:         5.9
    7 Stable tag:           2.0.3
     7Stable tag:           2.0.4
    88WC requires at least: 3.0.0
    99WC tested up to:      5.3.0
     
    5353
    5454== Changelog ==
     55 
     56= 2.0.4 =
     57- Updated tracking url for Belgium
     58- Updated product-based automatic mailbox selection to work with areas where mailbox delivery is not available when used with bulk actions
     59- Fixed an issue where product-based automatic mailbox selection is being applied to sequential orders when used in a bulk action
    5560 
    5661= 2.0.3 =
  • dhlpwc/trunk/README.md

    r2698318 r2702735  
    11# DHL Parcel for WooCommerce
     2 
     3v2.0.4
     4## Changes
     5- Updated tracking url for Belgium
     6- Updated product-based automatic mailbox selection to work with areas where mailbox delivery is not available when used with bulk actions
     7- Fixed an issue where product-based automatic mailbox selection is being applied to sequential orders when used in a bulk action
    28 
    39v2.0.3
  • dhlpwc/trunk/dhlpwoocommerce.php

    r2698318 r2702735  
    55 * Description:          This is the official DHL Parcel for WooCommerce plugin.
    66 * Author:               DHL Parcel
    7  * Version:              2.0.3
     7 * Version:              2.0.4
    88 * Requires at least:    4.7.16
    99 * Tested up to:         5.9
  • dhlpwc/trunk/includes/controller/class-dhlpwc-controller-mail.php

    r2688414 r2702735  
    7676        $postcode = $service->get_postcode_from_order($order->get_id());
    7777
     78        $service = DHLPWC_Model_Service_Order_Meta::instance();
     79        $country_code = $service->get_country_code($order->get_id());
     80
    7881        $service = DHLPWC_Model_Service_Track_Trace::instance();
    7982        $tracking_codes = $service->get_track_trace_from_order($order->get_id());
     
    8386        foreach($tracking_codes as $tracking_code) {
    8487            $tracking_codeset = array();
    85             $tracking_codeset['url'] = $service->get_url($tracking_code, $postcode, $locale);
     88            $tracking_codeset['url'] = $service->get_url($tracking_code, $postcode, $locale, $country_code);
    8689            $tracking_codeset['code'] = $tracking_code;
    8790            $tracking_codesets[] = $tracking_codeset;
  • dhlpwc/trunk/includes/model/service/class-dhlpwc-model-service-label-metabox.php

    r2688414 r2702735  
    294294        $postcode = $service->get_postcode_from_order($post_id);
    295295
     296        $service = DHLPWC_Model_Service_Order_Meta::instance();
     297        $country_code = $service->get_country_code($post_id);
     298
    296299        $service = DHLPWC_Model_Service_Track_Trace::instance();
    297         $tracking_url = $service->get_url($label['tracker_code'], $postcode, $locale);
     300        $tracking_url = $service->get_url($label['tracker_code'], $postcode, $locale, $country_code);
    298301
    299302        $service = DHLPWC_Model_Service_Access_Control::instance();
  • dhlpwc/trunk/includes/model/service/class-dhlpwc-model-service-order-meta.php

    r2688414 r2702735  
    4646    }
    4747
     48    public function get_country_code($order_id)
     49    {
     50        $order = wc_get_order($order_id);
     51        $address = $order->get_address('shipping') ?: $order->get_address();
     52        return strtoupper($address['country']);
     53    }
    4854}
    4955
  • dhlpwc/trunk/includes/model/service/class-dhlpwc-model-service-shipment.php

    r2688414 r2702735  
    211211
    212212        foreach ($order_ids as $order_id) {
     213            $selected_size = $bulk_size;
    213214
    214215            // Generate to business option
     
    227228            if ($option_service->send_with_bp($order_id)) {
    228229                // Simulate bp_only print when eligible for BP
    229                 $bulk_size = 'bp_only';
     230                $service = DHLPWC_Model_Service_Access_Control::instance();
     231                $sizes = $service->check(DHLPWC_Model_Service_Access_Control::ACCESS_CAPABILITY_PARCELTYPE, array(
     232                    'order_id' => $order_id,
     233                    'options' => [DHLPWC_Model_Meta_Order_Option_Preference::OPTION_BP],
     234                    'to_business' => $to_business,
     235                ));
     236
     237                if (!empty($sizes)) {
     238                    $selected_size = 'bp_only';
     239                }
    230240            }
    231241
     
    233243            if (!in_array(DHLPWC_Model_Meta_Order_Option_Preference::OPTION_PS, $preset_options)) {
    234244                // BP preference
    235                 if ($bulk_size === 'bp_only') {
     245                if ($selected_size === 'bp_only') {
    236246                    if ( in_array(DHLPWC_Model_Meta_Order_Option_Preference::OPTION_DOOR, $preset_options)) {
    237247                        // Remove DOOR
     
    314324            } else {
    315325                $label_size = null;
    316                 switch($bulk_size) {
     326                switch($selected_size) {
    317327                    case 'bp_only':
    318328                    case 'smallest':
  • dhlpwc/trunk/includes/model/service/class-dhlpwc-model-service-track-trace.php

    r2688414 r2702735  
    1212    const QUERY_LANDCODE = 'lc';
    1313
     14    protected $url_be = 'https://www.dhlparcel.be/nl/particulieren/volg-je-zending';
    1415    protected $url = 'https://www.dhlparcel.nl/nl/volg-uw-zending-0';
    1516
    16     public function get_url($tracking_code = null, $postcode = null, $locale = null)
     17    public function get_url($tracking_code = null, $postcode = null, $locale = null, $country_code = null)
    1718    {
    1819        $query_args = array();
     
    2930        }
    3031
    31         return add_query_arg($query_args, $this->url);
     32        $tracking_url = $this->url;
     33        if ($country_code === 'BE') {
     34            $tracking_url = $this->url_be;
     35        }
     36
     37        return add_query_arg($query_args, $tracking_url);
    3238    }
    3339
  • dhlpwc/trunk/readme.txt

    r2698318 r2702735  
    55Requires PHP:         5.6
    66Tested up to:         5.9
    7 Stable tag:           2.0.3
     7Stable tag:           2.0.4
    88WC requires at least: 3.0.0
    99WC tested up to:      5.3.0
     
    5353
    5454== Changelog ==
     55 
     56= 2.0.4 =
     57- Updated tracking url for Belgium
     58- Updated product-based automatic mailbox selection to work with areas where mailbox delivery is not available when used with bulk actions
     59- Fixed an issue where product-based automatic mailbox selection is being applied to sequential orders when used in a bulk action
    5560 
    5661= 2.0.3 =
Note: See TracChangeset for help on using the changeset viewer.