Changeset 3122791
- Timestamp:
- 07/21/2024 04:18:14 PM (21 months ago)
- Location:
- box-now-delivery/trunk
- Files:
-
- 5 edited
-
box-now-delivery.php (modified) (6 diffs)
-
includes/box-now-delivery-admin-page.php (modified) (1 diff)
-
includes/box-now-delivery-validation.php (modified) (1 diff)
-
js/box-now-delivery.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box-now-delivery/trunk/box-now-delivery.php
r3002071 r3122791 5 5 Author: BOX NOW 6 6 Text Domain: box-now-delivery 7 Version: 2.1 7 Version: 2.1.2 8 8 */ 9 9 … … 360 360 "allowReturn" => true, 361 361 "origin" => [ 362 "contactNumber" => get_option('boxnow_mobile_number', ''), 362 363 "contactEmail" => get_option('boxnow_voucher_email', ''), 363 364 "locationId" => $prep_data['selected_warehouse'], … … 394 395 $order->save(); 395 396 } else { 396 throw new Exception('Error: Unable to create vouchers.' );397 throw new Exception('Error: Unable to create vouchers.' . json_encode($response_body)); 397 398 } 398 399 return wp_remote_retrieve_body($response); … … 509 510 // Ensure the country's prefix is not missing 510 511 $tel = $prep_data['phone']; 511 if (substr($tel, 0, 1) != '+' && substr($tel, 0, 2) != '00') { 512 $numberOfDigits = strlen(preg_replace('/[^\d]/', '', $tel)); 513 $firstTwoDigits = substr($tel, 0, 2); 514 if ($numberOfDigits < 9 && in_array($firstTwoDigits, ['22', '23', '24', '25', '26', '96', '97', '98', '99'])) { 515 $tel = '+357' . $tel; 516 } 517 else { 518 $tel = '+30' . $tel; 519 } 520 } 512 if (substr($tel, 0, 1) != '+') { 513 // If the phone starts with "00", replace "00" with "+" 514 if (substr($tel, 0, 2) === '00') { 515 $tel = '+' . substr($tel, 2); 516 } 517 // If the phone starts with the specified codes and has less than 9 digits, put "+357" in the beginning 518 elseif (in_array(substr($tel, 0, 2), ['22', '23', '24', '25', '26', '96', '97', '98', '99']) && strlen(preg_replace('/[^\d]/', '', $tel)) < 9) { 519 $tel = '+357' . preg_replace('/[^\d]/', '', $tel); 520 } 521 else { 522 $tel = '+30' . preg_replace('/[^\d]/', '', $tel); 523 } 524 } 521 525 $prep_data['phone'] = $tel; 522 526 … … 564 568 "allowReturn" => true, 565 569 "origin" => [ 570 "contactNumber" => get_option('boxnow_mobile_number', ''), 566 571 "contactEmail" => get_option('boxnow_voucher_email', ''), 567 572 "locationId" => $prep_data['selected_warehouse'], … … 599 604 } else { 600 605 error_log('API Response: ' . print_r($response_body, true)); 601 throw new Exception('Error: Unable to create vouchers.' );606 throw new Exception('Error: Unable to create vouchers.'. json_encode($response_body)); 602 607 } 603 608 return wp_remote_retrieve_body($response); -
box-now-delivery/trunk/includes/box-now-delivery-admin-page.php
r3002071 r3122791 154 154 </p> 155 155 </div> 156 <!-- Sender's Contact field --> 157 <h2 style="width: 100%; float: left;">Sender's Contact field</h2> 158 <div style="width: 30%; float: left;"> 159 <p> 160 <label>Sender's Phone(Will be used for returns):</label> 161 <br /> 162 <input type="text" name="boxnow_mobile_number" value="<?php echo esc_attr(get_option('boxnow_mobile_number', '')); ?>" placeholder="Enter your phone with country preffix (+30 , +357, etc)" /> 163 </p> 164 </div> 156 165 157 166 <!-- Save button --> -
box-now-delivery/trunk/includes/box-now-delivery-validation.php
r2956661 r3122791 56 56 update_option('boxnow_voucher_email', sanitize_email($_POST['boxnow_voucher_email'])); 57 57 } 58 if (isset($_POST['boxnow_mobile_number'])) { 59 update_option('boxnow_mobile_number', sanitize_text_field($_POST['boxnow_mobile_number'])); 60 } 58 61 if (isset($_POST['boxnow_locker_not_selected_message'])) { 59 62 update_option('boxnow_locker_not_selected_message', sanitize_text_field($_POST['boxnow_locker_not_selected_message'])); -
box-now-delivery/trunk/js/box-now-delivery.js
r3003253 r3122791 395 395 396 396 if ( 397 (!lockerData && 398 $( 399 'input[type="radio"][name="shipping_method[0]"]:checked' 400 ).val() === "box_now_delivery") || 401 $("input[name='shipping_method[0]']").length == 1 397 !lockerData && 398 $('input[type="radio"][name="shipping_method[0]"]:checked').val() === 399 "box_now_delivery" 402 400 ) { 403 401 event.preventDefault(); -
box-now-delivery/trunk/readme.txt
r3002071 r3122791 3 3 Tags: delivery, boxnow 4 4 Requires at least: 6.2 5 Tested up to: 6. 4.16 Stable tag: 2.1 5 Tested up to: 6.6 6 Stable tag: 2.1.2 7 7 Requires PHP: 8.0 8 8 License: GPLv2 or later … … 17 17 == Changelog == 18 18 19 = 2.1 =20 *Added Cyprus map+utility19 = 2.1.2 = 20 *Added Sender's contact phone 21 21 *Added Phone "check and fix" for cyprus and greek numbers 22 *Added Sender's email field for "create voucher via a button" 23 *Fixed a bug where boxnow wouldnt show if it was the only delivery service 24 *Fixed a bug where admin was prompted to only define max weight in kilograms 22 *Minor Bug fixes 25 23 26 24 == Upgrade Notice == 27 25 28 = 2.1 =26 = 2.1.2 = 29 27 Please upgrade to our latest plugin version to avoid coflicts and errors of any older versions.
Note: See TracChangeset
for help on using the changeset viewer.