Changeset 3228676
- Timestamp:
- 01/26/2025 08:45:28 AM (14 months ago)
- Location:
- hfd-epost-integration/trunk
- Files:
-
- 4 edited
-
class/App.php (modified) (6 diffs)
-
class/Setting.php (modified) (1 diff)
-
hfd-woocommerce-epost.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hfd-epost-integration/trunk/class/App.php
r3227946 r3228676 66 66 add_filter( 'admin_init', array( $this, 'flushRewriteUrls' ) ); 67 67 68 //render wc_get_orders query69 add_filter( 'woocommerce_order_data_store_cpt_get_orders_query', array( $this, 'hfd_handle_order_custom_query_vars' ), 10, 2 );70 71 68 //add wordpress ron for auto sync 72 69 add_filter( 'cron_schedules', array( $this, 'hfdAutoSyncOrderCron' ) ); … … 78 75 wp_schedule_event( time(), 'hfd_auto_sync', 'hfd_schedule_auto_sync' ); 79 76 } 80 77 78 //update plugin settings if its not saved 79 add_action( 'plugins_loaded', array( $this, 'hfdUpdatePluginsOptions' ) ); 80 81 81 //action for gutenberg 82 82 if( $this->is_block_checkout() && !is_admin() ){ … … 90 90 add_action( 'wp_ajax_hfd_get_additional_data', array( $this, 'hfdRenderAdditionalData' ) ); 91 91 add_action( 'wp_ajax_nopriv_hfd_get_additional_data', array( $this, 'hfdRenderAdditionalData' ) ); 92 93 //update plugin settings if its not saved 94 add_action( 'plugins_loaded', array( $this, 'hfdUpdatePluginsOptions' ) ); 95 96 //update option on plugin upgrade 97 add_action( 'upgrader_process_complete', array( $this, 'hfd_run_on_plugin_update' ), 10, 2 ); 98 } 99 100 public function hfd_run_on_plugin_update( $upgrader_object, $options ){ 101 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ){ 102 // Iterate through the plugins being updated and check if ours is there 103 if( $options['plugins'] ){ 104 foreach( $options['plugins'] as $plugin ){ 105 if( $plugin == HFD_EPOST_PLUGIN_FILE ){ 106 $this->hfdUpdatePluginsOptions(); 107 } 108 } 109 } 110 } 111 } 112 113 public function hfd_handle_order_custom_query_vars( $query, $query_vars ){ 114 if( isset( $query_vars['hfd_cron'] ) && ! empty( $query_vars['hfd_cron'] ) ){ 115 $query['meta_query'][] = array( 116 'key' => 'hfd_ship_number', 117 'compare' => 'NOT EXISTS', 118 ); 119 $query['meta_query'][] = array( 120 'key' => 'hfd_sync_flag', 121 'compare' => 'NOT EXISTS', 122 ); 123 } 124 125 return $query; 126 } 92 } 127 93 128 94 public function is_block_checkout(){ … … 147 113 $hfd_epost_service_url = get_option( 'betanet_epost_service_url' ); 148 114 if( strpos( $hfd_epost_service_url, "http://" ) !== false || empty( $hfd_epost_service_url ) ){ 149 update_option( 'betanet_epost_service_url', 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ws_spotslist&ARGUMENTS=-Aall' );150 } 115 update_option( 'betanet_epost_service_url', 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ws_spotslist&ARGUMENTS=-Aall' ); 116 } 151 117 if( empty( $track_shipment_url ) ){ 152 update_option( 'betanet_epost_hfd_track_shipment_url', 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_locate_random&ARGUMENTS=-A{RAND}' );118 update_option( 'betanet_epost_hfd_track_shipment_url', 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_locate_random&ARGUMENTS=-A{RAND}' ); 153 119 } 154 120 if( empty( $cancel_shipment_url ) ){ 155 update_option( 'betanet_epost_hfd_cancel_shipment_url', 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=bitul_mishloah&ARGUMENTS=-A{shipping_number},-A,-A,-A,-N' );121 update_option( 'betanet_epost_hfd_cancel_shipment_url', 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=bitul_mishloah&ARGUMENTS=-A{shipping_number},-A,-A,-A,-N' ); 156 122 } 157 123 if( empty( $print_label_url ) ){ 158 update_option( 'betanet_epost_hfd_print_label_url', 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_print_ws&ARGUMENTS=-N{RAND}' );124 update_option( 'betanet_epost_hfd_print_label_url', 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_print_ws&ARGUMENTS=-N{RAND}' ); 159 125 } 160 126 if( empty( $hfd_order_auto_sync ) ){ … … 166 132 167 133 //replace old urls to new 168 if( ( strpos( $hfd_epost_service_url, "run.hfd.co.il" ) !== false || strpos( $hfd_epost_service_url, "uniscripts/MGrqispi.dll" ) !== false )&& filter_var( $hfd_epost_service_url, FILTER_VALIDATE_URL ) == true ){169 $hfd_epost_service_url = str_replace( array( 'uniscripts/MGrqispi.dll', 'run.hfd.co.il' ), array( 'RunCom.Server/Request.aspx', 'ws.hfd.co.il' ), $hfd_epost_service_url );170 134 if( strpos( $hfd_epost_service_url, "uniscripts/MGrqispi.dll" ) !== false && filter_var( $hfd_epost_service_url, FILTER_VALIDATE_URL ) == true ){ 135 $hfd_epost_service_url = str_replace( 'uniscripts/MGrqispi.dll', 'RunCom.Server/Request.aspx', $hfd_epost_service_url ); 136 171 137 update_option( 'betanet_epost_service_url', $hfd_epost_service_url ); 172 138 } 173 139 174 140 $betanet_epost_hfd_service_url = get_option( 'betanet_epost_hfd_service_url' ); 175 if( ( strpos( $betanet_epost_hfd_service_url, "uniscripts/MGrqispi.dll" ) !== false || strpos( $betanet_epost_hfd_service_url, "run.hfd.co.il" ) !== false )&& filter_var( $betanet_epost_hfd_service_url, FILTER_VALIDATE_URL ) == true ){176 $betanet_epost_hfd_service_url = str_replace( array( 'uniscripts/MGrqispi.dll', 'run.hfd.co.il' ), array( 'RunCom.Server/Request.aspx', 'ws.hfd.co.il' ), $betanet_epost_hfd_service_url );141 if( strpos( $betanet_epost_hfd_service_url, "uniscripts/MGrqispi.dll" ) !== false && filter_var( $betanet_epost_hfd_service_url, FILTER_VALIDATE_URL ) == true ){ 142 $betanet_epost_hfd_service_url = str_replace( 'uniscripts/MGrqispi.dll', 'RunCom.Server/Request.aspx', $betanet_epost_hfd_service_url ); 177 143 178 144 update_option( 'betanet_epost_hfd_service_url', $betanet_epost_hfd_service_url ); 179 145 } 180 146 181 if( ( strpos( $track_shipment_url, "uniscripts/MGrqispi.dll" ) !== false || strpos( $track_shipment_url, "run.hfd.co.il" ) !== false )&& filter_var( $track_shipment_url, FILTER_VALIDATE_URL ) == true ){182 $track_shipment_url = str_replace( array( 'uniscripts/MGrqispi.dll', 'run.hfd.co.il' ), array( 'RunCom.Server/Request.aspx', 'ws.hfd.co.il' ), $track_shipment_url );147 if( strpos( $track_shipment_url, "uniscripts/MGrqispi.dll" ) !== false && filter_var( $track_shipment_url, FILTER_VALIDATE_URL ) == true ){ 148 $track_shipment_url = str_replace( 'uniscripts/MGrqispi.dll', 'RunCom.Server/Request.aspx', $track_shipment_url ); 183 149 184 150 update_option( 'betanet_epost_hfd_track_shipment_url', $track_shipment_url ); 185 151 } 186 152 187 if( ( strpos( $cancel_shipment_url, "uniscripts/MGrqispi.dll" ) !== false || strpos( $cancel_shipment_url, "run.hfd.co.il" ) !== false )&& filter_var( $cancel_shipment_url, FILTER_VALIDATE_URL ) == true ){188 $cancel_shipment_url = str_replace( array( 'uniscripts/MGrqispi.dll', 'run.hfd.co.il' ), array( 'RunCom.Server/Request.aspx', 'ws.hfd.co.il' ), $cancel_shipment_url );153 if( strpos( $cancel_shipment_url, "uniscripts/MGrqispi.dll" ) !== false && filter_var( $cancel_shipment_url, FILTER_VALIDATE_URL ) == true ){ 154 $cancel_shipment_url = str_replace( 'uniscripts/MGrqispi.dll', 'RunCom.Server/Request.aspx', $cancel_shipment_url ); 189 155 190 156 update_option( 'betanet_epost_hfd_cancel_shipment_url', $cancel_shipment_url ); 191 157 } 192 158 193 if( ( strpos( $print_label_url, "uniscripts/MGrqispi.dll" ) !== false || strpos( $print_label_url, "run.hfd.co.il" ) !== false )&& filter_var( $print_label_url, FILTER_VALIDATE_URL ) == true ){194 $print_label_url = str_replace( array( 'uniscripts/MGrqispi.dll', 'run.hfd.co.il' ), array( 'RunCom.Server/Request.aspx', 'ws.hfd.co.il' ), $print_label_url );159 if( strpos( $print_label_url, "uniscripts/MGrqispi.dll" ) !== false && filter_var( $print_label_url, FILTER_VALIDATE_URL ) == true ){ 160 $print_label_url = str_replace( 'uniscripts/MGrqispi.dll', 'RunCom.Server/Request.aspx', $print_label_url ); 195 161 196 162 update_option( 'betanet_epost_hfd_print_label_url', $print_label_url ); … … 205 171 return; 206 172 207 $args = array( 208 'limit' => -1, 209 'status' => array( $hfd_auto_sync_status ), 210 'return' => 'ids', 211 'hfd_cron' => 'yes', 173 $orderIds = get_posts( array( 174 'numberposts' => - 1, 175 'post_type' => array( 'shop_order' ), 176 'post_status' => array( $hfd_auto_sync_status ), 212 177 'date_query' => array( 213 'before' => date( 'Y-m-d H:i:s', strtotime( '-'.$hfd_auto_sync_time.' minutes' ) ) 178 'after' => date( 'Y-m-d H:i:s', strtotime( '-'.$hfd_auto_sync_time.' minutes' ) ), 179 'before' => date( 'Y-m-d H:i:s', time() ) 214 180 ), 215 ); 216 $orderIds = wc_get_orders( $args ); 181 'meta_query' => array( 182 array( 183 'key' => 'hfd_ship_number', 184 'compare' => 'NOT EXISTS' // this should work... 185 ) 186 ), 187 'fields' => 'ids' 188 ) ); 217 189 218 190 if( $orderIds ){ -
hfd-epost-integration/trunk/class/Setting.php
r3227930 r3228676 34 34 { 35 35 $_settings = array( 36 'betanet_epost_service_url' => 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ws_spotslist&ARGUMENTS=-Aall',36 'betanet_epost_service_url' => 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ws_spotslist&ARGUMENTS=-Aall', 37 37 'betanet_epost_google_api_key' => '', 38 38 'betanet_epost_hfd_active' => 1, 39 'betanet_epost_hfd_service_url' => 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx',39 'betanet_epost_hfd_service_url' => 'https://run.hfd.co.il/RunCom.Server/Request.aspx', 40 40 'betanet_epost_hfd_shipping_method' => array(\Hfd\Woocommerce\Shipping\Epost::METHOD_ID), 41 41 'betanet_epost_hfd_sender_name' => 'default', 42 42 'betanet_epost_hfd_customer_number' => 0, 43 'betanet_epost_hfd_print_pdf_url' => 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_print_ws&ARGUMENTS=-N{shipping_number}',44 'betanet_epost_hfd_track_shipment_url' => 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_locate_random&ARGUMENTS=-A{RAND}',45 'betanet_epost_hfd_cancel_shipment_url' => 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=bitul_mishloah&ARGUMENTS=-A{shipping_number},-A,-A,-A,-N',46 'betanet_epost_hfd_print_label_url' => 'https:// ws.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_print_ws&ARGUMENTS=-N{RAND}',43 'betanet_epost_hfd_print_pdf_url' => 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_print_ws&ARGUMENTS=-N{shipping_number}', 44 'betanet_epost_hfd_track_shipment_url' => 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_locate_random&ARGUMENTS=-A{RAND}', 45 'betanet_epost_hfd_cancel_shipment_url' => 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=bitul_mishloah&ARGUMENTS=-A{shipping_number},-A,-A,-A,-N', 46 'betanet_epost_hfd_print_label_url' => 'https://run.hfd.co.il/RunCom.Server/Request.aspx?APPNAME=run&PRGNAME=ship_print_ws&ARGUMENTS=-N{RAND}', 47 47 'hfd_order_auto_sync' => 'no', 48 48 'hfd_sync_order_items' => 'no', -
hfd-epost-integration/trunk/hfd-woocommerce-epost.php
r3227946 r3228676 5 5 Plugin URI: 6 6 Description: Add shipping method of ePost, allowing the user on the checkout, to select the pickup location point from a google map popup. Also allows to synch the order to HFD API after the order is created. 7 Version: 2.1 37 Version: 2.14 8 8 Author: HFD 9 9 Author URI: https://www.hfd.co.il … … 20 20 21 21 define( 'HFD_EPOST_PATH', dirname( __FILE__ ) ); 22 define( 'HFD_EPOST_PLUGIN_FILE', plugin_basename( __FILE__ ) );23 22 define( 'HFD_EPOST_PLUGIN_DIR', basename( __DIR__ ) ); 24 23 define( 'HFD_EPOST_PLUGIN_URL', plugins_url( HFD_EPOST_PLUGIN_DIR ) ); -
hfd-epost-integration/trunk/readme.txt
r3227946 r3228676 5 5 Requires at least: 4.0 6 6 Tested up to: 6.7 7 Stable tag: 2.1 37 Stable tag: 2.14 8 8 Requires PHP: 5.4 9 9 License: GPLv2 or later … … 75 75 == Third Party API == 76 76 Google Maps - maps.googleapis.com 77 HFD - ws.hfd.co.il77 HFD - run.hfd.co.il 78 78 79 79 == Changelog == … … 116 116 * Performance Improvement 117 117 118 = 2.14 = 119 * Performance Improvement 120 118 121 == Frequently Asked Questions == 119 122 = Why Google Maps isnt loading =
Note: See TracChangeset
for help on using the changeset viewer.