Further work on the previous patch

pull/304/merge
iglocska 2014-08-13 16:13:38 +02:00
parent 97eba22b46
commit cf3809ef74
2 changed files with 7 additions and 3 deletions

View File

@ -491,10 +491,13 @@ class Attribute extends AppModel {
public function validateAttributeValue($fields) {
$value = $fields['value'];
return $this->runValidation($value, $this->data['Attribute']['type']);
}
public function runValidation($value, $type) {
$returnValue = false;
// check data validation
switch($this->data['Attribute']['type']) {
switch($type) {
case 'md5':
if (preg_match("#^[0-9a-f]{32}$#", $value)) {
$returnValue = true;

View File

@ -394,7 +394,8 @@ class ShadowAttribute extends AppModel {
}
public function validateAttributeValue($fields) {
return $this->Event->Attribute->validateAttributeValue($fields);
$value = $fields['value'];
return $this->Event->Attribute->runValidation($value, $this->data['ShadowAttribute']['type']);
}
public function getCompositeTypes() {