Changeset 3006736
- Timestamp:
- 12/07/2023 12:06:05 PM (2 years ago)
- Location:
- eshipper-commerce
- Files:
-
- 2 deleted
- 9 edited
- 25 copied
-
tags/2.16.4 (copied) (copied from eshipper-commerce/trunk)
-
tags/2.16.4/.editorconfig (deleted)
-
tags/2.16.4/.gitignore (deleted)
-
tags/2.16.4/README.md (copied) (copied from eshipper-commerce/trunk/README.md)
-
tags/2.16.4/assets (copied) (copied from eshipper-commerce/trunk/assets)
-
tags/2.16.4/assets/eShipper.js (copied) (copied from eshipper-commerce/trunk/assets/eShipper.js)
-
tags/2.16.4/composer.json (copied) (copied from eshipper-commerce/trunk/composer.json)
-
tags/2.16.4/composer.lock (copied) (copied from eshipper-commerce/trunk/composer.lock)
-
tags/2.16.4/docs (copied) (copied from eshipper-commerce/trunk/docs)
-
tags/2.16.4/framework (copied) (copied from eshipper-commerce/trunk/framework)
-
tags/2.16.4/framework/db.php (modified) (3 diffs)
-
tags/2.16.4/framework/lib/admin-settings.js (copied) (copied from eshipper-commerce/trunk/framework/lib/admin-settings.js)
-
tags/2.16.4/framework/lib/plugin_health.css (copied) (copied from eshipper-commerce/trunk/framework/lib/plugin_health.css)
-
tags/2.16.4/framework/orderdetails.php (copied) (copied from eshipper-commerce/trunk/framework/orderdetails.php)
-
tags/2.16.4/framework/plugin.php (copied) (copied from eshipper-commerce/trunk/framework/plugin.php) (5 diffs)
-
tags/2.16.4/framework/shipments.php (copied) (copied from eshipper-commerce/trunk/framework/shipments.php)
-
tags/2.16.4/framework/shippingmethod.php (copied) (copied from eshipper-commerce/trunk/framework/shippingmethod.php) (2 diffs)
-
tags/2.16.4/img (copied) (copied from eshipper-commerce/trunk/img)
-
tags/2.16.4/languages (copied) (copied from eshipper-commerce/trunk/languages)
-
tags/2.16.4/lib (copied) (copied from eshipper-commerce/trunk/lib)
-
tags/2.16.4/license.txt (copied) (copied from eshipper-commerce/trunk/license.txt)
-
tags/2.16.4/models (copied) (copied from eshipper-commerce/trunk/models)
-
tags/2.16.4/plugin (copied) (copied from eshipper-commerce/trunk/plugin)
-
tags/2.16.4/plugin/PluginHealthHelper.php (copied) (copied from eshipper-commerce/trunk/plugin/PluginHealthHelper.php) (2 diffs)
-
tags/2.16.4/plugin/pluginLifeCycle.php (modified) (8 diffs)
-
tags/2.16.4/readme.txt (copied) (copied from eshipper-commerce/trunk/readme.txt) (3 diffs)
-
tags/2.16.4/views (copied) (copied from eshipper-commerce/trunk/views)
-
tags/2.16.4/views/login_modal.php (copied) (copied from eshipper-commerce/trunk/views/login_modal.php)
-
tags/2.16.4/woocommerce-eshipper.php (copied) (copied from eshipper-commerce/trunk/woocommerce-eshipper.php) (5 diffs)
-
trunk/framework/db.php (modified) (3 diffs)
-
trunk/framework/plugin.php (modified) (5 diffs)
-
trunk/framework/shippingmethod.php (modified) (2 diffs)
-
trunk/plugin/PluginHealthHelper.php (modified) (2 diffs)
-
trunk/plugin/pluginLifeCycle.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/woocommerce-eshipper.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eshipper-commerce/tags/2.16.4/framework/db.php
r2963096 r3006736 4 4 eshipper_db.php 5 5 6 6 7 7 */ 8 8 abstract class eshipper_db 9 9 { 10 10 public $collate; 11 public function setup() { 11 public function setup() 12 { 12 13 // Create sql tables as needed. 13 14 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 14 15 $this->get_collate(); 15 // Future development16 // if ($this->get_resource('shipments_implemented')){17 // $this->sql_shipments();18 // $this->sql_lists();19 // $this->sql_services();20 // }21 // Done.22 16 update_option('eshipper_version', ESHIPPER_VERSION); 23 17 } 24 18 25 public function updateDBForVersion2_15()19 public function get_collate() 26 20 { 27 if (version_compare(phpversion(), '8.0', '>=')) {28 require_once(ESHIPPER_PLUGIN_PATH . '/plugin/PluginHealthHelper.php');29 30 PluginHealthHelper::createEshipperPluginHealthTable();31 }32 33 // Shipping address table structure was updated to change 'phone_no' datatype to varchar from int34 pluginLifeCycle::createEshipperShippingAddressTable();35 36 update_option('eshipper_version', ESHIPPER_VERSION_LATEST);37 }38 39 public function get_collate() {40 21 global $wpdb; 41 if ($wpdb->has_cap( 'utf8mb4_520' )){22 if ($wpdb->has_cap('utf8mb4_520')) { 42 23 $this->collate = 'DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci'; 43 } elseif ($wpdb->has_cap( 'utf8mb4' )){24 } elseif ($wpdb->has_cap('utf8mb4')) { 44 25 $this->collate = 'DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci'; 45 26 } else { … … 51 32 52 33 /* 53 * Return resources54 */55 abstract function get_resource($id);34 * Return resources 35 */ 36 abstract public function get_resource($id); 56 37 57 38 /* 58 39 * Date format 59 40 */ 60 public function db_datetime($datestring){ 61 if (!empty($datestring)){ 41 public function db_datetime($datestring) 42 { 43 if (!empty($datestring)) { 62 44 // Converts to mysql date string format 63 45 return (new DateTime($datestring))->format('Y-m-d H:i:s'); … … 66 48 return ''; 67 49 } 68 69 50 } -
eshipper-commerce/tags/2.16.4/framework/plugin.php
r2966127 r3006736 43 43 44 44 // Database integration 45 add_action('init', [&$this, 'eshipper_db']);45 // add_action('init', [&$this, 'eshipper_db']); 46 46 47 47 // Wire up product shipping options … … 194 194 wp_enqueue_script('eshipper-require-postalcode', plugins_url('lib/require-postalcode.js', ESHIPPER_PLUGIN_FILE), ['jquery'], ESHIPPER_VERSION, true); 195 195 echo '<div id="calc_shipping_postcode_required" class="hidden woocommerce-info" style="display:none">' . __( 196 'Zip / Postal Code is required to calculate shipping',197 'woocommerce-eshipper'198 ) . '</div>';196 'Zip / Postal Code is required to calculate shipping', 197 'woocommerce-eshipper' 198 ) . '</div>'; 199 199 } 200 200 … … 259 259 260 260 // If the plugin is deactivated, activate it again 261 // TODO: Check if this works262 261 require_once(ABSPATH . 'wp-admin/includes/plugin.php'); 263 262 if (!is_plugin_active(plugin_basename(ESHIPPER_PLUGIN_FILE))) { … … 265 264 } 266 265 267 /** 268 * Updates required for Version >= 2.15.0 & < 2.16.0 269 */ 270 271 // DB upgrade for version 2.15.1 272 $version = get_option('eshipper_version', '1.0'); 273 if (version_compare($version, ESHIPPER_VERSION_DB_UPDATE, '<')) { 274 // Get required files for db upgrade 275 if (!class_exists('woocommerce_eshipper_db')) { 276 require_once(ESHIPPER_PLUGIN_PATH . '/framework/db.php'); 277 require_once(ESHIPPER_PLUGIN_PATH . '/models/woocommerce_eshipper_db.php'); 278 } 279 // Setup / Run Update. 280 (new woocommerce_eshipper_db())->updateDBForVersion2_15(); 281 } 266 // Apply DB updates 267 pluginLifeCycle::updateDB(); 268 update_option('eshipper_version', ESHIPPER_VERSION); 282 269 } 283 270 … … 332 319 { 333 320 return "<p>New feature: <b>Shipping Calculator</b><br> 334 <ul><li>You can now test Live Shipping Rates without going through the checkout process!</li> 335 <li>UI/UX Upgrades </li> 336 <li>Major Bug Fixes. </li> 321 <ul><li>Bug fix for 'Update Database' error in Plugin Health page</li> 337 322 </ul></p>"; 338 323 } 339 324 340 325 326 /** 327 * @deprecated 328 * @return void 329 */ 341 330 public function eshipper_db() 342 331 { -
eshipper-commerce/tags/2.16.4/framework/shippingmethod.php
r2984482 r3006736 406 406 <?php _e('Plugin Health', 'woocommerce-eshipper') ?> 407 407 </a> 408 <!-- <a href="#eshipper_boxing_manager" class="nav-tab" id="eshipper_services_tab">-->409 <?php //_e('Boxing Manager', 'woocommerce-eshipper')410 ?><!--</a>-->411 <!--<a href="#eshipper_flatrates" class="nav-tab" id="eshipper_flatrates_tab"><?php /*_e('Lettermail/Flat Rates', 'woocommerce-eshipper') */ ?></a>-->412 <!-- <a href="#eshipper_shipments" class="nav-tab --><?php //echo $this->get_resource('display_shipmentstab');413 ?><!--"-->414 <!-- id="eshipper_shipments_tab">--><?php //_e('Shipment Labels', 'woocommerce-eshipper')415 ?><!--</a>-->416 <!--<a href="#eshipper_tracking" class="nav-tab" id="eshipper_tracking_tab"><?php /*_e('Tracking', 'woocommerce-eshipper') */ ?></a>417 <a href="#eshipper_update" class="nav-tab" id="eshipper_update_tab"><?php /*_e('Updates', 'woocommerce-eshipper') */ ?></a>-->418 408 </div> 419 409 … … 1277 1267 </div> 1278 1268 </div> 1279 1280 <div class="eshipper_panel eshipper_hidden" id="eshipper_boxing_manager">1281 <h3><?php echo $this->get_resource('method_title') . ' ';1282 _e('Boxing Manager', 'woocommerce-eshipper') ?></h3>1283 <table class="es_form-table">1284 <tr valign="top"1285 class="woocommerce-eshipper-development-api <?php if ($this->options->mode != 'dev' && $this->options->shipment_mode != 'dev') {1286 echo 'hidden';1287 } ?>">1288 <th><?php _e('Box Dimensions', 'woocommerce-eshipper') ?></th>1289 <td>1290 <br/><br/>1291 <table class="es_form-table" id="main_table">1292 <thead>1293 <tr>1294 <td></td>1295 <td></td>1296 <td>Name</td>1297 <td>Length(in)</td>1298 <td>Width(in)</td>1299 <td>Height(in)</td>1300 <td>Box Weight(lbs)</td>1301 <td>Max Weight(lbs)</td>1302 </tr>1303 </thead>1304 1305 <?php1306 global $wpdb;1307 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";1308 $number_of_boxes = $wpdb->get_results("SELECT count(*) as count FROM $box_master_table");1309 ?>1310 <tbody id="boxing_manager_boxes">1311 <tr id="row_0">1312 <td></td>1313 <td><input type="checkbox" id="checkbox_box_0"></td>1314 <td><input type="text" id="box_0_name" style="min-width:50px;" placeholder="Box Name"></td>1315 <td><input type="text" id="box_0_length" style="min-width:20px;" placeholder="Length"></td>1316 <td><input type="text" id="box_0_width" style="min-width:20px;" placeholder="Width"></td>1317 <td><input type="text" id="box_0_height" style="min-width:20px;" placeholder="Height"></td>1318 <td><input type="text" id="box_0_box_weight" style="min-width:20px;" placeholder="Box Weight"></td>1319 <td><input type="text" id="box_0_max_weight" style="min-width:20px;" placeholder="Max Weight"></td>1320 </tr>1321 </tbody>1322 <tfoot>1323 <tr>1324 <td></td>1325 <td></td>1326 <td>1327 <button type="button" id="add_box_btn">Add Box</button>1328 </td>1329 <td>1330 <button type="button" id="remove_box_btn">Remove Selected Box/Boxes</button>1331 </td>1332 <!--<td><button type="button" id="remove_box_btn">Remove Box</button></td>-->1333 </tr>1334 </tfoot>1335 </table>1336 <br/>1337 <script type="text/javascript">1338 jQuery(document).ready(function () {1339 1340 var get_boxing_form_data = {1341 "boxing_flag": "fetch"1342 }1343 jQuery.ajax({1344 type: "post",1345 dataType: "json",1346 url: ajaxurl,1347 data: {1348 action: "boxing_insert",1349 formdata: get_boxing_form_data,1350 },1351 success: function (response) {1352 var number_of_boxes = (response.boxing_data.length);1353 if (number_of_boxes > 0) {1354 jQuery("#boxing_manager_boxes").html("");1355 }1356 1357 for (var i = 0; i < number_of_boxes; i++) {1358 jQuery("#boxing_manager_boxes").append("" +1359 "<tr id='row_" + i + "'>" +1360 "<td></td>" +1361 "<td><input type='checkbox' id='checkbox_box_" + i + "'></td>" +1362 "<td><input type='text' id='box_" + i + "_name' style='min-width:20px;' placeholder='Box Name' value='" + response.boxing_data[i].box_name + "'></td>" +1363 "<td><input type='text' id='box_" + i + "_length' style='min-width:20px;' placeholder='Length' value='" + response.boxing_data[i].box_length + "'></td>" +1364 "<td><input type='text' id='box_" + i + "_width' style='min-width:20px;' placeholder='Width' value='" + response.boxing_data[i].box_width + "'></td>" +1365 "<td><input type='text' id='box_" + i + "_height' style='min-width:20px;' placeholder='Height' value='" + response.boxing_data[i].box_height + "'></td>" +1366 "<td><input type='text' id='box_" + i + "_box_weight' style='min-width:20px;' placeholder='Box Weight' value='" + response.boxing_data[i].box_weight + "'></td>" +1367 "<td><input type='text' id='box_" + i + "_max_weight' style='min-width:20px;' placeholder='Max Weight' value='" + response.boxing_data[i].max_box_weight + "'></td>" +1368 "</tr>"1369 );1370 }1371 }1372 });1373 1374 1375 //Onclick of remove box button1376 jQuery("body").on('click', '#remove_box_btn', function (event) {1377 event.preventDefault();1378 var check_flag = [];1379 var check_ids = []; //array to store the id of the checkboxes that have been checked for removal1380 var finalCheckArray = {};1381 for (var i = 0; i < 10; i++) {1382 check_flag[i] = jQuery("#checkbox_box_" + i).is(":checked");1383 if (check_flag[i] == true) {1384 check_ids.push(i);1385 }1386 }1387 for (var remove_counter = 0; remove_counter < check_ids.length; remove_counter++) {1388 jQuery("#row_" + check_ids[remove_counter]).remove();1389 }1390 1391 });1392 1393 1394 //On click of add button in boxing manager settings1395 jQuery("body").on('click', '#add_box_btn', function (event) {1396 event.preventDefault();1397 var id = (jQuery('#main_table tbody tr:last').index());1398 id = id + 1;1399 jQuery("#main_table").append("" +1400 "<tr id='row_" + id + "'>" +1401 "<td></td>" +1402 "<td><input type='checkbox' id='checkbox_box_" + id + "'></td>" +1403 "<td><input type='text' id='box_" + id + "_name' style='min-width:50px;' placeholder='Box Name'></td>" +1404 "<td><input type='text' id='box_" + id + "_length' style='min-width:20px;' placeholder='Length'></td>" +1405 "<td><input type='text' id='box_" + id + "_width' style='min-width:20px;' placeholder='Width'></td>" +1406 "<td><input type='text' id='box_" + id + "_height' style='min-width:20px;' placeholder='Height'></td>" +1407 "<td><input type='text' id='box_" + id + "_box_weight' style='min-width:20px;' placeholder='Box Weight'></td>" +1408 "<td><input type='text' id='box_" + id + "_max_weight' style='min-width:20px;' placeholder='Max Weight'></td>" +1409 "</td>" +1410 "</tr>"1411 );1412 });1413 1414 //Onclick of save button in boxing manager settings1415 jQuery("body").on('click', '#save_boxing_options', function (event) {1416 event.preventDefault();1417 var finalArray = {};1418 for (var i = 0; i < 10; i++) {1419 var j = i;1420 var finalSubArray = {};1421 finalSubArray.name = jQuery("#box_" + j + "_name").val();1422 finalSubArray.box_length = jQuery("#box_" + j + "_length").val();1423 finalSubArray.box_width = jQuery("#box_" + j + "_width").val();1424 finalSubArray.box_height = jQuery("#box_" + j + "_height").val();1425 finalSubArray.box_weight = jQuery("#box_" + j + "_box_weight").val();1426 finalSubArray.box_max_weight = jQuery("#box_" + j + "_max_weight").val();1427 finalArray[i] = finalSubArray;1428 }1429 1430 jQuery.ajax({1431 type: "post",1432 dataType: "json",1433 url: ajaxurl,1434 data: {1435 action: "boxing_insert",1436 formdata: finalArray,1437 },1438 success: function (response) {1439 if (response.statusCode == 200) {1440 jQuery("#boxing_save_message_display").text(response.msg);1441 jQuery("#boxing_save_message_display").css('color', 'green');1442 }1443 1444 }1445 });1446 });1447 });1448 </script>1449 1450 <button type="submit" name="save_boxing_options" value="save_boxing_options" id="save_boxing_options">Save Boxing1451 Information1452 </button>1453 <br/><br/>1454 <div id="boxing_save_message_display"></div>1455 </td>1456 </tr>1457 </table>1458 </div>1459 1269 </div> 1460 1270 -
eshipper-commerce/tags/2.16.4/plugin/PluginHealthHelper.php
r2984482 r3006736 65 65 $create_plugin_health_table = " CREATE TABLE $table($columns 66 66 created_time timestamp DEFAULT CURRENT_TIMESTAMP, 67 updated_time timestamp DEFAULT NULL67 updated_time timestamp DEFAULT CURRENT_TIMESTAMP 68 68 )"; 69 69 70 70 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 71 dbDelta($create_plugin_health_table);71 $queryResult = dbDelta($create_plugin_health_table); 72 72 73 73 // Check if table exists at this point before proceeding. … … 75 75 global $wpdb; 76 76 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 77 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);77 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 78 78 return false; 79 79 } -
eshipper-commerce/tags/2.16.4/plugin/pluginLifeCycle.php
r2963096 r3006736 23 23 24 24 // Create all required tables for the plugin 25 self::updateDB(); 26 } 27 28 /** 29 * Create/update all required tables for the plugin 30 * @return void 31 */ 32 public static function updateDB() 33 { 34 // All methods called here use dbDelta to create/update the tables 35 // and hence always contain the latest structure of the table 25 36 pluginLifeCycle::createEshipperAccessTokensTable(); 26 37 pluginLifeCycle::createEshipperCarrierServicesTable(); … … 30 41 PluginHealthHelper::createEshipperPluginHealthTable(); 31 42 } 32 33 // TODO: Remove old code34 pluginLifeCycle::createEshipperBoxingMasterTable();35 43 } 36 44 … … 137 145 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_carrier_service_master"); 138 146 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_shipping_address"); 139 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_boxing_services_master");140 147 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_plugin_health"); 141 148 … … 151 158 } 152 159 } 153 } 154 155 /* 156 * Creating a table at the time of activation to store the boxing services in Woo-Commerce DB 157 * @Deprecated This table is not used anymore 158 */ 159 private static function createEshipperBoxingMasterTable() 160 { 161 global $wpdb; 162 $table = $wpdb->prefix . "eshipper_boxing_services_master"; 163 164 wc_get_logger()->debug("Attempting to create table - $table", ['source' => 'eshipper']); 165 166 $create_boxing_master_table_query = " CREATE TABLE $table( 167 p_id int(10) NOT NULL AUTO_INCREMENT, 168 box_name varchar(255), 169 box_length int(10) , 170 box_width int(10) , 171 box_height int(10) , 172 box_weight int(10) , 173 max_box_weight int(10) , 174 created_time timestamp DEFAULT CURRENT_TIMESTAMP, 175 PRIMARY KEY (p_id) 176 )"; 177 178 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 179 dbDelta($create_boxing_master_table_query); 180 181 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 182 wc_get_logger()->error("Could not create table - $table", ['source' => 'eshipper']); 183 } 184 185 wc_get_logger()->debug("Successfully created table - $table", ['source' => 'eshipper']); 160 161 // Delete old tables 162 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_boxing_services_master"); 186 163 } 187 164 … … 208 185 209 186 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 210 dbDelta($access_tokens_query);187 $queryResult = dbDelta($access_tokens_query); 211 188 212 189 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 213 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);190 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 214 191 } 215 192 … … 242 219 243 220 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 244 dbDelta($access_tokens_query);221 $queryResult = dbDelta($access_tokens_query); 245 222 246 223 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 247 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);224 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 248 225 } 249 226 … … 534 511 535 512 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 536 dbDelta($create_shipping_address_query);513 $queryResult = dbDelta($create_shipping_address_query); 537 514 538 515 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 539 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);516 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 540 517 } 541 518 … … 599 576 } 600 577 601 /*602 * Function to manage the boxing services in Woo-Commerce DB603 */604 public function eshipperBoxingServicesUpdate($dataArray)605 {606 global $wpdb;607 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";608 $truncate_box_master_query = $wpdb->query("TRUNCATE TABLE $box_master_table");609 $finalData = $dataArray;610 foreach ($finalData as $i => $value) {611 $data = [612 'box_name' => $finalData[$i]['name'],613 'box_length' => $finalData[$i]['box_length'],614 'box_width' => $finalData[$i]['box_width'],615 'box_height' => $finalData[$i]['box_height'],616 'box_weight' => $finalData[$i]['box_weight'],617 'max_box_weight' => $finalData[$i]['box_max_weight'],618 ];619 $wpdb->insert(620 $wpdb->prefix . 'eshipper_boxing_services_master',621 $data,622 ['%s', '%d', '%d', '%d', '%d', '%d',]623 );624 }625 626 $response = "Boxes have been successfuly saved";627 628 return $response;629 }630 631 578 public static function getEshipperSettingsLink(bool $healthPage = true, bool $asyncRequest = false) 632 579 { -
eshipper-commerce/tags/2.16.4/readme.txt
r2984482 r3006736 5 5 Tested up to: 6.3.1 6 6 Requires PHP: 7.1 7 Stable tag: 2.16. 37 Stable tag: 2.16.4 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 54 54 55 55 == Changelog == 56 = 2.16.4 = 57 * Bug fix for 'Update Database' error in Plugin Health page. 58 56 59 = 2.16.3 = 57 60 * Bug fix for Shipping Calculator - not able to select states when selling is allowed to one specific country in WooCommerce Settings. … … 99 102 100 103 == Upgrade Notice == 104 = 2.16.4 = 105 Bug fix for 'Update Database' error in Plugin Health page. 106 101 107 = 2.16.3 = 102 108 Bug fixes for Shipping Calculator. -
eshipper-commerce/tags/2.16.4/woocommerce-eshipper.php
r2984482 r3006736 4 4 Plugin URI: https://ww2.eshipper.com/ecommerce/ 5 5 Description: Extends WooCommerce with Shipping Rates from eShipper 6 Version: 2.16. 36 Version: 2.16.4 7 7 Author: eShipper 8 8 Author URI: https://ww2.eshipper.com/ … … 28 28 get_site_option('active_sitewide_plugins') 29 29 ))) { 30 define('ESHIPPER_VERSION', '2.16.3'); 31 define('ESHIPPER_VERSION_LATEST', '2.16.3'); 32 define('ESHIPPER_VERSION_DB_UPDATE', '2.15.3'); 33 //Plugin Path 30 define('ESHIPPER_VERSION', '2.16.4'); 34 31 define('ESHIPPER_PLUGIN_PATH', dirname(__FILE__)); 35 32 define('ESHIPPER_PLUGIN_FILE', __FILE__); … … 86 83 add_action('wp_ajax_es_select_country_states', 'es_select_country_states'); 87 84 add_action('wp_ajax_get_rates_for_shipping_calculator', 'get_rates_for_shipping_calculator'); 88 89 90 // TODO: Remove stale code91 add_action('wp_ajax_boxing_insert', 'boxing_insert');92 85 93 86 function save_shipping_address() … … 642 635 } 643 636 644 645 // TODO: Remove stale code646 647 /**648 * --------------------------------------------------------649 * UNUSED STALE CODE650 * --------------------------------------------------------651 */652 653 /**654 * Ajax function call to insert the boxing details in the db655 * @return void656 */657 function boxing_insert()658 {659 if ($_POST['formdata']['boxing_flag'] == "fetch") {660 global $wpdb;661 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";662 $fetch_box_query = $wpdb->get_results("SELECT * FROM $box_master_table");663 $responseArray = ['statusCode' => "200", "boxing_data" => $fetch_box_query];664 echo json_encode($responseArray);665 die();666 }667 668 if ($_POST['action'] == "boxing_insert") {669 if (isset($_POST['formdata']) && is_array($_POST['formdata'])) {670 $eshipperAuthentication = new pluginLifeCycle();671 $response = $eshipperAuthentication->eshipperBoxingServicesUpdate($_POST['formdata']);672 $responseArray = ['statusCode' => "200", "msg" => $response];673 echo json_encode($responseArray);674 die();675 }676 }677 }678 679 /*680 * Custom REST API for sending boxing information starts681 */682 /*add_action('rest_api_init',function (){683 register_rest_route('wl/v3','getBoxingInfo',[684 'methods' => 'GET',685 'callback' => 'send_boxing_info',686 ]);687 });*/688 689 function send_boxing_info()690 {691 global $wpdb;692 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";693 $boxing_info = $wpdb->get_results("SELECT * FROM $box_master_table");694 if (count($boxing_info) > 0) {695 $responseArray = ['statusCode' => "200", "msg" => "Boxing Information Successfuly Fetched", "Boxing_info" => $boxing_info];696 697 return $responseArray;698 } else {699 $responseArray = ['statusCode' => "200", "msg" => "No Boxing Information Currently Available"];700 701 return $responseArray;702 }703 }704 705 637 add_action('rest_api_init', function () { 706 638 register_rest_route('wl/v3', 'uninstall-eshipper-plugin', [ … … 945 877 return new WP_REST_Response($responseArray, 200); 946 878 } 947 948 /*949 * Custom REST API for sending boxing information ends950 */951 879 952 880 /*Called by ajax on submit from deactivation form*/ -
eshipper-commerce/trunk/framework/db.php
r2963096 r3006736 4 4 eshipper_db.php 5 5 6 6 7 7 */ 8 8 abstract class eshipper_db 9 9 { 10 10 public $collate; 11 public function setup() { 11 public function setup() 12 { 12 13 // Create sql tables as needed. 13 14 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 14 15 $this->get_collate(); 15 // Future development16 // if ($this->get_resource('shipments_implemented')){17 // $this->sql_shipments();18 // $this->sql_lists();19 // $this->sql_services();20 // }21 // Done.22 16 update_option('eshipper_version', ESHIPPER_VERSION); 23 17 } 24 18 25 public function updateDBForVersion2_15()19 public function get_collate() 26 20 { 27 if (version_compare(phpversion(), '8.0', '>=')) {28 require_once(ESHIPPER_PLUGIN_PATH . '/plugin/PluginHealthHelper.php');29 30 PluginHealthHelper::createEshipperPluginHealthTable();31 }32 33 // Shipping address table structure was updated to change 'phone_no' datatype to varchar from int34 pluginLifeCycle::createEshipperShippingAddressTable();35 36 update_option('eshipper_version', ESHIPPER_VERSION_LATEST);37 }38 39 public function get_collate() {40 21 global $wpdb; 41 if ($wpdb->has_cap( 'utf8mb4_520' )){22 if ($wpdb->has_cap('utf8mb4_520')) { 42 23 $this->collate = 'DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci'; 43 } elseif ($wpdb->has_cap( 'utf8mb4' )){24 } elseif ($wpdb->has_cap('utf8mb4')) { 44 25 $this->collate = 'DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci'; 45 26 } else { … … 51 32 52 33 /* 53 * Return resources54 */55 abstract function get_resource($id);34 * Return resources 35 */ 36 abstract public function get_resource($id); 56 37 57 38 /* 58 39 * Date format 59 40 */ 60 public function db_datetime($datestring){ 61 if (!empty($datestring)){ 41 public function db_datetime($datestring) 42 { 43 if (!empty($datestring)) { 62 44 // Converts to mysql date string format 63 45 return (new DateTime($datestring))->format('Y-m-d H:i:s'); … … 66 48 return ''; 67 49 } 68 69 50 } -
eshipper-commerce/trunk/framework/plugin.php
r2966127 r3006736 43 43 44 44 // Database integration 45 add_action('init', [&$this, 'eshipper_db']);45 // add_action('init', [&$this, 'eshipper_db']); 46 46 47 47 // Wire up product shipping options … … 194 194 wp_enqueue_script('eshipper-require-postalcode', plugins_url('lib/require-postalcode.js', ESHIPPER_PLUGIN_FILE), ['jquery'], ESHIPPER_VERSION, true); 195 195 echo '<div id="calc_shipping_postcode_required" class="hidden woocommerce-info" style="display:none">' . __( 196 'Zip / Postal Code is required to calculate shipping',197 'woocommerce-eshipper'198 ) . '</div>';196 'Zip / Postal Code is required to calculate shipping', 197 'woocommerce-eshipper' 198 ) . '</div>'; 199 199 } 200 200 … … 259 259 260 260 // If the plugin is deactivated, activate it again 261 // TODO: Check if this works262 261 require_once(ABSPATH . 'wp-admin/includes/plugin.php'); 263 262 if (!is_plugin_active(plugin_basename(ESHIPPER_PLUGIN_FILE))) { … … 265 264 } 266 265 267 /** 268 * Updates required for Version >= 2.15.0 & < 2.16.0 269 */ 270 271 // DB upgrade for version 2.15.1 272 $version = get_option('eshipper_version', '1.0'); 273 if (version_compare($version, ESHIPPER_VERSION_DB_UPDATE, '<')) { 274 // Get required files for db upgrade 275 if (!class_exists('woocommerce_eshipper_db')) { 276 require_once(ESHIPPER_PLUGIN_PATH . '/framework/db.php'); 277 require_once(ESHIPPER_PLUGIN_PATH . '/models/woocommerce_eshipper_db.php'); 278 } 279 // Setup / Run Update. 280 (new woocommerce_eshipper_db())->updateDBForVersion2_15(); 281 } 266 // Apply DB updates 267 pluginLifeCycle::updateDB(); 268 update_option('eshipper_version', ESHIPPER_VERSION); 282 269 } 283 270 … … 332 319 { 333 320 return "<p>New feature: <b>Shipping Calculator</b><br> 334 <ul><li>You can now test Live Shipping Rates without going through the checkout process!</li> 335 <li>UI/UX Upgrades </li> 336 <li>Major Bug Fixes. </li> 321 <ul><li>Bug fix for 'Update Database' error in Plugin Health page</li> 337 322 </ul></p>"; 338 323 } 339 324 340 325 326 /** 327 * @deprecated 328 * @return void 329 */ 341 330 public function eshipper_db() 342 331 { -
eshipper-commerce/trunk/framework/shippingmethod.php
r2984482 r3006736 406 406 <?php _e('Plugin Health', 'woocommerce-eshipper') ?> 407 407 </a> 408 <!-- <a href="#eshipper_boxing_manager" class="nav-tab" id="eshipper_services_tab">-->409 <?php //_e('Boxing Manager', 'woocommerce-eshipper')410 ?><!--</a>-->411 <!--<a href="#eshipper_flatrates" class="nav-tab" id="eshipper_flatrates_tab"><?php /*_e('Lettermail/Flat Rates', 'woocommerce-eshipper') */ ?></a>-->412 <!-- <a href="#eshipper_shipments" class="nav-tab --><?php //echo $this->get_resource('display_shipmentstab');413 ?><!--"-->414 <!-- id="eshipper_shipments_tab">--><?php //_e('Shipment Labels', 'woocommerce-eshipper')415 ?><!--</a>-->416 <!--<a href="#eshipper_tracking" class="nav-tab" id="eshipper_tracking_tab"><?php /*_e('Tracking', 'woocommerce-eshipper') */ ?></a>417 <a href="#eshipper_update" class="nav-tab" id="eshipper_update_tab"><?php /*_e('Updates', 'woocommerce-eshipper') */ ?></a>-->418 408 </div> 419 409 … … 1277 1267 </div> 1278 1268 </div> 1279 1280 <div class="eshipper_panel eshipper_hidden" id="eshipper_boxing_manager">1281 <h3><?php echo $this->get_resource('method_title') . ' ';1282 _e('Boxing Manager', 'woocommerce-eshipper') ?></h3>1283 <table class="es_form-table">1284 <tr valign="top"1285 class="woocommerce-eshipper-development-api <?php if ($this->options->mode != 'dev' && $this->options->shipment_mode != 'dev') {1286 echo 'hidden';1287 } ?>">1288 <th><?php _e('Box Dimensions', 'woocommerce-eshipper') ?></th>1289 <td>1290 <br/><br/>1291 <table class="es_form-table" id="main_table">1292 <thead>1293 <tr>1294 <td></td>1295 <td></td>1296 <td>Name</td>1297 <td>Length(in)</td>1298 <td>Width(in)</td>1299 <td>Height(in)</td>1300 <td>Box Weight(lbs)</td>1301 <td>Max Weight(lbs)</td>1302 </tr>1303 </thead>1304 1305 <?php1306 global $wpdb;1307 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";1308 $number_of_boxes = $wpdb->get_results("SELECT count(*) as count FROM $box_master_table");1309 ?>1310 <tbody id="boxing_manager_boxes">1311 <tr id="row_0">1312 <td></td>1313 <td><input type="checkbox" id="checkbox_box_0"></td>1314 <td><input type="text" id="box_0_name" style="min-width:50px;" placeholder="Box Name"></td>1315 <td><input type="text" id="box_0_length" style="min-width:20px;" placeholder="Length"></td>1316 <td><input type="text" id="box_0_width" style="min-width:20px;" placeholder="Width"></td>1317 <td><input type="text" id="box_0_height" style="min-width:20px;" placeholder="Height"></td>1318 <td><input type="text" id="box_0_box_weight" style="min-width:20px;" placeholder="Box Weight"></td>1319 <td><input type="text" id="box_0_max_weight" style="min-width:20px;" placeholder="Max Weight"></td>1320 </tr>1321 </tbody>1322 <tfoot>1323 <tr>1324 <td></td>1325 <td></td>1326 <td>1327 <button type="button" id="add_box_btn">Add Box</button>1328 </td>1329 <td>1330 <button type="button" id="remove_box_btn">Remove Selected Box/Boxes</button>1331 </td>1332 <!--<td><button type="button" id="remove_box_btn">Remove Box</button></td>-->1333 </tr>1334 </tfoot>1335 </table>1336 <br/>1337 <script type="text/javascript">1338 jQuery(document).ready(function () {1339 1340 var get_boxing_form_data = {1341 "boxing_flag": "fetch"1342 }1343 jQuery.ajax({1344 type: "post",1345 dataType: "json",1346 url: ajaxurl,1347 data: {1348 action: "boxing_insert",1349 formdata: get_boxing_form_data,1350 },1351 success: function (response) {1352 var number_of_boxes = (response.boxing_data.length);1353 if (number_of_boxes > 0) {1354 jQuery("#boxing_manager_boxes").html("");1355 }1356 1357 for (var i = 0; i < number_of_boxes; i++) {1358 jQuery("#boxing_manager_boxes").append("" +1359 "<tr id='row_" + i + "'>" +1360 "<td></td>" +1361 "<td><input type='checkbox' id='checkbox_box_" + i + "'></td>" +1362 "<td><input type='text' id='box_" + i + "_name' style='min-width:20px;' placeholder='Box Name' value='" + response.boxing_data[i].box_name + "'></td>" +1363 "<td><input type='text' id='box_" + i + "_length' style='min-width:20px;' placeholder='Length' value='" + response.boxing_data[i].box_length + "'></td>" +1364 "<td><input type='text' id='box_" + i + "_width' style='min-width:20px;' placeholder='Width' value='" + response.boxing_data[i].box_width + "'></td>" +1365 "<td><input type='text' id='box_" + i + "_height' style='min-width:20px;' placeholder='Height' value='" + response.boxing_data[i].box_height + "'></td>" +1366 "<td><input type='text' id='box_" + i + "_box_weight' style='min-width:20px;' placeholder='Box Weight' value='" + response.boxing_data[i].box_weight + "'></td>" +1367 "<td><input type='text' id='box_" + i + "_max_weight' style='min-width:20px;' placeholder='Max Weight' value='" + response.boxing_data[i].max_box_weight + "'></td>" +1368 "</tr>"1369 );1370 }1371 }1372 });1373 1374 1375 //Onclick of remove box button1376 jQuery("body").on('click', '#remove_box_btn', function (event) {1377 event.preventDefault();1378 var check_flag = [];1379 var check_ids = []; //array to store the id of the checkboxes that have been checked for removal1380 var finalCheckArray = {};1381 for (var i = 0; i < 10; i++) {1382 check_flag[i] = jQuery("#checkbox_box_" + i).is(":checked");1383 if (check_flag[i] == true) {1384 check_ids.push(i);1385 }1386 }1387 for (var remove_counter = 0; remove_counter < check_ids.length; remove_counter++) {1388 jQuery("#row_" + check_ids[remove_counter]).remove();1389 }1390 1391 });1392 1393 1394 //On click of add button in boxing manager settings1395 jQuery("body").on('click', '#add_box_btn', function (event) {1396 event.preventDefault();1397 var id = (jQuery('#main_table tbody tr:last').index());1398 id = id + 1;1399 jQuery("#main_table").append("" +1400 "<tr id='row_" + id + "'>" +1401 "<td></td>" +1402 "<td><input type='checkbox' id='checkbox_box_" + id + "'></td>" +1403 "<td><input type='text' id='box_" + id + "_name' style='min-width:50px;' placeholder='Box Name'></td>" +1404 "<td><input type='text' id='box_" + id + "_length' style='min-width:20px;' placeholder='Length'></td>" +1405 "<td><input type='text' id='box_" + id + "_width' style='min-width:20px;' placeholder='Width'></td>" +1406 "<td><input type='text' id='box_" + id + "_height' style='min-width:20px;' placeholder='Height'></td>" +1407 "<td><input type='text' id='box_" + id + "_box_weight' style='min-width:20px;' placeholder='Box Weight'></td>" +1408 "<td><input type='text' id='box_" + id + "_max_weight' style='min-width:20px;' placeholder='Max Weight'></td>" +1409 "</td>" +1410 "</tr>"1411 );1412 });1413 1414 //Onclick of save button in boxing manager settings1415 jQuery("body").on('click', '#save_boxing_options', function (event) {1416 event.preventDefault();1417 var finalArray = {};1418 for (var i = 0; i < 10; i++) {1419 var j = i;1420 var finalSubArray = {};1421 finalSubArray.name = jQuery("#box_" + j + "_name").val();1422 finalSubArray.box_length = jQuery("#box_" + j + "_length").val();1423 finalSubArray.box_width = jQuery("#box_" + j + "_width").val();1424 finalSubArray.box_height = jQuery("#box_" + j + "_height").val();1425 finalSubArray.box_weight = jQuery("#box_" + j + "_box_weight").val();1426 finalSubArray.box_max_weight = jQuery("#box_" + j + "_max_weight").val();1427 finalArray[i] = finalSubArray;1428 }1429 1430 jQuery.ajax({1431 type: "post",1432 dataType: "json",1433 url: ajaxurl,1434 data: {1435 action: "boxing_insert",1436 formdata: finalArray,1437 },1438 success: function (response) {1439 if (response.statusCode == 200) {1440 jQuery("#boxing_save_message_display").text(response.msg);1441 jQuery("#boxing_save_message_display").css('color', 'green');1442 }1443 1444 }1445 });1446 });1447 });1448 </script>1449 1450 <button type="submit" name="save_boxing_options" value="save_boxing_options" id="save_boxing_options">Save Boxing1451 Information1452 </button>1453 <br/><br/>1454 <div id="boxing_save_message_display"></div>1455 </td>1456 </tr>1457 </table>1458 </div>1459 1269 </div> 1460 1270 -
eshipper-commerce/trunk/plugin/PluginHealthHelper.php
r2984482 r3006736 65 65 $create_plugin_health_table = " CREATE TABLE $table($columns 66 66 created_time timestamp DEFAULT CURRENT_TIMESTAMP, 67 updated_time timestamp DEFAULT NULL67 updated_time timestamp DEFAULT CURRENT_TIMESTAMP 68 68 )"; 69 69 70 70 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 71 dbDelta($create_plugin_health_table);71 $queryResult = dbDelta($create_plugin_health_table); 72 72 73 73 // Check if table exists at this point before proceeding. … … 75 75 global $wpdb; 76 76 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 77 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);77 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 78 78 return false; 79 79 } -
eshipper-commerce/trunk/plugin/pluginLifeCycle.php
r2963096 r3006736 23 23 24 24 // Create all required tables for the plugin 25 self::updateDB(); 26 } 27 28 /** 29 * Create/update all required tables for the plugin 30 * @return void 31 */ 32 public static function updateDB() 33 { 34 // All methods called here use dbDelta to create/update the tables 35 // and hence always contain the latest structure of the table 25 36 pluginLifeCycle::createEshipperAccessTokensTable(); 26 37 pluginLifeCycle::createEshipperCarrierServicesTable(); … … 30 41 PluginHealthHelper::createEshipperPluginHealthTable(); 31 42 } 32 33 // TODO: Remove old code34 pluginLifeCycle::createEshipperBoxingMasterTable();35 43 } 36 44 … … 137 145 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_carrier_service_master"); 138 146 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_shipping_address"); 139 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_boxing_services_master");140 147 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_plugin_health"); 141 148 … … 151 158 } 152 159 } 153 } 154 155 /* 156 * Creating a table at the time of activation to store the boxing services in Woo-Commerce DB 157 * @Deprecated This table is not used anymore 158 */ 159 private static function createEshipperBoxingMasterTable() 160 { 161 global $wpdb; 162 $table = $wpdb->prefix . "eshipper_boxing_services_master"; 163 164 wc_get_logger()->debug("Attempting to create table - $table", ['source' => 'eshipper']); 165 166 $create_boxing_master_table_query = " CREATE TABLE $table( 167 p_id int(10) NOT NULL AUTO_INCREMENT, 168 box_name varchar(255), 169 box_length int(10) , 170 box_width int(10) , 171 box_height int(10) , 172 box_weight int(10) , 173 max_box_weight int(10) , 174 created_time timestamp DEFAULT CURRENT_TIMESTAMP, 175 PRIMARY KEY (p_id) 176 )"; 177 178 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 179 dbDelta($create_boxing_master_table_query); 180 181 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 182 wc_get_logger()->error("Could not create table - $table", ['source' => 'eshipper']); 183 } 184 185 wc_get_logger()->debug("Successfully created table - $table", ['source' => 'eshipper']); 160 161 // Delete old tables 162 $wpdb->query("DROP TABLE {$wpdb->prefix}eshipper_boxing_services_master"); 186 163 } 187 164 … … 208 185 209 186 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 210 dbDelta($access_tokens_query);187 $queryResult = dbDelta($access_tokens_query); 211 188 212 189 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 213 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);190 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 214 191 } 215 192 … … 242 219 243 220 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 244 dbDelta($access_tokens_query);221 $queryResult = dbDelta($access_tokens_query); 245 222 246 223 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 247 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);224 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 248 225 } 249 226 … … 534 511 535 512 require_once(ABSPATH . "wp-admin/includes/upgrade.php"); 536 dbDelta($create_shipping_address_query);513 $queryResult = dbDelta($create_shipping_address_query); 537 514 538 515 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) { 539 wc_get_logger()->error("Could not create table - $table ", ['source' => 'eshipper']);516 wc_get_logger()->error("Could not create table - $table \n Query Result - \n" . var_export($queryResult, true), ['source' => 'eshipper']); 540 517 } 541 518 … … 599 576 } 600 577 601 /*602 * Function to manage the boxing services in Woo-Commerce DB603 */604 public function eshipperBoxingServicesUpdate($dataArray)605 {606 global $wpdb;607 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";608 $truncate_box_master_query = $wpdb->query("TRUNCATE TABLE $box_master_table");609 $finalData = $dataArray;610 foreach ($finalData as $i => $value) {611 $data = [612 'box_name' => $finalData[$i]['name'],613 'box_length' => $finalData[$i]['box_length'],614 'box_width' => $finalData[$i]['box_width'],615 'box_height' => $finalData[$i]['box_height'],616 'box_weight' => $finalData[$i]['box_weight'],617 'max_box_weight' => $finalData[$i]['box_max_weight'],618 ];619 $wpdb->insert(620 $wpdb->prefix . 'eshipper_boxing_services_master',621 $data,622 ['%s', '%d', '%d', '%d', '%d', '%d',]623 );624 }625 626 $response = "Boxes have been successfuly saved";627 628 return $response;629 }630 631 578 public static function getEshipperSettingsLink(bool $healthPage = true, bool $asyncRequest = false) 632 579 { -
eshipper-commerce/trunk/readme.txt
r2984482 r3006736 5 5 Tested up to: 6.3.1 6 6 Requires PHP: 7.1 7 Stable tag: 2.16. 37 Stable tag: 2.16.4 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 54 54 55 55 == Changelog == 56 = 2.16.4 = 57 * Bug fix for 'Update Database' error in Plugin Health page. 58 56 59 = 2.16.3 = 57 60 * Bug fix for Shipping Calculator - not able to select states when selling is allowed to one specific country in WooCommerce Settings. … … 99 102 100 103 == Upgrade Notice == 104 = 2.16.4 = 105 Bug fix for 'Update Database' error in Plugin Health page. 106 101 107 = 2.16.3 = 102 108 Bug fixes for Shipping Calculator. -
eshipper-commerce/trunk/woocommerce-eshipper.php
r2984482 r3006736 4 4 Plugin URI: https://ww2.eshipper.com/ecommerce/ 5 5 Description: Extends WooCommerce with Shipping Rates from eShipper 6 Version: 2.16. 36 Version: 2.16.4 7 7 Author: eShipper 8 8 Author URI: https://ww2.eshipper.com/ … … 28 28 get_site_option('active_sitewide_plugins') 29 29 ))) { 30 define('ESHIPPER_VERSION', '2.16.3'); 31 define('ESHIPPER_VERSION_LATEST', '2.16.3'); 32 define('ESHIPPER_VERSION_DB_UPDATE', '2.15.3'); 33 //Plugin Path 30 define('ESHIPPER_VERSION', '2.16.4'); 34 31 define('ESHIPPER_PLUGIN_PATH', dirname(__FILE__)); 35 32 define('ESHIPPER_PLUGIN_FILE', __FILE__); … … 86 83 add_action('wp_ajax_es_select_country_states', 'es_select_country_states'); 87 84 add_action('wp_ajax_get_rates_for_shipping_calculator', 'get_rates_for_shipping_calculator'); 88 89 90 // TODO: Remove stale code91 add_action('wp_ajax_boxing_insert', 'boxing_insert');92 85 93 86 function save_shipping_address() … … 642 635 } 643 636 644 645 // TODO: Remove stale code646 647 /**648 * --------------------------------------------------------649 * UNUSED STALE CODE650 * --------------------------------------------------------651 */652 653 /**654 * Ajax function call to insert the boxing details in the db655 * @return void656 */657 function boxing_insert()658 {659 if ($_POST['formdata']['boxing_flag'] == "fetch") {660 global $wpdb;661 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";662 $fetch_box_query = $wpdb->get_results("SELECT * FROM $box_master_table");663 $responseArray = ['statusCode' => "200", "boxing_data" => $fetch_box_query];664 echo json_encode($responseArray);665 die();666 }667 668 if ($_POST['action'] == "boxing_insert") {669 if (isset($_POST['formdata']) && is_array($_POST['formdata'])) {670 $eshipperAuthentication = new pluginLifeCycle();671 $response = $eshipperAuthentication->eshipperBoxingServicesUpdate($_POST['formdata']);672 $responseArray = ['statusCode' => "200", "msg" => $response];673 echo json_encode($responseArray);674 die();675 }676 }677 }678 679 /*680 * Custom REST API for sending boxing information starts681 */682 /*add_action('rest_api_init',function (){683 register_rest_route('wl/v3','getBoxingInfo',[684 'methods' => 'GET',685 'callback' => 'send_boxing_info',686 ]);687 });*/688 689 function send_boxing_info()690 {691 global $wpdb;692 $box_master_table = $wpdb->prefix . "eshipper_boxing_services_master";693 $boxing_info = $wpdb->get_results("SELECT * FROM $box_master_table");694 if (count($boxing_info) > 0) {695 $responseArray = ['statusCode' => "200", "msg" => "Boxing Information Successfuly Fetched", "Boxing_info" => $boxing_info];696 697 return $responseArray;698 } else {699 $responseArray = ['statusCode' => "200", "msg" => "No Boxing Information Currently Available"];700 701 return $responseArray;702 }703 }704 705 637 add_action('rest_api_init', function () { 706 638 register_rest_route('wl/v3', 'uninstall-eshipper-plugin', [ … … 945 877 return new WP_REST_Response($responseArray, 200); 946 878 } 947 948 /*949 * Custom REST API for sending boxing information ends950 */951 879 952 880 /*Called by ajax on submit from deactivation form*/
Note: See TracChangeset
for help on using the changeset viewer.