mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
fix validation of attributes
This commit is contained in:
parent
a0661536b3
commit
058fc1217e
|
@ -58,9 +58,7 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
|||
$attributes = $this->getParam('attributes');
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||
if(false === $this->callHook('validateAttribute', $attrdef, $attribute)) {
|
||||
return false;
|
||||
}
|
||||
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||
if($attribute) {
|
||||
if(!$attrdef->validate($attribute)) {
|
||||
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||
|
@ -70,20 +68,26 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
|||
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if($ret === false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$attributes_version = $this->getParam('attributesversion');
|
||||
foreach($attributes_version as $attrdefid=>$attribute) {
|
||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||
if(false === $this->callHook('validateAttribute', $attrdef, $attribute)) {
|
||||
return false;
|
||||
}
|
||||
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||
if($attribute) {
|
||||
if(!$attrdef->validate($attribute)) {
|
||||
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if($ret === false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$workflow = $this->getParam('workflow');
|
||||
|
|
|
@ -42,9 +42,7 @@ class SeedDMS_Controller_AddSubFolder extends SeedDMS_Controller_Common {
|
|||
$attributes = $this->getParam('attributes');
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||
if(false === $this->callHook('validateAttribute', $attrdef, $attribute)) {
|
||||
return false;
|
||||
}
|
||||
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||
if($attribute) {
|
||||
if(!$attrdef->validate($attribute)) {
|
||||
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||
|
@ -54,6 +52,10 @@ class SeedDMS_Controller_AddSubFolder extends SeedDMS_Controller_Common {
|
|||
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if($ret === false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$notificationgroups = $this->getParam('notificationgroups');
|
||||
|
|
Loading…
Reference in New Issue
Block a user