Changeset 3341654
- Timestamp:
- 08/08/2025 01:11:40 PM (7 months ago)
- Location:
- barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk
- Files:
-
- 4 added
- 4 deleted
- 12 edited
-
assets/js/bundle-business-1.10.0-1753286566858.js (deleted)
-
assets/js/bundle-business-1.10.2-1754656172339.js (added)
-
assets/js/index-business-1.10.0-1753286566858.js (deleted)
-
assets/js/index-business-1.10.2-1754656172339.js (added)
-
download-csv.php (modified) (2 diffs)
-
request.php (modified) (2 diffs)
-
src/API/actions/CartScannerActions.php (modified) (1 diff)
-
src/API/actions/HPOS.php (modified) (1 diff)
-
src/API/actions/ManagementActions.php (modified) (2 diffs)
-
src/API/classes/Integrations.php (modified) (2 diffs)
-
src/Database.php (modified) (2 diffs)
-
src/Languages.php (modified) (1 diff)
-
src/features/logs/assets/js/index-business-1.10.0-1753286566858.js (deleted)
-
src/features/logs/assets/js/index-business-1.10.2-1754656172339.js (added)
-
src/features/settings/assets/js/index-business-1.10.0-1753286566858.js (deleted)
-
src/features/settings/assets/js/index-business-1.10.2-1754656172339.js (added)
-
src/features/settings/assets/js/index.js (modified) (6 diffs)
-
src/features/settings/views/fields/_mobile.php (modified) (1 diff)
-
src/features/settings/views/fields/_web.php (modified) (1 diff)
-
src/features/settings/views/fields/field.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/download-csv.php
r3304735 r3341654 2 2 3 3 use UkrSolution\BarcodeScanner\Core; 4 5 if (!defined('WP_USE_THEMES')) {6 define('WP_USE_THEMES', false);7 }8 9 if (!defined('DISABLE_WP_CRON')) {10 define('DISABLE_WP_CRON', true);11 }12 4 13 5 global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header; … … 28 20 29 21 require($root . "/wp-load.php"); 22 23 if (!defined('WP_USE_THEMES')) { 24 define('WP_USE_THEMES', false); 25 } 26 27 if (!defined('DISABLE_WP_CRON')) { 28 define('DISABLE_WP_CRON', true); 29 } 30 30 31 31 $dt = new \DateTime("now"); -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/request.php
r3336436 r3341654 2 2 3 3 use UkrSolution\BarcodeScanner\Core; 4 5 if (!defined('WP_USE_THEMES')) {6 define('WP_USE_THEMES', false);7 }8 9 if (!defined('DISABLE_WP_CRON')) {10 define('DISABLE_WP_CRON', true);11 }12 4 13 5 global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header; … … 28 20 29 21 require($root . "/wp-load.php"); 22 23 if (!defined('WP_USE_THEMES')) { 24 define('WP_USE_THEMES', false); 25 } 26 27 if (!defined('DISABLE_WP_CRON')) { 28 define('DISABLE_WP_CRON', true); 29 } 30 30 31 31 function usbs_plugin_filter($plugins) -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/API/actions/CartScannerActions.php
r3335202 r3341654 744 744 "cart_total_c" => strip_tags($cartTotal), 745 745 "cart_subtotal" => $cart_subtotal, 746 "cart_subtotal_c" => strip_tags(wc_price($cartSubtotal)), 746 "cart_subtotal_c" => strip_tags(wc_price($cartSubtotal)), 747 747 "cart_subtotal_tax" => $cartSubtotalTax, 748 748 "cart_subtotal_tax_c" => strip_tags(wc_price($cartSubtotalTax)), -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/API/actions/HPOS.php
r3335202 r3341654 507 507 508 508 $taxAddress = $cartScannerActions->getTaxAddress(array("address" => array( 509 "billing_country" => $order-> billing_country,510 "billing_state" => $order-> billing_state,511 "billing_city" => $order-> billing_city,512 "billing_postcode" => $order-> billing_postcode,513 "shipping_country" => $order-> shipping_country,514 "shipping_state" => $order-> shipping_state,515 "shipping_city" => $order-> shipping_city,516 "shipping_postcode" => $order-> shipping_postcode,509 "billing_country" => $order->get_billing_country(), 510 "billing_state" => $order->get_billing_state(), 511 "billing_city" => $order->get_billing_city(), 512 "billing_postcode" => $order->get_billing_postcode(), 513 "shipping_country" => $order->get_shipping_country(), 514 "shipping_state" => $order->get_shipping_state(), 515 "shipping_city" => $order->get_shipping_city(), 516 "shipping_postcode" => $order->get_shipping_postcode(), 517 517 "shipping_as_billing" => 0 518 518 ))); -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/API/actions/ManagementActions.php
r3335202 r3341654 2139 2139 $order->save(); 2140 2140 2141 if ( preg_match('/^(\d+)\%$/', $coupon, $matches)) {2141 if (false && preg_match('/^(\d+)\%$/', $coupon, $matches)) { 2142 2142 $couponPercent = $matches[1]; 2143 $item = new \WC_Order_Item_Coupon(); 2144 $item->set_props(array( 2145 'code' => $coupon, 2146 'discount' => $couponPercent, 2147 'discount_tax' => 0, 2148 )); 2149 $order->add_item($item); 2143 $coupon_code = 'dynamic' . $couponPercent . '-' . wp_generate_password(6, false); 2144 $coupon_code = $couponPercent . "%"; 2145 $coupon = new \WC_Coupon(); 2146 $coupon->set_description('Barcode scanner - autogenerated coupon'); 2147 $coupon->set_code($coupon_code); 2148 $coupon->set_discount_type('percent'); 2149 $coupon->set_amount($couponPercent); 2150 $coupon->set_individual_use(true); 2151 $coupon->set_usage_limit(1); 2152 $coupon->set_date_expires(strtotime('+1 day')); 2153 $coupon->save(); 2154 2155 $order->apply_coupon($coupon->get_code()); 2156 $order->set_discount_total($coupon->get_amount()); 2157 2158 2150 2159 2151 2160 } … … 2154 2163 2155 2164 if ($coupon->get_id()) { 2156 $order->apply_coupon($coupon->get_code()); 2157 $order->set_discount_total($coupon->get_amount()); 2158 } 2159 } 2165 $coupon_code = $order->apply_coupon($coupon->get_code()); 2166 2167 if (is_wp_error($coupon_code)) { 2168 return rest_ensure_response(array("error" => $coupon_code->get_error_message())); 2169 } else { 2170 $order->set_discount_total($coupon->get_amount()); 2171 } 2172 } else { 2173 return rest_ensure_response(array("error" => __("Coupon not found.", "us-barcode-scanner"))); 2174 } 2175 } 2160 2176 2161 2177 -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/API/classes/Integrations.php
r3304735 r3341654 34 34 35 35 add_action('init', array($this, "postDateFields")); 36 37 add_action('init', array($this, "printInvoicesPackingSlipLabelsForWoocommerce")); 36 38 } catch (\Throwable $th) { 37 39 } … … 575 577 }, 10, 3); 576 578 } 579 580 public function printInvoicesPackingSlipLabelsForWoocommerce() 581 { 582 add_filter('wf_pklist_modify_meta_data', function ($meta_data, $order_item, $order = null, $template_type = null) { 583 if (isset($meta_data['usbs_check_product_scanned'])) { 584 unset($meta_data['usbs_check_product_scanned']); 585 } 586 587 if (isset($meta_data['usbs_check_product'])) { 588 unset($meta_data['usbs_check_product']); 589 } 590 591 return $meta_data; 592 }, 1000, 4); 593 } 577 594 } -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/Database.php
r3335202 r3341654 503 503 array("field_name" => "usbs_stock_location_level_2", "field_label" => "Rack", "label_position" => "top", "label_width" => $widthRight, "position" => "product-left-sidebar", "type" => "text", "field_height" => 0, "status" => 1, "order" => 290), 504 504 array("field_name" => "usbs_stock_location_level_3", "field_label" => "Shelf", "label_position" => "top", "label_width" => $widthRight, "position" => "product-left-sidebar", "type" => "text", "field_height" => 0, "status" => 1, "order" => 280), 505 );506 $defaultFieldsForAll = array(505 ); 506 $defaultFieldsForAll = array( 507 507 array("field_name" => "usbs_variation_attributes", "field_label" => "Variation attributes", "label_position" => "top", "label_width" => $widthRight, "position" => "product-middle-right", "type" => "variation_attributes", "field_height" => 0, "status" => 1, "order" => 870), 508 508 array("field_name" => "product_cat", "field_label" => "Categories", "label_position" => "left", "label_width" => $widthLeft, "position" => "product-middle-left", "type" => "taxonomy", "field_height" => 0, "status" => 1, "order" => 400), … … 513 513 array("field_name" => "_backorders", "field_label" => "Allow backorders?", "label_position" => "top", "label_width" => $widthRight, "position" => "product-middle-right", "type" => "select", "field_height" => 0, "status" => 0, "options" => json_encode($_backorders), "order" => 920), 514 514 array("field_name" => "_switch_status", "field_label" => "Checkbox", "label_position" => "top", "label_width" => $widthRight, "position" => "product-middle-right", "type" => "checkbox", "field_height" => 0, "status" => 0, "mobile_status" => 0, "order" => 920), 515 ); 515 516 array("field_name" => "product_name_section", "field_label" => "Product name section", "label_position" => "", "label_width" => $widthLeft, "position" => "product-middle-top", "type" => "product_name_section", "field_height" => 0, "status" => 1, "mobile_status" => 0, "order" => 3000), 517 ); 516 518 517 519 -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/Languages.php
r3335202 r3341654 2 2 3 3 return array( 4 "ID" => __("ID", 'us-barcode-scanner'), 4 5 "inventory" => __("Inventory", 'us-barcode-scanner'), 5 6 "orders" => __("Orders", 'us-barcode-scanner'), -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/features/settings/assets/js/index.js
r3304735 r3341654 258 258 } else if (position === "product-middle-bottom") { 259 259 template.find(".usbs_label_width").val("100"); 260 } else if (position === "product-middle-top") { 261 template.find(".usbs_label_width").val("100"); 260 262 } 261 263 }); … … 279 281 const fieldsChecker = (e, field) => { 280 282 const type = jQuery(e.target).closest(".settings_field_body").find(".usbs_field_type").val(); 283 const fieldStatusEl = jQuery(e.target).closest(".settings_field_body").find(".usbs_field_status"); 284 const fieldRemoveEl = jQuery(e.target).closest(".settings_field_body").find(".settings_field_remove"); 285 const dashiconsMoveEl = jQuery(e.target).closest(".settings_field_section").find(".dashicons.dashicons-move"); 281 286 const positionEl = jQuery(e.target).closest(".settings_field_body").find(".usbs_field_label_position"); 282 287 const nameEl = jQuery(e.target).closest(".settings_field_body").find(".usbs_field_name"); … … 291 296 const buttonWidthEl = jQuery(e.target).closest(".settings_field_body").find(".button_width"); 292 297 const taxonomyEl = jQuery(e.target).closest(".settings_field_body").find(".usbs_taxonomy"); 293 294 if (['usbs_wcpbn', 'usbs_webis'].includes(type)) { 298 const productNameSectionEl = jQuery(e.target).closest(".settings_field_body").find(".product_name_section"); 299 const fieldTypeEl = jQuery(e.target).closest(".settings_field_body").find(".tr_usbs_field_type"); 300 301 if (['usbs_wcpbn', 'usbs_webis', 'search_section', 'product_name_section'].includes(type)) { 295 302 const elements = jQuery("select.usbs_field_type").filter((index, el) => jQuery(el).val() == type); 303 const position = jQuery(e.target).closest("[data-position]").attr("data-position"); 296 304 297 305 if (elements && elements.length > 1) { 298 306 alert('This type of field already was created!'); 299 307 jQuery(e.target).val('text'); 308 jQuery(e.target).change(); 309 return; 310 } else if (position && position != "product-middle-top") { 311 alert('You can\'t add this type of field to this position!'); 312 jQuery(e.target).val('text'); 313 jQuery(e.target).change(); 300 314 return; 301 315 } 316 } 317 318 fieldTypeEl.removeAttr("style"); 319 320 if (['search_section', 'product_name_section'].includes(type)) { 321 fieldRemoveEl.css("display", "none"); 322 dashiconsMoveEl.css("display", "none"); 323 } else { 324 fieldRemoveEl.removeAttr("style"); 325 dashiconsMoveEl.removeAttr("style"); 302 326 } 303 327 … … 413 437 if (!["position"].includes(field)) positionEl.change(); 414 438 } 439 440 441 if (productNameSectionEl && type == "product_name_section") { 442 fieldStatusEl.closest("tr").css("display", "none"); 443 heightEl.closest("tr").css("display", "none"); 444 nameEl.closest("tr").css("display", "none"); 445 positionEl.closest("tr").css("display", "none"); 446 showInCreateOrderEl.closest("tr").css("display", "none"); 447 labelEl.closest("tr").css("display", "none"); 448 heightEl.closest("tr").css("display", "none"); 449 labelWidthEl.closest("tr").css("display", "none"); 450 fieldTypeEl.closest("tr").css("display", "none"); 451 } 415 452 }; 416 453 … … 474 511 stop: WebbsFieldsInitAfterChanges, 475 512 start: function (event, ui) { 513 if (jQuery(ui.item).hasClass('field_product_name_section')) { 514 jQuery(this).sortable("option", "revert", false); 515 setTimeout(() => { 516 jQuery(this).sortable("cancel"); 517 }, 0); 518 return; 519 } 520 476 521 if (!jQuery(ui.item).find(".edit_java_script_modal").attr("style")) { 477 522 jQuery(this).sortable("option", "revert", false); … … 486 531 } 487 532 }, 533 beforeStop: function (event, ui) { 534 const $container = jQuery(this); 535 const $productNameSection = $container.find('.field_product_name_section'); 536 537 if ($productNameSection.length > 0) { 538 if ($productNameSection.index() !== 0) { 539 $container.prepend($productNameSection); 540 } 541 } 542 }, 543 change: function (event, ui) { 544 545 546 }, 547 update: function (event, ui) { 548 const $container = jQuery(this); 549 const $productNameSection = $container.find('.field_product_name_section'); 550 551 if ($productNameSection.length > 0 && $productNameSection.index() !== 0) { 552 $container.prepend($productNameSection); 553 } 554 }, 488 555 receive: function (event, ui) { 556 const $container = jQuery(this); 557 const $productNameSection = $container.find('.field_product_name_section'); 558 559 if ($productNameSection.length > 0) { 560 if ($productNameSection.index() !== 0) { 561 $container.prepend($productNameSection); 562 } 563 } 489 564 }, 490 565 }); -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/features/settings/views/fields/_mobile.php
r3304735 r3341654 24 24 <?php foreach ($interfaceData::getFields(false, "mobile", false, $roleActive, false) as $field) : ?> 25 25 <?php if ($field["type"] == "price") continue; ?> 26 <?php if (in_array($field["position"], array("product-middle- left", "product-middle-right", "product-left-sidebar", "product-column-4", "product-middle-bottom"))) {26 <?php if (in_array($field["position"], array("product-middle-top", "product-middle-left", "product-middle-right", "product-left-sidebar", "product-column-4", "product-middle-bottom"))) { 27 27 require __DIR__ . "/field.php"; 28 28 } ?> -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/features/settings/views/fields/_web.php
r3304735 r3341654 138 138 </div> 139 139 <!-- end product-column-4 --> 140 <!-- middle top --> 141 <div style="margin-right: 20px; width: 380px;"> 142 <b><?php echo esc_html__("Middle top fields:", "us-barcode-scanner"); ?></b> 143 <button type="button" class="settings_field_add_new" data-position="product-middle-top"><?php echo esc_html__("Add new", "us-barcode-scanner"); ?></button> 144 145 <div style="height: 10px;"></div> 146 <table class="form-table wrapper" data-position="product-middle-top" style="min-height: 100px;"> 147 <tbody class="usbs_fields_list_sortable"> 148 <?php foreach ($interfaceData::getFields(false, "", false, $roleActive, false) as $field) : ?> 149 <?php if ($field["position"] == "product-middle-top") { 150 require __DIR__ . "/field.php"; 151 } ?> 152 <?php endforeach; ?> 153 </tbody> 154 </table> 155 </div> 156 <!-- end middle top --> 140 157 <!-- middle bottom --> 141 158 <div style="width: 380px;"> -
barcode-scanner-lite-pos-to-manage-products-inventory-and-orders/trunk/src/features/settings/views/fields/field.php
r3304735 r3341654 79 79 </tr> 80 80 81 <tr >81 <tr class="tr_usbs_field_type"> 82 82 <td scope="row" style="text-align:left; padding: 0 10px 0 10px; width: 110px; box-sizing: border-box;"> 83 83 <?php echo esc_html__("Field type", "us-barcode-scanner"); ?> … … 112 112 <?php endif; ?> 113 113 <option value="checkbox" <?php echo $field["type"] == "checkbox" ? wp_kses_post("selected='selected'") : ""; ?>><?php echo esc_html__("Checkbox", "us-barcode-scanner"); ?></option> 114 <!-- <option value="search_section" <?php echo $field["type"] == "search_section" ? wp_kses_post("selected='selected'") : ""; ?>><?php echo esc_html__("Search section", "us-barcode-scanner"); ?></option> --> 115 <option value="product_name_section" <?php echo $field["type"] == "product_name_section" ? wp_kses_post("selected='selected'") : ""; ?>><?php echo esc_html__("Product name section", "us-barcode-scanner"); ?></option> 114 116 </select> 115 117 </td>
Note: See TracChangeset
for help on using the changeset viewer.