1
0
mirror of synced 2024-11-28 16:26:07 +03:00

ref #89446 Исправление ошибок генерации ICML каталога при установке модуля (#294)

This commit is contained in:
Uryvskiy Dima 2023-06-01 13:33:41 +03:00 committed by GitHub
parent 595d713931
commit de7a2bc1de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 69 deletions

View File

@ -1,3 +1,6 @@
## 2023-06-01 v.6.3.9
- Исправление ошибок генерации ICML каталога при установке модуля
## 2023-06-01 v.6.3.8 ## 2023-06-01 v.6.3.8
- Исправлена ошибка с получением настроек при генерации файла каталога - Исправлена ошибка с получением настроек при генерации файла каталога

View File

@ -1,2 +1 @@
- Исправлена ошибка с получением настроек при генерации файла каталога - Исправление ошибок генерации ICML каталога при установке модуля

View File

@ -492,20 +492,18 @@ if ($STEP === 1) {
$SETUP_FILE_NAME : $settingsService->setupFileName); ?>" size="50"><br><br> $SETUP_FILE_NAME : $settingsService->setupFileName); ?>" size="50"><br><br>
<span class="text"><?=GetMessage('LOAD_PURCHASE_PRICE')?>&nbsp;</span> <span class="text"><?=GetMessage('LOAD_PURCHASE_PRICE')?>&nbsp;</span>
<input type="checkbox" name="loadPurchasePrice" value="Y" <?=$loadPurchasePrice === 'Y' ? 'checked' : ''?>> <input type="checkbox" name="loadPurchasePrice" value="Y" <?=$loadPurchasePrice === 'Y' ? 'checked' : ''?>>
<br> <br><br>
<span class="text"><?=GetMessage('LOAD_NON_ACTIVITY')?>&nbsp;</span> <span class="text"><?=GetMessage('LOAD_NON_ACTIVITY')?>&nbsp;</span>
<input type="checkbox" name="loadNonActivity" value="Y" <?=$loadNonActivity === 'Y' ? 'checked' : ''?>> <input type="checkbox" name="loadNonActivity" value="Y" <?=$loadNonActivity === 'Y' ? 'checked' : ''?>>
<br><br><br> <br><br>
<?php <?php
if ($isSetupModulePage) { ?> if ($isSetupModulePage) { ?>
<span class="text"><?=GetMessage('AGENT_LOADING')?>&nbsp;</span> <span class="text"><?=GetMessage('AGENT_LOADING')?>&nbsp;</span>
<input type="checkbox" name="NEED_CATALOG_AGENT" value="agent" onclick="checkProfile(this);"><br> <input id="add-agent" type="checkbox" name="NEED_CATALOG_AGENT" value="agent"><br><br>
<span class="text" style="font-weight: bold; font-size: 14px"><?=GetMessage('LOAD_NOW')?>&nbsp;</span>
<input id="load-now" type="checkbox" onchange="checkLoadStatus(this)" name="LOAD_NOW" value="now"><br>
<br> <br>
<br> <div id="loadMessageNow" hidden><?=GetMessage('LOAD_NOW_MSG')?></div>
<span class="text"><?=GetMessage('LOAD_NOW')?>&nbsp;</span>
<input id="load-now" onchange="checkLoadStatus(this)" type="checkbox" name="LOAD_NOW" value="now">
<br>
<div id="loadMessage" hidden><?=GetMessage('LOAD_NOW_MSG')?></div>
<br> <br>
<?php <?php
}?> }?>
@ -586,9 +584,9 @@ if ($STEP === 1) {
function checkLoadStatus(object) function checkLoadStatus(object)
{ {
if (object.checked) { if (object.checked) {
$('#loadMessage').show(); $('#loadMessageNow').show();
} else { } else {
$('#loadMessage').hide(); $('#loadMessageNow').hide();
} }
} }

View File

@ -938,14 +938,8 @@ class intaro_retailcrm extends CModule
); );
} }
if (!isset($_POST['iblockExport'])) {
$arResult['errCode'] = 'ERR_FIELDS_IBLOCK';
} else {
$iblocks = $_POST['iblockExport'];
}
$hlblockModule = false; $hlblockModule = false;
//highloadblock
if (CModule::IncludeModule('highloadblock')) { if (CModule::IncludeModule('highloadblock')) {
$hlblockModule = true; $hlblockModule = true;
$hlblockList = []; $hlblockList = [];
@ -1017,29 +1011,22 @@ class intaro_retailcrm extends CModule
} }
} }
if (!isset($_POST['SETUP_FILE_NAME'])) { $iblocks = $_POST['iblockExport'] ?? null;
$arResult['errCode'] = 'ERR_FIELDS_FILE'; $filename = $_POST['SETUP_FILE_NAME'] ?? null;
} else { $maxOffers = $_POST['maxOffersValue'] ?? null;
$filename = $_POST['SETUP_FILE_NAME']; $profileName = $_POST['SETUP_PROFILE_NAME'] ?? null;
$loadPurchasePrice = $_POST['loadPurchasePrice'] ?? null;
$loadInactiveProduct = $_POST['loadNonActivity'] ?? null;
if ($iblocks === null) {
$arResult['errCode'] = 'ERR_FIELDS_IBLOCK';
} }
if (!isset($_POST['maxOffersValue'])) { if ($profileName === null) {
$maxOffers = null;
} else {
$maxOffers = (int) $_POST['maxOffersValue'];
}
if (!isset($_POST['SETUP_PROFILE_NAME'])) {
$profileName = '';
} else {
$profileName = $_POST['SETUP_PROFILE_NAME'];
}
if ($profileName == '') {
$arResult['errCode'] = 'ERR_FIELDS_PROFILE'; $arResult['errCode'] = 'ERR_FIELDS_PROFILE';
} }
if ($filename === '') { if ($filename === null) {
$arResult['errCode'] = 'ERR_FIELDS_FILE'; $arResult['errCode'] = 'ERR_FIELDS_FILE';
} }
@ -1053,6 +1040,8 @@ class intaro_retailcrm extends CModule
'SETUP_FILE_NAME' => $filename, 'SETUP_FILE_NAME' => $filename,
'SETUP_PROFILE_NAME' => $profileName, 'SETUP_PROFILE_NAME' => $profileName,
'maxOffersValue' => $maxOffers, 'maxOffersValue' => $maxOffers,
'loadPurchasePrice' => $loadPurchasePrice,
'loadNonActivity' => $loadInactiveProduct,
]; ];
global $oldValues; global $oldValues;
@ -1121,8 +1110,11 @@ class intaro_retailcrm extends CModule
$propertiesHbSKU, $propertiesHbSKU,
$propertiesHbProduct, $propertiesHbProduct,
$filename, $filename,
$maxOffers $maxOffers,
$loadPurchasePrice,
$loadInactiveProduct
); );
$profileId = CCatalogExport::Add([ $profileId = CCatalogExport::Add([
'LAST_USE' => false, 'LAST_USE' => false,
'FILE_NAME' => $this->RETAIL_CRM_EXPORT, 'FILE_NAME' => $this->RETAIL_CRM_EXPORT,
@ -1150,18 +1142,10 @@ class intaro_retailcrm extends CModule
$agentId = null; $agentId = null;
if (isset($_POST['NEED_CATALOG_AGENT'])) { if (isset($_POST['NEED_CATALOG_AGENT'])) {
$dateAgent = new DateTime();
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
$dateAgent->add($intAgent);
$agentId = CAgent::AddAgent( $agentId = CAgent::AddAgent(
'CCatalogExport::PreGenerateExport(' . $profileId . ');', 'CCatalogExport::PreGenerateExport(' . $profileId . ');',
'catalog', 'catalog',
'N', 'N',
86400,
$dateAgent->format('d.m.Y H:i:s'),
'Y',
$dateAgent->format('d.m.Y H:i:s'),
30
); );
CCatalogExport::Update($profileId, [ CCatalogExport::Update($profileId, [
@ -1169,19 +1153,8 @@ class intaro_retailcrm extends CModule
]); ]);
} }
if ( if (isset($_POST['LOAD_NOW']) && $agentId === null) {
isset($_POST['LOAD_NOW']) CCatalogExport::PreGenerateExport($profileId);
&& $agentId === null
) {
CAgent::AddAgent(
'\Intaro\RetailCrm\Component\Agent::preGenerateExport(' . $profileId . ');',
$this->MODULE_ID,
'N',
86400,
$dateAgent->format('d.m.Y H:i:s'),
'Y',
$dateAgent->format('d.m.Y H:i:s')
);
} }
$api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0); $api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0);
@ -1330,7 +1303,9 @@ class intaro_retailcrm extends CModule
$propertiesHbSKU, $propertiesHbSKU,
$propertiesHbProduct, $propertiesHbProduct,
$filename, $filename,
$maxOffers $maxOffers,
$loadPurchasePrice,
$loadInactiveProduct
): string { ): string {
$strVars = ''; $strVars = '';
@ -1354,10 +1329,15 @@ class intaro_retailcrm extends CModule
} }
} }
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename); $additionalProperties = sprintf(
$strVars .= '&maxOffersValue=' . urlencode($maxOffers); 'SETUP_FILE_NAME=%s&maxOffersValue=%s&loadPurchasePrice=%s&loadNonActivity=%s',
$filename,
$maxOffers,
$loadPurchasePrice,
$loadInactiveProduct
);
return $strVars; return $strVars . $additionalProperties;
} }
/** /**

View File

@ -1,6 +1,6 @@
<?php <?php
$arModuleVersion = [ $arModuleVersion = [
'VERSION' => '6.3.8', 'VERSION' => '6.3.9',
'VERSION_DATE' => '2023-06-01 12:00:00' 'VERSION_DATE' => '2023-06-01 14:00:00'
]; ];

View File

@ -13,9 +13,8 @@ $MESS ['PAYMENT_N'] = 'Not paid';
$MESS ['CANCELED'] = 'Is «Cancelled»'; $MESS ['CANCELED'] = 'Is «Cancelled»';
$MESS ['INFO_1'] = ' Set the correspondence between 1C-Bitrix data books and RetailCRM data books.'; $MESS ['INFO_1'] = ' Set the correspondence between 1C-Bitrix data books and RetailCRM data books.';
$MESS ['AGENT_LOADING'] = 'Export catalog periodically (By Agent every 24 hours)'; $MESS ['AGENT_LOADING'] = 'Export catalog periodically (By Agent every 24 hours)';
$MESS ['LOAD_NOW'] = 'Export now'; $MESS ['LOAD_NOW'] = 'Generate ICML catalog now';
$MESS ['LOAD_NOW_MSG'] = 'The generation will start after you click "Finish installation". $MESS ['LOAD_NOW_MSG'] = 'The generation will start after you click "Finish installation". This may take some time';
This may take some time';
$MESS ['PROFILE_NAME'] = 'Profile name:'; $MESS ['PROFILE_NAME'] = 'Profile name:';
$MESS ['PROFILE_NAME_EXAMPLE'] = 'RetailCRM catalog export'; $MESS ['PROFILE_NAME_EXAMPLE'] = 'RetailCRM catalog export';
$MESS ['ERR_FIELDS_PROFILE'] = 'Invalid profile name field'; $MESS ['ERR_FIELDS_PROFILE'] = 'Invalid profile name field';

View File

@ -13,7 +13,7 @@ $MESS ['PAYMENT_N'] = 'Не оплачен';
$MESS ['CANCELED'] = 'Флаг «Отменен»'; $MESS ['CANCELED'] = 'Флаг «Отменен»';
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками RetailCRM.'; $MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками RetailCRM.';
$MESS ['AGENT_LOADING'] = 'Выгружать каталог периодически (Агентом каждые 24 часа)'; $MESS ['AGENT_LOADING'] = 'Выгружать каталог периодически (Агентом каждые 24 часа)';
$MESS ['LOAD_NOW'] = 'Выгрузить сейчас'; $MESS ['LOAD_NOW'] = 'Сгенерировать ICML каталог сейчас';
$MESS ['LOAD_NOW_MSG'] = 'Генерация начнется после нажатия "Завершить установку". Это может занять некоторое время'; $MESS ['LOAD_NOW_MSG'] = 'Генерация начнется после нажатия "Завершить установку". Это может занять некоторое время';
$MESS ['PROFILE_NAME'] = 'Имя профиля:'; $MESS ['PROFILE_NAME'] = 'Имя профиля:';
$MESS ['PROFILE_NAME_EXAMPLE'] = 'Выгрузка каталога RetailCRM'; $MESS ['PROFILE_NAME_EXAMPLE'] = 'Выгрузка каталога RetailCRM';