1
0
mirror of synced 2024-11-22 21:36:10 +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 ## 2015-03-19 v.1.1.1
* Исправлена ошибка, связанная с версионностью PHP в History. * Исправлена ошибка, связанная с версионностью PHP в History.
* Добавлена выгрузка закупочной цены вместе с заказом * Добавлена выгрузка закупочной цены вместе с заказом

View File

@ -1,9 +1,12 @@
<?php <?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; class ICMLLoader {
IncludeModuleLangFile(__FILE__);
class ICMLLoader {
public $profileID; public $profileID;
public $iblocks; public $iblocks;
@ -539,4 +542,5 @@ class ICMLLoader {
$offer.= "</offer>\n"; $offer.= "</offer>\n";
return $offer; return $offer;
} }
}
} }

View File

@ -1,7 +1,11 @@
<?php <?php
IncludeModuleLangFile(__FILE__); if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/ICrmOrderActions.php")){
class ICrmOrderActions require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/ICrmOrderActions.php");
{ }
else{
IncludeModuleLangFile(__FILE__);
class ICrmOrderActions
{
protected static $MODULE_ID = 'intaro.intarocrm'; protected static $MODULE_ID = 'intaro.intarocrm';
protected static $CRM_API_HOST_OPTION = 'api_host'; protected static $CRM_API_HOST_OPTION = 'api_host';
protected static $CRM_API_KEY_OPTION = 'api_key'; protected static $CRM_API_KEY_OPTION = 'api_key';
@ -292,9 +296,9 @@ class ICrmOrderActions
} }
} }
if (function_exists('intarocrm_before_order_send')) { 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)) { if (is_array($newResOrder) && !empty($newResOrder)) {
$resOrder = $newResOrder; $order = $newResOrder;
} }
} }
@ -500,7 +504,7 @@ class ICrmOrderActions
'CANCELED' => 'N', 'CANCELED' => 'N',
'STATUS_ID' => 'N', 'STATUS_ID' => 'N',
'PRICE' => 0, 'PRICE' => 0,
'CURRENCY' => 'RUB', 'CURRENCY' => CCurrency::GetBaseCurrency(),
'USER_ID' => $order['customer']['externalId'], 'USER_ID' => $order['customer']['externalId'],
'PAY_SYSTEM_ID' => 0, 'PAY_SYSTEM_ID' => 0,
'PRICE_DELIVERY' => 0, 'PRICE_DELIVERY' => 0,
@ -1025,10 +1029,10 @@ class ICrmOrderActions
return $result; return $result;
} }
} }
} }
class RetailUser extends CUser class RetailUser extends CUser
{ {
public function GetID() public function GetID()
{ {
$rsUser = CUser::GetList(($by='ID'), ($order='DESC'), array('LOGIN' => 'retailcrm%')); $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 <?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); global $APPLICATION;
set_time_limit(0); if (!CModule::IncludeModule("iblock"))
global $APPLICATION;
if (!CModule::IncludeModule("iblock"))
return; return;
if (!CModule::IncludeModule("catalog")) if (!CModule::IncludeModule("catalog"))
return; return;
if (!CModule::IncludeModule("intaro.intarocrm")) if (!CModule::IncludeModule("intaro.intarocrm"))
return; return;
$rsSites = CSite::GetList($by, $sort, array('ACTIVE' => 'Y')); $rsSites = CSite::GetList($by, $sort, array('ACTIVE' => 'Y'));
while ($ar = $rsSites->Fetch()){ while ($ar = $rsSites->Fetch()){
if($ar['DEF'] == 'Y'){ if($ar['DEF'] == 'Y'){
$SERVER_NAME = $ar['SERVER_NAME'];//разделить потом с учетом многосайтовости $SERVER_NAME = $ar['SERVER_NAME'];//разделить потом с учетом многосайтовости
} }
} }
$iblockProperties = Array( $iblockProperties = Array(
"article" => "article", "article" => "article",
"manufacturer" => "manufacturer", "manufacturer" => "manufacturer",
"color" =>"color", "color" =>"color",
@ -28,9 +31,9 @@ $iblockProperties = Array(
"width" => "width", "width" => "width",
"height" => "height", "height" => "height",
); );
$IBLOCK_PROPERTY_SKU = array(); $IBLOCK_PROPERTY_SKU = array();
$IBLOCK_PROPERTY_UNIT_SKU = array(); $IBLOCK_PROPERTY_UNIT_SKU = array();
foreach ($iblockProperties as $prop) { foreach ($iblockProperties as $prop) {
$skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $prop); $skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $prop);
$skuUnitProps = $$skuUnitProps; $skuUnitProps = $$skuUnitProps;
@ -47,10 +50,10 @@ foreach ($iblockProperties as $prop) {
$IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val; $IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val;
} }
} }
} }
$IBLOCK_PROPERTY_PRODUCT = array(); $IBLOCK_PROPERTY_PRODUCT = array();
$IBLOCK_PROPERTY_UNIT_PRODUCT = array(); $IBLOCK_PROPERTY_UNIT_PRODUCT = array();
foreach ($iblockProperties as $prop) { foreach ($iblockProperties as $prop) {
$productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop; $productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop;
$productUnitProps = $$productUnitProps; $productUnitProps = $$productUnitProps;
@ -67,17 +70,18 @@ foreach ($iblockProperties as $prop) {
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val; $IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
} }
} }
} }
$loader = new ICMLLoader(); $loader = new ICMLLoader();
$loader->profileID = $PROFILE_ID; $loader->profileID = $PROFILE_ID;
$loader->iblocks = $IBLOCK_EXPORT; $loader->iblocks = $IBLOCK_EXPORT;
$loader->propertiesSKU = $IBLOCK_PROPERTY_SKU; $loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU; $loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT; $loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT; $loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
$loader->filename = $SETUP_FILE_NAME; $loader->filename = $SETUP_FILE_NAME;
$loader->serverName = $SERVER_NAME; $loader->serverName = $SERVER_NAME;
$loader->application = $APPLICATION; $loader->application = $APPLICATION;
$loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y'; $loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y';
$loader->Load(); $loader->Load();
}

