Skip to content

Commit f01227c

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #16961: [Forwardport] Improve "Invalid country code" error message on tax import (by @ihor-sviziev) - #16962: [Forwardport] Add Confirm Modal Width (by @ihor-sviziev) - #16769: [Forwardport] Added 'title' attribute to 'img' tag in knockout template files. (by @sanganinamrata) - #16947: [Forwardport] Fix newsletter subscription behaviour for registered customer. (by @eduard13) - #16876: FIXED: FTP user and password strings urldecoded (by @javierperezm) - #16875: Remove unused comments from _initDiscount() function (by @mageprince) - #16888: Code improvement (by @mage2pratik) - #16892: [Forwardport] Fix for #12081: missing translations in the js-translations.json (by @mage2pratik) - magento-engcom/import-export-improvements#115: import-export-improvements #82 : super attribute error message improvements (by @tadhgbowe) Fixed GitHub Issues: - #12081: Magento 2.2.0: Translations for 'Item in Cart' missing in mini cart. (reported by @jhruehl) has been fixed in #16892 by @mage2pratik in 2.3-develop branch Related commits: 1. 18d11f5
2 parents 2b76b97 + e6f0508 commit f01227c

File tree

24 files changed

+124
-48
lines changed

24 files changed

+124
-48
lines changed

Diff for: app/code/Magento/Braintree/Setup/Patch/Data/ConvertSerializedDataToJson.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\Framework\Setup\Patch\PatchVersionInterface;
1313

1414
/**
15-
* Convert data fro php native serialized data to JSON.
15+
* Convert data from php native serialized data to JSON.
1616
*/
1717
class ConvertSerializedDataToJson implements DataPatchInterface, PatchVersionInterface
1818
{

Diff for: app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
1313
<label class="label" data-bind="attr: {'for': getCode()}">
1414
<!-- PayPal Logo -->
15-
<img data-bind="attr: {src: getPaymentAcceptanceMarkSrc(), alt: $t('Acceptance Mark')}"
15+
<img data-bind="attr: {src: getPaymentAcceptanceMarkSrc(), alt: $t('Acceptance Mark')}, title: $t('Acceptance Mark')}"
1616
class="payment-icon"/>
1717
<!-- PayPal Logo -->
1818
<span text="getTitle()"></span>

Diff for: app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionPriceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected function setupSelectionPrice($useRegularPrice = false)
121121
}
122122

