1
0
Fork 0
mirror of synced 2025-04-11 05:00:55 +00:00
Промежуточные изменения
This commit is contained in:
Ivan Chaplygin 2024-01-11 11:21:14 +03:00
parent d9cdfced49
commit 16e6ddaa29
4 changed files with 38 additions and 29 deletions

View file

@ -6,6 +6,7 @@ use Intaro\RetailCrm\Model\Bitrix\Xml\XmlSetup;
use Intaro\RetailCrm\Model\Bitrix\Xml\XmlSetupProps;
use Intaro\RetailCrm\Model\Bitrix\Xml\XmlSetupPropsCategories;
use Intaro\RetailCrm\Repository\CatalogRepository;
use Intaro\RetailCrm\Icml\SettingsService;
/** @var $SETUP_FILE_NAME */
@ -37,16 +38,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/retailcrm/exp
}
}
$iblockProperties = [
'article' => 'article',
'manufacturer' => 'manufacturer',
'color' => 'color',
'weight' => 'weight',
'size' => 'size',
'length' => 'length',
'width' => 'width',
'height' => 'height',
];
$iblockProperties = SettingsService::getIblockPropsPreset();
$iblockPropertySku = [];
$iblockPropertySkuHl = [];

View file

@ -63,7 +63,7 @@ if (($ACTION === 'EXPORT' || $ACTION === 'EXPORT_EDIT' || $ACTION === 'EXPORT_CO
$SETUP_FILE_NAME = $settingsService->setupFileName;
$SETUP_PROFILE_NAME = $settingsService->setupProfileName;
$iblockProperties = $settingsService->getIblockPropsPreset();
$iblockProperties = $settingsService::getIblockPropsPreset();
$loadPurchasePrice = $settingsService->loadPurchasePrice;
$iblockExport = $settingsService->iblockExport;
$loadNonActivity = $settingsService->loadNonActivity;

View file

@ -97,11 +97,15 @@ class SettingsService
*/
public $loadNonActivity;
/** @var array */
public $actrualPropList = [];
/**
* @var \Intaro\RetailCrm\Icml\SettingsService|null
*/
private static $instance = null;
/**
* SettingsService constructor.
*
@ -123,6 +127,8 @@ class SettingsService
$this->getPriceTypes();
$this->getVatRates();
$this->actrualPropList = array_merge($this->getIblockPropsPreset(), $this->parseNewProps());
}
/**
@ -131,12 +137,12 @@ class SettingsService
*
* @return \Intaro\RetailCrm\Icml\SettingsService|null
*/
static public function getInstance(array $arOldSetupVars, ?string $action): ?SettingsService
public static function getInstance(array $arOldSetupVars, ?string $action): ?SettingsService
{
if(is_null(self::$instance))
{
if (is_null(self::$instance)) {
self::$instance = new self($arOldSetupVars, $action);
}
return self::$instance;
}
@ -242,18 +248,25 @@ class SettingsService
public function getIblockPropsPreset(): array
{
return [
'article' => 'article',
'manufacturer' => 'manufacturer',
'color' => 'color',
'size' => 'size',
'weight' => 'weight',
'length' => 'length',
'width' => 'width',
'height' => 'height',
'picture' => 'picture',
'article' => GetMessage('PROPERTY_ARTICLE_HEADER_NAME'),
'manufacturer' => GetMessage('PROPERTY_MANUFACTURER_HEADER_NAME'),
'color' => GetMessage('PROPERTY_COLOR_HEADER_NAME'),
'size' => GetMessage('PROPERTY_SIZE_HEADER_NAME'),
'weight' => GetMessage('PROPERTY_WEIGHT_HEADER_NAME'),
'length' => GetMessage('PROPERTY_LENGTH_HEADER_NAME'),
'width' => GetMessage('PROPERTY_WIDTH_HEADER_NAME'),
'height' => GetMessage('PROPERTY_HEIGHT_HEADER_NAME'),
'picture' => GetMessage('PROPERTY_PICTURE_HEADER_NAME'),
];
}
private function parseNewProps(): array
{
$result = [];
}
/**
* @return array
*/

View file

@ -94,6 +94,11 @@ class XmlOfferBuilder
*/
private $vatRates;
/**
* @var SettingsService
*/
private $settingsService;
/**
* IcmlDataManager constructor.
*
@ -107,9 +112,8 @@ class XmlOfferBuilder
{
$this->setup = $setup;
$this->purchasePriceNull = RetailcrmConfigProvider::getCrmPurchasePrice();
/** @var \Intaro\RetailCrm\Icml\SettingsService $settingsService */
$settingsService = SettingsService::getInstance([], '');
$this->vatRates = $settingsService->vatRates;
$this->settingsService = SettingsService::getInstance([], '');
$this->vatRates = $this->settingsService->vatRates;
$this->measures = $this->prepareMeasures($measure);
$this->defaultServerName = $defaultServerName;
}
@ -461,16 +465,16 @@ class XmlOfferBuilder
private function createParamObject(array $params): array
{
$offerParams = [];
$names = $this->settingsService->getIblockPropsNames();
foreach ($params as $code => $value) {
$paramName = GetMessage('PARAM_NAME_' . $code);
if (empty($paramName)) {
if (!isset($names[$code])) {
continue;
}
$offerParam = new OfferParam();
$offerParam->name = $paramName;
$offerParam->name = $names[$code];
$offerParam->code = $code;
$offerParam->value = $value;
$offerParams[] = $offerParam;