View File

@ -1,6 +1,9 @@
<? <?
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php")){
$iblockProperties = Array( require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/export_setup.php");
}
else{
$iblockProperties = Array(
"article" => "article", "article" => "article",
"manufacturer" => "manufacturer", "manufacturer" => "manufacturer",
"color" =>"color", "color" =>"color",
@ -11,25 +14,25 @@ $iblockProperties = Array(
"height" => "height", "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'; $MODULE_ID = 'intaro.intarocrm';
$CRM_CATALOG_BASE_PRICE = 'catalog_base_price'; $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
$basePriceId = COption::GetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], 1); $basePriceId = COption::GetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], 1);
$arResult['PRICE_TYPES'] = array(); $arResult['PRICE_TYPES'] = array();
$dbPriceType = CCatalogGroup::GetList( $dbPriceType = CCatalogGroup::GetList(
array("SORT" => "ASC"), array(), array(), array(), array("ID", "NAME", "BASE") array("SORT" => "ASC"), array(), array(), array(), array("ID", "NAME", "BASE")
); );
while ($arPriceType = $dbPriceType->Fetch()) { while ($arPriceType = $dbPriceType->Fetch()) {
$arResult['PRICE_TYPES'][$arPriceType['ID']] = $arPriceType; $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'])) if (isset($arOldSetupVars['SETUP_FILE_NAME']))
$SETUP_FILE_NAME = $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; $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val;
} }
} }
} }
if ($STEP>1) if ($STEP>1)
{ {
if (strlen($SETUP_FILE_NAME)<=0) if (strlen($SETUP_FILE_NAME)<=0)
{ {
@ -87,25 +90,25 @@ if ($STEP>1)
{ {
$STEP = 1; $STEP = 1;
} }
} }
if (!empty($arSetupErrors)) if (!empty($arSetupErrors))
echo ShowError(implode('<br />', $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 { .iblock-export-table-display-none {
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') <?if ($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY')
{ {
?><input type="hidden" name="PROFILE_ID" value="<? echo intval($PROFILE_ID); ?>"><? ?><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")?>"> <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']))); COption::SetOptionString($MODULE_ID, $CRM_CATALOG_BASE_PRICE . '_' . $_REQUEST['PROFILE_ID'], htmlspecialchars(trim($_POST['price-types'])));
$FINITE = true; $FINITE = true;
}
} }
?> ?>