Skip to content

Commit 724e1e5

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents bd06fc9 + 931f2ea commit 724e1e5

File tree

17 files changed

+228
-63
lines changed

17 files changed

+228
-63
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ Tests:
626626
* Fixed an issue where filters were not shown on product reviews report grid
627627
* Fixed an issue where second customer address was not deleted from customer account
628628
* Fixed an issue where custom options pop-up was still displayed after submit
629-
* Fixed an issue where Second Product was not added to Shopping Cart from Wishlist at first atempt
629+
* Fixed an issue where Second Product was not added to Shopping Cart from Wishlist at first attempt
630630
* Fixed an issue where customer invalid email message was not displayed
631631
* Fixed an issue where All Access Tokens for Customer without Tokens could not be revoked
632632
* Fixed an issue where it was impossible to add Product to Shopping Cart from shared Wishlist

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract
185185
* @param AdvancedPricing\Validator\Website $websiteValidator
186186
* @param AdvancedPricing\Validator\TierPrice $tierPriceValidator
187187
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
188+
* @throws \Exception
188189
*/
189190
public function __construct(
190191
\Magento\Framework\Json\Helper\Data $jsonHelper,
@@ -255,6 +256,7 @@ public function getEntityTypeCode()
255256
* @param array $rowData
256257
* @param int $rowNum
257258
* @return bool
259+
* @throws \Zend_Validate_Exception
258260
*/
259261
public function validateRow(array $rowData, $rowNum)
260262
{
@@ -308,6 +310,7 @@ protected function _importData()
308310
* Save advanced pricing
309311
*
310312
* @return $this
313+
* @throws \Exception
311314
*/
312315
public function saveAdvancedPricing()
313316
{
@@ -319,6 +322,7 @@ public function saveAdvancedPricing()
319322
* Deletes Advanced price data from raw data.
320323
*
321324
* @return $this
325+
* @throws \Exception
322326
*/
323327
public function deleteAdvancedPricing()
324328
{
@@ -347,6 +351,7 @@ public function deleteAdvancedPricing()
347351
* Replace advanced pricing
348352
*
349353
* @return $this
354+
* @throws \Exception
350355
*/
351356
public function replaceAdvancedPricing()
352357
{
@@ -360,6 +365,7 @@ public function replaceAdvancedPricing()
360365
* @return $this
361366
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
362367
* @SuppressWarnings(PHPMD.NPathComplexity)
368+
* @throws \Exception
363369
*/
364370
protected function saveAndReplaceAdvancedPrices()
365371
{
@@ -368,8 +374,8 @@ protected function saveAndReplaceAdvancedPrices()
368374
$this->_cachedSkuToDelete = null;
369375
}
370376
$listSku = [];
377+
$tierPrices = [];
371378
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
372-
$tierPrices = [];
373379
foreach ($bunch as $rowNum => $rowData) {
374380
if (!$this->validateRow($rowData, $rowNum)) {
375381
$this->addRowError(ValidatorInterface::ERROR_SKU_IS_EMPTY, $rowNum);
@@ -397,15 +403,8 @@ protected function saveAndReplaceAdvancedPrices()
397403
];
398404
}
399405
}
400-
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
401-
if ($listSku) {
402-
$this->processCountNewPrices($tierPrices);
403-
if ($this->deleteProductTierPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) {
404-
$this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE);
405-
$this->setUpdatedAt($listSku);
406-
}
407-
}
408-
} elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
406+
407+
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
409408
$this->processCountExistingPrices($tierPrices, self::TABLE_TIER_PRICE)
410409
->processCountNewPrices($tierPrices);
411410

@@ -415,6 +414,17 @@ protected function saveAndReplaceAdvancedPrices()
415414
}
416415
}
417416
}
417+
418+
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
419+
if ($listSku) {
420+
$this->processCountNewPrices($tierPrices);
421+
if ($this->deleteProductTierPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) {
422+
$this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE);
423+
$this->setUpdatedAt($listSku);
424+
}
425+
}
426+
}
427+
418428
return $this;
419429
}
420430

