Skip to content

Commit 2cbe1a6

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #15536: [Forwardport] Moved css from media #TODO (by @vgelani) - #15551: [Forwardport] Fixes in ui module (by @mhauri) - #15560: [Forwardport] Format the javascript code in Tax module (by @vgelani) - #15554: Fixes in widget component (2.3-develop) (by @mhauri) - #15529: [Forwardport] Added language translation for message string (by @yogeshks) - #15520: [Forwardport] Improvements to the CONTRIBUTING.md document (by @osrecio) - magento-engcom/import-export-improvements#104: MAGETWO-84124: Add bundle parent/child relationship during import (by @adam-paterson) Fixed GitHub Issues: - #15352: Reformat the javascript code as per magento standards. (reported by @namratachangani) has been fixed in #15560 by @vgelani in 2.3-develop branch Related commits: 1. 467ebb2 2. 4ec581c 3. 4078907 4. 60ed680 - #12330: Imported bundle products are not assigned stock status (reported by @indefinitedevil) has been fixed in magento-engcom/import-export-improvements#104 by @adam-paterson in 2.3-develop branch Related commits: 1. 9cbef5e 2. e07b074 3. f1657b8
2 parents d83f3f5 + 21f2615 commit 2cbe1a6

File tree

16 files changed

+159
-45
lines changed

16 files changed

+159
-45
lines changed

.github/CONTRIBUTING.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
# Contributing to Magento 2 code
22

