Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-03-06 16:27:48 +01:00
commit 347c740f1f
4 changed files with 9 additions and 2 deletions

View File

@ -177,12 +177,14 @@ class SeedDMS_Core_Attribute { /* {{{ */
if($values) {
$vsep = $this->getValueSetSeparator();
if($valueset) {
/* Validation should have been done before
$error = false;
foreach($values as $v) {
if(!in_array($v, $valueset)) { $error = true; break; }
}
if($error)
return false;
*/
$valuesetstr = $this->_attrdef->getValueSet();
$value = $vsep.implode($vsep, $values);
} else {
@ -203,12 +205,14 @@ class SeedDMS_Core_Attribute { /* {{{ */
}
if($valueset) {
/* Validation should have been done before
$error = false;
foreach($values as $v) {
if(!in_array($v, $valueset)) { $error = true; break; }
}
if($error)
return false;
*/
$value = $valuesetstr[0].implode($valuesetstr[0], $values);
} else {
$value = ','.implode(',', $values);

View File

@ -244,6 +244,7 @@ class SeedDMS_Core_Object { /* {{{ */
$sep = substr($attrdef->getValueSet(), 0, 1);
$value = $sep.implode($sep, $value);
}
/* Handle the case if an attribute is not set already */
if(!isset($this->_attributes[$attrdef->getId()])) {
switch(get_class($this)) {
case $this->_dms->getClassname('document'):
@ -271,6 +272,7 @@ class SeedDMS_Core_Object { /* {{{ */
return true;
}
/* The attribute already exists. setValue() will either update or delete it. */
$this->_attributes[$attrdef->getId()]->setValue($value);
return true;

View File

@ -1883,6 +1883,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
- add SeedDMS_Core_User->getDMS() and SeedDMS_Core_Group->getDMS()
- add new parameter to SeedDMS_Core_DMS->getDocumentList() for skipping expired documents
- add parameter $incdisabled to SeedDMS_Core_Folder::getNotifyList()
- do not validate value in SeedDMS_Core_Attribute::setValue(), it should have been done before
</notes>
</release>
<release>

View File

@ -295,11 +295,11 @@ console.log(element);
} elseif(is_string($arr)) {
echo $arr;
} else {
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $document->getAttribute($attrdef)));
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $document->getAttribute($attrdef), 'attributes_version'));
}
}
}
$arrs = $this->callHook('addDocumentContentAttributes', $folder);
$arrs = $this->callHook('addDocumentContentAttributes', $document);
if(is_array($arrs)) {
foreach($arrs as $arr) {
$this->formField($arr[0], $arr[1]);