diff --git a/CHANGELOG.md b/CHANGELOG.md index 0318268..115a90f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v.3.3.0 +* Добавена настройка записи истории изменения заказов в Opencart +* Устранен баг с вызовом события редактирования заказа при выгрузке истории изменений из retailCRM + ## v.3.2.4 * Добавлена возможность передачи акционных цен для нескольких групп пользователей * Добавлена передача нулевой цены для неустановленных акционных цен diff --git a/VERSION b/VERSION index 351227f..15a2799 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.4 +3.3.0 diff --git a/src/upload/admin/controller/extension/module/retailcrm.php b/src/upload/admin/controller/extension/module/retailcrm.php index cf7295d..85ef039 100644 --- a/src/upload/admin/controller/extension/module/retailcrm.php +++ b/src/upload/admin/controller/extension/module/retailcrm.php @@ -304,7 +304,9 @@ class ControllerExtensionModuleRetailcrm extends Controller 'order_number', 'text_order_number', 'text_currency', - 'text_currency_label' + 'text_currency_label', + 'status_changes', + 'text_status_changes' ); $_data = &$data; diff --git a/src/upload/admin/language/en-gb/extension/module/retailcrm.php b/src/upload/admin/language/en-gb/extension/module/retailcrm.php index 579cce8..768b332 100644 --- a/src/upload/admin/language/en-gb/extension/module/retailcrm.php +++ b/src/upload/admin/language/en-gb/extension/module/retailcrm.php @@ -1,8 +1,8 @@ db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE iso_code_2 = '" . $isoCode . "'"); - + return $query->row; } /** * Get zone by name - * + * * @param string $name - * + * * @return array */ public function getZoneByName($name) @@ -137,10 +137,10 @@ class ModelExtensionRetailcrmHistory extends Model /** * Get currency - * + * * @param string $code * @param string $field (default = '') - * + * * @return mixed array | string */ public function getCurrencyByCode($code, $field = '') @@ -156,10 +156,10 @@ class ModelExtensionRetailcrmHistory extends Model /** * Get language - * + * * @param string $code * @param string $field (default = '') - * + * * @return mixed array | string */ public function getLanguageByCode($code, $field = '') @@ -175,10 +175,10 @@ class ModelExtensionRetailcrmHistory extends Model /** * Get product option value - * + * * @param int $option_value_id * @param string $field - * + * * @return mixed array | string */ public function getOptionValue($option_value_id, $field = '') 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 39b72f6..2202812 100644 --- a/src/upload/admin/model/extension/retailcrm/history/v4_5.php +++ b/src/upload/admin/model/extension/retailcrm/history/v4_5.php @@ -4,6 +4,9 @@ require_once __DIR__ . '/../history.php'; class ModelExtensionRetailcrmHistoryV45 extends ModelExtensionRetailcrmHistory { + /** @var bool */ + public static $history_run = false; + protected $createResult; protected $settings; protected $moduleTitle; @@ -32,7 +35,7 @@ class ModelExtensionRetailcrmHistoryV45 extends ModelExtensionRetailcrmHistory $this->load->model('setting/store'); $this->load->model('user/api'); $this->load->model('sale/order'); - $this->load->model('customer/customer'); + $this->load->model('customer/customer'); $this->load->model('extension/retailcrm/references'); $this->load->model('catalog/product'); $this->load->model('catalog/option'); @@ -162,9 +165,9 @@ class ModelExtensionRetailcrmHistoryV45 extends ModelExtensionRetailcrmHistory } $this->model_setting_setting->editSetting( - 'retailcrm_history', + 'retailcrm_history', array( - 'retailcrm_history_orders' => $sinceIdOrders, + 'retailcrm_history_orders' => $sinceIdOrders, 'retailcrm_history_customers' => $sinceIdCustomers, 'retailcrm_history_datetime' => $generatedAt ) @@ -183,13 +186,13 @@ class ModelExtensionRetailcrmHistoryV45 extends ModelExtensionRetailcrmHistory /** * Update orders from history - * + * * @param array $orders - * + * * @return void */ protected function updateOrders($orders) - { + { foreach ($orders as $order) { $ocOrder = $this->model_sale_order->getOrder($order['externalId']); @@ -468,19 +471,26 @@ class ModelExtensionRetailcrmHistoryV45 extends ModelExtensionRetailcrmHistory } $this->editOrder($order['externalId'], $data); - $this->opencartApiClient->addHistory($order['externalId'], $data['order_status_id']); + + if (isset($this->settings[$this->moduleTitle . '_status_changes']) + && $this->settings[$this->moduleTitle . '_status_changes'] + ) { + static::$history_run = true; + $this->opencartApiClient->addHistory($order['externalId'], $data['order_status_id']); + static::$history_run = false; + } } } /** * Create orders from history - * + * * @param array $orders - * + * * @return array */ protected function createOrders($orders) - { + { $customersIdsFix = array(); $ordersIdsFix = array(); diff --git a/src/upload/admin/view/template/extension/module/retailcrm.tpl b/src/upload/admin/view/template/extension/module/retailcrm.tpl index 5f3821f..8151190 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.tpl +++ b/src/upload/admin/view/template/extension/module/retailcrm.tpl @@ -109,6 +109,26 @@ +
@@ -510,7 +530,7 @@