Changeset 3395106
- Timestamp:
- 11/13/2025 02:43:56 PM (5 months ago)
- Location:
- shelf-planner/trunk
- Files:
-
- 4 edited
-
block.json (modified) (1 diff)
-
includes/shelf_planner_connector.php (modified) (10 diffs)
-
readme.txt (modified) (4 diffs)
-
shelf-planner.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shelf-planner/trunk/block.json
r3393802 r3395106 3 3 "apiVersion": 3, 4 4 "name": "extension/shelf-planner", 5 "version": "2.8. 1",5 "version": "2.8.2", 6 6 "title": "Stock Management for WooCommerce", 7 7 "category": "widgets", -
shelf-planner/trunk/includes/shelf_planner_connector.php
r3393802 r3395106 337 337 function add_product_stock($data) 338 338 { 339 $this->debug("add_product_stock call parameters:" . json_encode($data->get_json_params())); 339 340 $product = wc_get_product($data['ProductId']); 340 341 if (!$product) { … … 352 353 function update_product_stock($data) 353 354 { 355 $this->debug("update_product_stock call parameters:" . json_encode($data->get_json_params())); 354 356 $product = wc_get_product($data['ProductId']); 355 357 if (!$product) { … … 379 381 { 380 382 // Validate request auth 381 $this->debug(" GetCategoryList call parameters:" . json_encode($data->get_json_params()));383 $this->debug("get_categories_list call parameters:" . json_encode($data->get_json_params())); 382 384 $taxonomy = 'product_cat'; 383 385 $orderby = 'name'; … … 436 438 { 437 439 // Validate request auth 438 $this->debug(" GetProductListcall parameters:" . json_encode($data->get_json_params()));440 $this->debug("get_products_id call parameters:" . json_encode($data->get_json_params())); 439 441 global $wpdb; 440 442 … … 473 475 { 474 476 // Validate request auth 475 $this->debug(" GetOrderListcall parameters:" . json_encode($data->get_json_params()));477 $this->debug("get_orders_id call parameters:" . json_encode($data->get_json_params())); 476 478 global $wpdb; 477 479 … … 518 520 } 519 521 520 function get_orders_detail($ request)521 { 522 $this->debug(" GetOrderDetail call");523 $params = $ request->get_params(); // Ottieni i parametri passati nella richiesta POST522 function get_orders_detail($data) 523 { 524 $this->debug("get_orders_detail call parameters:" . json_encode($data->get_json_params())); 525 $params = $data->get_params(); // Ottieni i parametri passati nella richiesta POST 524 526 $tmpOrders = []; 525 527 foreach ($params['IDS'] as $order_id) { … … 616 618 function get_products_detail($data) 617 619 { 618 $this->debug(" GetProductDetail call parameters:" . json_encode($data->get_json_params()));620 $this->debug("get_products_detail call parameters:" . json_encode($data->get_json_params())); 619 621 $ar_return = []; 620 622 foreach ($data['IDS'] as $product_id) { … … 673 675 } 674 676 677 function ping($data) 678 { 679 return "pong"; 680 } 681 682 function validate_request_auth_website_url($data) 683 { 684 // Verify WebsiteUrl validity 685 if ($this->get_website_url() != $data['WebsiteUrl']) { 686 $this->warning("ERROR SITE: doesn't match "); 687 return false; 688 } 689 690 return true; 691 } 692 693 function validate_request_auth_website_url_server_key($data) 694 { 695 // Verify WebsiteUrl validity 696 if (!$this->validate_request_auth_website_url($data)) { 697 return false; 698 } 699 700 // Verify ServerKey validity 701 if ($this->get_server_key() != $data['ServerKey']) { 702 $this->warning("ERROR SERVER: doesn't match "); 703 return false; 704 } 705 706 return true; 707 } 708 709 function validate_request_auth($data) 710 { 711 // Verify WebsiteUrl and ServerKey validity 712 if (!$this->validate_request_auth_website_url_server_key($data)) { 713 return false; 714 } 715 716 // Verify LicenseKey validity 717 if ($this->get_license_key() != $data['LicenseKey']) { 718 $this->warning("ERROR LICENSE doesn't match "); 719 return false; 720 } 721 722 return true; 723 } 724 725 function setup_connector($data) 726 { 727 // Set licenseKey 728 $this->set_license_key($data['LicenseKey']); 729 } 730 731 function connector_product_update($product_id, $product) 732 { 733 if (!$this->has_license_key()) { 734 return; 735 } 736 737 $updating_product_id = 'update_product_' . $product_id; 738 if (false === ($updating_product = get_transient($updating_product_id))) { 739 set_transient($updating_product_id, $product_id, 2); // change 2 seconds if not enough 740 $this->debug('PRODUCT UPDATED! PRODUCT_ID: ' . $product_id); 741 $this->send_product_update_sync_request($product_id); 742 } 743 } 744 745 function connector_order_completed($order_id) 746 { 747 if (!$this->has_license_key()) { 748 return; 749 } 750 751 $updating_order_id = 'update_order_' . $order_id; 752 if (false === ($updating_order = get_transient($updating_order_id))) { 753 set_transient($updating_order_id, $order_id, 2); // change 2 seconds if not enough 754 $this->debug('ORDER COMPLETED! ORDER_ID: ' . $order_id); 755 $this->send_order_completed_sync_request($order_id); 756 } 757 } 758 759 /** 760 * Logs messages if WP_DEBUG is enabled. 761 * 762 * @param mixed $data Data to log. 763 * @param string $level Log level (debug, info, warning, error). 764 */ 765 public function log($data, $level = 'info') 766 { 767 $log_enabled = get_option($this->config->get_domain() . '_enable_logs', 'checked'); 768 if ('checked' == $log_enabled) { 769 $message = $data; 770 if (strpos($message, 'serverKey') !== false || strpos($message, 'ServerKey') !== false) { 771 $message = preg_replace('/"[Ss]erver[Kk]ey":\s*"[^"]*"/', '"ServerKey":"ANON"', $message); 772 } 773 if (strpos($message, 'licenseKey') !== false || strpos($message, 'LicenseKey') !== false) { 774 $message = preg_replace('/"[Ll]icense[Kk]ey":\s*"[^"]*"/', '"LicenseKey":"ANON"', $message); 775 } 776 $log_file = $this->get_log_file_path(gmdate('Y-m-d'), true); 777 $message = gmdate('[Y.m.d H:i:s]') . ' [' . strtoupper($level) . '] ' . $message . PHP_EOL; 778 file_put_contents($log_file, $message, FILE_APPEND); 779 } 780 } 781 675 782 function get_logs($data) 676 783 { 677 $logs_filename = $data["LogsDate"] . ".log";678 $log_file _path = $this->config->get_log_path() . $logs_filename;679 680 if (file_exists($log_file _path)) {784 $logs_filename = $data["LogsDate"] . '.log'; 785 $log_file = $this->get_log_file_path($data["LogsDate"]); 786 787 if (file_exists($log_file)) { 681 788 global $wp_filesystem; 682 789 // create a file interaction object, if it is not already created … … 686 793 } 687 794 688 $contents = $wp_filesystem->get_contents($log_file _path);795 $contents = $wp_filesystem->get_contents($log_file); 689 796 if (!$contents) { 690 797 return "Log file read error for date: " . $data["LogsDate"]; … … 700 807 } 701 808 702 function ping($data) 703 { 704 return "pong"; 705 } 706 707 function validate_request_auth_website_url($data) 708 { 709 // Verify WebsiteUrl validity 710 if ($this->get_website_url() != $data['WebsiteUrl']) { 711 $this->warning("ERROR SITE: doesn't match "); 712 return false; 713 } 714 715 return true; 716 } 717 718 function validate_request_auth_website_url_server_key($data) 719 { 720 // Verify WebsiteUrl validity 721 if (!$this->validate_request_auth_website_url($data)) { 722 return false; 723 } 724 725 // Verify ServerKey validity 726 if ($this->get_server_key() != $data['ServerKey']) { 727 $this->warning("ERROR SERVER: doesn't match "); 728 return false; 729 } 730 731 return true; 732 } 733 734 function validate_request_auth($data) 735 { 736 // Verify WebsiteUrl and ServerKey validity 737 if (!$this->validate_request_auth_website_url_server_key($data)) { 738 return false; 739 } 740 741 // Verify LicenseKey validity 742 if ($this->get_license_key() != $data['LicenseKey']) { 743 $this->warning("ERROR LICENSE doesn't match "); 744 return false; 745 } 746 747 return true; 748 } 749 750 function setup_connector($data) 751 { 752 // Set licenseKey 753 $this->set_license_key($data['LicenseKey']); 754 } 755 756 function connector_product_update($product_id, $product) 757 { 758 if (!$this->has_license_key()) { 759 return; 760 } 761 762 $updating_product_id = 'update_product_' . $product_id; 763 if (false === ($updating_product = get_transient($updating_product_id))) { 764 set_transient($updating_product_id, $product_id, 2); // change 2 seconds if not enough 765 $this->debug('PRODUCT UPDATED! PRODUCT_ID: ' . $product_id); 766 $this->send_product_update_sync_request($product_id); 767 } 768 } 769 770 function connector_order_completed($order_id) 771 { 772 if (!$this->has_license_key()) { 773 return; 774 } 775 776 $updating_order_id = 'update_order_' . $order_id; 777 if (false === ($updating_order = get_transient($updating_order_id))) { 778 set_transient($updating_order_id, $order_id, 2); // change 2 seconds if not enough 779 $this->debug('ORDER COMPLETED! ORDER_ID: ' . $order_id); 780 $this->send_order_completed_sync_request($order_id); 781 } 782 } 783 784 /** 785 * Logs messages if WP_DEBUG is enabled. 786 * 787 * @param mixed $data Data to log. 788 * @param string $level Log level (debug, info, warning, error). 789 */ 790 public function log($data, $level = 'info') 791 { 792 $log_enabled = get_option($this->config->get_domain() . '_enable_logs', 'checked'); 793 if ('checked' == $log_enabled) { 794 $log_file = $this->config->get_log_path() . gmdate('Y-m-d') . '.log'; 795 796 $message = $data; 797 798 if (strpos($message, 'serverKey') !== false || strpos($message, 'ServerKey') !== false) { 799 $message = preg_replace('/"[Ss]erver[Kk]ey":\s*"[^"]*"/', '"ServerKey":"ANON"', $message); 800 } 801 if (strpos($message, 'licenseKey') !== false || strpos($message, 'LicenseKey') !== false) { 802 $message = preg_replace('/"[Ll]icense[Kk]ey":\s*"[^"]*"/', '"LicenseKey":"ANON"', $message); 803 } 804 $message = gmdate('[d.m.Y H:i:s]') . ' [' . strtoupper($level) . '] ' . $message . PHP_EOL; 805 file_put_contents($log_file, $message, FILE_APPEND); 806 } 809 public function get_log_file_path($log_date, $create_if_not_exists = false) 810 { 811 $log_files_dictionary = get_option($this->config->get_domain() . '_logs_dictionary'); 812 813 if ( 814 !$create_if_not_exists && 815 (!isset($log_files_dictionary) || !is_array($log_files_dictionary) || !isset($log_files_dictionary[$log_date])) 816 ) { 817 return null; 818 } 819 820 if ($create_if_not_exists && (!isset($log_files_dictionary) || !is_array($log_files_dictionary))) { 821 $log_files_dictionary = array(); 822 } 823 824 if (!isset($log_files_dictionary[$log_date])) { 825 826 $log_files_dictionary[$log_date] = $this->config->get_log_path() . wp_generate_uuid4() . '.log'; 827 update_option($this->config->get_domain() . '_logs_dictionary', $log_files_dictionary); 828 } 829 830 return $log_files_dictionary[$log_date]; 807 831 } 808 832 -
shelf-planner/trunk/readme.txt
r3393802 r3395106 4 4 Tested up to: 6.8 5 5 Requires PHP: 8.0 6 Stable tag: 2.8. 16 Stable tag: 2.8.2 7 7 Tags: Inventory Management,ABC Analysis,Demand Forecasting,Replenishment,Purchasing 8 8 License: GPLv2 or later … … 17 17 == Main Features == 18 18 19 - **Inventory Management** - Bridge the gap between demand and supply planning with data-driven insights. 19 20 - **AI Demand forecasting** - Predict future sales with machine learning - no spreadsheets required. 20 - **Sales Forecasting** - Get weekly, monthly, and seasonal sales forecasts to plan inventory and promotions with confidence.21 - **Sales Forecasting** - Leverage powerful AI algorithms for demand forecasting, drawing insights from past sales and seasonal patterns. 21 22 - **Automated replenishment** - Get instant order proposals tailored to your store’s demand. 22 23 - **Stock Projections** - Plan ahead with forecasts that account for incoming stock and transfers. … … 29 30 - **WPML & Multi-currency Ready** - Perfect for international stores with multi-language and currency support. 30 31 31 ####Automate Stock Replenishment 32 ###Inventory Management 33 - Don't take the stockout risk and automate your stock management with Shelf Planner. 34 - Make more sales with higher product availability by ordering the right quantities before it's too late 35 36 ###Automate Stock Replenishment 32 37 - Get live order proposals for all your products based on your customer's demand. 33 38 - Order Proposals based on true customer demand. 34 39 35 ### #Avoid Lost Sales and stock-outs40 ###Avoid Lost Sales and stock-outs 36 41 - Avoid lost sales and missed opportunities by understanding what to order, when. 37 42 - Get alerts so you don't lose sales due to stock-outs. 38 43 - Understand where your business is going and take better decisions when managing your stock. 39 44 40 ### #Automate your purchasing processes45 ###Automate your purchasing processes 41 46 - Get order proposals based on true customer demand and create purchase orders directly from the extension. 42 47 - Automatically update your store's stock with the built in Purchase Order tracking 43 48 44 ### #Boost Profitability of your store49 ###Boost Profitability of your store 45 50 - Track and monitor the costs and profits of your products and see the impact on your store’s profitability. 46 51 - See both your gross margin targets and achieved net margins 47 52 48 ### #Pricing & Free Trial53 ###Pricing & Free Trial 49 54 - **Free 3-Month Trial:** Test all features with no commitment. 50 55 - **Flexible Plans:** Scale up as your business grows. … … 131 136 == Changelog == 132 137 138 = 2.8.2 = 139 - Even more improvements in security and logging functionalities — mostly to survive another day in a PHP world. 140 133 141 = 2.8.1 = 134 *Additional improvements in security and logging functionalities142 - Additional improvements in security and logging functionalities 135 143 136 144 = 2.8.0 = 137 *Improvement in security and logging functionalities138 *Added support for website with strict security settings on http verbs145 - Improvement in security and logging functionalities 146 - Added support for website with strict security settings on http verbs 139 147 140 148 = 2.7.0 = -
shelf-planner/trunk/shelf-planner.php
r3393802 r3395106 10 10 * Description: AI-driven Stock Management, Demand Forecasting, Replenishment and Order Management for WooCommerce, all in one powerful tool. 11 11 * 12 * Version: 2.8. 112 * Version: 2.8.2 13 13 * Author: Shelf Planner 14 14 * Author URI: https://www.shelfplanner.com … … 26 26 27 27 if (!defined('SPC_WP__VERSION')) { 28 define('SPC_WP__VERSION', '2.8. 1');28 define('SPC_WP__VERSION', '2.8.2'); 29 29 } 30 30
Note: See TracChangeset
for help on using the changeset viewer.