Skip to content

Commit edaba3c

Browse files
authored
Merge pull request #2970 from magento-tango/TANGO-FP-PR-1
[tango] TANGO-FP-PR-1
2 parents d5ad9dd + 6470211 commit edaba3c

File tree

13 files changed

+388
-172
lines changed

13 files changed

+388
-172
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ protected function _prepareCustomOptionPriceTable()
547547
* @param IndexTableStructure $finalPriceTable
548548
* @return void
549549
*/
550-
private function modifyPriceIndex(IndexTableStructure $finalPriceTable)
550+
private function modifyPriceIndex(IndexTableStructure $finalPriceTable) : void
551551
{
552552
foreach ($this->priceModifiers as $priceModifier) {
553553
$priceModifier->modifyPrice($finalPriceTable);
@@ -862,6 +862,11 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression)
862862
);
863863
}
864864

865+
/**
866+
* @param string $tableAlias
867+
* @param \Zend_Db_Expr $priceExpression
868+
* @return \Zend_Db_Expr
869+
*/
865870
private function getTierPriceExpressionForTable($tableAlias, \Zend_Db_Expr $priceExpression)
866871
{
867872
return $this->getConnection()->getCheckSql(

app/code/Magento/CatalogInventory/Model/Plugin/PriceIndexUpdater.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(Processor $priceIndexProcessor)
3636
* @return Item
3737
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3838
*/
39-
public function afterSave(Item $subject, Item $result, AbstractModel $model)
39+
public function afterSave(Item $subject, Item $result, AbstractModel $model): Item
4040
{
4141
$fields = [
4242
'is_in_stock',
@@ -55,7 +55,7 @@ public function afterSave(Item $subject, Item $result, AbstractModel $model)
5555

5656
/**
5757
* @param Item $subject
58-
* @param $result
58+
* @param mixed $result
5959
* @param int $websiteId
6060
* @return void
6161
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -67,7 +67,7 @@ public function afterUpdateSetOutOfStock(Item $subject, $result, int $websiteId)
6767

6868
/**
6969
* @param Item $subject
70-
* @param $result
70+
* @param mixed $result
7171
* @param int $websiteId
7272
* @return void
7373
* @SuppressWarnings(PHPMD.UnusedFormalParameter)

app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@
571571
<settings>
572572
<scopeLabel>[GLOBAL]</scopeLabel>
573573
<validation>
574+
<rule name="validate-integer" xsi:type="boolean">true</rule>
574575
<rule name="validate-number" xsi:type="boolean">true</rule>
575576
</validation>
576577
<label translate="true">Qty Increments</label>

app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ define([
2020
var isDigits = value !== 1;
2121

2222
this.validation['validate-integer'] = isDigits;
23-
this.validation['validate-digits'] = isDigits;
2423
this.validation['less-than-equals-to'] = isDigits ? 99999999 : 99999999.9999;
2524
this.validate();
2625
}

app/code/Magento/Elasticsearch/Elasticsearch5/Model/Adapter/FieldMapper/ProductFieldMapper.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ public function __construct(
6969
}
7070

7171
/**
72-
* {@inheritdoc}
72+
* @param string $attributeCode
73+
* @param array $context
74+
* @return string
7375
*/
7476
public function getFieldName($attributeCode, $context = [])
7577
{
@@ -105,8 +107,10 @@ public function getFieldName($attributeCode, $context = [])
105107
}
106108

107109
/**
108-
* {@inheritdoc}
110+
* @param array $context
111+
* @return array
109112
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
113+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
110114
*/
111115
public function getAllAttributesTypes($context = [])
112116
{
@@ -173,8 +177,14 @@ protected function isAttributeUsedInAdvancedSearch($attribute)
173177
*/
174178
protected function getRefinedFieldName($frontendInput, $fieldType, $attributeCode)
175179
{
176-
return (in_array($frontendInput, ['select', 'boolean'], true) && $fieldType === 'integer')
177-
? $attributeCode . '_value' : $attributeCode;
180+
switch ($frontendInput) {
181+
case 'select':
182+
return in_array($fieldType, ['text','integer'], true) ? $attributeCode . '_value' : $attributeCode;
183+
case 'boolean':
184+
return $fieldType === 'integer' ? $attributeCode . '_value' : $attributeCode;
185+
default:
186+
return $attributeCode;
187+
}
178188
}
179189

180190
/**

app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/ProductFieldMapper.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public function __construct(
4242
}
4343

4444
/**
45-
* {@inheritdoc}
45+
* @param string $attributeCode
46+
* @param array $context
47+
* @return string
4648
*/
4749
public function getFieldName($attributeCode, $context = [])
4850
{
@@ -78,7 +80,8 @@ public function getFieldName($attributeCode, $context = [])
7880
}
7981

8082
/**
81-
* {@inheritdoc}
83+
* @param array $context
84+
* @return array
8285
*/
8386
public function getAllAttributesTypes($context = [])
8487
{
@@ -115,4 +118,22 @@ public function getAllAttributesTypes($context = [])
115118

116119
return $allAttributes;
117120
}
121+
122+
/**
123+
* @param string $frontendInput
124+
* @param string $fieldType
125+
* @param string $attributeCode
126+
* @return string
127+
*/
128+
protected function getRefinedFieldName($frontendInput, $fieldType, $attributeCode)
129+
{
130+
switch ($frontendInput) {
131+
case 'select':
132+
return in_array($fieldType, ['string','integer'], true) ? $attributeCode . '_value' : $attributeCode;
133+
case 'boolean':
134+
return $fieldType === 'integer' ? $attributeCode . '_value' : $attributeCode;
135+
default:
136+
return $attributeCode;
137+
}
138+
}
118139
}

app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Adapter/FieldMapper/ProductFieldMapperTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ public function testGetFieldNameWithoutAttribute()
180180
/**
181181
* @dataProvider attributeProvider
182182
* @param string $attributeCode
183-
*
183+
* @param string $inputType
184+
* @param array $searchAttributes
185+
* @param array $expected
184186
* @return void
185187
*/
186188
public function testGetAllAttributesTypes($attributeCode, $inputType, $searchAttributes, $expected)
@@ -227,17 +229,17 @@ public function testGetAllAttributesTypes($attributeCode, $inputType, $searchAtt
227229
public function attributeCodeProvider()
228230
{
229231
return [
230-
['id', 'id', 'string'],
231-
['status', 'status', 'string'],
232-
['status', 'status', 'string', ['type'=>'default']],
233-
['price', 'price_0_1', 'string', ['type'=>'default']],
234-
['position', 'position_category_1', 'string', ['type'=>'default']],
235-
['price', 'price_2_3', 'string', ['type'=>'default', 'customerGroupId'=>'2', 'websiteId'=>'3']],
236-
['position', 'position_category_3', 'string', ['type'=>'default', 'categoryId'=>'3']],
237-
['color', 'color', 'select', ['type'=>'default']],
238-
['description', 'sort_description', 'string', ['type'=>'some']],
239-
['*', '_all', 'string', ['type'=>'text']],
240-
['description', 'description', 'string', ['type'=>'text']],
232+
['id', 'id', 'text'],
233+
['status', 'status', 'text'],
234+
['status', 'status_value', 'text', ['type'=>'default']],
235+
['price', 'price_0_1', 'text', ['type'=>'default']],
236+
['position', 'position_category_1', 'text', ['type'=>'default']],
237+
['price', 'price_2_3', 'text', ['type'=>'default', 'customerGroupId'=>'2', 'websiteId'=>'3']],
238+
['position', 'position_category_3', 'text', ['type'=>'default', 'categoryId'=>'3']],
239+
['color', 'color_value', 'text', ['type'=>'text']],
240+
['description', 'sort_description', 'text', ['type'=>'some']],
241+
['*', '_all', 'text', ['type'=>'text']],
242+
['description', 'description_value', 'text', ['type'=>'text']],
241243
];
242244
}
243245

0 commit comments

Comments
 (0)