123123
/**
124-
* test fro method getValue with dynamic productType
124+
* Test for method getValue with dynamic productType
125125
*
126126
* @param bool $useRegularPrice
127127
* @dataProvider useRegularPriceDataProvider

Diff for: app/code/Magento/Captcha/view/frontend/web/template/checkout/captcha.html

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<div class="control captcha-image">
1616
<img data-bind="attr: {
1717
alt: $t('Please type the letters and numbers below'),
18+
title: $t('Please type the letters and numbers below'),
1819
height: imageHeight(),
1920
src: getImageSource(),
2021
}"

Diff for: app/code/Magento/Catalog/etc/adminhtml/system.xml

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
<clone_fields>1</clone_fields>
9999
<clone_model>Magento\Catalog\Model\Config\CatalogClone\Media\Image</clone_model>
100100
<field id="placeholder" type="image" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
101-
<label></label>
102101
<backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
103102
<upload_dir config="system/filesystem/media" scope_info="1">catalog/product/placeholder</upload_dir>
104103
<base_url type="media" scope_info="1">catalog/product/placeholder</base_url>

Diff for: app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
event="load: $parent.onPreviewLoad.bind($parent)"
1515
attr="
1616
src: $parent.getFilePreview($file),
17-
alt: $file.name">
17+
alt: $file.name,
18+
title: $file.name">
1819
</a>
1920

2021
<div class="actions">

Diff for: app/code/Magento/Catalog/view/base/web/template/product/list/columns/image.html

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class="product-image-photo"
1212
attr="src: getImageUrl($row()),
1313
alt: getLabel($row()),
14+
title: getLabel($row()),
1415
width: getResizedImageWidth($row()),
1516
height: getResizedImageHeight($row())"/>
1617
</a>

Diff for: app/code/Magento/Catalog/view/base/web/template/product/list/columns/image_with_borders.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
data-bind="style: {'padding-bottom': getHeight($row())/getWidth($row()) * 100 + '%'}">
1515
<img class="product-image-photo"
1616
data-bind="attr: {src: getImageUrl($row()),
17-
alt: getLabel($row())}" />
17+
alt: getLabel($row()), title: getLabel($row())}" />
1818
</span>
1919
</span>
2020
</a>

Diff for: app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/thumbnail.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
data-bind="attr: {'style': 'height: ' + getHeight($parents[1]) + 'px; width: ' + getWidth($parents[1]) + 'px;' }">
99
<span class="product-image-wrapper">
1010
<img
11-
data-bind="attr: {'src': getSrc($parents[1]), 'width': getWidth($parents[1]), 'height': getHeight($parents[1]), 'alt': getAlt($parents[1]) }"/>
11+
data-bind="attr: {'src': getSrc($parents[1]), 'width': getWidth($parents[1]), 'height': getHeight($parents[1]), 'alt': getAlt($parents[1]), 'title': getAlt($parents[1]) }"/>
1212
</span>
1313
</span>

Diff for: app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php

+81-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class Configurable extends \Magento\CatalogImportExport\Model\Import\Product\Typ
2525
/**
2626
* Error codes.
2727
*/
28+
const ERROR_ATTRIBUTE_CODE_DOES_NOT_EXIST = 'attrCodeDoesNotExist';
29+
30+
const ERROR_ATTRIBUTE_CODE_NOT_GLOBAL_SCOPE = 'attrCodeNotGlobalScope';
31+
32+
const ERROR_ATTRIBUTE_CODE_NOT_TYPE_SELECT = 'attrCodeNotTypeSelect';
33+
2834
const ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER = 'attrCodeIsNotSuper';
2935

