1
0
mirror of synced 2024-11-24 22:36: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
- Исправлена ошибка с получением настроек при генерации файла каталога

View File

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

View File

@ -492,20 +492,18 @@ if ($STEP === 1) {
$SETUP_FILE_NAME : $settingsService->setupFileName); ?>" size="50"><br><br>
<span class="text"><?=GetMessage('LOAD_PURCHASE_PRICE')?>&nbsp;</span>
<input type="checkbox" name="loadPurchasePrice" value="Y" <?=$loadPurchasePrice === 'Y' ? 'checked' : ''?>>
<br>
<br><br>
<span class="text"><?=GetMessage('LOAD_NON_ACTIVITY')?>&nbsp;</span>
<input type="checkbox" name="loadNonActivity" value="Y" <?=$loadNonActivity === 'Y' ? 'checked' : ''?>>
<br><br><br>
<br><br>
<?php
if ($isSetupModulePage) { ?>
<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>
<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>
<div id="loadMessageNow" hidden><?=GetMessage('LOAD_NOW_MSG')?></div>
<br>
<?php
}?>
@ -586,9 +584,9 @@ if ($STEP === 1) {
function checkLoadStatus(object)
{
if (object.checked) {
$('#loadMessage').show();
$('#loadMessageNow').show();
} 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;
//highloadblock
if (CModule::IncludeModule('highloadblock')) {
$hlblockModule = true;
$hlblockList = [];
@ -1017,29 +1011,22 @@ class intaro_retailcrm extends CModule
}
}
if (!isset($_POST['SETUP_FILE_NAME'])) {
$arResult['errCode'] = 'ERR_FIELDS_FILE';
} else {
$filename = $_POST['SETUP_FILE_NAME'];
$iblocks = $_POST['iblockExport'] ?? null;
$filename = $_POST['SETUP_FILE_NAME'] ?? null;
$maxOffers = $_POST['maxOffersValue'] ?? null;
$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'])) {
$maxOffers = null;
} else {
$maxOffers = (int) $_POST['maxOffersValue'];
}
if (!isset($_POST['SETUP_PROFILE_NAME'])) {
$profileName = '';
} else {
$profileName = $_POST['SETUP_PROFILE_NAME'];
}
if ($profileName == '') {
if ($profileName === null) {
$arResult['errCode'] = 'ERR_FIELDS_PROFILE';
}
if ($filename === '') {
if ($filename === null) {
$arResult['errCode'] = 'ERR_FIELDS_FILE';
}
@ -1053,6 +1040,8 @@ class intaro_retailcrm extends CModule
'SETUP_FILE_NAME' => $filename,
'SETUP_PROFILE_NAME' => $profileName,
'maxOffersValue' => $maxOffers,
'loadPurchasePrice' => $loadPurchasePrice,
'loadNonActivity' => $loadInactiveProduct,
];
global $oldValues;
@ -1121,8 +1110,11 @@ class intaro_retailcrm extends CModule
$propertiesHbSKU,
$propertiesHbProduct,
$filename,
$maxOffers
$maxOffers,
$loadPurchasePrice,
$loadInactiveProduct
);
$profileId = CCatalogExport::Add([
'LAST_USE' => false,
'FILE_NAME' => $this->RETAIL_CRM_EXPORT,
@ -1150,18 +1142,10 @@ class intaro_retailcrm extends CModule
$agentId = null;
if (isset($_POST['NEED_CATALOG_AGENT'])) {
$dateAgent = new DateTime();
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
$dateAgent->add($intAgent);
$agentId = CAgent::AddAgent(
'CCatalogExport::PreGenerateExport(' . $profileId . ');',
'catalog',
'N',
86400,
$dateAgent->format('d.m.Y H:i:s'),
'Y',
$dateAgent->format('d.m.Y H:i:s'),
30
);
CCatalogExport::Update($profileId, [
@ -1169,19 +1153,8 @@ class intaro_retailcrm extends CModule
]);
}
if (
isset($_POST['LOAD_NOW'])
&& $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')
);
if (isset($_POST['LOAD_NOW']) && $agentId === null) {
CCatalogExport::PreGenerateExport($profileId);
}
$api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0);
@ -1330,7 +1303,9 @@ class intaro_retailcrm extends CModule
$propertiesHbSKU,
$propertiesHbProduct,
$filename,
$maxOffers
$maxOffers,
$loadPurchasePrice,
$loadInactiveProduct
): string {
$strVars = '';
@ -1354,10 +1329,15 @@ class intaro_retailcrm extends CModule
}
}
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);
$strVars .= '&maxOffersValue=' . urlencode($maxOffers);
$additionalProperties = sprintf(
'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
$arModuleVersion = [
'VERSION' => '6.3.8',
'VERSION_DATE' => '2023-06-01 12:00:00'
'VERSION' => '6.3.9',
'VERSION_DATE' => '2023-06-01 14:00:00'
];

View File

@ -13,9 +13,8 @@ $MESS ['PAYMENT_N'] = 'Not paid';
$MESS ['CANCELED'] = 'Is «Cancelled»';
$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 ['LOAD_NOW'] = 'Export now';
$MESS ['LOAD_NOW_MSG'] = 'The generation will start after you click "Finish installation".
This may take some time';
$MESS ['LOAD_NOW'] = 'Generate ICML catalog now';
$MESS ['LOAD_NOW_MSG'] = 'The generation will start after you click "Finish installation". This may take some time';
$MESS ['PROFILE_NAME'] = 'Profile name:';
$MESS ['PROFILE_NAME_EXAMPLE'] = 'RetailCRM catalog export';
$MESS ['ERR_FIELDS_PROFILE'] = 'Invalid profile name field';

View File

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