@@ -424,6 +434,7 @@ protected function saveAndReplaceAdvancedPrices()
424434
* @param array $priceData
425435
* @param string $table
426436
* @return $this
437+
* @throws \Exception
427438
*/
428439
protected function saveProductPrices(array $priceData, $table)
429440
{
@@ -455,6 +466,7 @@ protected function saveProductPrices(array $priceData, $table)
455466
* @param array $listSku
456467
* @param string $table
457468
* @return boolean
469+
* @throws \Exception
458470
*/
459471
protected function deleteProductTierPrices(array $listSku, $table)
460472
{
@@ -532,6 +544,7 @@ protected function getCustomerGroupId($customerGroup)
532544
* Retrieve product skus
533545
*
534546
* @return array
547+
* @throws \Exception
535548
*/
536549
protected function retrieveOldSkus()
537550
{
@@ -552,6 +565,7 @@ protected function retrieveOldSkus()
552565
* @param array $prices
553566
* @param string $table
554567
* @return $this
568+
* @throws \Exception
555569
*/
556570
protected function processCountExistingPrices($prices, $table)
557571
{

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,27 +169,27 @@
169169
</group>
170170
<group id="js" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
171171
<label>JavaScript Settings</label>
172-
<field id="merge_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
172+
<field id="merge_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
173173
<label>Merge JavaScript Files</label>
174174
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
175175
</field>
176-
<field id="enable_js_bundling" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
176+
<field id="enable_js_bundling" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
177177
<label>Enable JavaScript Bundling</label>
178178
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
179179
</field>
180-
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
180+
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
181181
<label>Minify JavaScript Files</label>
182182
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
183183
<comment>Minification is not applied in developer mode.</comment>
184184
</field>
185185
</group>
186186
<group id="css" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
187187
<label>CSS Settings</label>
188-
<field id="merge_css_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
188+
<field id="merge_css_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
189189
<label>Merge CSS Files</label>
190190
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
191191
</field>
192-
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
192+
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
193193
<label>Minify CSS Files</label>
194194
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
195195
<comment>Minification is not applied in developer mode.</comment>

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Product attribute add/edit form main tab
9-
*
10-
* @author Magento Core Team <[email protected]>
11-
*/
127
namespace Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab;
138

149
use Magento\Backend\Block\Widget\Form\Generic;
@@ -18,6 +13,8 @@
1813
use Magento\Framework\App\ObjectManager;
1914

2015
/**
16+
* Product attribute add/edit form main tab
17+
*
2118
* @api
2219
* @since 100.0.2
2320
*/
@@ -73,6 +70,7 @@ public function __construct(
7370
* Adding product form elements for editing attribute
7471
*
7572
* @return $this
73+
* @throws \Magento\Framework\Exception\LocalizedException
7674
* @SuppressWarnings(PHPMD)
7775
*/
7876
protected function _prepareForm()
@@ -255,7 +253,7 @@ protected function _prepareForm()
255253
}
256254

257255
/**
258-
* Initialize form fileds values
256+
* Initialize form fields values
259257
*
260258
* @return $this
261259
*/

app/code/Magento/CatalogInventory/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</type>
4545
<type name="Magento\CatalogInventory\Observer\UpdateItemsStockUponConfigChangeObserver">
4646
<arguments>
47-
<argument name="resourceStock" xsi:type="object">Magento\CatalogInventory\Model\ResourceModel\Stock\Proxy</argument>
47+
<argument name="resourceStockItem" xsi:type="object">Magento\CatalogInventory\Model\ResourceModel\Stock\Item\Proxy</argument>
4848
</arguments>
4949
</type>
5050
<type name="Magento\Catalog\Model\Layer">

app/code/Magento/Directory/Setup/Patch/Data/AddDataForIndia.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
use Magento\Framework\Setup\Patch\PatchVersionInterface;
1414

1515
/**
16-
* Class AddDataForIndia
17-
* @package Magento\Directory\Setup\Patch\Data
16+
* Add Regions for India.
1817
*/
1918
class AddDataForIndia implements DataPatchInterface, PatchVersionInterface
2019
{
@@ -29,7 +28,7 @@ class AddDataForIndia implements DataPatchInterface, PatchVersionInterface
2928
private $dataInstallerFactory;
3029

3130
/**
32-
* AddDataForCroatia constructor.
31+
* AddDataForIndia constructor.
3332
*
3433
* @param ModuleDataSetupInterface $moduleDataSetup
3534
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
@@ -43,7 +42,7 @@ public function __construct(
4342
}
4443

4544
/**
46-
* {@inheritdoc}
45+
* @inheritdoc
4746
*/
4847
public function apply()
4948
{
@@ -103,7 +102,7 @@ private function getDataForIndia()
103102
}
104103

105104
/**
106-
* {@inheritdoc}
105+
* @inheritdoc
107106
*/
108107
public static function getDependencies()
109108
{
@@ -113,15 +112,15 @@ public static function getDependencies()
113112
}
114113

115114
/**
116-
* {@inheritdoc}
115+
* @inheritdoc
117116
*/
118117
public static function getVersion()
119118
{
120119
return '2.0.2';
121120
}
122121

123122
/**
124-
* {@inheritdoc}
123+
* @inheritdoc
125124
*/
126125
public function getAliases()
127126
{
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Directory\Setup\Patch\Data;
10+
11+
use Magento\Directory\Setup\DataInstaller;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
15+
16+
/**
17+
* Adds Mexican States
18+
*/
19+
class AddDataForMexico implements DataPatchInterface, PatchVersionInterface
20+
{
21+
/**
22+
* @var ModuleDataSetupInterface
23+
*/
24+
private $moduleDataSetup;
25+
26+
/**
27+
* @var \Magento\Directory\Setup\DataInstallerFactory
28+
*/
29+
private $dataInstallerFactory;
30+
31+
/**
32+
* @param ModuleDataSetupInterface $moduleDataSetup
33+
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
34+
*/
35+
public function __construct(
36+
ModuleDataSetupInterface $moduleDataSetup,
37+
\Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
38+
) {
39+
$this->moduleDataSetup = $moduleDataSetup;
40+
$this->dataInstallerFactory = $dataInstallerFactory;
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function apply()
47+
{
48+
/** @var DataInstaller $dataInstaller */
49+
$dataInstaller = $this->dataInstallerFactory->create();
50+
$dataInstaller->addCountryRegions(
51+
$this->moduleDataSetup->getConnection(),
52+
$this->getDataForMexico()
53+
);
54+
}
55+
56+
/**
57+
* Mexican states data.
58+
*
59+
* @return array
60+
*/
61+
private function getDataForMexico()
62+
{
63+
return [
64+
['MX', 'AGU', 'Aguascalientes'],
65+
['MX', 'BCN', 'Baja California'],
66+
['MX', 'BCS', 'Baja California Sur'],
67+
['MX', 'CAM', 'Campeche'],
68+
['MX', 'CHP', 'Chiapas'],
69+
['MX', 'CHH', 'Chihuahua'],
70+
['MX', 'CMX', 'Ciudad de México'],
71+
['MX', 'COA', 'Coahuila'],
72+
['MX', 'COL', 'Colima'],
73+
['MX', 'DUR', 'Durango'],
74+
['MX', 'MEX', 'Estado de México'],
75+
['MX', 'GUA', 'Guanajuato'],
76+
['MX', 'GRO', 'Guerrero'],
77+
['MX', 'HID', 'Hidalgo'],
78+
['MX', 'JAL', 'Jalisco'],
79+
['MX', 'MIC', 'Michoacán'],
80+
['MX', 'MOR', 'Morelos'],
81+
['MX', 'NAY', 'Nayarit'],
82+
['MX', 'NLE', 'Nuevo León'],
83+
['MX', 'OAX', 'Oaxaca'],
84+
['MX', 'PUE', 'Puebla'],
85+
['MX', 'QUE', 'Querétaro'],
86+
['MX', 'ROO', 'Quintana Roo'],
87+
['MX', 'SLP', 'San Luis Potosí'],
88+
['MX', 'SIN', 'Sinaloa'],
89+
['MX', 'SON', 'Sonora'],
90+
['MX', 'TAB', 'Tabasco'],
91+
['MX', 'TAM', 'Tamaulipas'],
92+
['MX', 'TLA', 'Tlaxcala'],
93+
['MX', 'VER', 'Veracruz'],
94+
['MX', 'YUC', 'Yucatán'],
95+
['MX', 'ZAC', 'Zacatecas']
96+
];
97+
}
98+
99+
/**
100+
* @inheritdoc
101+
*/
102+
public static function getDependencies()
103+
{
104+
return [
105+
InitializeDirectoryData::class,
106+
AddDataForAustralia::class,
107+
AddDataForCroatia::class,
108+
AddDataForIndia::class,
109+
];
110+
}
111+
112+
/**
113+
* @inheritdoc
114+
*/
115+
public static function getVersion()
116+
{
117+
return '2.0.4';
118+
}
119+
120+
/**
121+
* @inheritdoc
122+
*/
123+
public function getAliases()
124+
{
125+
return [];
126+
}
127+
}

0 commit comments

Comments
 (0)