3036
const ERROR_INVALID_OPTION_VALUE = 'invalidOptionValue';
@@ -39,10 +45,19 @@ class Configurable extends \Magento\CatalogImportExport\Model\Import\Product\Typ
3945
* Validation failure message template definitions
4046
*
4147
* @var array
48+
*
49+
* Note: Some of these messages exceed maximum limit of 120 characters per line. Split up accordingly.
4250
*/
4351
protected $_messageTemplates = [
44-
self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER => 'Attribute with code "%s" is not super',
45-
self::ERROR_INVALID_OPTION_VALUE => 'Invalid option value for attribute "%s"',
52+
self::ERROR_ATTRIBUTE_CODE_DOES_NOT_EXIST => 'Column configurable_variations: Attribute with code ' .
53+
'"%s" does not exist or is missing from product attribute set',
54+
self::ERROR_ATTRIBUTE_CODE_NOT_GLOBAL_SCOPE => 'Column configurable_variations: Attribute with code ' .
55+
'"%s" is not super - it needs to have Global Scope',
56+
self::ERROR_ATTRIBUTE_CODE_NOT_TYPE_SELECT => 'Column configurable_variations: Attribute with code ' .
57+
'"%s" is not super - it needs to be Input Type of Dropdown, Visual Swatch or Text Swatch',
58+
self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER => 'Column configurable_variations: Attribute with code ' .
59+
'"%s" is not super',
60+
self::ERROR_INVALID_OPTION_VALUE => 'Column configurable_variations: Invalid option value for attribute "%s"',
4661
self::ERROR_INVALID_WEBSITE => 'Invalid website code for super attribute',
4762
self::ERROR_DUPLICATED_VARIATIONS => 'SKU %s contains duplicated variations',
4863
self::ERROR_UNIDENTIFIABLE_VARIATION => 'Configurable variation "%s" is unidentifiable',
@@ -289,10 +304,11 @@ protected function _isParticularAttributesValid(array $rowData, $rowNum)
289304
{
290305
if (!empty($rowData['_super_attribute_code'])) {
291306
$superAttrCode = $rowData['_super_attribute_code'];
292-
293307
if (!$this->_isAttributeSuper($superAttrCode)) {
294-
// check attribute superity
295-
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER, $rowNum, $superAttrCode);
308+
// Identify reason why attribute is not super:
309+
if (!$this->identifySuperAttributeError($superAttrCode, $rowNum)) {
310+
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER, $rowNum, $superAttrCode);
311+
}
296312
return false;
297313
} elseif (isset($rowData['_super_attribute_option']) && strlen($rowData['_super_attribute_option'])) {
298314
$optionKey = strtolower($rowData['_super_attribute_option']);
@@ -305,6 +321,66 @@ protected function _isParticularAttributesValid(array $rowData, $rowNum)
305321
return true;
306322
}
307323

324+
/**
325+
* Identify exactly why a super attribute code is not super.
326+
*
327+
* @param string $superAttrCode
328+
* @param int $rowNum
329+
* @return bool
330+
*/
331+
private function identifySuperAttributeError($superAttrCode, $rowNum)
332+
{
333+
// This attribute code is not a super attribute. Need to give a clearer message why?
334+
$reasonFound = false;
335+
$codeExists = false;
336+
337+
// Does this attribute code exist?
338+
$sourceAttribute = $this->doesSuperAttributeExist($superAttrCode);
339+
if (is_array($sourceAttribute)) {
340+
$codeExists = true;
341+
// Does attribute have the correct settings?
342+
if (isset($sourceAttribute['is_global']) && $sourceAttribute['is_global'] !== '1') {
343+
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_NOT_GLOBAL_SCOPE, $rowNum, $superAttrCode);
344+
$reasonFound = true;
345+
} elseif (isset($sourceAttribute['type']) && $sourceAttribute['type'] !== 'select') {
346+
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_NOT_TYPE_SELECT, $rowNum, $superAttrCode);
347+
$reasonFound = true;
348+
}
349+
}
350+
351+
if ($codeExists === false) {
352+
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_DOES_NOT_EXIST, $rowNum, $superAttrCode);
353+
$reasonFound = true;
354+
}
355+
356+
return $reasonFound;
357+
}
358+
359+
/**
360+
* Does the super attribute exist in the current attribute set?
361+
*
362+
* @param string $superAttrCode
363+
* @return array
364+
*/
365+
private function doesSuperAttributeExist($superAttrCode)
366+
{
367+
$returnAttributeArray = null;
368+
if (is_array(self::$commonAttributesCache)) {
369+
$filteredAttribute = array_filter(
370+
self::$commonAttributesCache,
371+
function ($element) use ($superAttrCode) {
372+
return $element['code'] == $superAttrCode;
373+
}
374+
);
375+
376+
// Return the first element of the filtered array (if found).
377+
if (count($filteredAttribute)) {
378+
$returnAttributeArray = array_shift($filteredAttribute);
379+
}
380+
}
381+
return $returnAttributeArray;
382+
}
383+
308384
/**
309385
* Array of SKU to array of super attribute values for all products.
310386
*

Diff for: app/code/Magento/Newsletter/Model/Subscriber.php

+2-11
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ public function subscribe($email)
419419
self::XML_PATH_CONFIRMATION_FLAG,
420420
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
421421
) == 1 ? true : false;
422-
$isOwnSubscribes = false;
423422

424423
$isSubscribeOwnEmail = $this->_customerSession->isLoggedIn()
425424
&& $this->_customerSession->getCustomerDataObject()->getEmail() == $email;
@@ -428,13 +427,7 @@ public function subscribe($email)
428427
|| $this->getStatus() == self::STATUS_NOT_ACTIVE
429428
) {
430429
if ($isConfirmNeed === true) {
431-
// if user subscribes own login email - confirmation is not needed
432-
$isOwnSubscribes = $isSubscribeOwnEmail;
433-
if ($isOwnSubscribes == true) {
434-
$this->setStatus(self::STATUS_SUBSCRIBED);
435-
} else {
436-
$this->setStatus(self::STATUS_NOT_ACTIVE);
437-
}
430+
$this->setStatus(self::STATUS_NOT_ACTIVE);
438431
} else {
439432
$this->setStatus(self::STATUS_SUBSCRIBED);
440433
}
@@ -460,9 +453,7 @@ public function subscribe($email)
460453
try {
461454
/* Save model before sending out email */
462455
$this->save();
463-
if ($isConfirmNeed === true
464-
&& $isOwnSubscribes === false
465-
) {
456+
if ($isConfirmNeed === true) {
466457
$this->sendConfirmationRequestEmail();
467458
} else {
468459
$this->sendConfirmationSuccessEmail();

Diff for: app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php

+13-11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Newsletter\Test\Unit\Model;
77

8+
use Magento\Newsletter\Model\Subscriber;
9+
810
/**
911
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1012
*/
@@ -116,7 +118,7 @@ public function testSubscribe()
116118
$email = '[email protected]';
117119
$this->resource->expects($this->any())->method('loadByEmail')->willReturn(
118120
[
119-
'subscriber_status' => 3,
121+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED,
120122
'subscriber_email' => $email,
121123
'name' => 'subscriber_name'
122124
]
@@ -133,15 +135,15 @@ public function testSubscribe()
133135
$this->sendEmailCheck();
134136
$this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
135137

136-
$this->assertEquals(1, $this->subscriber->subscribe($email));
138+
$this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->subscribe($email));
137139
}
138140

139141
public function testSubscribeNotLoggedIn()
140142
{
141143
$email = '[email protected]';
142144
$this->resource->expects($this->any())->method('loadByEmail')->willReturn(
143145
[
144-
'subscriber_status' => 3,
146+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED,
145147
'subscriber_email' => $email,
146148
'name' => 'subscriber_name'
147149
]
@@ -158,7 +160,7 @@ public function testSubscribeNotLoggedIn()
158160
$this->sendEmailCheck();
159161
$this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
160162

161-
$this->assertEquals(2, $this->subscriber->subscribe($email));
163+
$this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->subscribe($email));
162164
}
163165

164166
public function testUpdateSubscription()
@@ -175,7 +177,7 @@ public function testUpdateSubscription()
175177
->willReturn(
176178
[
177179
'subscriber_id' => 1,
178-
'subscriber_status' => 1
180+
'subscriber_status' => Subscriber::STATUS_SUBSCRIBED
179181
]
180182
);
181183
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -210,7 +212,7 @@ public function testUnsubscribeCustomerById()
210212
->willReturn(
211213
[
212214
'subscriber_id' => 1,
213-
'subscriber_status' => 1
215+
'subscriber_status' => Subscriber::STATUS_SUBSCRIBED
214216
]
215217
);
216218
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -236,7 +238,7 @@ public function testSubscribeCustomerById()
236238
->willReturn(
237239
[
238240
'subscriber_id' => 1,
239-
'subscriber_status' => 3
241+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED
240242
]
241243
);
242244
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -262,7 +264,7 @@ public function testSubscribeCustomerById1()
262264
->willReturn(
263265
[
264266
'subscriber_id' => 1,
265-
'subscriber_status' => 3
267+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED
266268
]
267269
);
268270
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -276,7 +278,7 @@ public function testSubscribeCustomerById1()
276278
$this->scopeConfig->expects($this->atLeastOnce())->method('getValue')->with()->willReturn(true);
277279

278280
$this->subscriber->subscribeCustomerById($customerId);
279-
$this->assertEquals(\Magento\Newsletter\Model\Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->getStatus());
281+
$this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->getStatus());
280282
}
281283

