Skip to content

Commit 9224419

Browse files
author
Oleksii Korshenko
authored
Merge pull request #1024 from magento-engcom/develop-prs
Public Pull Requests: #9221 #6772 #5367 #9210 #7506 #6385 #9084 #9103 #5742 #5043 #6443 #9165 #9131 #9112 #9062 #8824 #6910 #7900 #7464 #8462 #9215
2 parents 23f7456 + 3f58731 commit 9224419

File tree

68 files changed

+1115
-236
lines changed

Some content is hidden

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

68 files changed

+1115
-236
lines changed

COPYING.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
66
Please see LICENSE.txt for the full text of the OSL 3.0 license or contact [email protected] for a copy.
77

88
Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file.
9-
Please see <insert file name of the MEE license> for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise.
9+
Please see LICENSE_EE.txt for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise.

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,33 @@ To suggest documentation improvements, click [here][4].
2727
[3]: <https://github.com/magento/magento2/issues>
2828
[4]: <http://devdocs.magento.com>
2929

30+
<h3>Labels applied by the Magento team</h3>
31+
32+
| Label | Description |
33+
| ------------- |-------------|
34+
| ![DOC](http://devdocs.magento.com/common/images/github_DOC.png) | Affects Documentation domain. |
35+
| ![PROD](http://devdocs.magento.com/common/images/github_PROD.png) | Affects the Product team (mostly feature requests or business logic change). |
36+
| ![TECH](http://devdocs.magento.com/common/images/github_TECH.png) | Affects Architect Group (mostly to make decisions around technology changes). |
37+
| ![accept](http://devdocs.magento.com/common/images/github_accept.png) | The pull request has been accepted and will be merged into mainline code. |
38+
| ![reject](http://devdocs.magento.com/common/images/github_reject.png) | The pull request has been rejected and will not be merged into mainline code. Possible reasons can include but are not limited to: issue has already been fixed in another code contribution, or there is an issue with the code contribution. |
39+
| ![bug report](http://devdocs.magento.com/common/images/github_bug.png) | The Magento Team has confirmed that this issue contains the minimum required information to reproduce. |
40+
| ![acknowledged](http://devdocs.magento.com/common/images/gitHub_acknowledged.png) | The Magento Team has validated the issue and an internal ticket has been created. |
41+
| ![acknowledged](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. |
42+
| ![acknowledged](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. |
43+
3044
<h2>Reporting security issues</h2>
3145

3246
To report security vulnerabilities in Magento software or web sites, please e-mail <a href="mailto:[email protected]">[email protected]</a>. Please do not report security issues using GitHub. Be sure to encrypt your e-mail with our <a href="https://info2.magento.com/rs/magentoenterprise/images/security_at_magento.asc">encryption key</a> if it includes sensitive information. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.
3347

34-
Stay up-to-date on the latest vulnerabilities and patches for Magento by signing up for <a href="https://magento.com/security/sign-up">Security Alert Notifications</a>.
48+
Stay up-to-date on the latest security news and patches for Magento by signing up for <a href="https://magento.com/security/sign-up">Security Alert Notifications</a>.
49+
50+
<h2>License</h2>
51+
52+
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
53+
54+
http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
55+
Please see LICENSE.txt for the full text of the OSL 3.0 license or contact [email protected] for a copy.
56+
57+
Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file.
58+
Please see LICENSE_EE.txt for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise.
3559

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<class>separator-top</class>
3434
<label>Store Email Addresses</label>
3535
<tab>general</tab>
36-
<resource>Magento_Backend::trans_email</resource>
36+
<resource>Magento_Config::trans_email</resource>
3737
<group id="ident_custom1" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1">
3838
<label>Custom Email 1</label>
3939
<field id="email" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ define([
239239

240240
switch (optionType) {
241241
case 'radio':
242-
243242
case 'select-one':
244243

245244
if (optionType === 'radio' && !element.is(':checked')) {

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ private function setMessageToResponse($response, $messages)
154154
*/
155155
private function checkUniqueOption(DataObject $response, array $options = null)
156156
{
157-
if (is_array($options) && !$this->isUniqueAdminValues($options['value'], $options['delete'])) {
157+
if (is_array($options)
158+
&& isset($options['value'])
159+
&& isset($options['delete'])
160+
&& !$this->isUniqueAdminValues($options['value'], $options['delete'])
161+
) {
158162
$this->setMessageToResponse($response, [__("The value of Admin must be unique.")]);
159163
$response->setError(true);
160164
}

app/code/Magento/Catalog/Model/Product/Option/Type/File.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
3333

3434
/**
3535
* @var \Magento\Framework\Filesystem\Directory\ReadInterface
36+
* @deprecated
37+
* @see $mediaDirectory
3638
*/
3739
protected $_rootDirectory;
3840

41+
/**
42+
* @var \Magento\Framework\Filesystem\Directory\WriteInterface
43+
*/
44+
private $mediaDirectory;
45+
3946
/**
4047
* Core file storage database
4148
*
@@ -114,7 +121,9 @@ public function __construct(
114121
$this->_escaper = $escaper;
115122
$this->_coreFileStorageDatabase = $coreFileStorageDatabase;
116123
$this->filesystem = $filesystem ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Filesystem::class);
124+
/** The _rootDirectory is deprecated. The field is initialized for backward compatibility */
117125
$this->_rootDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
126+
$this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);
118127
$this->validatorInfo = $validatorInfo;
119128
$this->validatorFile = $validatorFile;
120129
$this->serializer = $serializer ? $serializer : ObjectManager::getInstance()->get(Json::class);
@@ -466,13 +475,18 @@ public function copyQuoteToOrder()
466475
$quotePath = $value['quote_path'];
467476
$orderPath = $value['order_path'];
468477

469-
if (!$this->_rootDirectory->isFile($quotePath) || !$this->_rootDirectory->isReadable($quotePath)) {
478+
if (!$this->mediaDirectory->isFile($quotePath) || !$this->mediaDirectory->isReadable($quotePath)) {
470479
throw new \Exception();
471480
}
472-
$this->_coreFileStorageDatabase->copyFile(
473-
$this->_rootDirectory->getAbsolutePath($quotePath),
474-
$this->_rootDirectory->getAbsolutePath($orderPath)
475-
);
481+
482+
if ($this->_coreFileStorageDatabase->checkDbUsage()) {
483+
$this->_coreFileStorageDatabase->copyFile(
484+
$this->mediaDirectory->getAbsolutePath($quotePath),
485+
$this->mediaDirectory->getAbsolutePath($orderPath)
486+
);
487+
} else {
488+
$this->mediaDirectory->copyFile($quotePath, $orderPath);
489+
}
476490
} catch (\Exception $e) {
477491
return $this;
478492
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,7 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje
105105
* If there is not price skip saving price
106106
*/
107107

108-
if ($object->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_FIELD ||
109-
$object->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_AREA ||
110-
$object->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_FILE ||
111-
$object->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE ||
112-
$object->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE_TIME ||
113-
$object->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_TIME
114-
) {
108+
if (in_array($object->getType(), $this->getPriceTypes())) {
115109
//save for store_id = 0
116110
if (!$object->getData('scope', 'price')) {
117111
$statement = $connection->select()->from(
@@ -569,6 +563,23 @@ public function getSearchableData($productId, $storeId)
569563

570564
return $searchData;
571565
}
566+
567+
/**
568+
* All Option Types that support price and price_type
569+
*
570+
* @return string[]
571+
*/
572+
public function getPriceTypes()
573+
{
574+
return [
575+
\Magento\Catalog\Model\Product\Option::OPTION_TYPE_FIELD,
576+
\Magento\Catalog\Model\Product\Option::OPTION_TYPE_AREA,
577+
\Magento\Catalog\Model\Product\Option::OPTION_TYPE_FILE,
578+
\Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE,
579+
\Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE_TIME,
580+
\Magento\Catalog\Model\Product\Option::OPTION_TYPE_TIME,
581+
];
582+
}
572583

573584
/**
574585
* @return \Magento\Framework\EntityManager\MetadataPool

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

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Framework\App\Filesystem\DirectoryList;
1010
use Magento\Framework\Exception\SerializationException;
1111
use Magento\Framework\Filesystem;
12-
use Magento\Framework\Filesystem\Directory\ReadInterface;
12+
use Magento\Framework\Filesystem\Directory\WriteInterface;
1313
use Magento\Framework\Filesystem\DriverPool;
1414

1515
/**
@@ -25,9 +25,9 @@ class FileTest extends \PHPUnit_Framework_TestCase
2525
protected $objectManager;
2626

2727
/**
28-
* @var ReadInterface|\PHPUnit_Framework_MockObject_MockObject
28+
* @var WriteInterface|\PHPUnit_Framework_MockObject_MockObject
2929
*/
30-
protected $rootDirectory;
30+
protected $mediaDirectory;
3131

3232
/**
3333
* @var \Magento\MediaStorage\Helper\File\Storage\Database|\PHPUnit_Framework_MockObject_MockObject
@@ -67,13 +67,13 @@ protected function setUp()
6767
->disableOriginalConstructor()
6868
->getMock();
6969

70-
$this->rootDirectory = $this->getMockBuilder(ReadInterface::class)
70+
$this->mediaDirectory = $this->getMockBuilder(WriteInterface::class)
7171
->getMock();
7272

7373
$this->filesystemMock->expects($this->any())
74-
->method('getDirectoryRead')
74+
->method('getDirectoryWrite')
7575
->with(DirectoryList::MEDIA, DriverPool::FILE)
76-
->willReturn($this->rootDirectory);
76+
->willReturn($this->mediaDirectory);
7777

7878
$this->serializer = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class)
7979
->disableOriginalConstructor()
@@ -95,7 +95,7 @@ protected function setUp()
9595

9696
$this->coreFileStorageDatabase = $this->getMock(
9797
\Magento\MediaStorage\Helper\File\Storage\Database::class,
98-
['copyFile'],
98+
['copyFile', 'checkDbUsage'],
9999
[],
100100
'',
101101
false
@@ -166,7 +166,7 @@ public function testGetCustomizedView()
166166
);
167167
}
168168

169-
public function testCopyQuoteToOrder()
169+
public function testCopyQuoteToOrderWithDbUsage()
170170
{
171171
$optionMock = $this->getMockBuilder(OptionInterface::class)
172172
->disableOriginalConstructor()
@@ -187,25 +187,29 @@ function ($value) {
187187
}
188188
);
189189

190-
$optionMock->expects($this->any())
190+
$optionMock->expects($this->once())
191191
->method('getValue')
192192
->will($this->returnValue($quoteValue));
193193

194-
$this->rootDirectory->expects($this->any())
194+
$this->mediaDirectory->expects($this->once())
195195
->method('isFile')
196196
->with($this->equalTo($quotePath))
197197
->will($this->returnValue(true));
198198

199-
$this->rootDirectory->expects($this->any())
199+
$this->mediaDirectory->expects($this->once())
200200
->method('isReadable')
201201
->with($this->equalTo($quotePath))
202202
->will($this->returnValue(true));
203203

204-
$this->rootDirectory->expects($this->any())
204+
$this->mediaDirectory->expects($this->exactly(2))
205205
->method('getAbsolutePath')
206206
->will($this->returnValue('/file.path'));
207207

208-
$this->coreFileStorageDatabase->expects($this->any())
208+
$this->coreFileStorageDatabase->expects($this->once())
209+
->method('checkDbUsage')
210+
->willReturn(true);
211+
212+
$this->coreFileStorageDatabase->expects($this->once())
209213
->method('copyFile')
210214
->will($this->returnValue('true'));
211215

@@ -218,6 +222,62 @@ function ($value) {
218222
);
219223
}
220224

225+
public function testCopyQuoteToOrderWithoutUsage()
226+
{
227+
$optionMock = $this->getMockBuilder(OptionInterface::class)
228+
->disableOriginalConstructor()
229+
->setMethods(['getValue'])
230+
->getMockForAbstractClass();
231+
232+
$quotePath = '/quote/path/path/uploaded.file';
233+
$orderPath = '/order/path/path/uploaded.file';
234+
235+
$quoteValue = "{\"quote_path\":\"$quotePath\",\"order_path\":\"$orderPath\"}";
236+
237+
$this->serializer->expects($this->once())
238+
->method('unserialize')
239+
->with($quoteValue)
240+
->willReturnCallback(
241+
function ($value) {
242+
return json_decode($value, true);
243+
}
244+
);
245+
246+
$optionMock->expects($this->once())
247+
->method('getValue')
248+
->will($this->returnValue($quoteValue));
249+
250+
$this->mediaDirectory->expects($this->once())
251+
->method('isFile')
252+
->with($this->equalTo($quotePath))
253+
->will($this->returnValue(true));
254+
255+
$this->mediaDirectory->expects($this->once())
256+
->method('isReadable')
257+
->with($this->equalTo($quotePath))
258+
->will($this->returnValue(true));
259+
260+
$this->mediaDirectory->expects($this->never())
261+
->method('getAbsolutePath')
262+
->will($this->returnValue('/file.path'));
263+
264+
$this->coreFileStorageDatabase->expects($this->once())
265+
->method('checkDbUsage')
266+
->willReturn(false);
267+
268+
$this->coreFileStorageDatabase->expects($this->any())
269+
->method('copyFile')
270+
->willReturn(false);
271+
272+
$fileObject = $this->getFileObject();
273+
$fileObject->setData('configuration_item_option', $optionMock);
274+
275+
$this->assertInstanceOf(
276+
\Magento\Catalog\Model\Product\Option\Type\File::class,
277+
$fileObject->copyQuoteToOrder()
278+
);
279+
}
280+
221281
public function testGetFormattedOptionValue()
222282
{
223283
$resultValue = ['result'];

app/code/Magento/Catalog/view/base/web/js/price-box.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ define([
3838
* Widget creating.
3939
*/
4040
_create: function createPriceBox() {
41-
this.cache = {};
4241
var box = this.element;
4342

43+
this.cache = {};
4444
this._setDefaultsFromPriceConfig();
4545
this._setDefaultsFromDataSet();
4646

app/code/Magento/Catalog/view/base/web/js/price-options.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ define([
4343

4444
switch (optionType) {
4545
case 'text':
46-
4746
case 'textarea':
4847
changes[optionHash] = optionValue ? optionConfig.prices : {};
4948
break;

app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $_attributeType = $block->getAtType();
2323
$_attributeAddAttribute = $block->getAddAttribute();
2424

2525
if ($_attributeLabel && $_attributeLabel == 'default') {
26-
$_attributeLabel = $_product->getResource()->getAttribute($_code)->getFrontendLabel();
26+
$_attributeLabel = $_product->getResource()->getAttribute($_code)->getStoreLabel();
2727
}
2828
if ($_attributeType && $_attributeType == 'text') {
2929
$_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) ? $_product->getAttributeText($_code) : '';

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,19 @@
180180
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
181181
</field>
182182
</group>
183+
<group id="account_information" translate="label" type="text" sortOrder="35" showInDefault="1" showInWebsite="1" showInStore="1">
184+
<label>Account Information Options</label>
185+
<field id="change_email_template" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
186+
<label>Change Email Template</label>
187+
<comment>Email template chosen based on theme fallback when "Default" option is selected.</comment>
188+
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
189+
</field>
190+
<field id="change_email_and_password_template" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
191+
<label>Change Email and Password Template</label>
192+
<comment>Email template chosen based on theme fallback when "Default" option is selected.</comment>
193+
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
194+
</field>
195+
</group>
183196
<group id="address" translate="label" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
184197
<label>Name and Address Options</label>
185198
<field id="street_lines" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">

0 commit comments

Comments
 (0)