Skip to content

Commit 7ec341c

Browse files
AC-9871 improve customer profile page
1 parent 12c63a4 commit 7ec341c

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

app/code/Magento/Customer/Controller/Account/EditPost.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,6 @@ public function execute()
237237
$customer = $this->getCustomerDataObject($this->session->getCustomerId());
238238
$customerCandidate = $this->populateNewCustomerDataObject($this->_request, $customer);
239239

240-
$attributeToDelete = (string)$this->_request->getParam('delete_attribute_value');
241-
if ($attributeToDelete !== "") {
242-
$attributesToDelete = $this->prepareAttributesToDelete($attributeToDelete);
243-
foreach ($attributesToDelete as $attribute) {
244-
$uploadedValue = $this->_request->getParam($attribute . File::UPLOADED_FILE_SUFFIX);
245-
if ((string)$uploadedValue === "") {
246-
$this->deleteCustomerFileAttribute($customerCandidate, $attribute);
247-
}
248-
}
249-
}
250-
251240
try {
252241
// whether a customer enabled change email option
253242
$isEmailChanged = $this->processChangeEmailRequest($customer);
@@ -484,38 +473,4 @@ private function disableAddressValidation($customer)
484473
$addressModel->setShouldIgnoreValidation(true);
485474
}
486475
}
487-
488-
/**
489-
* Removes file attribute from customer entity and file from filesystem
490-
*
491-
* @param CustomerInterface $customerCandidateDataObject
492-
* @param string $attributeToDelete
493-
* @return void
494-
* @throws FileSystemException
495-
*/
496-
private function deleteCustomerFileAttribute(
497-
CustomerInterface $customerCandidateDataObject,
498-
string $attributeToDelete
499-
) : void {
500-
if ($attributeToDelete !== '') {
501-
$attributes = $this->prepareAttributesToDelete($attributeToDelete);
502-
foreach ($attributes as $attr) {
503-
$attributeValue = $customerCandidateDataObject->getCustomAttribute($attr);
504-
if ($attributeValue!== null) {
505-
if ($attributeValue->getValue() !== '') {
506-
$mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);
507-
$fileName = $attributeValue->getValue();
508-
$path = $mediaDirectory->getAbsolutePath('customer' . $fileName);
509-
if ($fileName && $mediaDirectory->isFile($path)) {
510-
$mediaDirectory->delete($path);
511-
}
512-
$customerCandidateDataObject->setCustomAttribute(
513-
$attr,
514-
''
515-
);
516-
}
517-
}
518-
}
519-
}
520-
}
521476
}

app/code/Magento/Customer/Model/Metadata/Form/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public function compactValue($value)
314314
// Remove outdated file (in the case of file uploader UI component)
315315
if (!empty($this->_value)
316316
&& (!empty($value['delete'])
317-
|| ($this->_entityTypeCode == 'customer' && empty($value)))
317+
|| ($this->_entityTypeCode === 'customer' && empty($value)))
318318
) {
319319
$this->fileProcessor->removeUploadedFile($this->_value);
320320
return $value;

0 commit comments

Comments
 (0)