mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 05:31:42 +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');
|
$attributes = $this->getParam('attributes');
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if(false === $this->callHook('validateAttribute', $attrdef, $attribute)) {
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
if(!$attrdef->validate($attribute)) {
|
if(!$attrdef->validate($attribute)) {
|
||||||
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $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()));
|
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$attributes_version = $this->getParam('attributesversion');
|
$attributes_version = $this->getParam('attributesversion');
|
||||||
foreach($attributes_version as $attrdefid=>$attribute) {
|
foreach($attributes_version as $attrdefid=>$attribute) {
|
||||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if(false === $this->callHook('validateAttribute', $attrdef, $attribute)) {
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
if(!$attrdef->validate($attribute)) {
|
if(!$attrdef->validate($attribute)) {
|
||||||
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$workflow = $this->getParam('workflow');
|
$workflow = $this->getParam('workflow');
|
||||||
|
|
|
@ -42,9 +42,7 @@ class SeedDMS_Controller_AddSubFolder extends SeedDMS_Controller_Common {
|
||||||
$attributes = $this->getParam('attributes');
|
$attributes = $this->getParam('attributes');
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if(false === $this->callHook('validateAttribute', $attrdef, $attribute)) {
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
if(!$attrdef->validate($attribute)) {
|
if(!$attrdef->validate($attribute)) {
|
||||||
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $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()));
|
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$notificationgroups = $this->getParam('notificationgroups');
|
$notificationgroups = $this->getParam('notificationgroups');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user