Fixed multiple execution of order updates (#352)
This commit is contained in:
parent
aa4e337cd0
commit
894c065b99
@ -1,3 +1,6 @@
|
||||
## 2024-10-24 4.8.12
|
||||
* Fixed multiple execution of order updates
|
||||
|
||||
## 2024-10-14 4.8.11
|
||||
* Added additional parameters to GET requests
|
||||
|
||||
|
@ -108,6 +108,14 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
add_action('admin_enqueue_scripts', [$this, 'include_files_for_admin'], 101);
|
||||
add_action('woocommerce_new_order', [$this, 'create_order'], 11, 1);
|
||||
|
||||
if (
|
||||
!$this->get_option('deactivate_update_order')
|
||||
|| $this->get_option('deactivate_update_order') == static::NO
|
||||
) {
|
||||
add_action('woocommerce_update_order', [$this, 'take_update_order'], 11, 1);
|
||||
add_action('shutdown', [$this, 'update_order'], -1);
|
||||
add_action('woocommerce_saved_order_items', [$this, 'update_order_items'], 10, 1);
|
||||
}
|
||||
|
||||
if (isLoyaltyActivate($this->settings)) {
|
||||
add_action('wp_ajax_register_customer_loyalty', [$this, 'register_customer_loyalty']);
|
||||
@ -130,23 +138,8 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
add_action('retailcrm_loyalty_upload_price', [$this, 'upload_loyalty_price']);
|
||||
add_action('admin_print_footer_scripts', [$this, 'ajax_upload_loyalty_price'], 99);
|
||||
add_action('wp_ajax_upload_loyalty_price', [$this, 'upload_loyalty_price']);
|
||||
|
||||
if (
|
||||
!$this->get_option('deactivate_update_order')
|
||||
|| $this->get_option('deactivate_update_order') == static::NO
|
||||
) {
|
||||
add_action('woocommerce_update_order', [$this, 'take_update_order'], 11, 1);
|
||||
add_action('shutdown', [$this, 'update_order_loyalty'], -1);
|
||||
add_action('woocommerce_saved_order_items', [$this, 'update_order_items'], 10, 1);
|
||||
}
|
||||
} elseif (
|
||||
!$this->get_option('deactivate_update_order')
|
||||
|| $this->get_option('deactivate_update_order') == static::NO
|
||||
) {
|
||||
add_action('woocommerce_update_order', [$this, 'update_order'], 10, 1);
|
||||
}
|
||||
|
||||
|
||||
// Subscribed hooks
|
||||
add_action('register_form', [$this, 'subscribe_register_form'], 99);
|
||||
add_action('woocommerce_register_form', [$this, 'subscribe_woocommerce_register_form'], 99);
|
||||
@ -653,19 +646,6 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
}
|
||||
}
|
||||
|
||||
public function update_order($orderId)
|
||||
{
|
||||
WC_Retailcrm_Logger::setHook(current_action(), $orderId);
|
||||
|
||||
if (WC_Retailcrm_Plugin::history_running() === true) {
|
||||
WC_Retailcrm_Logger::info(__METHOD__, 'History in progress, skip');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->orders->updateOrder($orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit order in retailCRM
|
||||
*
|
||||
@ -695,7 +675,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
$this->updatedOrderId[$order_id] = $order_id;
|
||||
}
|
||||
|
||||
public function update_order_loyalty()
|
||||
public function update_order()
|
||||
{
|
||||
WC_Retailcrm_Logger::setHook(current_action());
|
||||
|
||||
@ -708,8 +688,10 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
|
||||
public function update_order_items($orderId)
|
||||
{
|
||||
WC_Retailcrm_Logger::setHook(current_action(), $orderId);
|
||||
$this->orders->updateOrder($orderId);
|
||||
if (is_admin()) {
|
||||
WC_Retailcrm_Logger::setHook(current_action(), $orderId);
|
||||
$this->orders->updateOrder($orderId);
|
||||
}
|
||||
}
|
||||
|
||||
public function trash_order_action($id)
|
||||
|
@ -330,6 +330,11 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
||||
|
||||
try {
|
||||
$wcOrder = wc_get_order($orderId);
|
||||
|
||||
if ($wcOrder->get_status() === 'checkout-draft') {
|
||||
return null;
|
||||
}
|
||||
|
||||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Update WC_Order ' . $wcOrder->get_id(),
|
||||
|
@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
|
||||
Requires PHP: 7.1
|
||||
Requires at least: 5.3
|
||||
Tested up to: 6.5
|
||||
Stable tag: 4.8.11
|
||||
Stable tag: 4.8.12
|
||||
License: GPLv1 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
||||
|
||||
@ -82,6 +82,8 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
|
||||
|
||||
|
||||
== Changelog ==
|
||||
= 4.8.12 =
|
||||
* Fixed multiple execution of order updates
|
||||
|
||||
= 4.8.11 =
|
||||
* Added additional parameters to GET requests
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Description: Integration plugin for WooCommerce & Simla.com
|
||||
* Author: RetailDriver LLC
|
||||
* Author URI: http://retailcrm.pro/
|
||||
* Version: 4.8.11
|
||||
* Version: 4.8.12
|
||||
* Tested up to: 6.5
|
||||
* Requires Plugins: woocommerce
|
||||
* WC requires at least: 5.4
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||
*
|
||||
* @version 4.8.11
|
||||
* @version 4.8.12
|
||||
*
|
||||
* @package RetailCRM
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user