From adf390c286beeb40fbbe51bf1977caea10312570 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Thu, 21 Mar 2019 10:00:00 +0300 Subject: [PATCH] bug fix --- .../admin/model/extension/retailcrm/history/v4_5.php | 7 ++----- .../catalog/controller/extension/module/retailcrm.php | 7 +++++-- src/upload/system/library/retailcrm/retailcrm.php | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/upload/admin/model/extension/retailcrm/history/v4_5.php b/src/upload/admin/model/extension/retailcrm/history/v4_5.php index 2202812..36ca4c2 100644 --- a/src/upload/admin/model/extension/retailcrm/history/v4_5.php +++ b/src/upload/admin/model/extension/retailcrm/history/v4_5.php @@ -4,9 +4,6 @@ require_once __DIR__ . '/../history.php'; class ModelExtensionRetailcrmHistoryV45 extends ModelExtensionRetailcrmHistory { - /** @var bool */ - public static $history_run = false; - protected $createResult; protected $settings; protected $moduleTitle; @@ -475,9 +472,9 @@ class ModelExtensionRetailcrmHistoryV45 extends ModelExtensionRetailcrmHistory if (isset($this->settings[$this->moduleTitle . '_status_changes']) && $this->settings[$this->moduleTitle . '_status_changes'] ) { - static::$history_run = true; + \retailcrm\Retailcrm::$history_run = true; $this->opencartApiClient->addHistory($order['externalId'], $data['order_status_id']); - static::$history_run = false; + \retailcrm\Retailcrm::$history_run = false; } } } diff --git a/src/upload/catalog/controller/extension/module/retailcrm.php b/src/upload/catalog/controller/extension/module/retailcrm.php index 40515b5..42874b9 100644 --- a/src/upload/catalog/controller/extension/module/retailcrm.php +++ b/src/upload/catalog/controller/extension/module/retailcrm.php @@ -31,8 +31,7 @@ class ControllerExtensionModuleRetailcrm extends Controller { * @return void */ public function order_create($trigger, $data, $order_id = null) { - - if (ModelExtensionRetailcrmHistoryV45::$history_run === true) { + if (\retailcrm\Retailcrm::$history_run === true) { return; } @@ -80,6 +79,10 @@ class ControllerExtensionModuleRetailcrm extends Controller { * @return void */ public function order_edit($trigger, $parameter2 = null) { + if (\retailcrm\Retailcrm::$history_run === true) { + return; + } + $order_id = $parameter2[0]; $this->load->model('checkout/order'); diff --git a/src/upload/system/library/retailcrm/retailcrm.php b/src/upload/system/library/retailcrm/retailcrm.php index d6e81cf..e9df359 100644 --- a/src/upload/system/library/retailcrm/retailcrm.php +++ b/src/upload/system/library/retailcrm/retailcrm.php @@ -8,6 +8,9 @@ class Retailcrm { protected $apiClient; protected $registry; + /** @var bool */ + public static $history_run = false; + public function __construct($registry) { $this->registry = $registry; } @@ -23,7 +26,7 @@ class Retailcrm { * @param string $apiKey (default = null) * @param string $apiVersion (default = null) * - * @return mixed object | boolean + * @return mixed object | boolean */ public function getApiClient($apiUrl = null, $apiKey = null, $apiVersion = null) { $this->load->model('setting/setting'); @@ -128,7 +131,7 @@ class Retailcrm { } } } - + // Совмещаем или добавляем необязательные опции, учитывая тот факт что обязательных опций может и не быть. foreach($notRequiredOptions as $notRequiredOption) { // Если обязательных опцией не оказалось и первая итерация