Skip to content

Commit

Permalink
Merge pull request #709 from akeneo/release/104.3.15
Browse files Browse the repository at this point in the history
Release/104.3.15
  • Loading branch information
magentix authored Oct 24, 2024
2 parents 1c3361c + 71cc5b8 commit 7c4ad05
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 23 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,3 +514,12 @@
* PGTO-340: Fix job executor date format
* PGTO-462: Set attribute code to lowercase for options
* Fix non-scopable localizable attribute import

### Version 104.3.15 :
* PGTO-398: Do not create an empty value for visual swatch in stores
* PGTO-463: Fix empty option label error for table attributes
* PGTO-472: Empty product model option label if not exist for local
* PGTO-479: Fix UUID error when product models have no variant
* PGTO-480: Fix request to match existing options
* Set default product name to empty instead of null
* Update UUID according sku configured column
2 changes: 1 addition & 1 deletion Helper/Import/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function matchEntity($pimKey, $entityTable, $entityKey, $import, $prefix
['a' => $this->getTable('eav_attribute')],
'o.`attribute_id` = a.`attribute_id` AND t.`attribute` = a.`attribute_code`',
[]
)->where('e.store_id = ?', 0)->where('a.entity_type_id', $entityTypeId);
)->where('e.store_id = ?', 0)->where('a.entity_type_id = ?', $entityTypeId);
/** @var string[] $existingMagentoOptions */
$existingMagentoOptions = $connection->query($select)->fetchAll();
/** @var string[] $existingMagentoOptionIds */
Expand Down
4 changes: 2 additions & 2 deletions Helper/ProductModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function insertData(AkeneoPimClientInterface $akeneoClient, array $filter
/** @var string[][] $option */
foreach ($config['options'] as $option) {
if ($option['code'] === $newData || $option['code'] === $label) {
$table['data'][$i][$label] = [$newLabel => $option['labels'][$locale]];
$table['data'][$i][$label] = [$newLabel => $option['labels'][$locale] ?? ''];
}
}
}
Expand Down Expand Up @@ -441,7 +441,7 @@ public function getMetricsSymbols($akeneoClient)
*
* @param string $code
* @param string|null $family
*
*
* @return void
*/
public function addColumns($code, ?string $family = null)
Expand Down
8 changes: 7 additions & 1 deletion Job/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ public function insertSwatchOption(): void

foreach ($swatchesAttributesData as $swatchesAttributeData) {
$optionTypeAndValue = $this->getTypeAndValue($swatchesAttributes, $swatchesAttributeData);
if ((int)$optionTypeAndValue['type'] === Swatch::SWATCH_TYPE_VISUAL_IMAGE &&
(int)$swatchesAttributeData['store_id'] !== 0)
{
continue;
}
$dataToInsert[] = [
'option_id' => $swatchesAttributeData['option_id'],
'store_id' => $swatchesAttributeData['store_id'],
Expand Down Expand Up @@ -597,8 +602,9 @@ public function getTypeAndValue(array $swatchesAttributes, array $swatchesAttrib
$current = $connection->fetchRow(
$connection->select()
->from($this->entitiesHelper->getTable('eav_attribute_option_swatch'), ['value', 'type'])
->where('store_id = ?', $swatchesAttributeData['store_id'])
->where('store_id = 0 OR store_id = ?', $swatchesAttributeData['store_id'])
->where('option_id = ?', $swatchesAttributeData['option_id'])
->order('store_id DESC')
->limit(1)
);
if (!empty($current)) {
Expand Down
39 changes: 21 additions & 18 deletions Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,6 @@ public function createTable()
__('No product found for family: %1 but product model found, process with import', $family),
$this->logger
);

return;
} else {
$product = reset($products);
// Make sure to delete product model table
Expand All @@ -621,17 +619,20 @@ public function createTable()
if ($this->entitiesHelper->isProductUuidEdition()) {
$tmpTable = $this->entitiesHelper->getTableName($this->jobExecutor->getCurrentJob()->getCode());

$connection->changeColumn(
$tmpTable,
'uuid',
'uuid',
[
'nullable' => true,
'type' => Table::TYPE_TEXT,
'length' => 255,
'comment' => 'UUID',
]
);
$definition = [
'nullable' => true,
'type' => Table::TYPE_TEXT,
'length' => 255,
'comment' => 'UUID',
];

if ($connection->tableColumnExists($tmpTable, 'uuid')) {
$connection->changeColumn($tmpTable, 'uuid', 'uuid', $definition);
} else {
// We have no product (like product models without variant) with applied filters
// We need to add manually the column
$connection->addColumn($tmpTable, 'uuid', $definition);
}
$connection->addIndex($tmpTable, 'UNIQUE_UUID', 'uuid', 'unique');
}
}
Expand Down Expand Up @@ -752,7 +753,7 @@ public function insertData()
/** @var string[][] $option */
foreach ($config['options'] as $option) {
if ($option['code'] === $newData || $option['code'] === $label) {
$table['data'][$i][$label] = [$newLabel => $option['labels'][$locale]];
$table['data'][$i][$label] = [$newLabel => $option['labels'][$locale] ?? ''];
}
}
}
Expand Down Expand Up @@ -1725,12 +1726,14 @@ public function matchEntities()
return;
}

if ($this->entitiesHelper->isProductUuidEdition() && $connection->tableColumnExists($tmpTable, 'sku')) {
// We replace the sku by the uuid in the Akeneo entities table if needed for retro-compatibility
$skuColumn = $this->configHelper->getAkeneoAttributeCodeForSku() ?: 'sku';

if ($this->entitiesHelper->isProductUuidEdition() && $connection->tableColumnExists($tmpTable, $skuColumn)) {
// We replace the sku by the uuid in the Akeneo entities table if needed
$entitiesTable = $this->entitiesHelper->getTable('akeneo_connector_entities');
$uuids = $connection->select()
->from(false, ['code' => 'tmp.uuid'])
->joinInner(['tmp' => $tmpTable], '`tmp`.`sku` = `ace`.`code`', [])
->joinInner(['tmp' => $tmpTable], '`tmp`.`' . $skuColumn . '` = `ace`.`code`', [])
->where('`ace`.`import` = ?', 'product');
$connection->query($connection->updateFromSelect($uuids, ['ace' => $entitiesTable]));
}
Expand Down Expand Up @@ -5188,7 +5191,7 @@ protected function handleNoName(): void

$connection->query('INSERT IGNORE INTO `' . $entityVarcharTable . '`
(`attribute_id`, `store_id`, `value`, `' . $columnIdentifier . '`)
SELECT ' . $attribute->getId() . ', 0, NULL, `' . $columnIdentifier . '` FROM `' . $entityTable . '` e
SELECT ' . $attribute->getId() . ', 0, "", `' . $columnIdentifier . '` FROM `' . $entityTable . '` e
INNER JOIN `' . $tmpTable . '` t ON e.`entity_id` = t.`_entity_id`');
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"nyholm/psr7": "^1.5"
},
"type": "magento2-module",
"version": "104.3.14",
"version": "104.3.15",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down

0 comments on commit 7c4ad05

Please sign in to comment.