Fix validate form on saved settings (#43)

This commit is contained in:
Akolzin Dmitry 2017-08-18 14:44:01 +02:00 committed by Alex Lushpai
parent 82d93de94b
commit 05a47a90b5
4 changed files with 6 additions and 5 deletions

View File

@ -544,9 +544,9 @@ class ControllerExtensionModuleRetailcrm extends Controller
); );
} }
$response = $this->retailcrm->statisticUpdate(); $response = $this->retailcrm->deliveryTypesList();
if ($response['errorMsg'] == 'API method not found') { if ($response == false) {
$this->_error['warning'] = $this->language->get('text_error_api'); $this->_error['warning'] = $this->language->get('text_error_api');
} }

View File

@ -41,7 +41,7 @@ $_['field_email'] = 'Email';
$_['field_phone'] = 'Phone'; $_['field_phone'] = 'Phone';
$_['text_require'] = 'Require'; $_['text_require'] = 'Require';
$_['text_error_collector_fields']= 'Fill in the field names Daemon Collector'; $_['text_error_collector_fields']= 'Fill in the field names Daemon Collector';
$_['text_error_api'] = 'The selected version of the API is unavailable'; $_['text_error_api'] = 'The selected version of the API or method is unavailable';
$_['retailcrm_dict_delivery'] = 'Shipment methods'; $_['retailcrm_dict_delivery'] = 'Shipment methods';
$_['retailcrm_dict_status'] = 'Order statuses'; $_['retailcrm_dict_status'] = 'Order statuses';

View File

@ -41,7 +41,7 @@ $_['field_email'] = 'Email';
$_['field_phone'] = 'Телефон'; $_['field_phone'] = 'Телефон';
$_['text_require'] = 'Обязательно для заполнения'; $_['text_require'] = 'Обязательно для заполнения';
$_['text_error_collector_fields']= 'Заполните названия полей формы Демон Collector'; $_['text_error_collector_fields']= 'Заполните названия полей формы Демон Collector';
$_['text_error_api'] = 'Недоступна выбранная версия API'; $_['text_error_api'] = 'Недоступна выбранная версия API или метод.';
$_['retailcrm_dict_delivery'] = 'Способы доставки'; $_['retailcrm_dict_delivery'] = 'Способы доставки';
$_['retailcrm_dict_status'] = 'Статусы'; $_['retailcrm_dict_status'] = 'Статусы';

View File

@ -10,8 +10,9 @@ class RetailcrmProxy
private $api; private $api;
private $log; private $log;
public function __construct($url, $key, $log, $version = 'v4') public function __construct($url, $key, $log, $version)
{ {
if (!$version) $version = 'v4';
switch ($version) { switch ($version) {
case 'v5': case 'v5':
$this->api = new RetailcrmApiClient5($url, $key); $this->api = new RetailcrmApiClient5($url, $key);