Changeset 3329065
- Timestamp:
- 07/16/2025 12:38:38 PM (9 months ago)
- Location:
- minicrm-woocommerce-sync/trunk
- Files:
-
- 6 edited
-
languages/minicrm-woocommerce-sync.pot (modified) (1 diff)
-
lib/Configuration.php (modified) (1 diff)
-
lib/Feed.php (modified) (4 diffs)
-
lib/Integration.php (modified) (1 diff)
-
minicrm-woocommerce-sync.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
minicrm-woocommerce-sync/trunk/languages/minicrm-woocommerce-sync.pot
r3294841 r3329065 4 4 "Project-Id-Version: MiniCRM " 5 5 "WooCommerce Sync plugin " 6 "v1.7. 1\n"6 "v1.7.2\n" 7 7 "POT-Creation-Date: 2022-05-30 " 8 8 "22:22+0200\n" -
minicrm-woocommerce-sync/trunk/lib/Configuration.php
r2849279 r3329065 828 828 '127.0.0.9', 829 829 '127.0.0.10', 830 '172.18.0.1', 830 831 '195.228.75.201', 831 832 '195.228.75.202', -
minicrm-woocommerce-sync/trunk/lib/Feed.php
r3294841 r3329065 429 429 $itemClass = get_class ($item); 430 430 431 if ($item->get_total() === '') { 432 $item->set_total('0.00'); 433 } 434 431 435 // Get tax percent 432 436 try { … … 505 509 if ($sync_product_desc) { 506 510 $productDescription = $itemProduct->get_description (); 507 $productDescription = s ubstr ($productDescription, 0, 1024);511 $productDescription = strip_tags ($productDescription); 508 512 } 509 513 } … … 522 526 throw new \Exception ("Unexpected item class: '$itemClass'"); 523 527 } 524 // Apply htmlspecialchars and then safely truncate to 1024 characters 525 $encodedDescription = htmlspecialchars($productDescription, ENT_QUOTES, 'UTF-8'); 526 $safeTruncatedDescription = mb_substr($encodedDescription, 0, 1024, 'UTF-8'); 528 // Truncate to 1024 characters 529 $truncatedDescription = mb_substr($productDescription, 0, 1024, 'UTF-8'); 527 530 528 531 // Add XML node … … 536 539 $product->Quantity = $item->get_quantity (); 537 540 $product->SKU = $sku; 538 $product->Description = $ safeTruncatedDescription;541 $product->Description = $truncatedDescription; 539 542 $product->Unit = $localUnit; 540 543 $product->VAT = "$taxPercent%"; -
minicrm-woocommerce-sync/trunk/lib/Integration.php
r3294841 r3329065 102 102 103 103 $projectIds = []; 104 104 105 $filters = [ 105 'post_type' => 'shop_order', 106 'post_status' => 'any', 107 'posts_per_page' => 100, 108 'orderby' => 'ID', 109 'order' => 'DESC', 110 'fields' => 'ids', 111 'no_found_rows' => true 106 'type' => 'shop_order', 107 'limit' => 100, 108 'paginate' => true, 109 'orderby' => 'ID', 110 'order' => 'DESC', 111 'return' => 'object' 112 112 ]; 113 114 $query = new \WP_Query($filters); 115 $orderIds = $query->get_posts(); 116 117 foreach ($orderIds as $orderId) { 118 $customerId = (int) get_post_meta($orderId, '_customer_user', true); 119 $projectId = Plugin::getOrderProjectId($orderId, $customerId); 120 if (!in_array($projectId, $projectIds)) { 121 $projectIds[] = $projectId; 113 $query = new \WC_Order_Query($filters); 114 115 $page = 1; 116 117 do { 118 $query->set('paged', $page); 119 $result = $query->get_orders(); 120 121 foreach ($result->orders as $order) { 122 $projectId = Plugin::getOrderProjectId($order->get_id(), $order->get_customer_id()); 123 if (!in_array($projectId, $projectIds)) { 124 $projectIds[] = $projectId; 125 } 122 126 } 123 } 127 128 $page++; 129 } while ($page <= $result->max_num_pages); 124 130 125 131 // Cache the results for 1 hour -
minicrm-woocommerce-sync/trunk/minicrm-woocommerce-sync.php
r3294841 r3329065 10 10 * Requires PHP: 8.0 11 11 * Text Domain: minicrm-woocommerce-sync 12 * Version: 1.7. 112 * Version: 1.7.2 13 13 * WC requires at least: 4.0.0 14 14 * WC tested up to: 7.2 … … 36 36 */ 37 37 38 use Automattic\WooCommerce\Utilities\FeaturesUtil; 38 39 use MiniCRM\WoocommercePlugin\Plugin; 39 40 … … 62 63 // Load translations 63 64 add_action ( 64 ' plugins_loaded',65 'init', 65 66 function () { 66 67 $textDomain = dirname (plugin_basename (__FILE__)); … … 69 70 10 70 71 ); 72 73 // Declare compatibility with High Performance Order Storage 74 add_action( 'before_woocommerce_init', function() { 75 if ( class_exists( FeaturesUtil::class ) ) { 76 FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 77 } 78 } ); 71 79 72 80 // Init plugin -
minicrm-woocommerce-sync/trunk/readme.txt
r3294841 r3329065 5 5 Requires at least: 4.9 6 6 Requires PHP: 8.0 7 Stable tag: 1.7. 17 Stable tag: 1.7.2 8 8 Tested up to: 6.2 9 9 WC requires at least: 4.0.0 … … 34 34 35 35 - Initial public release 36 37 == Known Issues == 38 39 1. Due to a known bug in WooCommerce, if you use High-Performance Order Storage, the plugin is not notified when an order is trashed or untrashed; therefore, it cannot synchronize the order with MiniCRM.
Note: See TracChangeset
for help on using the changeset viewer.