33
Contributions to the Magento 2 codebase are done using the fork & pull model.
4-
This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes (hence the phrase “pull request”).
4+
This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes. For more information on pull requests please refer to [GitHub Help](https://help.github.com/articles/about-pull-requests/).
55

6-
Contributions can take the form of new components/features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations or just good suggestions.
6+
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes or optimizations.
77

8-
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor for two weeks, the issue is closed.
8+
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor within two weeks, the pull request will be closed.
99

1010

1111
## Contribution requirements
1212

13-
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v2.0/coding-standards/bk-coding-standards.html).
14-
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request to be merged quickly and without additional clarification requests.
15-
3. Commits must be accompanied by meaningful commit messages.
16-
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
13+
1. Contributions must adhere to the [Magento coding standards](https://devdocs.magento.com/guides/v2.2/coding-standards/bk-coding-standards.html).
14+
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests.
15+
3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/2.2-develop/.github/PULL_REQUEST_TEMPLATE.md) for more information.
16+
4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug.
1717
3. PRs which include new logic or new features must be submitted along with:
18-
* Unit/integration test coverage (we will be releasing more information on writing test coverage in the near future).
19-
* Proposed [documentation](http://devdocs.magento.com) update. Documentation contributions can be submitted [here](https://github.com/magento/devdocs).
20-
4. For large features or changes, please [open an issue](https://github.com/magento/magento2/issues) and discuss first. This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors.
21-
5. All automated tests are passed successfully (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
18+
* Unit/integration test coverage
19+
* Proposed [documentation](http://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
20+
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
21+
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
2222

2323
## Contribution process
2424

25-
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, fork the Magento 2 project and be able to easily send pull requests.
25+
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). This will allow you to collaborate with the Magento 2 development team, fork the Magento 2 project and send pull requests.
2626

2727
1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
2828
2. Review the [Contributor License Agreement](https://magento.com/legaldocuments/mca) if this is your first time contributing.
2929
3. Create and test your work.
30-
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#pull_request).
31-
5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution.
30+
4. Fork the Magento 2 repository according to the [Fork A Repository instructions](http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow the [Create A Pull Request instructions](http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#pull_request).
31+
5. Once your contribution is received the Magento 2 development team will review the contribution and collaborate with you as needed.
3232

3333
## Code of Conduct
3434

app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ public function execute()
6262
if (empty($result)) {
6363
$result[] = [
6464
'severity' => (string)\Magento\Framework\Notification\MessageInterface::SEVERITY_NOTICE,
65-
'text' => 'You have viewed and resolved all recent system notices. '
66-
. 'Please refresh the web page to clear the notice alert.',
65+
'text' => __(
66+
'You have viewed and resolved all recent system notices. '
67+
. 'Please refresh the web page to clear the notice alert.'
68+
)
6769
];
6870
}
6971
/** @var \Magento\Framework\Controller\Result\Json $resultJson */

app/code/Magento/AdminNotification/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ Severity,Severity
4848
"Date Added","Date Added"
4949
Message,Message
5050
Actions,Actions
51+
"You have viewed and resolved all recent system notices. Please refresh the web page to clear the notice alert.","You have viewed and resolved all recent system notices. Please refresh the web page to clear the notice alert."

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ public function saveData()
411411
$this->populateExistingOptions();
412412
$this->insertOptions();
413413
$this->insertSelections();
414+
$this->insertParentChildRelations();
414415
$this->clear();
415416
}
416417
}
@@ -659,6 +660,32 @@ protected function insertSelections()
659660
return $this;
660661
}
661662

663+
/**
664+
* Insert parent/child product relations
665+
*
666+
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
667+
*/
668+
private function insertParentChildRelations()
669+
{
670+
foreach ($this->_cachedOptions as $productId => $options) {
671+
$childIds = [];
672+
foreach ($options as $option) {
673+
foreach ($option['selections'] as $selection) {
674+
if (!isset($selection['parent_product_id'])) {
675+
if (!isset($this->_cachedSkuToProducts[$selection['sku']])) {
676+
continue;
677+
}
678+
$childIds[] = $this->_cachedSkuToProducts[$selection['sku']];
679+
}
680+
}
681+
682+
$this->relationsDataSaver->saveProductRelations($productId, $childIds);
683+
}
684+
}
685+
686+
return $this;
687+
}
688+
662689
/**
663690
* Initialize attributes parameters for all attributes' sets.
664691
*

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle/RelationsDataSaver.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\BundleImportExport\Model\Import\Product\Type\Bundle;
77

8+
use Magento\Catalog\Model\ResourceModel\Product\Relation;
9+
use Magento\Framework\App\ObjectManager;
10+
811
/**
912
* A bundle product relations (options, selections, etc.) data saver.
1013
*
@@ -17,13 +20,22 @@ class RelationsDataSaver
1720
*/
1821
private $resource;
1922

23+
/**
24+
* @var Relation
25+
*/
26+
private $productRelation;
27+
2028
/**
2129
* @param \Magento\Framework\App\ResourceConnection $resource
30+
* @param Relation $productRelation
2231
*/
2332
public function __construct(
24-
\Magento\Framework\App\ResourceConnection $resource
33+
\Magento\Framework\App\ResourceConnection $resource,
34+
Relation $productRelation = null
2535
) {
26-
$this->resource = $resource;
36+
$this->resource = $resource;
37+
$this->productRelation = $productRelation
38+
?: ObjectManager::getInstance()->get(Relation::class);
2739
}
2840

2941
/**
@@ -92,4 +104,17 @@ public function saveSelections(array $selections)
92104
);
93105
}
94106
}
107+
108+
/**
109+
* Saves given parent/child relations.
110+
*
111+
* @param int $parentId
112+
* @param array $childIds
113+
*
114+
* @return void
115+
*/
116+
public function saveProductRelations($parentId, $childIds)
117+
{
118+
$this->productRelation->processRelations($parentId, $childIds);
119+
}
95120
}

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/Bundle/RelationsDataSaverTest.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\BundleImportExport\Test\Unit\Model\Import\Product\Type\Bundle;
88

99
use Magento\BundleImportExport\Model\Import\Product\Type\Bundle\RelationsDataSaver;
10+
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1011
use Magento\Framework\App\ResourceConnection;
1112
use Magento\Framework\DB\Adapter\AdapterInterface;
1213

@@ -30,6 +31,11 @@ class RelationsDataSaverTest extends \PHPUnit\Framework\TestCase
3031
*/
3132
private $connectionMock;
3233

34+
/**
35+
* @var Relation|\PHPUnit_Framework_MockObject_MockObject
36+
*/
37+
private $productRelationMock;
38+
3339
protected function setUp()
3440
{
3541
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -39,12 +45,16 @@ protected function setUp()
3945
$this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
4046
->disableOriginalConstructor()
4147
->getMock();
42-
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
48+
49+
$this->productRelationMock = $this->getMockBuilder(Relation::class)
50+
->disableOriginalConstructor()
51+
->getMock();
4352

4453
$this->relationsDataSaver = $helper->getObject(
4554
RelationsDataSaver::class,
4655
[
47-
'resource' => $this->resourceMock
56+
'resource' => $this->resourceMock,
57+
'productRelation' => $this->productRelationMock
4858
]
4959
);
5060
}
@@ -53,7 +63,7 @@ public function testSaveOptions()
5363
{
5464
$options = [1, 2];
5565
$table_name= 'catalog_product_bundle_option';
56-
66+
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
5767
$this->resourceMock->expects($this->once())
5868
->method('getTableName')
5969
->with('catalog_product_bundle_option')
@@ -78,6 +88,7 @@ public function testSaveOptionValues()
7888
$optionsValues = [1, 2];
7989
$table_name= 'catalog_product_bundle_option_value';
8090

91+
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
8192
$this->resourceMock->expects($this->once())
8293
->method('getTableName')
8394
->with('catalog_product_bundle_option_value')
@@ -98,6 +109,7 @@ public function testSaveSelections()
98109
$selections = [1, 2];
99110
$table_name= 'catalog_product_bundle_selection';
100111

112+
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
101113
$this->resourceMock->expects($this->once())
102114
->method('getTableName')
103115
->with('catalog_product_bundle_selection')
@@ -121,4 +133,16 @@ public function testSaveSelections()
121133

122134
$this->relationsDataSaver->saveSelections($selections);
123135
}
136+
137+
public function testSaveProductRelations()
138+
{
139+
$parentId = 1;
140+
$children = [2, 3];
141+
142+
$this->productRelationMock->expects($this->once())
143+
->method('processRelations')
144+
->with($parentId, $children);
145+
146+
$this->relationsDataSaver->saveProductRelations($parentId, $children);
147+
}
124148
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<resource>Magento_Sales::fraud_protection</resource>
1414
<group id="signifyd" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
1515
<fieldset_css>signifyd-logo-header</fieldset_css>
16-
<group id="about" translate="label" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
16+
<group id="about" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
1717
<frontend_model>Magento\Signifyd\Block\Adminhtml\System\Config\Fieldset\Info</frontend_model>
1818
<fieldset_css>signifyd-about-header</fieldset_css>
1919
<label><![CDATA[Protect your store from fraud with Guaranteed Fraud Protection by Signifyd.]]></label>
@@ -26,12 +26,12 @@
2626
</comment>
2727
<more_url>https://www.signifyd.com/magento-guaranteed-fraud-protection</more_url>
2828
</group>
29-
<group id="config" translate="label" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
29+
<group id="config" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
3030
<fieldset_css>signifyd-about-header</fieldset_css>
3131
<label>Configuration</label>
3232
<comment><![CDATA[<a href="https://www.signifyd.com/resources/manual/magento-2/signifyd-on-magento-integration-guide/" target="_blank">View our setup guide</a> for step-by-step instructions on how to integrate Signifyd with Magento.<br />For support contact <a href="mailto:support@signifyd.com">support@signifyd.com</a>.]]>
3333
</comment>
34-
<field id="active" translate="label comment" type="select" showInDefault="1" showInWebsite="1" showInStore="0">
34+
<field id="active" translate="label" type="select" showInDefault="1" showInWebsite="1" showInStore="0">
3535
<label>Enable this Solution</label>
3636
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
3737
<config_path>fraud_protection/signifyd/active</config_path>

app/code/Magento/Tax/view/adminhtml/templates/class/page/edit.phtml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
<?= $block->getSaveButtonHtml() ?>
1212
</div>
1313
<?= $block->getRenameFormHtml() ?>
14-
<script>
15-
require(['jquery', "mage/mage"], function(jQuery){
16-
17-
jQuery('#<?= /* @escapeNotVerified */ $block->getRenameFormId() ?>').mage('form').mage('validation');
18-
19-
});
14+
<script type="text/x-magento-init">
15+
{
16+
"#<?= /* @escapeNotVerified */ $block->getRenameFormId() ?>": {
17+
"Magento_Tax/js/page/validate": {}
18+
}
19+
}
2020
</script>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery',
8+
'mage/mage'
9+
], function (jQuery) {
10+
'use strict';
11+
12+
return function (data, element) {
13+
jQuery(element).mage('form').mage('validation');
14+
};
15+
});

app/code/Magento/Ui/Component/Bookmark.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public function prepare()
8282
}
8383
}
8484

85-
$this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));
85+
$this->setData('config', array_replace_recursive($config, $this->getConfiguration()));
8686

8787
parent::prepare();
8888

89-
$jsConfig = $this->getConfiguration($this);
89+
$jsConfig = $this->getConfiguration();
9090
$this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
9191
}
9292
}

0 commit comments

Comments
 (0)