282284
public function testSubscribeCustomerByIdAfterConfirmation()
@@ -293,7 +295,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
293295
->willReturn(
294296
[
295297
'subscriber_id' => 1,
296-
'subscriber_status' => 4
298+
'subscriber_status' => Subscriber::STATUS_UNCONFIRMED
297299
]
298300
);
299301
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -305,7 +307,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
305307
$this->scopeConfig->expects($this->atLeastOnce())->method('getValue')->with()->willReturn(true);
306308

307309
$this->subscriber->updateSubscription($customerId);
308-
$this->assertEquals(\Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED, $this->subscriber->getStatus());
310+
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->subscriber->getStatus());
309311
}
310312

311313
public function testUnsubscribe()

Diff for: app/code/Magento/Paypal/etc/adminhtml/system/express_checkout.xml

-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@
198198
<attribute type="shared">1</attribute>
199199
</field>
200200
<field id="bml_wizard" translate="button_label" sortOrder="15" showInDefault="1" showInWebsite="1">
201-
<label></label>
202201
<button_label>Get Publisher ID from PayPal</button_label>
203202
<button_url><![CDATA[https:/financing.paypal.com/ppfinportal/cart/index?dcp=4eff8563b9cc505e0b9afaff3256705081553c79]]></button_url>
204203
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\BmlApiWizard</frontend_model>

