mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
check if attr def exists when setting attribute value
This commit is contained in:
parent
9f7933f030
commit
144d35849b
|
@ -1551,12 +1551,19 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if($attributes) {
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
/* $attribute can be a string or an array */
|
||||
if($attribute)
|
||||
if(!$content->setAttributeValue($this->_dms->getAttributeDefinition($attrdefid), $attribute)) {
|
||||
if($attribute) {
|
||||
if($attrdef = $this->_dms->getAttributeDefinition($attrdefid)) {
|
||||
if(!$content->setAttributeValue($attrdef, $attribute)) {
|
||||
$this->_removeContent($content);
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$this->_removeContent($content);
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -700,7 +700,12 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
if($attributes) {
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
if($attribute)
|
||||
if(!$newFolder->setAttributeValue($this->_dms->getAttributeDefinition($attrdefid), $attribute)) {
|
||||
if($attrdef = $this->_dms->getAttributeDefinition($attrdefid)) {
|
||||
if(!$newFolder->setAttributeValue($attrdef, $attribute)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
@ -1026,12 +1031,19 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
if($attributes) {
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
/* $attribute can be a string or an array */
|
||||
if($attribute)
|
||||
if(!$document->setAttributeValue($this->_dms->getAttributeDefinition($attrdefid), $attribute)) {
|
||||
if($attribute) {
|
||||
if($attrdef = $this->_dms->getAttributeDefinition($attrdefid)) {
|
||||
if(!$document->setAttributeValue($attrdef, $attribute)) {
|
||||
$document->remove();
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$document->remove();
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
- new paramter 'new' of methode SeedDMЅ_Core_AttributeDefinition::validate()
|
||||
- check if folder/document is below rootDir can be turned on (default off)
|
||||
- SeedDMS_Core_User::setHomeFolder() can be used to unset the home folder
|
||||
- check if attribute definition exists when setting attributes of folders and documents
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
|
Loading…
Reference in New Issue
Block a user