Changeset 3087389
- Timestamp:
- 05/16/2024 01:44:57 AM (23 months ago)
- Location:
- jt-express/trunk
- Files:
-
- 5 edited
-
admin/class-jnt-admin.php (modified) (1 diff)
-
admin/class-jnt-thermal.php (modified) (2 diffs)
-
includes/class-jnt-api.php (modified) (1 diff)
-
includes/class-jnt-helper.php (modified) (1 diff)
-
jnt.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jt-express/trunk/admin/class-jnt-admin.php
r2998619 r3087389 26 26 $plugins = get_plugins(); 27 27 $current_version = $plugins[$plugin_slug]['Version']; 28 $latest_version = '2.0. 7';28 $latest_version = '2.0.10'; 29 29 30 30 if (version_compare($current_version, $latest_version, '<')) { -
jt-express/trunk/admin/class-jnt-thermal.php
r2415591 r3087389 1 1 <?php 2 3 class Jnt_Thermal { 2 3 class Jnt_Thermal 4 { 4 5 5 6 public $jnt_helper = null; 6 7 7 public function __construct() { 8 public function __construct() 9 { 8 10 9 11 $this->jnt_helper = new Jnt_Helper(); 10 12 $this->define_hooks(); 11 12 13 } 13 14 14 15 /** 15 * Define hooks 16 */ 17 protected function define_hooks() { 16 * Define hooks 17 */ 18 protected function define_hooks() 19 { 18 20 19 add_filter( 'bulk_actions-edit-shop_order', [ $this, 'bulk_actions_consignment_note_thermal' ], 30 ); 20 add_filter( 'handle_bulk_actions-edit-shop_order', [$this, 'handle_bulk_action_consignment_note_thermal'], 10, 3 ); 21 21 add_filter('bulk_actions-woocommerce_page_wc-orders', [$this, 'bulk_actions_consignment_note_thermal'], 30); 22 add_filter('handle_bulk_actions-edit-shop_order', [$this, 'handle_bulk_action_consignment_note_thermal'], 10, 3); 23 24 add_filter('bulk_actions-edit-shop_order', [$this, 'bulk_actions_consignment_note_thermal'], 30); 25 add_filter('handle_bulk_actions-edit-shop_order', [$this, 'handle_bulk_action_consignment_note_thermal'], 10, 3); 22 26 } 23 27 24 public function bulk_actions_consignment_note_thermal ( $actions ) { 28 public function bulk_actions_consignment_note_thermal($actions) 29 { 25 30 26 $actions['jnt_consignment_note_thermal'] = __( 'Print J&T Consignment Note (Thermal)');31 $actions['jnt_consignment_note_thermal'] = __('Print J&T Consignment Note (Thermal)'); 27 32 28 33 return $actions; 29 34 } 30 35 31 public function handle_bulk_action_consignment_note_thermal ( $redirect_to, $action, $post_ids ) { 36 public function handle_bulk_action_consignment_note_thermal($redirect_to, $action, $post_ids) 37 { 32 38 33 if ( $action !== 'jnt_consignment_note_thermal') {39 if ($action !== 'jnt_consignment_note_thermal') { 34 40 return $redirect_to; 35 41 } … … 38 44 $empty_awb = array(); 39 45 40 foreach ( $post_ids as $post_id) {41 if ( ! get_post_meta( $post_id, 'jtawb', true ) ) {42 $empty_awb[] = $post_id;43 } else{44 $processed_ids[] = get_post_meta( $post_id, 'jtawb', true );46 foreach ($post_ids as $post_id) { 47 $order = wc_get_order($post_id); 48 if (!$order->get_meta('jtawb')) { 49 } else { 50 $processed_ids[] = $post_id; 45 51 } 46 }52 } 47 53 48 if ( ! empty( $processed_ids )) {54 if (!empty($processed_ids)) { 49 55 $result = $this->jnt_helper->process_print_thermal($processed_ids); 56 } else { 50 57 51 }else{ 52 53 $redirect_to = add_query_arg( array( 58 $redirect_to = add_query_arg(array( 54 59 'acti' => 'error', 55 60 'msg' => 'Not yet Order', 56 ), $redirect_to );61 ), $redirect_to); 57 62 58 63 return $redirect_to; 59 64 } 60 61 65 } 62 63 66 } -
jt-express/trunk/includes/class-jnt-api.php
r2998619 r3087389 121 121 $result = wp_remote_post($url, array('body' => $post)); 122 122 header('Content-Type: application/pdf'); 123 print_r(wp_remote_retrieve_body($result)); 123 echo wp_remote_retrieve_body($result); 124 exit; 124 125 } 125 126 -
jt-express/trunk/includes/class-jnt-helper.php
r3059538 r3087389 119 119 } 120 120 121 public function process_print_thermal($ awbs)121 public function process_print_thermal($ids) 122 122 { 123 123 $awbs = array(); 124 124 $setting = get_option('woocommerce_jnt_settings'); 125 125 $cuscode = $setting['vipcode']; 126 $awbs = implode(",", $awbs); 126 foreach ($ids as $key => $id) { 127 $order = wc_get_order($id); 128 $awbs[] = $order->get_meta('jtawb'); 129 } 130 $awb = implode(",", $awbs); 127 131 128 $this->jnt_api->print($cuscode, $awb s);132 $this->jnt_api->print($cuscode, $awb); 129 133 } 130 134 -
jt-express/trunk/jnt.php
r3059538 r3087389 5 5 Description: WooCommerce integration for J&T Express Malaysia. 6 6 Author: woocs 7 Version: 2.0. 97 Version: 2.0.10 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt … … 14 14 } 15 15 16 define('JNT_VERSION', '2.0. 7');16 define('JNT_VERSION', '2.0.10'); 17 17 define('JNT_PLUGIN_DIR', plugin_dir_path(__FILE__)); 18 18
Note: See TracChangeset
for help on using the changeset viewer.