-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: CustomerFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
Preconditions (*)
- Magento CE version 2.2.7
- Create custom attribute programmatically, which is to be added to the 'customer eav attribute e.g.:
$customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "customerprofile", array(
"type" => "varchar",
"backend" => "",
"label" => "Customerprofile",
"input" => "file",
"source" => "",
"visible" => true,
"required" => false,
"default" => "",
"frontend" => "",
"unique" => false,
"note" => ""
));
$customerdoc = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "customerdoc");
$customerdoc = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'customerdoc');
$used_in_forms[] = "adminhtml_customer";
$used_in_forms[] = "checkout_register";
$used_in_forms[] = "customer_account_create";
$used_in_forms[] = "customer_account_edit";
$used_in_forms[] = "adminhtml_checkout";
$customerdoc->setData("used_in_forms", $used_in_forms)
->setData("is_used_for_customer_segment", true)
->setData("is_system", 0)
->setData("is_user_defined", 1)
->setData("is_visible", 1)
->setData("sort_order", 100);
$customerdoc->save();
Steps to reproduce (*)
- Go to the registration form. you will show Customer profile attribute as a file. when user upload an image error message show "Customer profile is not a valid file".
Expected result (*)
- file is valid so data want to save.
Actual result (*)
- is not a valid file message on the frontend and backend.
Issue In this file (*)
-
An issue in the if a condition "Magento\Eav\Model\Attribute\Data\File"
protected function _validateByRules($value)
{
if (!empty($value['tmp_name']) && !is_uploaded_file($value['tmp_name'])) {
return [__('"%1" is not a valid file.', $label)];
}
return [];
}
Acctually Image first of upload in temp folder then after move into accordinglly.
according to the condition if a file exists in temp folder it's throw error.
Resolve the issue(*)
protected function _validateByRules($value)
{
if (empty($value['tmp_name']) && is_uploaded_file($value['tmp_name'])) {
return [__('"%1" is not a valid file.', $label)];
}
return [];
}
Metadata
Metadata
Assignees
Labels
Component: CustomerFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release