1
0
mirror of synced 2024-11-25 23:06:08 +03:00

Merge pull request #8 from ghostrainman/master

v.1.1.2
This commit is contained in:
Alex Lushpai 2015-05-20 10:50:08 +03:00
commit 7da2d5cdf0
5 changed files with 2165 additions and 2146 deletions

View File

@ -1,3 +1,6 @@
## 2015-05-18 v.1.1.2
* Добавлена возможность изменять файлы основных классов(ICMLLoader и ICrmOrderActions) и экспорт каталога без потери обновлений
* Исправлены мелкие ошибки
## 2015-03-19 v.1.1.1
* Исправлена ошибка, связанная с версионностью PHP в History.
* Добавлена выгрузка закупочной цены вместе с заказом

View File

@ -1,9 +1,12 @@
<?php
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/ICMLLoader.php")){
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/ICMLLoader.php");
}
else{
global $MESS;
IncludeModuleLangFile(__FILE__);
global $MESS;
IncludeModuleLangFile(__FILE__);
class ICMLLoader {
class ICMLLoader {
public $profileID;
public $iblocks;
@ -539,4 +542,5 @@ class ICMLLoader {
$offer.= "</offer>\n";
return $offer;
}
}
}

View File

@ -1,7 +1,11 @@
<?php
IncludeModuleLangFile(__FILE__);
class ICrmOrderActions
{
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/ICrmOrderActions.php")){
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/ICrmOrderActions.php");
}
else{
IncludeModuleLangFile(__FILE__);
class ICrmOrderActions
{
protected static $MODULE_ID = 'intaro.intarocrm';
protected static $CRM_API_HOST_OPTION = 'api_host';
protected static $CRM_API_KEY_OPTION = 'api_key';
@ -292,9 +296,9 @@ class ICrmOrderActions
}
}
if (function_exists('intarocrm_before_order_send')) {
$newResOrder = intarocrm_before_order_send($resOrder);
$newResOrder = intarocrm_before_order_send($order);
if (is_array($newResOrder) && !empty($newResOrder)) {
$resOrder = $newResOrder;
$order = $newResOrder;
}
}
@ -500,7 +504,7 @@ class ICrmOrderActions
'CANCELED' => 'N',
'STATUS_ID' => 'N',
'PRICE' => 0,
'CURRENCY' => 'RUB',
'CURRENCY' => CCurrency::GetBaseCurrency(),
'USER_ID' => $order['customer']['externalId'],
'PAY_SYSTEM_ID' => 0,
'PRICE_DELIVERY' => 0,
@ -1025,10 +1029,10 @@ class ICrmOrderActions
return $result;
}
}
}
}
class RetailUser extends CUser
{
class RetailUser extends CUser
{
public function GetID()
{
$rsUser = CUser::GetList(($by='ID'), ($order='DESC'), array('LOGIN' => 'retailcrm%'));
@ -1056,4 +1060,5 @@ class RetailUser extends CUser
}
}
}
}
}

View File

