From 368e2b6a4dc37a15834d47178213429a11e68a2e Mon Sep 17 00:00:00 2001 From: Tim Reynolds Date: Fri, 10 Aug 2012 15:37:15 -0400 Subject: [PATCH] Validation change for Text type attributes. 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. --- app/code/core/Mage/Eav/Model/Attribute/Data/Text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php b/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php index c48ed5932025f..15432541815dc 100644 --- a/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php +++ b/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php @@ -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); }