Skip to content

Commit f82c279

Browse files
committed
MAGETWO-42954: Can't view uploaded image
1 parent 6fc4dd3 commit f82c279

File tree

2 files changed

+21
-7
lines changed
  • app/code/Magento/Customer

2 files changed

+21
-7
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ protected function _extractData(
8181
$formData[$attributeCode] = isset($requestData[$attributeCode]) ? $requestData[$attributeCode] : false;
8282
}
8383

84+
$result = $metadataForm->compactData($formData);
85+
86+
// Re-initialize additional attributes
87+
$formData = array_replace($formData, $result);
88+
8489
// Unset unused attributes
8590
$formAttributes = $metadataForm->getAttributes();
8691
foreach ($formAttributes as $attribute) {
@@ -97,12 +102,7 @@ protected function _extractData(
97102
unset($formData['extension_attributes']);
98103
}
99104

100-
$result = $metadataForm->compactData($formData);
101-
102-
// Re-initialize additional attributes
103-
$result = array_merge($result, array_diff_key($formData, $result));
104-
105-
return $result;
105+
return $formData;
106106
}
107107

108108
/**
@@ -228,7 +228,9 @@ public function execute()
228228
['customer' => $customer, 'request' => $this->getRequest()]
229229
);
230230
$customer->setAddresses($addresses);
231-
$customer->setStoreId($customerData['sendemail_store_id']);
231+
if (isset($customerData['sendemail_store_id'])) {
232+
$customer->setStoreId($customerData['sendemail_store_id']);
233+
}
232234

233235
// Save customer
234236
if ($customerId) {

app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,13 @@ public function testExecuteWithExistentCustomer()
311311
$dataToCompact = [
312312
'entity_id' => $customerId,
313313
'code' => 'value',
314+
'coolness' => false,
314315
'disable_auto_group_change' => 'false',
315316
CustomerInterface::DEFAULT_BILLING => false,
316317
CustomerInterface::DEFAULT_SHIPPING => false,
317318
'confirmation' => false,
318319
'sendemail_store_id' => false,
320+
'extension_attributes' => false,
319321
];
320322
$addressFilteredData = [
321323
'entity_id' => $addressId,
@@ -331,6 +333,7 @@ public function testExecuteWithExistentCustomer()
331333
'default_billing' => 'true',
332334
'default_shipping' => 'true',
333335
'code' => 'value',
336+
'coolness' => false,
334337
'region' => 'region',
335338
'region_id' => 'region_id',
336339
];
@@ -637,11 +640,13 @@ public function testExecuteWithNewCustomer()
637640
'disable_auto_group_change' => 'false',
638641
];
639642
$dataToCompact = [
643+
'coolness' => false,
640644
'disable_auto_group_change' => 'false',
641645
CustomerInterface::DEFAULT_BILLING => false,
642646
CustomerInterface::DEFAULT_SHIPPING => false,
643647
'confirmation' => false,
644648
'sendemail_store_id' => false,
649+
'extension_attributes' => false,
645650
];
646651
$addressFilteredData = [
647652
'entity_id' => $addressId,
@@ -657,6 +662,7 @@ public function testExecuteWithNewCustomer()
657662
'default_billing' => 'false',
658663
'default_shipping' => 'false',
659664
'code' => 'value',
665+
'coolness' => false,
660666
'region' => 'region',
661667
'region_id' => 'region_id',
662668
];
@@ -911,11 +917,13 @@ public function testExecuteWithNewCustomerAndValidationException()
911917
'disable_auto_group_change' => 'false',
912918
];
913919
$dataToCompact = [
920+
'coolness' => false,
914921
'disable_auto_group_change' => 'false',
915922
CustomerInterface::DEFAULT_BILLING => false,
916923
CustomerInterface::DEFAULT_SHIPPING => false,
917924
'confirmation' => false,
918925
'sendemail_store_id' => false,
926+
'extension_attributes' => false,
919927
];
920928

921929
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
@@ -1061,11 +1069,13 @@ public function testExecuteWithNewCustomerAndLocalizedException()
10611069
'disable_auto_group_change' => 'false',
10621070
];
10631071
$dataToCompact = [
1072+
'coolness' => false,
10641073
'disable_auto_group_change' => 'false',
10651074
CustomerInterface::DEFAULT_BILLING => false,
10661075
CustomerInterface::DEFAULT_SHIPPING => false,
10671076
'confirmation' => false,
10681077
'sendemail_store_id' => false,
1078+
'extension_attributes' => false,
10691079
];
10701080

10711081
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
@@ -1211,11 +1221,13 @@ public function testExecuteWithNewCustomerAndException()
12111221
'disable_auto_group_change' => 'false',
12121222
];
12131223
$dataToCompact = [
1224+
'coolness' => false,
12141225
'disable_auto_group_change' => 'false',
12151226
CustomerInterface::DEFAULT_BILLING => false,
12161227
CustomerInterface::DEFAULT_SHIPPING => false,
12171228
'confirmation' => false,
12181229
'sendemail_store_id' => false,
1230+
'extension_attributes' => false,
12191231
];
12201232

12211233
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */

0 commit comments

Comments
 (0)