Skip to content

Commit

Permalink
Validation change for Text type attributes.
Browse files Browse the repository at this point in the history
The call on Mage_Eav_Model_Attribute_Data_Text:67 to empty returns true of a value of "0" is entered, as specified in the PHP spec. This prevents the entry of zero on the backend admin for fields. Zero should be a valid value, as it was in our case.

No unit tests were created, as no unit tests exist currently for the Eav module.
  • Loading branch information
tim-reynolds committed Aug 10, 2012
1 parent af7068a commit 368e2b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/code/core/Mage/Eav/Model/Attribute/Data/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function validateValue($value)
$value = $this->getEntity()->getDataUsingMethod($attribute->getAttributeCode());
}

if ($attribute->getIsRequired() && empty($value)) {
if ($attribute->getIsRequired() && empty($value) && $value !=='0') {
$errors[] = Mage::helper('Mage_Eav_Helper_Data')->__('"%s" is a required value.', $label);
}

Expand Down

0 comments on commit 368e2b6

Please sign in to comment.