Skip to content

Commit d282c10

Browse files
committed
Resolvee conflicts
2 parents 20a6a37 + e62c675 commit d282c10

File tree

117 files changed

+3510
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+3510
-456
lines changed

app/code/Magento/Backend/Block/Widget/Grid.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,10 @@ protected function _addColumnFilterToCollection($column)
300300
if ($this->getCollection()) {
301301
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
302302
if ($column->getFilterConditionCallback()) {
303-
call_user_func($column->getFilterConditionCallback(), $this->getCollection(), $column);
303+
$column->getFilterConditionCallback()[0]->{$column->getFilterConditionCallback()[1]}(
304+
$this->getCollection(),
305+
$column
306+
);
304307
} else {
305308
$condition = $column->getFilter()->getCondition();
306309
if ($field && isset($condition)) {
@@ -363,7 +366,7 @@ protected function _prepareCollection()
363366
$this->_setFilterValues($data);
364367
} elseif ($filter && is_array($filter)) {
365368
$this->_setFilterValues($filter);
366-
} elseif (0 !== sizeof($this->_defaultFilter)) {
369+
} elseif (0 !== count($this->_defaultFilter)) {
367370
$this->_setFilterValues($this->_defaultFilter);
368371
}
369372

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function render(\Magento\Framework\DataObject $row)
4747
return ' ';
4848
}
4949

50-
if (sizeof($actions) == 1 && !$this->getColumn()->getNoLink()) {
50+
if (count($actions) == 1 && !$this->getColumn()->getNoLink()) {
5151
foreach ($actions as $action) {
5252
if (is_array($action)) {
5353
return $this->_toLinkHtml($action, $row);
@@ -104,6 +104,7 @@ protected function _toLinkHtml($action, \Magento\Framework\DataObject $row)
104104
$this->_transformActionData($action, $actionCaption, $row);
105105

106106
if (isset($action['confirm'])) {
107+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
107108
$action['onclick'] = 'return window.confirm(\'' . addslashes(
108109
$this->escapeHtml($action['confirm'])
109110
) . '\')';
@@ -117,8 +118,8 @@ protected function _toLinkHtml($action, \Magento\Framework\DataObject $row)
117118
/**
118119
* Prepares action data for html render
119120
*
120-
* @param array &$action
121-
* @param string &$actionCaption
121+
* @param &array $action
122+
* @param &string $actionCaption
122123
* @param \Magento\Framework\DataObject $row
123124
* @return $this
124125
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
@@ -144,7 +145,7 @@ protected function _transformActionData(&$action, &$actionCaption, \Magento\Fram
144145
if (is_array($action['url']) && isset($action['field'])) {
145146
$params = [$action['field'] => $this->_getValue($row)];
146147
if (isset($action['url']['params'])) {
147-
$params = array_merge($action['url']['params'], $params);
148+
$params[] = $action['url']['params'];
148149
}
149150
$action['href'] = $this->getUrl($action['url']['base'], $params);
150151
unset($action['field']);

app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/**
99
* Adminhtml abstract dashboard helper.
1010
*
11+
* phpcs:disable Magento2.Classes.AbstractApi
1112
* @api
1213
* @since 100.0.2
1314
*/
@@ -28,6 +29,8 @@ abstract class AbstractDashboard extends \Magento\Framework\App\Helper\AbstractH
2829
protected $_params = [];
2930

3031
/**
32+
* Return collections
33+
*
3134
* @return array|\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
3235
*/
3336
public function getCollection()
@@ -39,6 +42,8 @@ public function getCollection()
3942
}
4043

4144
/**
45+
* Init collections
46+
*
4247
* @return void
4348
*/
4449
abstract protected function _initCollection();
@@ -54,14 +59,18 @@ public function getItems()
5459
}
5560

5661
/**
62+
* Return items count
63+
*
5764
* @return int
5865
*/
5966
public function getCount()
6067
{
61-
return sizeof($this->getItems());
68+
return count($this->getItems());
6269
}
6370

6471
/**
72+
* Return column
73+
*
6574
* @param string $index
6675
* @return array
6776
*/
@@ -85,6 +94,8 @@ public function getColumn($index)
8594
}
8695

8796
/**
97+
* Set params with value
98+
*
8899
* @param string $name
89100
* @param mixed $value
90101
* @return void
@@ -95,6 +106,8 @@ public function setParam($name, $value)
95106
}
96107

97108
/**
109+
* Set params
110+
*
98111
* @param array $params
99112
* @return void
100113
*/
@@ -104,6 +117,8 @@ public function setParams(array $params)
104117
}
105118

106119
/**
120+
* Get params with name
121+
*
107122
* @param string $name
108123
* @return mixed
109124
*/
@@ -117,6 +132,8 @@ public function getParam($name)
117132
}
118133

119134
/**
135+
* Get params
136+
*
120137
* @return array
121138
*/
122139
public function getParams()

app/code/Magento/Backend/Helper/Dashboard/Data.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getStores()
6868
*/
6969
public function countStores()
7070
{
71-
return sizeof($this->_stores->getItems());
71+
return count($this->_stores->getItems());
7272
}
7373

7474
/**
@@ -88,15 +88,15 @@ public function getDatePeriods()
8888
}
8989

9090
/**
91-
* Create data hash to ensure that we got valid
92-
* data and it is not changed by some one else.
91+
* Create data hash to ensure that we got valid data and it is not changed by some one else.
9392
*
9493
* @param string $data
9594
* @return string
9695
*/
9796
public function getChartDataHash($data)
9897
{
9998
$secret = $this->_installDate;
99+
// phpcs:disable Magento2.Security.InsecureFunction.FoundWithAlternative
100100
return md5($data . $secret);
101101
}
102102
}

