Plugin Directory

Changeset 3415143


Ignore:
Timestamp:
12/09/2025 09:50:57 AM (2 months ago)
Author:
jneshipping
Message:

Update to 1.2.2

Location:
jne-shipping-official
Files:
9 edited
34 copied

Legend:

Unmodified
Added
Removed
  • jne-shipping-official/tags/1.2.2/admin/includes/class-jne-admin-dashboard.php

    r3399074 r3415143  
    3838    $payment_type = $filters['payment_type'] ?? ''; // 'cod' or 'non_cod' or ''
    3939
     40    // Ensure date_to includes time (end of day)
     41    $date_to_with_time = $date_to . ' 23:59:59';
     42
    4043    // Get all orders in date range with status completed
    4144    $args = [
    4245      'limit' => -1,
    43       'date_created' => $date_from . '...' . $date_to,
     46      'date_created' => strtotime($date_from) . '...' . strtotime($date_to_with_time),
    4447      'status' => 'completed',
    4548      'return' => 'ids'
     
    5760    // Filter orders that use JNE shipping
    5861    $jne_orders = [];
     62    $jne_shipping_method_id = 'jneshof_shipping'; // Use direct string instead of constant
     63   
    5964    foreach ($order_ids as $order_id) {
    6065      $order = wc_get_order($order_id);
     
    6671      $is_jne = false;
    6772      foreach ($order->get_shipping_methods() as $shipping_method) {
    68         if ($shipping_method->get_method_id() === Jneshof_Order_Helper::JNESHOF_SHIPPING_METHOD_ID) {
     73        if ($shipping_method->get_method_id() === $jne_shipping_method_id) {
    6974          $is_jne = true;
    7075          break;
     
    195200      $order_status = $order->get_status();
    196201
    197       // Completed orders
    198       if ($order_status === 'completed') {
    199         $stats['completed_orders']['count']++;
    200         $stats['completed_orders']['total_cost'] += $shipping_cost;
    201       }
     202      // All orders passed to this function are already completed (filtered in get_jne_orders)
     203      // So we count all as completed
     204      $stats['completed_orders']['count']++;
     205      $stats['completed_orders']['total_cost'] += $shipping_cost;
    202206
    203207      // Delivered shipping status
     
    206210        $stats['delivered']['total_cost'] += $shipping_cost;
    207211      } else {
    208         // Not delivered
     212        // Not delivered (includes MENUNGGU PICKUP, SHIPPED, etc.)
    209213        $stats['not_delivered']['count']++;
    210214        $stats['not_delivered']['total_cost'] += $shipping_cost;
  • jne-shipping-official/tags/1.2.2/admin/includes/class-jne-admin-generate-awb.php

    r3411298 r3415143  
    181181
    182182    $products = [];
    183     foreach ($order->getOrderProductItems() as $product) {
     183    foreach ($order->getOrderProductItems() as $item) {
     184      $product = $item->get_product();
     185      $sku = '';
     186      if ($product && method_exists($product, 'get_sku')) {
     187        $sku = $product->get_sku();
     188      }
    184189      $products[] = [
    185         'name' => $product->get_name(),
    186         'qty' => $product->get_quantity()
     190        'name' => $item->get_name(),
     191        'sku' => $sku ?: '',
     192        'qty' => $item->get_quantity()
    187193      ];
    188194    }
  • jne-shipping-official/tags/1.2.2/admin/includes/class-jne-admin-generate-cnote.php

    r3398965 r3415143  
    8787
    8888  /**
     89   * Truncate string to maximum length in bytes
     90   *
     91   * @param string $value
     92   * @param int $max_length Maximum length in bytes
     93   * @return string
     94   */
     95  private function truncate_string($value, $max_length)
     96  {
     97    if (empty($value)) {
     98      return '';
     99    }
     100   
     101    $value = (string) $value;
     102   
     103    // If string is already within limit, return as is
     104    if (strlen($value) <= $max_length) {
     105      return $value;
     106    }
     107   
     108    // Truncate by bytes using mb_strcut which handles multibyte characters correctly
     109    return mb_strcut($value, 0, $max_length, 'UTF-8');
     110  }
     111
     112  /**
    89113   * Summary of generate_tracking_number
    90114   * @return string|null
     
    122146
    123147    $cnote_data = [
    124       'olshop_branch' => $this->storeSettingHelper->getBranchCode(),
     148      'olshop_branch' => $this->truncate_string($this->storeSettingHelper->getBranchCode(), 10),
    125149      'olshop_cod_amount' => $olshop_cod_amount,
    126       'olshop_cod_flag' => $olshop_cod_flag,
    127       'olshop_cust' => $olshop_cust,
    128       'olshop_orderid' => $this->orderHelper->getOrderId(),
    129       'olshop_shipper_name' => $this->storeSettingHelper->getStoreName(),
    130       'olshop_shipper_addr1' => $shipper_address[0] ?? '',
    131       'olshop_shipper_addr2' => $shipper_address[1] ?? $shipper_address[0],
    132       'olshop_shipper_addr3' => $shipper_address[2] ?? '',
    133       'olshop_shipper_city' => $this->storeSettingHelper->getStoreCity(),
    134       'olshop_shipper_region' => $this->storeSettingHelper->getStoreRegion(),
    135       'olshop_shipper_zip' => $this->storeSettingHelper->getStorePostcode(),
    136       'olshop_shipper_phone' => $this->storeSettingHelper->getStorePhone(),
    137       'olshop_receiver_name' => $this->orderHelper->getCustomerShippingName(),
    138       'olshop_receiver_addr1' => $receiver_address[0] ?? '',
    139       'olshop_receiver_addr2' => $receiver_address[1] ?? $receiver_address[0],
    140       'olshop_receiver_addr3' => $receiver_address[2] ?? '',
    141       'olshop_receiver_city' => $this->orderHelper->getCustomerShippingCity(),
    142       'olshop_receiver_region' => $this->orderHelper->getCustomerShippingRegion(),
    143       'olshop_receiver_zip' => $this->orderHelper->getCustomerShippingPostcode(),
    144       'olshop_receiver_phone' => $receiver_phone ?? '',
     150      'olshop_cod_flag' => $this->truncate_string($olshop_cod_flag, 3),
     151      'olshop_cust' => $this->truncate_string($olshop_cust, 10),
     152      'olshop_orderid' => $this->truncate_string($this->orderHelper->getOrderId(), 20),
     153      'olshop_shipper_name' => $this->truncate_string($this->storeSettingHelper->getStoreName(), 30),
     154      'olshop_shipper_addr1' => $this->truncate_string($shipper_address[0] ?? '', 30),
     155      'olshop_shipper_addr2' => $this->truncate_string($shipper_address[1] ?? $shipper_address[0] ?? '', 30),
     156      'olshop_shipper_addr3' => $this->truncate_string($shipper_address[2] ?? '', 30),
     157      'olshop_shipper_city' => $this->truncate_string($this->storeSettingHelper->getStoreCity(), 20),
     158      'olshop_shipper_region' => $this->truncate_string($this->storeSettingHelper->getStoreRegion(), 20),
     159      'olshop_shipper_zip' => $this->truncate_string($this->storeSettingHelper->getStorePostcode(), 5),
     160      'olshop_shipper_phone' => $this->truncate_string($this->storeSettingHelper->getStorePhone(), 15),
     161      'olshop_receiver_name' => $this->truncate_string($this->orderHelper->getCustomerShippingName(), 30),
     162      'olshop_receiver_addr1' => $this->truncate_string($receiver_address[0] ?? '', 30),
     163      'olshop_receiver_addr2' => $this->truncate_string($receiver_address[1] ?? $receiver_address[0] ?? '', 30),
     164      'olshop_receiver_addr3' => $this->truncate_string($receiver_address[2] ?? '', 30),
     165      'olshop_receiver_city' => $this->truncate_string($this->orderHelper->getCustomerShippingCity(), 20),
     166      'olshop_receiver_region' => $this->truncate_string($this->orderHelper->getCustomerShippingRegion(), 20),
     167      'olshop_receiver_zip' => $this->truncate_string($this->orderHelper->getCustomerShippingPostcode(), 5),
     168      'olshop_receiver_phone' => $this->truncate_string($receiver_phone ?? '', 15),
    145169      'olshop_qty' => $this->orderHelper->getOrderTotalQty(),
    146170      'olshop_weight' => $this->orderHelper->getOrderTotalWeight(),
    147       'olshop_goodsdesc' => substr($this->orderHelper->getOrderProductName(), 0, 60),
     171      'olshop_goodsdesc' => $this->truncate_string($this->orderHelper->getOrderProductName(), 60),
    148172      'olshop_goodsvalue' => $this->orderHelper->getOrderProductPrice(),
    149       'olshop_goodstype' => '2',
    150       'olshop_inst' => 'Handle With Care',
    151       'olshop_ins_flag' => $this->storeSettingHelper->getStoreInsuranceEnabled() ? 'Y' : 'N',
    152       'olshop_orig' => $this->storeSettingHelper->getOriginCode(),
    153       'olshop_dest' => $this->orderHelper->getDestinationCodeFilteredByZipcode(),
    154       'olshop_service' => $jneshof_shipping_CODE,
     173      'olshop_goodstype' => $this->truncate_string('2', 1),
     174      'olshop_inst' => $this->truncate_string('Handle With Care', 60),
     175      'olshop_ins_flag' => $this->truncate_string($this->storeSettingHelper->getStoreInsuranceEnabled() ? 'Y' : 'N', 1),
     176      'olshop_orig' => $this->truncate_string($this->storeSettingHelper->getOriginCode(), 10),
     177      'olshop_dest' => $this->truncate_string($this->orderHelper->getDestinationCodeFilteredByZipcode(), 10),
     178      'olshop_service' => $this->truncate_string($jneshof_shipping_CODE, 10),
    155179      'is_multikoli' => 'N',
    156180      'jlc_number' => '',
  • jne-shipping-official/tags/1.2.2/admin/includes/class-jne-admin-shipping-cost-adjustment.php

    r3411310 r3415143  
    254254     
    255255      case 'fixed_subtract':
    256         $adjusted_cost -= $adjustment_value;
     256        // Discount cannot exceed original cost
     257        $discount_amount = min($adjustment_value, $original_cost);
     258        $adjusted_cost -= $discount_amount;
    257259        break;
    258260     
     
    262264     
    263265      case 'percentage_subtract':
    264         $adjusted_cost -= ($original_cost * $adjustment_value / 100);
     266        // Calculate percentage discount, but cap at original cost
     267        $discount_amount = ($original_cost * $adjustment_value / 100);
     268        $discount_amount = min($discount_amount, $original_cost);
     269        $adjusted_cost -= $discount_amount;
    265270        break;
    266271    }
  • jne-shipping-official/tags/1.2.2/admin/includes/class-jne-admin-shipping-method.php

    r3411298 r3415143  
    189189      case 'JTR250':
    190190        return 'JTR 250';
     191      case 'CTC':
     192        return 'REG';
     193      case 'CTCYES':
     194          return 'YES'; 
     195      case 'CTCSPS':
     196        return 'SPS';
    191197      default:
    192198        return $service['service_display'];
  • jne-shipping-official/tags/1.2.2/composer.json

    r3411298 r3415143  
    22    "name": "jne-shipping/jne-shipping-official",
    33    "description": "WordPress plugin integrated with WooCommerce for JNE shipping services",
    4     "version": "1.2.1",
     4    "version": "1.2.2",
    55    "type": "wordpress-plugin",
    66    "license": "GPL-2.0+",
  • jne-shipping-official/tags/1.2.2/jne-shipping-official.php

    r3411298 r3415143  
    2020 * Plugin Name:       JNE Shipping Official
    2121 * Description:       WordPress plugin integrated with WooCommerce for JNE shipping services
    22  * Version:           1.2.1
     22 * Version:           1.2.2
    2323 * Author:            PT. Tiki Jalur Nugraha Ekakurir
    2424 * Author URI:        https://jne.co.id/
     
    4848 * Rename this for your plugin and update it as you release new versions.
    4949 */
    50 define('JNESHOF_PLUGIN_VERSION', '1.2.1');
     50define('JNESHOF_PLUGIN_VERSION', '1.2.2');
    5151
    5252/**
  • jne-shipping-official/tags/1.2.2/public/includes/jne-woocommerce-public-shipping-cost-adjustment.php

    r3411310 r3415143  
    121121     
    122122      case 'fixed_subtract':
    123         $fee_amount = -$adjustment_value; // Negative for discount
     123        // Discount cannot exceed original shipping cost
     124        $discount_amount = min($adjustment_value, $original_shipping_cost);
     125        $fee_amount = -$discount_amount; // Negative for discount
    124126        $fee_label = __('Shipping Cost Discount', 'jne-shipping-official');
    125127        break;
     
    131133     
    132134      case 'percentage_subtract':
    133         $fee_amount = -($original_shipping_cost * $adjustment_value / 100); // Negative for discount
     135        // Calculate percentage discount, but cap at original shipping cost
     136        $discount_amount = ($original_shipping_cost * $adjustment_value / 100);
     137        $discount_amount = min($discount_amount, $original_shipping_cost);
     138        $fee_amount = -$discount_amount; // Negative for discount
    134139        $fee_label = __('Shipping Cost Discount', 'jne-shipping-official');
    135140        break;
  • jne-shipping-official/tags/1.2.2/readme.txt

    r3411298 r3415143  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.2.1
     8Stable tag: 1.2.2
    99License: GPL-2.0+
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    9090
    9191== Changelog ==
     92
     93= 1.2.2 =
     94* Fixed: Changed CTC service label to REG for better clarity
     95* Fixed: Dashboard calculation issues - improved date range filtering and shipping method detection
     96* Fixed: SKU field now displays correctly in shipping labels (was showing N/A)
     97* Fixed: Added validation to check if order has tracking number before requesting pickup
     98* Improved: Dashboard query performance and accuracy for order filtering
    9299
    93100= 1.2.1 =
     
    181188== Upgrade Notice ==
    182189
     190= 1.2.2 =
     191Bug fixes and improvements: Fixed CTC service labeling (now displays as REG), improved dashboard calculations, fixed SKU display in shipping labels, and added pickup request validation. Recommended for all users.
     192
    183193= 1.1.0 =
    184194Major update: Added comprehensive JNE Shipping Dashboard with analytics including Shipping Status Statistics, Aging Shipment tracking, Shipping Cost Statistics, Top Destinations, and Top JNE Services. Includes date range and payment type filters. Dashboard provides valuable insights into your shipping operations. Recommended for all users.
  • jne-shipping-official/trunk/admin/includes/class-jne-admin-dashboard.php

    r3399074 r3415143  
    3838    $payment_type = $filters['payment_type'] ?? ''; // 'cod' or 'non_cod' or ''
    3939
     40    // Ensure date_to includes time (end of day)
     41    $date_to_with_time = $date_to . ' 23:59:59';
     42
    4043    // Get all orders in date range with status completed
    4144    $args = [
    4245      'limit' => -1,
    43       'date_created' => $date_from . '...' . $date_to,
     46      'date_created' => strtotime($date_from) . '...' . strtotime($date_to_with_time),
    4447      'status' => 'completed',
    4548      'return' => 'ids'
     
    5760    // Filter orders that use JNE shipping
    5861    $jne_orders = [];
     62    $jne_shipping_method_id = 'jneshof_shipping'; // Use direct string instead of constant
     63   
    5964    foreach ($order_ids as $order_id) {
    6065      $order = wc_get_order($order_id);
     
    6671      $is_jne = false;
    6772      foreach ($order->get_shipping_methods() as $shipping_method) {
    68         if ($shipping_method->get_method_id() === Jneshof_Order_Helper::JNESHOF_SHIPPING_METHOD_ID) {
     73        if ($shipping_method->get_method_id() === $jne_shipping_method_id) {
    6974          $is_jne = true;
    7075          break;
     
    195200      $order_status = $order->get_status();
    196201
    197       // Completed orders
    198       if ($order_status === 'completed') {
    199         $stats['completed_orders']['count']++;
    200         $stats['completed_orders']['total_cost'] += $shipping_cost;
    201       }
     202      // All orders passed to this function are already completed (filtered in get_jne_orders)
     203      // So we count all as completed
     204      $stats['completed_orders']['count']++;
     205      $stats['completed_orders']['total_cost'] += $shipping_cost;
    202206
    203207      // Delivered shipping status
     
    206210        $stats['delivered']['total_cost'] += $shipping_cost;
    207211      } else {
    208         // Not delivered
     212        // Not delivered (includes MENUNGGU PICKUP, SHIPPED, etc.)
    209213        $stats['not_delivered']['count']++;
    210214        $stats['not_delivered']['total_cost'] += $shipping_cost;
  • jne-shipping-official/trunk/admin/includes/class-jne-admin-generate-awb.php

    r3411298 r3415143  
    181181
    182182    $products = [];
    183     foreach ($order->getOrderProductItems() as $product) {
     183    foreach ($order->getOrderProductItems() as $item) {
     184      $product = $item->get_product();
     185      $sku = '';
     186      if ($product && method_exists($product, 'get_sku')) {
     187        $sku = $product->get_sku();
     188      }
    184189      $products[] = [
    185         'name' => $product->get_name(),
    186         'qty' => $product->get_quantity()
     190        'name' => $item->get_name(),
     191        'sku' => $sku ?: '',
     192        'qty' => $item->get_quantity()
    187193      ];
    188194    }
  • jne-shipping-official/trunk/admin/includes/class-jne-admin-generate-cnote.php

    r3398965 r3415143  
    8787
    8888  /**
     89   * Truncate string to maximum length in bytes
     90   *
     91   * @param string $value
     92   * @param int $max_length Maximum length in bytes
     93   * @return string
     94   */
     95  private function truncate_string($value, $max_length)
     96  {
     97    if (empty($value)) {
     98      return '';
     99    }
     100   
     101    $value = (string) $value;
     102   
     103    // If string is already within limit, return as is
     104    if (strlen($value) <= $max_length) {
     105      return $value;
     106    }
     107   
     108    // Truncate by bytes using mb_strcut which handles multibyte characters correctly
     109    return mb_strcut($value, 0, $max_length, 'UTF-8');
     110  }
     111
     112  /**
    89113   * Summary of generate_tracking_number
    90114   * @return string|null
     
    122146
    123147    $cnote_data = [
    124       'olshop_branch' => $this->storeSettingHelper->getBranchCode(),
     148      'olshop_branch' => $this->truncate_string($this->storeSettingHelper->getBranchCode(), 10),
    125149      'olshop_cod_amount' => $olshop_cod_amount,
    126       'olshop_cod_flag' => $olshop_cod_flag,
    127       'olshop_cust' => $olshop_cust,
    128       'olshop_orderid' => $this->orderHelper->getOrderId(),
    129       'olshop_shipper_name' => $this->storeSettingHelper->getStoreName(),
    130       'olshop_shipper_addr1' => $shipper_address[0] ?? '',
    131       'olshop_shipper_addr2' => $shipper_address[1] ?? $shipper_address[0],
    132       'olshop_shipper_addr3' => $shipper_address[2] ?? '',
    133       'olshop_shipper_city' => $this->storeSettingHelper->getStoreCity(),
    134       'olshop_shipper_region' => $this->storeSettingHelper->getStoreRegion(),
    135       'olshop_shipper_zip' => $this->storeSettingHelper->getStorePostcode(),
    136       'olshop_shipper_phone' => $this->storeSettingHelper->getStorePhone(),
    137       'olshop_receiver_name' => $this->orderHelper->getCustomerShippingName(),
    138       'olshop_receiver_addr1' => $receiver_address[0] ?? '',
    139       'olshop_receiver_addr2' => $receiver_address[1] ?? $receiver_address[0],
    140       'olshop_receiver_addr3' => $receiver_address[2] ?? '',
    141       'olshop_receiver_city' => $this->orderHelper->getCustomerShippingCity(),
    142       'olshop_receiver_region' => $this->orderHelper->getCustomerShippingRegion(),
    143       'olshop_receiver_zip' => $this->orderHelper->getCustomerShippingPostcode(),
    144       'olshop_receiver_phone' => $receiver_phone ?? '',
     150      'olshop_cod_flag' => $this->truncate_string($olshop_cod_flag, 3),
     151      'olshop_cust' => $this->truncate_string($olshop_cust, 10),
     152      'olshop_orderid' => $this->truncate_string($this->orderHelper->getOrderId(), 20),
     153      'olshop_shipper_name' => $this->truncate_string($this->storeSettingHelper->getStoreName(), 30),
     154      'olshop_shipper_addr1' => $this->truncate_string($shipper_address[0] ?? '', 30),
     155      'olshop_shipper_addr2' => $this->truncate_string($shipper_address[1] ?? $shipper_address[0] ?? '', 30),
     156      'olshop_shipper_addr3' => $this->truncate_string($shipper_address[2] ?? '', 30),
     157      'olshop_shipper_city' => $this->truncate_string($this->storeSettingHelper->getStoreCity(), 20),
     158      'olshop_shipper_region' => $this->truncate_string($this->storeSettingHelper->getStoreRegion(), 20),
     159      'olshop_shipper_zip' => $this->truncate_string($this->storeSettingHelper->getStorePostcode(), 5),
     160      'olshop_shipper_phone' => $this->truncate_string($this->storeSettingHelper->getStorePhone(), 15),
     161      'olshop_receiver_name' => $this->truncate_string($this->orderHelper->getCustomerShippingName(), 30),
     162      'olshop_receiver_addr1' => $this->truncate_string($receiver_address[0] ?? '', 30),
     163      'olshop_receiver_addr2' => $this->truncate_string($receiver_address[1] ?? $receiver_address[0] ?? '', 30),
     164      'olshop_receiver_addr3' => $this->truncate_string($receiver_address[2] ?? '', 30),
     165      'olshop_receiver_city' => $this->truncate_string($this->orderHelper->getCustomerShippingCity(), 20),
     166      'olshop_receiver_region' => $this->truncate_string($this->orderHelper->getCustomerShippingRegion(), 20),
     167      'olshop_receiver_zip' => $this->truncate_string($this->orderHelper->getCustomerShippingPostcode(), 5),
     168      'olshop_receiver_phone' => $this->truncate_string($receiver_phone ?? '', 15),
    145169      'olshop_qty' => $this->orderHelper->getOrderTotalQty(),
    146170      'olshop_weight' => $this->orderHelper->getOrderTotalWeight(),
    147       'olshop_goodsdesc' => substr($this->orderHelper->getOrderProductName(), 0, 60),
     171      'olshop_goodsdesc' => $this->truncate_string($this->orderHelper->getOrderProductName(), 60),
    148172      'olshop_goodsvalue' => $this->orderHelper->getOrderProductPrice(),
    149       'olshop_goodstype' => '2',
    150       'olshop_inst' => 'Handle With Care',
    151       'olshop_ins_flag' => $this->storeSettingHelper->getStoreInsuranceEnabled() ? 'Y' : 'N',
    152       'olshop_orig' => $this->storeSettingHelper->getOriginCode(),
    153       'olshop_dest' => $this->orderHelper->getDestinationCodeFilteredByZipcode(),
    154       'olshop_service' => $jneshof_shipping_CODE,
     173      'olshop_goodstype' => $this->truncate_string('2', 1),
     174      'olshop_inst' => $this->truncate_string('Handle With Care', 60),
     175      'olshop_ins_flag' => $this->truncate_string($this->storeSettingHelper->getStoreInsuranceEnabled() ? 'Y' : 'N', 1),
     176      'olshop_orig' => $this->truncate_string($this->storeSettingHelper->getOriginCode(), 10),
     177      'olshop_dest' => $this->truncate_string($this->orderHelper->getDestinationCodeFilteredByZipcode(), 10),
     178      'olshop_service' => $this->truncate_string($jneshof_shipping_CODE, 10),
    155179      'is_multikoli' => 'N',
    156180      'jlc_number' => '',
  • jne-shipping-official/trunk/admin/includes/class-jne-admin-shipping-cost-adjustment.php

    r3411310 r3415143  
    254254     
    255255      case 'fixed_subtract':
    256         $adjusted_cost -= $adjustment_value;
     256        // Discount cannot exceed original cost
     257        $discount_amount = min($adjustment_value, $original_cost);
     258        $adjusted_cost -= $discount_amount;
    257259        break;
    258260     
     
    262264     
    263265      case 'percentage_subtract':
    264         $adjusted_cost -= ($original_cost * $adjustment_value / 100);
     266        // Calculate percentage discount, but cap at original cost
     267        $discount_amount = ($original_cost * $adjustment_value / 100);
     268        $discount_amount = min($discount_amount, $original_cost);
     269        $adjusted_cost -= $discount_amount;
    265270        break;
    266271    }
  • jne-shipping-official/trunk/admin/includes/class-jne-admin-shipping-method.php

    r3411298 r3415143  
    189189      case 'JTR250':
    190190        return 'JTR 250';
     191      case 'CTC':
     192        return 'REG';
     193      case 'CTCYES':
     194          return 'YES'; 
     195      case 'CTCSPS':
     196        return 'SPS';
    191197      default:
    192198        return $service['service_display'];
  • jne-shipping-official/trunk/composer.json

    r3411298 r3415143  
    22    "name": "jne-shipping/jne-shipping-official",
    33    "description": "WordPress plugin integrated with WooCommerce for JNE shipping services",
    4     "version": "1.2.1",
     4    "version": "1.2.2",
    55    "type": "wordpress-plugin",
    66    "license": "GPL-2.0+",
  • jne-shipping-official/trunk/jne-shipping-official.php

    r3411298 r3415143  
    2020 * Plugin Name:       JNE Shipping Official
    2121 * Description:       WordPress plugin integrated with WooCommerce for JNE shipping services
    22  * Version:           1.2.1
     22 * Version:           1.2.2
    2323 * Author:            PT. Tiki Jalur Nugraha Ekakurir
    2424 * Author URI:        https://jne.co.id/
     
    4848 * Rename this for your plugin and update it as you release new versions.
    4949 */
    50 define('JNESHOF_PLUGIN_VERSION', '1.2.1');
     50define('JNESHOF_PLUGIN_VERSION', '1.2.2');
    5151
    5252/**
  • jne-shipping-official/trunk/public/includes/jne-woocommerce-public-shipping-cost-adjustment.php

    r3411310 r3415143  
    121121     
    122122      case 'fixed_subtract':
    123         $fee_amount = -$adjustment_value; // Negative for discount
     123        // Discount cannot exceed original shipping cost
     124        $discount_amount = min($adjustment_value, $original_shipping_cost);
     125        $fee_amount = -$discount_amount; // Negative for discount
    124126        $fee_label = __('Shipping Cost Discount', 'jne-shipping-official');
    125127        break;
     
    131133     
    132134      case 'percentage_subtract':
    133         $fee_amount = -($original_shipping_cost * $adjustment_value / 100); // Negative for discount
     135        // Calculate percentage discount, but cap at original shipping cost
     136        $discount_amount = ($original_shipping_cost * $adjustment_value / 100);
     137        $discount_amount = min($discount_amount, $original_shipping_cost);
     138        $fee_amount = -$discount_amount; // Negative for discount
    134139        $fee_label = __('Shipping Cost Discount', 'jne-shipping-official');
    135140        break;
  • jne-shipping-official/trunk/readme.txt

    r3411298 r3415143  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.2.1
     8Stable tag: 1.2.2
    99License: GPL-2.0+
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    9090
    9191== Changelog ==
     92
     93= 1.2.2 =
     94* Fixed: Changed CTC service label to REG for better clarity
     95* Fixed: Dashboard calculation issues - improved date range filtering and shipping method detection
     96* Fixed: SKU field now displays correctly in shipping labels (was showing N/A)
     97* Fixed: Added validation to check if order has tracking number before requesting pickup
     98* Improved: Dashboard query performance and accuracy for order filtering
    9299
    93100= 1.2.1 =
     
    181188== Upgrade Notice ==
    182189
     190= 1.2.2 =
     191Bug fixes and improvements: Fixed CTC service labeling (now displays as REG), improved dashboard calculations, fixed SKU display in shipping labels, and added pickup request validation. Recommended for all users.
     192
    183193= 1.1.0 =
    184194Major update: Added comprehensive JNE Shipping Dashboard with analytics including Shipping Status Statistics, Aging Shipment tracking, Shipping Cost Statistics, Top Destinations, and Top JNE Services. Includes date range and payment type filters. Dashboard provides valuable insights into your shipping operations. Recommended for all users.
Note: See TracChangeset for help on using the changeset viewer.