Skip to content

Commit b9265f4

Browse files
author
Alex Paliarush
committed
MAGETWO-58335: [Backport] - Can't view uploaded image - for 2.1
1 parent ef08e26 commit b9265f4

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected function _extractCustomerData()
4141
];
4242

4343
$customerData = $this->_extractData(
44+
$this->getRequest(),
4445
'adminhtml_customer',
4546
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
4647
$additionalAttributes,
@@ -61,24 +62,29 @@ protected function _extractCustomerData()
6162
/**
6263
* Perform customer data filtration based on form code and form object
6364
*
65+
* @param \Magento\Framework\App\RequestInterface $request
6466
* @param string $formCode The code of EAV form to take the list of attributes from
6567
* @param string $entityType entity type for the form
6668
* @param string[] $additionalAttributes The list of attribute codes to skip filtration for
6769
* @param string $scope scope of the request
68-
* @return array
70+
* @param \Magento\Customer\Model\Metadata\Form $metadataForm to use for extraction
71+
* @return array Filtered customer data
72+
* @SuppressWarnings(PHPMD.NPathComplexity)
6973
*/
7074
protected function _extractData(
75+
\Magento\Framework\App\RequestInterface $request,
7176
$formCode,
7277
$entityType,
7378
$additionalAttributes = [],
74-
$scope = null
79+
$scope = null,
80+
\Magento\Customer\Model\Metadata\Form $metadataForm = null
7581
) {
76-
$metadataForm = $this->getMetadataForm($entityType, $formCode, $scope);
77-
$formData = $metadataForm->extractData($this->getRequest(), $scope);
82+
$metadataForm = $metadataForm ? $metadataForm : $this->getMetadataForm($entityType, $formCode, $scope);
83+
$formData = $metadataForm->extractData($request, $scope);
7884

7985
// Initialize additional attributes
8086
/** @var \Magento\Framework\DataObject $object */
81-
$object = $this->_objectFactory->create(['data' => $this->getRequest()->getPostValue()]);
87+
$object = $this->_objectFactory->create(['data' => $request->getPostValue()]);
8288
$requestData = $object->getData($scope);
8389
foreach ($additionalAttributes as $attributeCode) {
8490
$formData[$attributeCode] = isset($requestData[$attributeCode]) ? $requestData[$attributeCode] : false;
@@ -123,6 +129,7 @@ protected function saveDefaultFlags(array $addressIdList, array & $extractedCust
123129
foreach ($addressIdList as $addressId) {
124130
$scope = sprintf('address/%s', $addressId);
125131
$addressData = $this->_extractData(
132+
$this->getRequest(),
126133
'adminhtml_customer_address',
127134
AddressMetadataInterface::ENTITY_TYPE_ADDRESS,
128135
['default_billing', 'default_shipping'],

app/code/Magento/Customer/Model/Customer/DataProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,8 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
127127
* @param CustomerCollectionFactory $customerCollectionFactory
128128
* @param Config $eavConfig
129129
* @param FilterPool $filterPool
130-
* @param FileProcessorFactory $fileProcessorFactory
131130
* @param array $meta
132131
* @param array $data
133-
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
134132
*/
135133
public function __construct(
136134
$name,
@@ -140,7 +138,6 @@ public function __construct(
140138
CustomerCollectionFactory $customerCollectionFactory,
141139
Config $eavConfig,
142140
FilterPool $filterPool,
143-
FileProcessorFactory $fileProcessorFactory = null,
144141
array $meta = [],
145142
array $data = []
146143
) {
@@ -150,7 +147,6 @@ public function __construct(
150147
$this->collection->addAttributeToSelect('*');
151148
$this->eavConfig = $eavConfig;
152149
$this->filterPool = $filterPool;
153-
$this->fileProcessorFactory = $fileProcessorFactory ?: $this->getFileProcessorFactory();
154150
$this->meta['customer']['children'] = $this->getAttributesMeta(
155151
$this->eavConfig->getEntityType('customer')
156152
);

0 commit comments

Comments
 (0)