@ -1,24 +1,27 @@
<?php
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_run.php")){
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_run.php");
}
else{
ignore_user_abort(true);
set_time_limit(0);
ignore_user_abort(true);
set_time_limit(0);
global $APPLICATION;
if (!CModule::IncludeModule("iblock"))
global $APPLICATION;
if (!CModule::IncludeModule("iblock"))
return;
if (!CModule::IncludeModule("catalog"))
if (!CModule::IncludeModule("catalog"))
return;
if (!CModule::IncludeModule("intaro.intarocrm"))
if (!CModule::IncludeModule("intaro.intarocrm"))
return;
$rsSites = CSite::GetList($by, $sort, array('ACTIVE' => 'Y'));
while ($ar = $rsSites->Fetch()){
$rsSites = CSite::GetList($by, $sort, array('ACTIVE' => 'Y'));
while ($ar = $rsSites->Fetch()){
if($ar['DEF'] == 'Y'){
$SERVER_NAME = $ar['SERVER_NAME'];//разделить потом с учетом многосайтовости
}
}
}
$iblockProperties = Array(
$iblockProperties = Array(
"article" => "article",
"manufacturer" => "manufacturer",
"color" =>"color",
@ -28,9 +31,9 @@ $iblockProperties = Array(
"width" => "width",
"height" => "height",
);
$IBLOCK_PROPERTY_SKU = array();
$IBLOCK_PROPERTY_UNIT_SKU = array();
foreach ($iblockProperties as $prop) {
$IBLOCK_PROPERTY_SKU = array();
$IBLOCK_PROPERTY_UNIT_SKU = array();
foreach ($iblockProperties as $prop) {
$skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $prop);
$skuUnitProps = $$skuUnitProps;
@ -47,10 +50,10 @@ foreach ($iblockProperties as $prop) {
$IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val;
}
}
}
$IBLOCK_PROPERTY_PRODUCT = array();
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
foreach ($iblockProperties as $prop) {
}
$IBLOCK_PROPERTY_PRODUCT = array();
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
foreach ($iblockProperties as $prop) {
$productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop;
$productUnitProps = $$productUnitProps;
@ -67,17 +70,18 @@ foreach ($iblockProperties as $prop) {
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
}
}
}
}
$loader = new ICMLLoader();
$loader->profileID = $PROFILE_ID;
$loader->iblocks = $IBLOCK_EXPORT;
$loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
$loader->filename = $SETUP_FILE_NAME;
$loader->serverName = $SERVER_NAME;
$loader->application = $APPLICATION;
$loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y';
$loader->Load();
$loader = new ICMLLoader();
$loader->profileID = $PROFILE_ID;
$loader->iblocks = $IBLOCK_EXPORT;
$loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
$loader->filename = $SETUP_FILE_NAME;
$loader->serverName = $SERVER_NAME;
$loader->application = $APPLICATION;
$loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y';
$loader->Load();
}

View File

@ -1,6 +1,9 @@
<?
$iblockProperties = Array(
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php")){
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php");
}
else{
$iblockProperties = Array(
"article" => "article",
"manufacturer" => "manufacturer",
"color" =>"color",
@ -11,25 +14,25 @@ $iblockProperties = Array(
"height" => "height",
);
if(!check_bitrix_sessid()) return;
if(!check_bitrix_sessid()) return;
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/icml_export_setup.php"));
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/icml_export_setup.php"));
$MODULE_ID = 'intaro.intarocrm';
$CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
$basePriceId = COption::GetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], 1);
$MODULE_ID = 'intaro.intarocrm';
$CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
$basePriceId = COption::GetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], 1);
$arResult['PRICE_TYPES'] = array();
$dbPriceType = CCatalogGroup::GetList(
$arResult['PRICE_TYPES'] = array();
$dbPriceType = CCatalogGroup::GetList(
array("SORT" => "ASC"), array(), array(), array(), array("ID", "NAME", "BASE")
);
);
while ($arPriceType = $dbPriceType->Fetch()) {
while ($arPriceType = $dbPriceType->Fetch()) {
$arResult['PRICE_TYPES'][$arPriceType['ID']] = $arPriceType;
}
}
if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
{
if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
{
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
$SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME'];
@ -62,12 +65,12 @@ if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'
$IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val;
}
}
}
}
if ($STEP>1)
{
if ($STEP>1)
{
if (strlen($SETUP_FILE_NAME)<=0)
{
@ -87,25 +90,25 @@ if ($STEP>1)
{
$STEP = 1;
}
}
}
if (!empty($arSetupErrors))
if (!empty($arSetupErrors))
echo ShowError(implode('<br />', $arSetupErrors));
if ($STEP==1)
{
if ($STEP==1)
{
?>
?>
<style type="text/css">
<style type="text/css">
.iblock-export-table-display-none {
display: none;
}
</style>
</style>
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
<?if ($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY')
{
?><input type="hidden" name="PROFILE_ID" value="<? echo intval($PROFILE_ID); ?>"><?
@ -686,14 +689,14 @@ if ($STEP==1)
<input type="submit" value="<?echo ($ACTION=="EXPORT")?GetMessage("CET_EXPORT"):GetMessage("CET_SAVE")?>">
</form>
</form>
<?
}
elseif ($STEP==2)
{
<?
}
elseif ($STEP==2)
{
COption::SetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], htmlspecialchars(trim($_POST['price-types'])));
$FINITE = true;
}
}
?>