"'%s' is required and cannot be empty.", self::PRICE_NOT_NUMERIC => "'%s': the price fields only accept numeric values.", ); /** * * checks if at least one row has been added and that the price fields contain localized numeric values * * @return bool return true if the validation is successful */ public function isValid() { $value = $this->getValue(); if (isset($value[FlatRatesLocationGroups::FIELD_NAME])) { $values = array_filter($value[FlatRatesLocationGroups::FIELD_NAME]); if (count($values) > 0) { $prices = array_filter($value[FlatRatesLocationGroups::FIELD_FIRST]) + array_filter($value[FlatRatesLocationGroups::FIELD_ADDL]); foreach ($prices as $price) { if (!is_numeric($price)) { $this->setMessage($this->_messages[self::PRICE_NOT_NUMERIC]); return false; } } return true; } } $this->setMessage($this->_messages[self::NO_POSTAGE]); return false; } }