Plugin Directory

Changeset 3329065


Ignore:
Timestamp:
07/16/2025 12:38:38 PM (9 months ago)
Author:
minicrmio
Message:

High-Performance Order Storage compatibility, bugfixes

Location:
minicrm-woocommerce-sync/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • minicrm-woocommerce-sync/trunk/languages/minicrm-woocommerce-sync.pot

    r3294841 r3329065  
    44"Project-Id-Version: MiniCRM "
    55"WooCommerce Sync plugin "
    6 "v1.7.1\n"
     6"v1.7.2\n"
    77"POT-Creation-Date: 2022-05-30 "
    88"22:22+0200\n"
  • minicrm-woocommerce-sync/trunk/lib/Configuration.php

    r2849279 r3329065  
    828828        '127.0.0.9',
    829829        '127.0.0.10',
     830        '172.18.0.1',
    830831        '195.228.75.201',
    831832        '195.228.75.202',
  • minicrm-woocommerce-sync/trunk/lib/Feed.php

    r3294841 r3329065  
    429429                    $itemClass = get_class ($item);
    430430
     431                    if ($item->get_total() === '') {
     432                        $item->set_total('0.00');
     433                    }
     434
    431435                    // Get tax percent
    432436                    try {
     
    505509                                if ($sync_product_desc) {
    506510                                    $productDescription = $itemProduct->get_description ();
    507                                     $productDescription = substr ($productDescription, 0, 1024);
     511                                    $productDescription = strip_tags ($productDescription);
    508512                                }
    509513                            }
     
    522526                            throw new \Exception ("Unexpected item class: '$itemClass'");
    523527                    }
    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');
    527530
    528531                    // Add XML node
     
    536539                    $product->Quantity = $item->get_quantity ();
    537540                    $product->SKU = $sku;
    538                     $product->Description = $safeTruncatedDescription;
     541                    $product->Description = $truncatedDescription;
    539542                    $product->Unit = $localUnit;
    540543                    $product->VAT = "$taxPercent%";
  • minicrm-woocommerce-sync/trunk/lib/Integration.php

    r3294841 r3329065  
    102102
    103103        $projectIds = [];
     104
    104105        $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'
    112112        ];
    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                }
    122126            }
    123         }
     127
     128            $page++;
     129        } while ($page <= $result->max_num_pages);
    124130
    125131        // Cache the results for 1 hour
  • minicrm-woocommerce-sync/trunk/minicrm-woocommerce-sync.php

    r3294841 r3329065  
    1010 * Requires PHP: 8.0
    1111 * Text Domain: minicrm-woocommerce-sync
    12  * Version: 1.7.1
     12 * Version: 1.7.2
    1313 * WC requires at least: 4.0.0
    1414 * WC tested up to: 7.2
     
    3636 */
    3737
     38use Automattic\WooCommerce\Utilities\FeaturesUtil;
    3839use MiniCRM\WoocommercePlugin\Plugin;
    3940
     
    6263// Load translations
    6364add_action (
    64     'plugins_loaded',
     65    'init',
    6566    function () {
    6667        $textDomain = dirname (plugin_basename (__FILE__));
     
    6970    10
    7071);
     72
     73// Declare compatibility with High Performance Order Storage
     74add_action( 'before_woocommerce_init', function() {
     75    if ( class_exists( FeaturesUtil::class ) ) {
     76        FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     77    }
     78} );
    7179
    7280// Init plugin
  • minicrm-woocommerce-sync/trunk/readme.txt

    r3294841 r3329065  
    55Requires at least: 4.9
    66Requires PHP: 8.0
    7 Stable tag: 1.7.1
     7Stable tag: 1.7.2
    88Tested up to: 6.2
    99WC requires at least: 4.0.0
     
    3434
    3535- Initial public release
     36
     37== Known Issues ==
     38
     391. 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.