From 6ca50e4a7b15b3e0ddcaf99ac5aeb0b27d4c5e3b Mon Sep 17 00:00:00 2001 From: Serhii Zhuravel Date: Wed, 17 May 2023 23:45:39 +0300 Subject: [PATCH] Backport #85 by @sylvainraye --- ...llectionVariantReindexMessageSendListenerDecorator.php | 3 +-- ImportExport/Processor/ProductImageImportProcessor.php | 8 -------- ImportExport/Writer/AttributeWriter.php | 7 +++++-- Layout/DataProvider/FileApplicationsDataProvider.php | 2 +- Resources/config/services.yml | 2 +- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/EventListener/ProductCollectionVariantReindexMessageSendListenerDecorator.php b/EventListener/ProductCollectionVariantReindexMessageSendListenerDecorator.php index 2f0d2e77..1bf46592 100644 --- a/EventListener/ProductCollectionVariantReindexMessageSendListenerDecorator.php +++ b/EventListener/ProductCollectionVariantReindexMessageSendListenerDecorator.php @@ -8,8 +8,7 @@ /** * Postpone segments updates */ -class ProductCollectionVariantReindexMessageSendListenerDecorator extends BaseListener implements - AdditionalOptionalListenerInterface +class ProductCollectionVariantReindexMessageSendListenerDecorator extends BaseListener implements AdditionalOptionalListenerInterface { use AdditionalOptionalListenerTrait; diff --git a/ImportExport/Processor/ProductImageImportProcessor.php b/ImportExport/Processor/ProductImageImportProcessor.php index b0caac59..c34624b5 100644 --- a/ImportExport/Processor/ProductImageImportProcessor.php +++ b/ImportExport/Processor/ProductImageImportProcessor.php @@ -82,14 +82,6 @@ private function mergeImages(Product $product, array $images): Product continue; } - if (!is_a($image->getImage()->getParentEntityClass(), ProductImage::class, true)) { - $image->setImage(null); - - $product->removeImage($image); - - continue; - } - $filename = $image->getImage()->getOriginalFilename(); if (!in_array($filename, array_keys($images))) { $product->removeImage($image); diff --git a/ImportExport/Writer/AttributeWriter.php b/ImportExport/Writer/AttributeWriter.php index 4e1fd17a..25beae53 100644 --- a/ImportExport/Writer/AttributeWriter.php +++ b/ImportExport/Writer/AttributeWriter.php @@ -275,8 +275,11 @@ protected function setAttributeData(FieldConfigModel $fieldConfigModel) $attributeConfig->set('visible', false); $attributeConfig->set('enabled', false); - $attributeConfig->set('is_global', false); - $attributeConfig->set('organization_id', $this->getOrganizationId()); + // Differentiate OroCommerce EE from CE + if (class_exists('\Oro\Bundle\EntityConfigProBundle\Attribute\AttributeConfigurationProvider')) { + $attributeConfig->set('is_global', false); + $attributeConfig->set('organization_id', $this->getOrganizationId()); + } } $attributeConfig->set('field_name', $fieldName); diff --git a/Layout/DataProvider/FileApplicationsDataProvider.php b/Layout/DataProvider/FileApplicationsDataProvider.php index eaf9e7db..82bf1d7f 100644 --- a/Layout/DataProvider/FileApplicationsDataProvider.php +++ b/Layout/DataProvider/FileApplicationsDataProvider.php @@ -34,6 +34,6 @@ public function isValidForField(string $className, string $fieldName): bool $config = $this->configProvider->getConfig($className, $fieldName); - return $config->get('visible'); + return $config->get('is_displayable'); } } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 7285783d..e10d6655 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -172,7 +172,7 @@ services: decorates: oro_attachment.layout.data_provider.file_applications arguments: - '@oro_akeneo.layout.data_provider.file_applications.inner' - - '@oro_entity_config.provider.attribute' + - '@oro_entity_config.provider.frontend' oro_akeneo.layout.block_type.attribute_group: class: 'Oro\Bundle\AkeneoBundle\Layout\Block\Type\AttributeGroupType'