Settings default status in export (#25)

This commit is contained in:
Akolzin Dmitry 2017-09-27 14:38:24 +02:00 committed by Alex Lushpai
parent 8b1c9ec5de
commit 87a6c6ee34
4 changed files with 35 additions and 7 deletions

View File

@ -17,6 +17,7 @@ require(dirname(__FILE__) . '/../bootstrap.php');
$apiUrl = Configuration::get('RETAILCRM_ADDRESS');
$apiKey = Configuration::get('RETAILCRM_API_TOKEN');
$apiVersion = Configuration::get('RETAILCRM_API_VERSION');
$statusExport = Configuration::get('RETAILCRM_STATUS_EXPORT');
if (!empty($apiUrl) && !empty($apiKey)) {
$api = new RetailcrmProxy($apiUrl, $apiKey, _PS_ROOT_DIR_ . '/retailcrm.log', $apiVersion);
@ -59,11 +60,11 @@ foreach ($orderRecords as $record) {
}
if ($record['current_state'] == 0) {
$order_status = 'completed';
$order_status = $statusExport;
} else {
$order_status = array_key_exists($record['current_state'], $status)
? $status[$record['current_state']]
: 'completed'
: $statusExport
;
}

View File

@ -202,6 +202,11 @@ class RetailcrmReferences
return $this->payment_modules;
}
public function getStatuseDefaultExport()
{
return $this->getApiStatuses();
}
protected function getApiDeliveryTypes()
{
$crmDeliveryTypes = array();

View File

@ -3,7 +3,7 @@
* @author Retail Driver LCC
* @copyright RetailCRM
* @license GPL
* @version 2.1.1
* @version 2.1.2
* @link https://retailcrm.ru
*
*/
@ -25,7 +25,7 @@ class RetailCRM extends Module
{
$this->name = 'retailcrm';
$this->tab = 'export';
$this->version = '2.1.1';
$this->version = '2.1.2';
$this->author = 'Retail Driver LCC';
$this->displayName = $this->l('RetailCRM');
$this->description = $this->l('Integration module for RetailCRM');
@ -94,6 +94,7 @@ class RetailCRM extends Module
$payment = json_encode(Tools::getValue('RETAILCRM_API_PAYMENT'));
$deliveryDefault = json_encode(Tools::getValue('RETAILCRM_API_DELIVERY_DEFAULT'));
$paymentDefault = json_encode(Tools::getValue('RETAILCRM_API_PAYMENT_DEFAULT'));
$statusExport = (string)(Tools::getValue('RETAILCRM_STATUS_EXPORT'));
$settings = array(
'address' => $address,
'token' => $token,
@ -111,6 +112,7 @@ class RetailCRM extends Module
Configuration::updateValue('RETAILCRM_API_PAYMENT', $payment);
Configuration::updateValue('RETAILCRM_API_DELIVERY_DEFAULT', $deliveryDefault);
Configuration::updateValue('RETAILCRM_API_PAYMENT_DEFAULT', $paymentDefault);
Configuration::updateValue('RETAILCRM_STATUS_EXPORT', $statusExport);
$output .= $this->displayConfirmation($this->l('Settings updated'));
}
@ -229,6 +231,23 @@ class RetailCRM extends Module
array($this->l('Delivery method'), $this->l('Payment type'))
),
);
/*
* Status in export
*/
$fields_form[5]['form'] = array(
'legend' => array('title' => $this->l('Default status')),
'input' => array(array(
'type' => 'select',
'name' => 'RETAILCRM_STATUS_EXPORT',
'label' => $this->l('Default status in export'),
'options' => array(
'query' => $this->reference->getStatuseDefaultExport(),
'id' => 'id_option',
'name' => 'name'
)
)),
);
}
/*
@ -270,7 +289,8 @@ class RetailCRM extends Module
$helper->fields_value['RETAILCRM_ADDRESS'] = Configuration::get('RETAILCRM_ADDRESS');
$helper->fields_value['RETAILCRM_API_TOKEN'] = Configuration::get('RETAILCRM_API_TOKEN');
$helper->fields_value['RETAILCRM_API_VERSION'] = Configuration::get('RETAILCRM_API_VERSION');
$helper->fields_value['RETAILCRM_STATUS_EXPORT'] = Configuration::get('RETAILCRM_STATUS_EXPORT');
$deliverySettings = Configuration::get('RETAILCRM_API_DELIVERY');
if (isset($deliverySettings) && $deliverySettings != '') {
$deliveryTypes = json_decode($deliverySettings);

View File

@ -46,8 +46,10 @@ $_MODULE['<{retailcrm}prestashop>retailcrm_1aadcc03a9dbba84a3c5a5cbfde8a162'] =
$_MODULE['<{retailcrm}prestashop>retailcrm_93d03fe37ab3c6abc2a19dd8e41543bd'] = 'Адрес строка 1';
$_MODULE['<{retailcrm}prestashop>retailcrm_22fcffe02ab9eda5b769387122f2ddce'] = 'Адрес строка 2';
$_MODULE['<{retailcrm}prestashop>retailcrm_8bcdc441379cbf584638b0589a3f9adb'] = 'Почтовый индекс';
$_MODULE['<{retailcrm}prestashop>retailcrm_69aede266809f89b89fe70681f6a129f'] = 'Область/Край/Республика';
$_MODULE['<{retailcrm}prestashop>retailcrm_57d056ed0984166336b7879c2af3657f'] = 'Город';
$_MODULE['<{retailcrm}prestashop>retailcrm_bcc254b55c4a1babdf1dcb82c207506b'] = 'Телефон';
$_MODULE['<{retailcrm}prestashop>retailcrm_f0e1fc6f97d36cb80f29196e2662ffde'] = 'Мобильный телефон';
$_MODULE['<{retailcrm}prestashop>retailcrm_7a1920d61156abc05a60135aefe8bc67'] = 'По умолчанию';
$_MODULE['<{retailcrm}prestashop>retailcrm_7a1920d61156abc05a60135aefe8bc67'] = 'По умолчанию';
$_MODULE['<{retailcrm}prestashop>retailcrm_cc18dd262eff97c4dd4b56f750896adb'] = 'Статус по умолчанию';
$_MODULE['<{retailcrm}prestashop>retailcrm_a33b96f0ce0f1227132f1cb3cf1c9e88'] = 'Статус заказа при пакетной выгрузке ';
$_MODULE['<{retailcrm}prestashop>retailcrm_1bd340aeb42a5ee0318784c2cffed8a9'] = 'Выбранная версия API недоступна';