cleanup master before first release

This commit is contained in:
Alex Lushpai 2014-04-30 03:58:13 +04:00
parent 741d079a72
commit 3739c84e09
8 changed files with 0 additions and 320 deletions

View File

@ -1,35 +0,0 @@
{
"name": "intarocrm/prestashop-module",
"description": "Prestashop integration for IntaroCRM",
"type": "library",
"keywords": ["api", "Intaro CRM", "rest"],
"homepage": "http://www.intarocrm.ru/",
"config": {
"vendor-dir": "intarocrm/classes"
},
"authors": [
{
"name": "Alex Lushpai",
"email": "lushpai@intaro.ru",
"role": "Developer"
}
],
"support": {
"email": "support@intarocrm.ru"
},
"require": {
"php": ">=5.3",
"intarocrm/rest-api-client": "1.2.*"
},
"autoload": {
"psr-0": {
"": "src/"
}
},
"repositories": [
{
"type": "git",
"url": "https://github.com/intarocrm/rest-api-client"
}
]
}

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>intarocrm</name>
<displayName><![CDATA[IntaroCRM]]></displayName>
<version><![CDATA[0.1]]></version>
<description><![CDATA[Integration module for IntaroCRM]]></description>
<author><![CDATA[Intaro Ltd.]]></author>
<tab><![CDATA[market_place]]></tab>
<confirmUninstall>Are you sure you want to uninstall?</confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@ -1,251 +0,0 @@
<?php
require 'classes/autoload.php';
if (!defined('_PS_VERSION_')) {
exit;
}
class IntaroCRM extends Module
{
function __construct()
{
$this->name = 'intarocrm';
$this->tab = 'market_place';
$this->version = '0.1';
$this->author = 'Intaro Ltd.';
$this->displayName = $this->l('IntaroCRM');
$this->description = $this->l('Integration module for IntaroCRM');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
parent::__construct();
}
function install()
{
return (parent::install());
}
function uninstall()
{
return parent::uninstall() &&
Configuration::deleteByName('INTAROCRM_ADDRESS') &&
Configuration::deleteByName('INTAROCRM_API_TOKEN')
;
}
public function getContent()
{
$output = null;
$address = Configuration::get('INTAROCRM_ADDRESS');
$token = Configuration::get('INTAROCRM_API_TOKEN');
if (!$address || $address == '') {
$output .= $this->displayError( $this->l('Invalid crm address') );
} elseif (!$token || $token == '') {
$output .= $this->displayError( $this->l('Invalid crm api token') );
}
if (Tools::isSubmit('submit'.$this->name))
{
$address = strval(Tools::getValue('INTAROCRM_ADDRESS'));
$token = strval(Tools::getValue('INTAROCRM_API_TOKEN'));
if (!$address || empty($address) || !Validate::isGenericName($address)) {
$output .= $this->displayError( $this->l('Invalid crm address') );
} elseif (!$token || empty($token) || !Validate::isGenericName($token)) {
$output .= $this->displayError( $this->l('Invalid crm api token') );
} else {
Configuration::updateValue('INTAROCRM_ADDRESS', $address);
Configuration::updateValue('INTAROCRM_API_TOKEN', $token);
$output .= $this->displayConfirmation($this->l('Settings updated'));
}
}
return $output.$this->displayForm();
}
public function displayForm()
{
$this->displayConfirmation($this->l('Settings updated'));
$default_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$intaroCrm = new \IntaroCrm\RestApi(
Configuration::get('INTAROCRM_ADDRESS'),
Configuration::get('INTAROCRM_API_TOKEN')
);
/*
* Network connection form
*/
$fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('Network connection'),
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('CRM address'),
'name' => 'INTAROCRM_ADDRESS',
'size' => 20,
'required' => true
),
array(
'type' => 'text',
'label' => $this->l('CRM token'),
'name' => 'INTAROCRM_API_TOKEN',
'size' => 20,
'required' => true
)
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'button'
)
);
/*
* Arrays for dictionaries
*/
$delivery_dict = array();
$crmDeliveryTypes = array();
$status_dict = array();
$crmStatusTypes = array();
/*
* Delivery dictionary form
*/
try {
$deliveryTypes = $intaroCrm->deliveryTypesList();
}
catch (\IntaroCrm\Exception\CurlException $e) {
error_log('deliveryTypesList: connection error');
}
catch (\IntaroCrm\Exception\ApiException $e) {
error_log('deliveryTypesList: ' . $e->getMessage());
}
if (!empty($deliveryTypes)) {
$crmDeliveryTypes[] = array();
foreach ($deliveryTypes as $dType) {
$crmDeliveryTypes[] = array(
'id_option' => $dType['code'],
'name' => $dType['name']
);
}
}
$carriers = Carrier::getCarriers(
$default_lang, true, false, false,
null, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE
);
if (!empty($carriers)) {
foreach ($carriers as $carrier) {
$delivery_dict[] = array(
'type' => 'select',
'label' => $carrier['name'],
'name' => 'carrier_' . $carrier['id_carrier'],
'required' => false,
'options' => array(
'query' => $crmDeliveryTypes,
'id' => 'id_option',
'name' => 'name'
)
);
}
}
$fields_form[1]['form'] = array(
'legend' => array(
'title' => $this->l('Delivery'),
),
'input' => $delivery_dict,
);
/*
* Status dictionary form
*/
try {
$statusTypes = $intaroCrm->orderStatusesList();
}
catch (\IntaroCrm\Exception\CurlException $e) {
error_log('statusTypesList: connection error');
}
catch (\IntaroCrm\Exception\ApiException $e) {
error_log('statusTypesList: ' . $e->getMessage());
}
if (!empty($statusTypes)) {
$crmStatusTypes[] = array();
foreach ($statusTypes as $sType) {
$crmStatusTypes[] = array(
'id_option' => $sType['code'],
'name' => $sType['name']
);
}
}
$states = OrderState::getOrderStates($default_lang, true);
if (!empty($states)) {
foreach ($states as $state) {
if ($state['name'] != ' ') {
$status_dict[] = array(
'type' => 'select',
'label' => $state['name'],
'name' => 'state_' . $state['id_order_state'],
'required' => false,
'options' => array(
'query' => $crmStatusTypes,
'id' => 'id_option',
'name' => 'name'
)
);
}
}
}
$fields_form[2]['form'] = array(
'legend' => array(
'title' => $this->l('Order statuses'),
),
'input' => $status_dict,
);
$helper = new HelperForm();
$helper->module = $this;
$helper->name_controller = $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
$helper->default_form_language = $default_lang;
$helper->allow_employee_form_lang = $default_lang;
$helper->title = $this->displayName;
$helper->show_toolbar = true;
$helper->toolbar_scroll = true;
$helper->submit_action = 'submit'.$this->name;
$helper->toolbar_btn = array(
'save' =>
array(
'desc' => $this->l('Save'),
'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name.
'&token='.Tools::getAdminTokenLite('AdminModules'),
),
'back' => array(
'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'),
'desc' => $this->l('Back to list')
)
);
$helper->fields_value['INTAROCRM_ADDRESS'] = Configuration::get('INTAROCRM_ADDRESS');
$helper->fields_value['INTAROCRM_API_TOKEN'] = Configuration::get('INTAROCRM_API_TOKEN');
return $helper->generateForm($fields_form);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,4 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();

