Skip to content

Commit a197f23

Browse files
committed
Merge branch '2.0-develop' of github.com:magento/magento2ce into MAGETWO-58917
2 parents c05e367 + ea78f5c commit a197f23

File tree

183 files changed

+11127
-1333
lines changed

Some content is hidden

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

183 files changed

+11127
-1333
lines changed

.php_cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ return Symfony\CS\Config\Config::create()
3333
'extra_empty_lines',
3434
'include',
3535
'join_function',
36-
'multiline_array_trailing_comma',
3736
'namespace_no_leading_whitespace',
3837
'new_with_braces',
3938
'object_operator',

app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,19 @@ public function execute()
5252
$user->setPassword($password);
5353
$user->setPasswordConfirmation($passwordConfirmation);
5454
}
55-
$user->save();
56-
/** Send password reset email notification only when password was changed */
57-
if ($password !== '') {
58-
$user->sendPasswordResetNotificationEmail();
55+
$errors = $user->validate();
56+
if ($errors !== true && !empty($errors)) {
57+
foreach ($errors as $error) {
58+
$this->messageManager->addError($error);
59+
}
60+
} else {
61+
$user->save();
62+
/** Send password reset email notification only when password was changed */
63+
if ($password !== '') {
64+
$user->sendPasswordResetNotificationEmail();
65+
}
66+
$this->messageManager->addSuccess(__('You saved the account.'));
5967
}
60-
$this->messageManager->addSuccess(__('You saved the account.'));
6168
} catch (ValidatorException $e) {
6269
$this->messageManager->addMessages($e->getMessages());
6370
if ($e->getMessage()) {

app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ protected function setUp()
7676
$this->_userMock = $this->getMockBuilder('Magento\User\Model\User')
7777
->disableOriginalConstructor()
7878
->setMethods(
79-
['load', 'save', 'sendPasswordResetNotificationEmail', 'verifyIdentity', '__sleep', '__wakeup']
79+
[
80+
'load', 'save', 'sendPasswordResetNotificationEmail',
81+
'verifyIdentity', 'validate', '__sleep', '__wakeup'
82+
]
8083
)
8184
->getMock();
8285

@@ -193,6 +196,7 @@ public function testSaveAction()
193196

194197
$this->_userMock->expects($this->once())->method('save');
195198
$this->_userMock->expects($this->once())->method('verifyIdentity')->will($this->returnValue(true));
199+
$this->_userMock->expects($this->once())->method('validate')->willReturn(true);
196200
$this->_userMock->expects($this->once())->method('sendPasswordResetNotificationEmail');
197201

198202
$this->_requestMock->setParams($requestParams);

app/code/Magento/Braintree/Model/Config.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ public function isActive()
169169
public function getClientToken()
170170
{
171171
if ($this->clientToken == null) {
172-
$this->clientToken = $this->braintreeClientToken->generate();
172+
$params = [];
173+
174+
if (!empty($this->getMerchantAccountId())) {
175+
$params['merchantAccountId'] = $this->getMerchantAccountId();
176+
}
177+
178+
$this->clientToken = $this->braintreeClientToken->generate($params);
173179
}
174180
return $this->clientToken;
175181
}

app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function execute()
132132
$attributesData[$attributeCode] = $value;
133133
} elseif ($attribute->getFrontendInput() == 'multiselect') {
134134
// Check if 'Change' checkbox has been checked by admin for this attribute
135-
$isChanged = (bool)$this->getRequest()->getPost($attributeCode . '_checkbox');
135+
$isChanged = (bool)$this->getRequest()->getPost('toggle_' . $attributeCode);
136136
if (!$isChanged) {
137137
unset($attributesData[$attributeCode]);
138138
continue;

app/code/Magento/Checkout/view/frontend/web/js/model/address-converter.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,25 @@ define(
116116

117117
addressToEstimationAddress: function (address) {
118118
var estimatedAddressData = {
119-
country_id: address.countryId,
120-
region: address.region,
121-
region_id: address.regionId,
122-
postcode: address.postcode
119+
'street': address.street,
120+
'city': address.city,
121+
'region_id': address.regionId,
122+
'region': address.region,
123+
'country_id': address.countryId,
124+
'postcode': address.postcode,
125+
'email': address.email,
126+
'customer_id': address.customerId,
127+
'firstname': address.firstname,
128+
'lastname': address.lastname,
129+
'middlename': address.middlename,
130+
'prefix': address.prefix,
131+
'suffix': address.suffix,
132+
'vat_id': address.vatId,
133+
'company': address.company,
134+
'telephone': address.telephone,
135+
'fax': address.fax,
136+
'custom_attributes': address.customAttributes
137+
123138
};
124139
return this.formAddressDataToQuoteAddress(estimatedAddressData);
125140
}

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@ define(
2525
serviceUrl = resourceUrlManager.getUrlForEstimationShippingMethodsForNewAddress(quote),
2626
payload = JSON.stringify({
2727
address: {
28-
country_id: address.countryId,
29-
region_id: address.regionId,
30-
region: address.region,
31-
postcode: address.postcode
28+
'street': address.street,
29+
'city': address.city,
30+
'region_id': address.regionId,
31+
'region': address.region,
32+
'country_id': address.countryId,
33+
'postcode': address.postcode,
34+
'email': address.email,
35+
'customer_id': address.customerId,
36+
'firstname': address.firstname,
37+
'lastname': address.lastname,
38+
'middlename': address.middlename,
39+
'prefix': address.prefix,
40+
'suffix': address.suffix,
41+
'vat_id': address.vatId,
42+
'company': address.company,
43+
'telephone': address.telephone,
44+
'fax': address.fax,
45+
'custom_attributes': address.customAttributes,
46+
'save_in_address_book': address.saveInAddressBook
3247
}
3348
}
3449
);

app/code/Magento/Checkout/view/frontend/web/js/region-updater.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ define([
2525
isMultipleCountriesAllowed: true
2626
},
2727

28+
/**
29+
*
30+
* @private
31+
*/
2832
_create: function () {
2933
this._initCountryElement();
3034

@@ -43,12 +47,18 @@ define([
4347
}, this));
4448
},
4549

46-
_initCountryElement: function() {
50+
/**
51+
*
52+
* @private
53+
*/
54+
_initCountryElement: function () {
55+
4756
if (this.options.isMultipleCountriesAllowed) {
4857
this.element.parents('div.field').show();
4958
this.element.on('change', $.proxy(function (e) {
5059
this._updateRegion($(e.target).val());
5160
}, this));
61+
5262
if (this.options.isCountryRequired) {
5363
this.element.addClass('required-entry');
5464
this.element.parents('div.field').addClass('required');
@@ -60,6 +70,7 @@ define([
6070

6171
/**
6272
* Remove options from dropdown list
73+
*
6374
* @param {Object} selectElement - jQuery object for dropdown list
6475
* @private
6576
*/
@@ -113,7 +124,7 @@ define([
113124
* @private
114125
*/
115126
_clearError: function () {
116-
if (this.options.clearError && typeof (this.options.clearError) === 'function') {
127+
if (this.options.clearError && typeof this.options.clearError === 'function') {
117128
this.options.clearError.call(this);
118129
} else {
119130
if (!this.options.form) {
@@ -122,12 +133,19 @@ define([
122133

123134
this.options.form = $(this.options.form);
124135

125-
this.options.form && this.options.form.data('validation') && this.options.form.validation('clearError',
136+
this.options.form && this.options.form.data('validator') && this.options.form.validation('clearError',
126137
this.options.regionListId, this.options.regionInputId, this.options.postcodeId);
138+
139+
// Clean up errors on region & zip fix
140+
$(this.options.regionInputId).removeClass('mage-error').parent().find('[generated]').remove();
141+
$(this.options.regionListId).removeClass('mage-error').parent().find('[generated]').remove();
142+
$(this.options.postcodeId).removeClass('mage-error').parent().find('[generated]').remove();
127143
}
128144
},
145+
129146
/**
130147
* Update dropdown list based on the country selected
148+
*
131149
* @param {String} country - 2 uppercase letter for country code
132150
* @private
133151
*/
@@ -182,11 +200,12 @@ define([
182200
if (!this.options.optionalRegionAllowed) {
183201
regionInput.attr('disabled', 'disabled');
184202
}
203+
requiredLabel.removeClass('required');
204+
regionInput.removeClass('required-entry');
185205
}
186206

187207
regionList.removeClass('required-entry').hide();
188208
regionInput.show();
189-
requiredLabel.removeClass('required');
190209
label.attr('for', regionInput.attr('id'));
191210
}
192211

@@ -208,10 +227,11 @@ define([
208227
* @private
209228
*/
210229
_checkRegionRequired: function (country) {
211-
this.options.isRegionRequired = false;
212230
var self = this;
231+
232+
this.options.isRegionRequired = false;
213233
$.each(this.options.regionJson.config.regions_required, function (index, elem) {
214-
if (elem == country) {
234+
if (elem === country) {
215235
self.options.isRegionRequired = true;
216236
}
217237
});

app/code/Magento/Customer/Controller/Address/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function execute()
1515
{
1616
$addressId = $this->getRequest()->getParam('id', false);
1717

18-
if ($addressId) {
18+
if ($addressId && $this->_formKeyValidator->validate($this->getRequest())) {
1919
try {
2020
$address = $this->_addressRepository->getById($addressId);
2121
if ($address->getCustomerId() === $this->_getSession()->getCustomerId()) {

0 commit comments

Comments
 (0)