Diff for: app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define([
4747
var buttons = controlButtonArea.childElements();
4848
for (var i = 0; i < buttons.length; i++) {
4949
if (buttons[i].innerHTML.include(button.label)) {
50-
return ;
50+
return;
5151
}
5252
}
5353
button.insertIn(controlButtonArea, 'top');

Diff for: app/code/Magento/Tax/Block/Sales/Order/Tax.php

-6
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,6 @@ protected function _initShipping()
264264
*/
265265
protected function _initDiscount()
266266
{
267-
// $store = $this->getStore();
268-
// $parent = $this->getParentBlock();
269-
// if ($this->_config->displaySales) {
270-
//
271-
// } elseif ($this->_config->displaySales) {
272-
// }
273267
}
274268

275269
/**

Diff for: app/code/Magento/TaxImportExport/Model/Rate/CsvImportHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected function _importRate(array $rateData, array $regionsCache, array $stor
237237
$countryCode = $rateData[1];
238238
$country = $this->_countryFactory->create()->loadByCode($countryCode, 'iso2_code');
239239
if (!$country->getId()) {
240-
throw new \Magento\Framework\Exception\LocalizedException(__('One of the countries has invalid code.'));
240+
throw new \Magento\Framework\Exception\LocalizedException(__('Country code is invalid: %1', $countryCode));
241241
}
242242
$regionsCache = $this->_addCountryRegionsToCache($countryCode, $regionsCache);
243243

Diff for: app/code/Magento/TaxImportExport/i18n/en_US.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Rate,Rate
1212
"Invalid file upload attempt","Invalid file upload attempt"
1313
"Invalid file upload attempt.","Invalid file upload attempt."
1414
"Invalid file format.","Invalid file format."
15-
"One of the countries has invalid code.","One of the countries has invalid code."
15+
"Country code is invalid: %1","Country code is invalid: %1"
1616
"Import Tax Rates","Import Tax Rates"
1717
"Export Tax Rates","Export Tax Rates"
1818
CSV,CSV

Diff for: app/code/Magento/Translation/etc/di.xml

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<item name="translate_wrapping" xsi:type="string"><![CDATA[~translate\=("')([^\'].*?)\'\"~]]></item>
6868
<item name="mage_translation_widget" xsi:type="string"><![CDATA[~(?:\$|jQuery)\.mage\.__\((?s)[^'"]*?(['"])(.+?)(?<!\\)\1(?s).*?\)~]]></item>
6969
<item name="mage_translation_static" xsi:type="string"><![CDATA[~\$t\((?s)[^'"]*?(["'])(.+?)\1(?s).*?\)~]]></item>
70+
<item name="translate_args" xsi:type="string"><![CDATA[~translate args\=("|'|"')([^\'].*?)('"|'|")~]]></item>
7071
</argument>
7172
</arguments>
7273
</type>

0 commit comments

Comments
 (0)