View File

@ -1,17 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{intarocrm}prestashop>intarocrm_03c4d9465b9b3a7533d18cacc79c7fe4'] = 'IntaroCRM';
$_MODULE['<{intarocrm}prestashop>intarocrm_5e695dc9fe273b7bc074e608113f4662'] = 'Модуль интеграции с IntaroCRM';
$_MODULE['<{intarocrm}prestashop>intarocrm_876f23178c29dc2552c0b48bf23cd9bd'] = 'Вы уверены, что хотите удалить модуль?';
$_MODULE['<{intarocrm}prestashop>intarocrm_5effd5157947e8ba4a08883f198b2e31'] = 'Неверный адрес CRM';
$_MODULE['<{intarocrm}prestashop>intarocrm_576300f5b6faeb746bb6d034d98e7afd'] = 'Неверный API ключ';
$_MODULE['<{intarocrm}prestashop>intarocrm_c888438d14855d7d96a2724ee9c306bd'] = 'Настройки обновлены';
$_MODULE['<{intarocrm}prestashop>intarocrm_51af428aa0dcceb5230acb267ecb91c5'] = 'Настройка соединения';
$_MODULE['<{intarocrm}prestashop>intarocrm_4cbd5dbeeef7392e50358b1bc00dd592'] = 'Адрес CRM';
$_MODULE['<{intarocrm}prestashop>intarocrm_7f775042e08eddee6bbfd8fbe0add4a3'] = 'Ключ авторизации';
$_MODULE['<{intarocrm}prestashop>intarocrm_c9cc8cce247e49bae79f15173ce97354'] = 'Сохранить';
$_MODULE['<{intarocrm}prestashop>intarocrm_065ab3a28ca4f16f55f103adc7d0226f'] = 'Способы доставки';
$_MODULE['<{intarocrm}prestashop>intarocrm_33af8066d3c83110d4bd897f687cedd2'] = 'Статусы заказов';
$_MODULE['<{intarocrm}prestashop>intarocrm_630f6dc397fe74e52d5189e2c80f282b'] = 'Вернуться к списку';