app/code/Magento/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Container extends \Magento\Eav\Model\Entity\Attribute\Source\Config
2121
public function getOptionText($value)
2222
{
2323
$options = $this->getAllOptions();
24-
if (sizeof($options) > 0) {
24+
if (count($options) > 0) {
2525
foreach ($options as $option) {
2626
if (isset($option['value']) && $option['value'] == $value) {
2727
return __($option['label']);

app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,13 @@ public function testTierPrices($priceScope, $expectedWebsiteId)
165165
$this->websiteMock->expects($this->any())->method('getId')->will($this->returnValue($expectedWebsiteId));
166166
$this->tpFactory->expects($this->any())
167167
->method('create')
168-
->will($this->returnCallback(function () {
169-
return $this->objectManagerHelper->getObject(\Magento\Catalog\Model\Product\TierPrice::class);
170-
}));
168+
->will(
169+
$this->returnCallback(
170+
function () {
171+
return $this->objectManagerHelper->getObject(\Magento\Catalog\Model\Product\TierPrice::class);
172+
}
173+
)
174+
);
171175

172176
// create sample TierPrice objects that would be coming from a REST call
173177
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
@@ -198,9 +202,10 @@ public function testTierPrices($priceScope, $expectedWebsiteId)
198202
$tpArray = $this->product->getData($this::KEY_TIER_PRICE);
199203
$this->assertNotNull($tpArray);
200204
$this->assertTrue(is_array($tpArray));
201-
$this->assertEquals(sizeof($tps), sizeof($tpArray));
205+
$this->assertEquals(count($tps), count($tpArray));
202206

203-
for ($i = 0; $i < sizeof($tps); $i++) {
207+
$count = count($tps);
208+
for ($i = 0; $i < $count; $i++) {
204209
$tpData = $tpArray[$i];
205210
$this->assertEquals($expectedWebsiteId, $tpData['website_id'], 'Website Id does not match');
206211
$this->assertEquals($tps[$i]->getValue(), $tpData['price'], 'Price/Value does not match');
@@ -226,12 +231,13 @@ public function testTierPrices($priceScope, $expectedWebsiteId)
226231
$tpRests = $this->model->getTierPrices($this->product);
227232
$this->assertNotNull($tpRests);
228233
$this->assertTrue(is_array($tpRests));
229-
$this->assertEquals(sizeof($tps), sizeof($tpRests));
234+
$this->assertEquals(count($tps), count($tpRests));
230235
foreach ($tpRests as $tpRest) {
231236
$this->assertEquals(50, $tpRest->getExtensionAttributes()->getPercentageValue());
232237
}
233238

234-
for ($i = 0; $i < sizeof($tps); $i++) {
239+
$count = count($tps);
240+
for ($i = 0; $i < $count; $i++) {
235241
$this->assertEquals(
236242
$tps[$i]->getValue(),
237243
$tpRests[$i]->getValue(),

app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
default :?>
131131
<?php if (is_string($block->getProductAttributeValue($item, $attribute))) :?>
132132
<?= /* @noEscape */ $helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode()) ?>
133+
<?php else : ?>
134+
<?= $block->escapeHtml($helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode())) ?>
133135
<?php endif; ?>
134136
<?php break;
135137
} ?>

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ protected function _initTypeModels()
11981198
// phpcs:disable Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge
11991199
$this->_fieldsMap = array_merge($this->_fieldsMap, $model->getCustomFieldsMapping());
12001200
$this->_specialAttributes = array_merge($this->_specialAttributes, $model->getParticularAttributes());
1201-
// phpcs:enable
1201+
// phpcs:enable
12021202
}
12031203
$this->_initErrorTemplates();
12041204
// remove doubles
@@ -2035,9 +2035,9 @@ protected function _saveProductTierPrices(array $tierPriceData)
20352035
protected function _getUploader()
20362036
{
20372037
if ($this->_fileUploader === null) {
2038-
$this->_fileUploader = $this->_uploaderFactory->create();
2038+
$fileUploader = $this->_uploaderFactory->create();
20392039

2040-
$this->_fileUploader->init();
2040+
$fileUploader->init();
20412041

20422042
$dirConfig = DirectoryList::getDefaultConfig();
20432043
$dirAddon = $dirConfig[DirectoryList::MEDIA][DirectoryList::PATH];
@@ -2048,7 +2048,7 @@ protected function _getUploader()
20482048
$tmpPath = $dirAddon . '/' . $this->_mediaDirectory->getRelativePath('import');
20492049
}
20502050

2051-
if (!$this->_fileUploader->setTmpDir($tmpPath)) {
2051+
if (!$fileUploader->setTmpDir($tmpPath)) {
20522052
throw new LocalizedException(
20532053
__('File directory \'%1\' is not readable.', $tmpPath)
20542054
);
@@ -2057,11 +2057,13 @@ protected function _getUploader()
20572057
$destinationPath = $dirAddon . '/' . $this->_mediaDirectory->getRelativePath($destinationDir);
20582058

20592059
$this->_mediaDirectory->create($destinationPath);
2060-
if (!$this->_fileUploader->setDestDir($destinationPath)) {
2060+
if (!$fileUploader->setDestDir($destinationPath)) {
20612061
throw new LocalizedException(
20622062
__('File directory \'%1\' is not writable.', $destinationPath)
20632063
);
20642064
}
2065+
2066+
$this->_fileUploader = $fileUploader;
20652067
}
20662068
return $this->_fileUploader;
20672069
}
@@ -3060,6 +3062,8 @@ private function getValidationErrorLevel($sku): string
30603062
* @param int $nextLinkId
30613063
* @param array $positionAttrId
30623064
* @return void
3065+
* @throws LocalizedException
3066+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
30633067
*/
30643068
private function processLinkBunches(
30653069
array $bunch,
@@ -3070,6 +3074,7 @@ private function processLinkBunches(
30703074
$productIds = [];
30713075
$linkRows = [];
30723076
$positionRows = [];
3077+
$linksToDelete = [];
30733078

30743079
$bunch = array_filter($bunch, [$this, 'isRowAllowedToImport'], ARRAY_FILTER_USE_BOTH);
30753080
foreach ($bunch as $rowData) {
@@ -3086,10 +3091,15 @@ function ($linkName) use ($rowData) {
30863091
);
30873092
foreach ($linkNameToId as $linkName => $linkId) {
30883093
$linkSkus = explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'sku']);
3094+
//process empty value
3095+
if (!empty($linkSkus[0]) && $linkSkus[0] === $this->getEmptyAttributeValueConstant()) {
3096+
$linksToDelete[$linkId][] = $productId;
3097+
continue;
3098+
}
3099+
30893100
$linkPositions = !empty($rowData[$linkName . 'position'])
30903101
? explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'position'])
30913102
: [];
3092-
30933103
$linkSkus = array_filter(
30943104
$linkSkus,
30953105
function ($linkedSku) use ($sku) {
@@ -3098,6 +3108,7 @@ function ($linkedSku) use ($sku) {
30983108
&& strcasecmp($linkedSku, $sku) !== 0;
30993109
}
31003110
);
3111+
31013112
foreach ($linkSkus as $linkedKey => $linkedSku) {
31023113
$linkedId = $this->getProductLinkedId($linkedSku);
31033114
if ($linkedId == null) {
@@ -3129,9 +3140,34 @@ function ($linkedSku) use ($sku) {
31293140
}
31303141
}
31313142
}
3143+
$this->deleteProductsLinks($resource, $linksToDelete);
31323144
$this->saveLinksData($resource, $productIds, $linkRows, $positionRows);
31333145
}
31343146

3147+
/**
3148+
* Delete links
3149+
*
3150+
* @param Link $resource
3151+
* @param array $linksToDelete
3152+
* @return void
3153+
* @throws LocalizedException
3154+
*/
3155+
private function deleteProductsLinks(Link $resource, array $linksToDelete)
3156+
{
3157+
if (!empty($linksToDelete) && Import::BEHAVIOR_APPEND === $this->getBehavior()) {
3158+
foreach ($linksToDelete as $linkTypeId => $productIds) {
3159+
if (!empty($productIds)) {
3160+
$whereLinkId = $this->_connection->quoteInto('link_type_id', $linkTypeId);
3161+
$whereProductId = $this->_connection->quoteInto('product_id IN (?)', array_unique($productIds));
3162+
$this->_connection->delete(
3163+
$resource->getMainTable(),
3164+
$whereLinkId . ' AND ' . $whereProductId
3165+
);
3166+
}
3167+
}
3168+
}
3169+
}
3170+
31353171
/**
31363172
* Fetches Product Links
31373173
*

app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,9 @@ protected function _parseCustomOptions($rowData)
20862086
}
20872087
}
20882088
}
2089-
$options[$name][$k]['_custom_option_store'] = $rowData[Product::COL_STORE_VIEW_CODE];
2089+
if (isset($rowData[Product::COL_STORE_VIEW_CODE])) {
2090+
$options[$name][$k][self::COLUMN_STORE] = $rowData[Product::COL_STORE_VIEW_CODE];
2091+
}
20902092
$k++;
20912093
}
20922094
$rowData['custom_options'] = $options;

0 commit comments

Comments
 (0)