Installer changes; bug fixes.
This commit is contained in:
parent
fda1c857d2
commit
9f06cc0c5d
@ -113,7 +113,8 @@ class ICrmOrderActions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastUpOrderIdNew);
|
if($lastUpOrderIdNew)
|
||||||
|
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastUpOrderIdNew);
|
||||||
|
|
||||||
return true; //all ok!
|
return true; //all ok!
|
||||||
}
|
}
|
||||||
|
321
intaro.intarocrm/classes/general/ICrmOrderActions.php~
Executable file
321
intaro.intarocrm/classes/general/ICrmOrderActions.php~
Executable file
@ -0,0 +1,321 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ICrmOrderActions
|
||||||
|
{
|
||||||
|
protected static $MODULE_ID = 'intaro.intarocrm';
|
||||||
|
protected static $CRM_API_HOST_OPTION = 'api_host';
|
||||||
|
protected static $CRM_API_KEY_OPTION = 'api_key';
|
||||||
|
protected static $CRM_ORDER_TYPES_ARR = 'order_types_arr';
|
||||||
|
protected static $CRM_DELIVERY_TYPES_ARR = 'deliv_types_arr';
|
||||||
|
protected static $CRM_PAYMENT_TYPES = 'pay_types_arr';
|
||||||
|
protected static $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
|
||||||
|
protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
||||||
|
protected static $CRM_ORDER_LAST_ID = 'order_last_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @global type $APPLICATION
|
||||||
|
* @param type $str in SITE_CHARSET
|
||||||
|
* @return type $str in utf-8
|
||||||
|
*/
|
||||||
|
protected static function toJSON($str) {
|
||||||
|
global $APPLICATION;
|
||||||
|
|
||||||
|
return $APPLICATION->ConvertCharset($str, SITE_CHARSET, 'utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @global type $APPLICATION
|
||||||
|
* @param type $str in utf-8
|
||||||
|
* @return type $str in SITE_CHARSET
|
||||||
|
*/
|
||||||
|
public static function fromJSON($str) {
|
||||||
|
global $APPLICATION;
|
||||||
|
|
||||||
|
return $APPLICATION->ConvertCharset($str, 'utf-8', SITE_CHARSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mass order uploading, without repeating; always returns true, but writes error log
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function uploadOrders() {
|
||||||
|
|
||||||
|
//COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, 0); // -- for test
|
||||||
|
|
||||||
|
if (!CModule::IncludeModule('iblock')) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('ICrmOrderActions::uploadOrders', 'iblock', 'module not found');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CModule::IncludeModule("sale")) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('ICrmOrderActions::uploadOrders', 'sale', 'module not found');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CModule::IncludeModule("catalog")) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('ICrmOrderActions::uploadOrders', 'catalog', 'module not found');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$resOrders = array();
|
||||||
|
|
||||||
|
$dbOrder = CSaleOrder::GetList();
|
||||||
|
|
||||||
|
$lastUpOrderId = COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, 0);
|
||||||
|
$lastUpOrderIdNew = 0;
|
||||||
|
|
||||||
|
$api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0);
|
||||||
|
$api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0);
|
||||||
|
|
||||||
|
//saved cat params
|
||||||
|
$optionsOrderTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_TYPES_ARR, 0));
|
||||||
|
$optionsDelivTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_DELIVERY_TYPES_ARR, 0));
|
||||||
|
$optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0));
|
||||||
|
$optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses
|
||||||
|
$optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0));
|
||||||
|
|
||||||
|
$api = new IntaroCrm\RestApi($api_host, $api_key);
|
||||||
|
|
||||||
|
$arParams = array(
|
||||||
|
'optionsOrderTypes' => $optionsOrderTypes,
|
||||||
|
'optionsDelivTypes' => $optionsDelivTypes,
|
||||||
|
'optionsPayTypes' => $optionsPayTypes,
|
||||||
|
'optionsPayStatuses' => $optionsPayStatuses,
|
||||||
|
'optionsPayment' => $optionsPayment
|
||||||
|
);
|
||||||
|
|
||||||
|
while ($arOrder = $dbOrder->GetNext()) {
|
||||||
|
if ($arOrder['ID'] <= $lastUpOrderId) //old orders not to upload
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(!$lastUpOrderIdNew)
|
||||||
|
$lastUpOrderIdNew = $arOrder['ID'];
|
||||||
|
|
||||||
|
$order = self::orderCreate($arOrder['ID'], $api, $arParams);
|
||||||
|
|
||||||
|
if(!$order)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$resOrders[] = $order;
|
||||||
|
}
|
||||||
|
|
||||||
|
$orders = $api->orderUpload($resOrders);
|
||||||
|
|
||||||
|
// error pushing orders
|
||||||
|
if(!$orders) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastUpOrderIdNew);
|
||||||
|
|
||||||
|
return true; //all ok!
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* w+ event in bitrix log
|
||||||
|
*/
|
||||||
|
private static function eventLog($auditType, $itemId, $description) {
|
||||||
|
CEventLog::Add(array(
|
||||||
|
"SEVERITY" => "SECURITY",
|
||||||
|
"AUDIT_TYPE_ID" => $auditType,
|
||||||
|
"MODULE_ID" => self::$MODULE_ID,
|
||||||
|
"ITEM_ID" => $itemId,
|
||||||
|
"DESCRIPTION" => $description,
|
||||||
|
));
|
||||||
|
|
||||||
|
//self::sendEmail($itemId, $description);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* send email to admin
|
||||||
|
*/
|
||||||
|
private static function sendEmail($itemId, $description) {
|
||||||
|
$title = 'Error: Intaro CRM.';
|
||||||
|
$text = 'Error: ' . $itemId . ' - ' . $description;
|
||||||
|
$to = COption::GetOptionString("main", "email_from");
|
||||||
|
$from = COption::GetOptionString("main", "email_from");
|
||||||
|
mail($to, $title, $text, 'From:'.$from);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Agent function
|
||||||
|
*
|
||||||
|
* @return self name
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static function uploadOrdersAgent() {
|
||||||
|
|
||||||
|
if(self::uploadOrders())
|
||||||
|
return 'ICrmOrderActions::uploadOrdersAgent();';
|
||||||
|
|
||||||
|
else return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function orderCreate($orderId, $api, $arParams, $send = false) {
|
||||||
|
if(!$api || empty($arParams) || !$orderId) { // add cond to check $arParams
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arFields = CSaleOrder::GetById($orderId);
|
||||||
|
|
||||||
|
if (empty($arFields)) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('ICrmOrderActions::orderCreate', 'empty($arFields)', 'incorrect order');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rsUser = CUser::GetByID($arFields['USER_ID']);
|
||||||
|
$arUser = $rsUser->Fetch();
|
||||||
|
|
||||||
|
// push customer (for crm)
|
||||||
|
$firstName = self::toJSON($arUser['NAME']);
|
||||||
|
$lastName = self::toJSON($arUser['LAST_NAME']);
|
||||||
|
$patronymic = self::toJSON($arUser['SECOND_NAME']);
|
||||||
|
|
||||||
|
$phonePersonal = array(
|
||||||
|
'number' => self::toJSON($arUser['PERSONAL_PHONE']),
|
||||||
|
'type' => 'mobile'
|
||||||
|
);
|
||||||
|
$phones[] = $phonePersonal;
|
||||||
|
|
||||||
|
$phoneWork = array(
|
||||||
|
'number' => self::toJSON($arUser['WORK_PHONE']),
|
||||||
|
'type' => 'work'
|
||||||
|
);
|
||||||
|
$phones[] = $phoneWork;
|
||||||
|
|
||||||
|
$addressPersonal = array(
|
||||||
|
'index' => self::toJSON($arUser['PERSONAL_ZIP']),
|
||||||
|
'country' => self::toJSON(GetCountryByID($arUser['PERSONAL_COUNTRY'])),
|
||||||
|
'city' => self::toJSON($arUser['PERSONAL_CITY']),
|
||||||
|
'street' => self::toJSON($arUser['PERSONAL_STREET']),
|
||||||
|
'building' => self::toJSON($arUser['UF_PERSONAL_BUILDING']),
|
||||||
|
'flat' => self::toJSON($arUser['UF_PERSONAL_FLAT']),
|
||||||
|
'notes' => self::toJSON($arUser['PERSONAL_NOTES']),
|
||||||
|
'text' => self::toJSON($arUser['UF_PERSONAL_TEXT']),
|
||||||
|
'type' => 'home'
|
||||||
|
);
|
||||||
|
$addresses[] = $addressPersonal;
|
||||||
|
|
||||||
|
$addressWork = array(
|
||||||
|
'index' => self::toJSON($arUser['WORK_ZIP']),
|
||||||
|
'country' => self::toJSON(GetCountryByID($arUser['WORK_COUNTRY'])),
|
||||||
|
'city' => self::toJSON($arUser['WORK_CITY']),
|
||||||
|
'street' => self::toJSON($arUser['WORK_STREET']),
|
||||||
|
'building' => self::toJSON($arUser['UF_WORK_BUILDING']), // --
|
||||||
|
'flat' => self::toJSON($arUser['UF_WORK_FLAT']),
|
||||||
|
'notes' => self::toJSON($arUser['PERSONAL_NOTES']),
|
||||||
|
'text' => self::toJSON($arUser['UF_WORK_TEXT']),
|
||||||
|
'type' => 'work'
|
||||||
|
);
|
||||||
|
$addresses[] = $addressWork;
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'externalId' => $arFields['USER_ID'],
|
||||||
|
'lastName' => $lastName,
|
||||||
|
'firstName' => $firstName,
|
||||||
|
'patronymic' => $patronymic,
|
||||||
|
'phones' => $phones,
|
||||||
|
'addresses' => $addresses
|
||||||
|
);
|
||||||
|
|
||||||
|
$customer = $api->customerEdit($result);
|
||||||
|
|
||||||
|
// error pushing customer
|
||||||
|
if (!$customer) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('ICrmOrderActions::orderCreate', 'IntaroCrm\RestApi::customerEdit', $api->getLastError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// delivery types
|
||||||
|
$arId = array();
|
||||||
|
if (strpos($arFields['DELIVERY_ID'], ":") !== false)
|
||||||
|
$arId = explode(":", $arFields["DELIVERY_ID"]);
|
||||||
|
|
||||||
|
if ($arId)
|
||||||
|
$resultDeliveryTypeId = $arId[0];
|
||||||
|
else
|
||||||
|
$resultDeliveryTypeId = $arFields['DELIVERY_ID'];
|
||||||
|
|
||||||
|
|
||||||
|
$resOrder = array();
|
||||||
|
$resOrderDeliveryAddress = array();
|
||||||
|
|
||||||
|
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
|
||||||
|
while ($ar = $rsOrderProps->Fetch()) {
|
||||||
|
switch ($ar['CODE']) {
|
||||||
|
case 'ZIP': $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']);
|
||||||
|
break;
|
||||||
|
case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
|
||||||
|
break;
|
||||||
|
case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
|
||||||
|
break;
|
||||||
|
case 'FIO': $resOrder['contactName'] = self::toJSON($ar['VALUE']);
|
||||||
|
break;
|
||||||
|
case 'PHONE': $resOrder['phone'] = $ar['VALUE'];
|
||||||
|
break;
|
||||||
|
case 'EMAIL': $resOrder['email'] = $ar['VALUE'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = array();
|
||||||
|
|
||||||
|
$rsOrderBasket = CSaleBasket::GetList(array('PRODUCT_ID' => 'ASC'), array('ORDER_ID' => $arFields['ID']));
|
||||||
|
while ($p = $rsOrderBasket->Fetch()) {
|
||||||
|
$pr = CCatalogProduct::GetList(array('ID' => $p['PRODUCT_ID']))->Fetch();
|
||||||
|
if ($pr)
|
||||||
|
$pr = $pr['PURCHASING_PRICE'];
|
||||||
|
else
|
||||||
|
$pr = '';
|
||||||
|
|
||||||
|
$items[] = array(
|
||||||
|
'price' => $p['PRICE'],
|
||||||
|
'purchasePrice' => $pr,
|
||||||
|
'discount' => $p['DISCOUNT_VALUE'],
|
||||||
|
'quantity' => $p['QUANTITY'],
|
||||||
|
'productId' => $p['PRODUCT_ID'],
|
||||||
|
'productName' => self::toJSON($p['NAME'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$resOrder = array(
|
||||||
|
'contactName' => $resOrder['contactName'],
|
||||||
|
'phone' => $resOrder['phone'],
|
||||||
|
'email' => $resOrder['email'],
|
||||||
|
'deliveryCost' => $arFields['PRICE_DELIVERY'],
|
||||||
|
'summ' => $arFields['PRICE'],
|
||||||
|
'markDateTime' => $arFields['DATE_MARKED'],
|
||||||
|
'externalId' => $arFields['ID'],
|
||||||
|
'customerId' => $arFields['USER_ID'],
|
||||||
|
'paymentType' => $arParams['optionsPayTypes'][$arFields['PAY_SYSTEM_ID']],
|
||||||
|
'paymentStatus' => $arParams['optionsPayment'][$arFields['PAYED']],
|
||||||
|
'orderType' => $arParams['optionsOrderTypes'][$arFields['PERSON_TYPE_ID']],
|
||||||
|
'deliveryType' => $arParams['optionsDelivTypes'][$resultDeliveryTypeId],
|
||||||
|
'status' => $arParams['optionsPayStatuses'][$arFields['STATUS_ID']],
|
||||||
|
'deliveryAddress' => $resOrderDeliveryAddress,
|
||||||
|
'items' => $items
|
||||||
|
);
|
||||||
|
|
||||||
|
if($send)
|
||||||
|
return $api->createOrder($resOrder);
|
||||||
|
|
||||||
|
return $resOrder;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -3,7 +3,8 @@ CModule::AddAutoloadClasses(
|
|||||||
'intaro.intarocrm', // module name
|
'intaro.intarocrm', // module name
|
||||||
array (
|
array (
|
||||||
'IntaroCrm\RestApi' => 'classes/general/RestApi.php',
|
'IntaroCrm\RestApi' => 'classes/general/RestApi.php',
|
||||||
'ICrmOrderActions' => 'classes/general/ICrmOrderActions.php'
|
'ICrmOrderActions' => 'classes/general/ICrmOrderActions.php',
|
||||||
|
'ICrmOrderEvent' => 'classes/general/events/ICrmOrderEvent.php'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
@ -190,11 +190,18 @@ class intaro_intarocrm extends CModule
|
|||||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
||||||
);
|
);
|
||||||
|
|
||||||
} else if ($step == 3) {
|
} else if ($step == 3) {
|
||||||
if(!CModule::IncludeModule("sale")) {
|
if(!CModule::IncludeModule("sale")) {
|
||||||
//handler
|
//handler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['back']) && $_POST['back']) {
|
||||||
|
$APPLICATION->IncludeAdminFile(
|
||||||
|
GetMessage('MODULE_INSTALL_TITLE'),
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step1.php'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//bitrix orderTypesList -- personTypes
|
//bitrix orderTypesList -- personTypes
|
||||||
$dbOrderTypesList = CSalePersonType::GetList(
|
$dbOrderTypesList = CSalePersonType::GetList(
|
||||||
array(
|
array(
|
||||||
@ -350,7 +357,6 @@ class intaro_intarocrm extends CModule
|
|||||||
function DeleteFiles() {
|
function DeleteFiles() {
|
||||||
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_run.php');
|
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_run.php');
|
||||||
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_setup.php');
|
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_setup.php');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -12,20 +12,35 @@
|
|||||||
|
|
||||||
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
|
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="heading">
|
<tr class="heading">
|
||||||
<td colspan="2"><b><?php echo GetMessage('STEP_NAME'); ?></b></td>
|
<td colspan="2">
|
||||||
</tr>
|
<b><?php echo GetMessage('STEP_NAME'); ?></b>
|
||||||
<tr>
|
</td>
|
||||||
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_HOST'); ?></td>
|
</tr>
|
||||||
<td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_host" name="api_host" value=""></td>
|
<tr align="center">
|
||||||
</tr>
|
<td colspan="2"><b><?php echo GetMessage('INFO_1'); ?></b></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_KEY'); ?></td>
|
<tr align="center">
|
||||||
<td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_key" name="api_key" value=""></td>
|
<td colspan="2"><b><?php echo GetMessage('INFO_2'); ?></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
<tr align="center">
|
||||||
</table>
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_HOST'); ?></td>
|
||||||
|
<td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_host" name="api_host" value=""></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_KEY'); ?></td>
|
||||||
|
<td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_key" name="api_key" value=""></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<br />
|
<br />
|
||||||
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
<div style="padding: 1px 13px 2px; height:28px;">
|
||||||
|
<div align="right" style="float:right; position:relative;">
|
||||||
|
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,6 +6,34 @@ $arResult['bitrixPaymentList'][0]['NAME'] = GetMessage('PAYMENT_Y');
|
|||||||
$arResult['bitrixPaymentList'][0]['ID'] = 'Y';
|
$arResult['bitrixPaymentList'][0]['ID'] = 'Y';
|
||||||
$arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N');
|
$arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N');
|
||||||
$arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
$arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
||||||
|
|
||||||
|
$defaultOrderTypes = array (
|
||||||
|
1 => 'eshop-individual',
|
||||||
|
2 => 'eshop-legal'
|
||||||
|
);
|
||||||
|
|
||||||
|
$defaultDelivTypes = array (
|
||||||
|
1 => 'courier',
|
||||||
|
2 => 'self-delivery'
|
||||||
|
);
|
||||||
|
|
||||||
|
$defaultPayTypes = array (
|
||||||
|
1 => 'cash',
|
||||||
|
5 => 'bank-card',
|
||||||
|
6 => 'bank-transfer'
|
||||||
|
);
|
||||||
|
|
||||||
|
$defaultPayStatuses = array (
|
||||||
|
'N' => 'in-processing',
|
||||||
|
'P' => 'in-processing',
|
||||||
|
'F' => 'complete'
|
||||||
|
);
|
||||||
|
|
||||||
|
$defaultPayment = array(
|
||||||
|
'Y' => 'paid',
|
||||||
|
'N' => 'not-paid'
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="adm-detail-content-item-block">
|
<div class="adm-detail-content-item-block">
|
||||||
@ -21,6 +49,9 @@ $arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
|||||||
<tr class="heading">
|
<tr class="heading">
|
||||||
<td colspan="2"><b><?php echo GetMessage('STEP_NAME'); ?></b></td>
|
<td colspan="2"><b><?php echo GetMessage('STEP_NAME'); ?></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr align="center">
|
||||||
|
<td colspan="2"><b><?php echo GetMessage('INFO_1'); ?></b></td>
|
||||||
|
</tr>
|
||||||
<tr class="heading">
|
<tr class="heading">
|
||||||
<td colspan="2"><b><?php echo GetMessage('DELIVERY_TYPES_LIST'); ?></b></td>
|
<td colspan="2"><b><?php echo GetMessage('DELIVERY_TYPES_LIST'); ?></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -31,9 +62,10 @@ $arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
|||||||
</td>
|
</td>
|
||||||
<td width="50%" class="adm-detail-content-cell-r">
|
<td width="50%" class="adm-detail-content-cell-r">
|
||||||
<select name="delivery-type-<?php echo $bitrixDeliveryType['ID']; ?>" class="typeselect">
|
<select name="delivery-type-<?php echo $bitrixDeliveryType['ID']; ?>" class="typeselect">
|
||||||
<option value="" selected=""></option>
|
<option value=""></option>
|
||||||
<?php foreach($arResult['deliveryTypesList'] as $deliveryType): ?>
|
<?php foreach($arResult['deliveryTypesList'] as $deliveryType): ?>
|
||||||
<option value="<?php echo $deliveryType['code']; ?>">
|
<option value="<?php echo $deliveryType['code']; ?>"
|
||||||
|
<?php if($defaultDelivTypes[$bitrixDeliveryType['ID']] == $deliveryType['code']) echo 'selected'; ?>>
|
||||||
<?php echo $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET); ?>
|
<?php echo $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET); ?>
|
||||||
</option>
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -51,9 +83,10 @@ $arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
|||||||
</td>
|
</td>
|
||||||
<td width="50%" class="adm-detail-content-cell-r">
|
<td width="50%" class="adm-detail-content-cell-r">
|
||||||
<select name="payment-type-<?php echo $bitrixPaymentType['ID']; ?>" class="typeselect">
|
<select name="payment-type-<?php echo $bitrixPaymentType['ID']; ?>" class="typeselect">
|
||||||
<option value="" selected=""></option>
|
<option value=""></option>
|
||||||
<?php foreach($arResult['paymentTypesList'] as $paymentType): ?>
|
<?php foreach($arResult['paymentTypesList'] as $paymentType): ?>
|
||||||
<option value="<?php echo $paymentType['code']; ?>">
|
<option value="<?php echo $paymentType['code']; ?>"
|
||||||
|
<?php if($defaultPayTypes[$bitrixPaymentType['ID']] == $paymentType['code']) echo 'selected'; ?>>
|
||||||
<?php echo $APPLICATION->ConvertCharset($paymentType['name'], 'utf-8', SITE_CHARSET); ?>
|
<?php echo $APPLICATION->ConvertCharset($paymentType['name'], 'utf-8', SITE_CHARSET); ?>
|
||||||
</option>
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -73,7 +106,8 @@ $arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
|||||||
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
|
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
|
||||||
<option value="" selected=""></option>
|
<option value="" selected=""></option>
|
||||||
<?php foreach($arResult['paymentList'] as $payment): ?>
|
<?php foreach($arResult['paymentList'] as $payment): ?>
|
||||||
<option value="<?php echo $payment['code']; ?>">
|
<option value="<?php echo $payment['code']; ?>"
|
||||||
|
<?php if($defaultPayStatuses[$bitrixPaymentStatus['ID']] == $payment['code']) echo 'selected'; ?>>
|
||||||
<?php echo $APPLICATION->ConvertCharset($payment['name'], 'utf-8', SITE_CHARSET); ?>
|
<?php echo $APPLICATION->ConvertCharset($payment['name'], 'utf-8', SITE_CHARSET); ?>
|
||||||
</option>
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -91,9 +125,10 @@ $arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
|||||||
</td>
|
</td>
|
||||||
<td width="50%" class="adm-detail-content-cell-r">
|
<td width="50%" class="adm-detail-content-cell-r">
|
||||||
<select name="payment-<?php echo $bitrixPayment['ID']; ?>" class="typeselect">
|
<select name="payment-<?php echo $bitrixPayment['ID']; ?>" class="typeselect">
|
||||||
<option value="" selected=""></option>
|
<option value=""></option>
|
||||||
<?php foreach($arResult['paymentStatusesList'] as $paymentStatus): ?>
|
<?php foreach($arResult['paymentStatusesList'] as $paymentStatus): ?>
|
||||||
<option value="<?php echo $paymentStatus['code']; ?>">
|
<option value="<?php echo $paymentStatus['code']; ?>"
|
||||||
|
<?php if($defaultPayment[$bitrixPayment['ID']] == $paymentStatus['code']) echo 'selected'; ?>>
|
||||||
<?php echo $APPLICATION->ConvertCharset($paymentStatus['name'], 'utf-8', SITE_CHARSET); ?>
|
<?php echo $APPLICATION->ConvertCharset($paymentStatus['name'], 'utf-8', SITE_CHARSET); ?>
|
||||||
</option>
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -111,9 +146,10 @@ $arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
|||||||
</td>
|
</td>
|
||||||
<td width="50%" class="adm-detail-content-cell-r">
|
<td width="50%" class="adm-detail-content-cell-r">
|
||||||
<select name="order-type-<?php echo $bitrixOrderType['ID']; ?>" class="typeselect">
|
<select name="order-type-<?php echo $bitrixOrderType['ID']; ?>" class="typeselect">
|
||||||
<option value="" selected=""></option>
|
<option value=""></option>
|
||||||
<?php foreach($arResult['orderTypesList'] as $orderType): ?>
|
<?php foreach($arResult['orderTypesList'] as $orderType): ?>
|
||||||
<option value="<?php echo $orderType['code']; ?>">
|
<option value="<?php echo $orderType['code']; ?>"
|
||||||
|
<?php if($defaultOrderTypes[$bitrixOrderType['ID']] == $orderType['code']) echo 'selected'; ?>>
|
||||||
<?php echo $APPLICATION->ConvertCharset($orderType['name'], 'utf-8', SITE_CHARSET); ?>
|
<?php echo $APPLICATION->ConvertCharset($orderType['name'], 'utf-8', SITE_CHARSET); ?>
|
||||||
</option>
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -124,6 +160,13 @@ $arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
<div style="padding: 1px 13px 2px; height:28px;">
|
||||||
|
<div align="right" style="float:right; width:50%; position:relative;">
|
||||||
|
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
||||||
|
</div>
|
||||||
|
<div align="left" style="float:right; width:50%; position:relative;">
|
||||||
|
<input type="submit" name="back" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,5 +6,5 @@ echo CAdminMessage::ShowNote(GetMessage("MOD_INST_OK")); ?>
|
|||||||
<input type="hidden" name="lang" value="<?php echo LANG; ?>">
|
<input type="hidden" name="lang" value="<?php echo LANG; ?>">
|
||||||
<input type="hidden" name="id" value="intaro.intarocrm">
|
<input type="hidden" name="id" value="intaro.intarocrm">
|
||||||
<input type="hidden" name="install" value="Y">
|
<input type="hidden" name="install" value="Y">
|
||||||
<input type="submit" name="" value="<?php echo GetMessage("MOD_BACK"); ?>" class="adm-btn-save">
|
<input type="submit" name="" value="<?php echo GetMessage("MOD_BACK"); ?>">
|
||||||
<form>
|
<form>
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<?php IncludeModuleLangFile(__FILE__); ?>
|
<?php IncludeModuleLangFile(__FILE__);
|
||||||
<form action="<?php echo $APPLICATION->GetCurPage(); ?>">
|
bitrix_sessid_post();
|
||||||
<?php bitrix_sessid_post(); ?>
|
echo CAdminMessage::ShowNote(GetMessage("MOD_UNINST_OK")); ?>
|
||||||
<input type="hidden" name="lang" value="<?php echo LANGUAGE_ID; ?>">
|
|
||||||
<input type="hidden" name="id" value="intaro.intarocrm">
|
<form action="<?echo $APPLICATION->GetCurPage()?>">
|
||||||
<input type="hidden" name="uninstall" value="Y">
|
<input type="hidden" name="lang" value="<?echo LANG?>">
|
||||||
<input type="hidden" name="step" value="2">
|
<input type="submit" name="" value="<?echo GetMessage("MOD_BACK")?>">
|
||||||
<?php echo CAdminMessage::ShowMessage(GetMessage("MOD_UNINST_WARN")); ?>
|
|
||||||
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_UNINST_DEL"); ?>" class="adm-btn-save">
|
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<?if(!check_bitrix_sessid()) return;?>
|
|
||||||
<?
|
|
||||||
$errors=false;
|
|
||||||
|
|
||||||
if($errors===false):
|
|
||||||
echo CAdminMessage::ShowNote(GetMessage("MOD_UNINST_OK"));
|
|
||||||
else:
|
|
||||||
$alErrors = "";
|
|
||||||
for($i=0; $i<count($errors); $i++)
|
|
||||||
$alErrors .= $errors[$i]."<br>";
|
|
||||||
echo CAdminMessage::ShowMessage(Array("TYPE"=>"ERROR", "MESSAGE" =>GetMessage("MOD_UNINST_ERR"), "DETAILS"=>$alErrors, "HTML"=>true));
|
|
||||||
endif;
|
|
||||||
?>
|
|
||||||
<form action="<?echo $APPLICATION->GetCurPage()?>">
|
|
||||||
<input type="hidden" name="lang" value="<?echo LANG?>">
|
|
||||||
<input type="submit" name="" value="<?echo GetMessage("MOD_BACK")?>">
|
|
||||||
</form>
|
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
'VERSION' => '0.3.0',
|
'VERSION' => '0.4.4',
|
||||||
'VERSION_DATE' => '2013-07-16 14:55:00',
|
'VERSION_DATE' => '2013-07-16 14:41:00',
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
$MESS ['STEP_NAME'] = 'Шаг 1';
|
$MESS ['STEP_NAME'] = 'Шаг 1';
|
||||||
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
|
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
|
||||||
$MESS ['ICRM_API_HOST'] = 'Адрес Intaro CRM:';
|
$MESS ['ICRM_API_HOST'] = 'Адрес IntaroCRM:';
|
||||||
$MESS ['ICRM_API_KEY'] = 'Ключ авторизации:';
|
$MESS ['ICRM_API_KEY'] = 'Ключ авторизации:';
|
||||||
$MESS ['ERR_404'] = 'Возможно не верно введен адрес CRM.';
|
$MESS ['ERR_404'] = 'Возможно не верно введен адрес IntaroCRM.';
|
||||||
$MESS ['ERR_403'] = 'Не верный apiKey.';
|
$MESS ['ERR_403'] = 'Не верный apiKey.';
|
||||||
$MESS ['ERR_0'] = 'Превышено время ожидания ответа от сервера.';
|
$MESS ['ERR_0'] = 'Превышено время ожидания ответа от сервера.';
|
||||||
$MESS ['ERR_FIELDS_API_HOST'] = 'Не верно заполены поля.';
|
$MESS ['ERR_FIELDS_API_HOST'] = 'Не верно заполнены поля.';
|
||||||
|
$MESS ['INFO_1'] = 'Введите адрес экземпляра IntaroCRM (например, http://demo.intarocrm.ru) и API-ключ.';
|
||||||
|
$MESS ['INFO_2'] = 'API-ключ можно сгенерировать при регистрации магазина в IntaroCRM (Администрирование > Магазины).';
|
||||||
?>
|
?>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$MESS ['STEP_NAME'] = 'Шаг 2';
|
$MESS ['STEP_NAME'] = 'Шаг 2';
|
||||||
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
|
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
|
||||||
|
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
|
||||||
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
|
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
|
||||||
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
|
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
|
||||||
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
|
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
|
||||||
@ -8,4 +9,5 @@ $MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
|
|||||||
$MESS ['PAYMENT_LIST'] = 'Оплата';
|
$MESS ['PAYMENT_LIST'] = 'Оплата';
|
||||||
$MESS ['PAYMENT_Y'] = 'Оплачен';
|
$MESS ['PAYMENT_Y'] = 'Оплачен';
|
||||||
$MESS ['PAYMENT_N'] = 'Не оплачен';
|
$MESS ['PAYMENT_N'] = 'Не оплачен';
|
||||||
|
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';
|
||||||
?>
|
?>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
$MESS['MOD_UNINST_SITES'] = 'В системе присутствуют сайты, установленные данным модулем.';
|
$MESS['MOD_UNINST_OK'] = 'Удаление модуля успешно завершено';
|
||||||
$MESS['DELETE_SITE'] = 'Удалить сайт';
|
$MESS['MOD_BACK'] = 'Вернуться в список';
|
||||||
?>
|
?>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
IncludeModuleLangFile(__FILE__);
|
IncludeModuleLangFile(__FILE__);
|
||||||
$mid = 'intaro.crm';
|
$mid = 'intaro.intarocrm';
|
||||||
$uri = $APPLICATION->GetCurPage() . '?mid=' . htmlspecialchars($mid) . '&lang=' . LANGUAGE_ID;
|
$uri = $APPLICATION->GetCurPage() . '?mid=' . htmlspecialchars($mid) . '&lang=' . LANGUAGE_ID;
|
||||||
|
|
||||||
$CRM_API_HOST_OPTION = 'api_host';
|
$CRM_API_HOST_OPTION = 'api_host';
|
||||||
@ -12,7 +12,7 @@ $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
|
|||||||
$CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
$CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
||||||
$CRM_ORDER_LAST_ID = 'order_last_id';
|
$CRM_ORDER_LAST_ID = 'order_last_id';
|
||||||
|
|
||||||
CModule::IncludeModule('intaro.crm');
|
CModule::IncludeModule('intaro.intarocrm');
|
||||||
CModule::IncludeModule('sale');
|
CModule::IncludeModule('sale');
|
||||||
|
|
||||||
$_GET['errc'] = htmlspecialchars(trim($_GET['errc']));
|
$_GET['errc'] = htmlspecialchars(trim($_GET['errc']));
|
||||||
|
Loading…
Reference in New Issue
Block a user